|
|
|
@ -89,6 +89,7 @@ static char msg[NUM_MSG][CONFIG_USART1_TXBUFSIZE];
@@ -89,6 +89,7 @@ static char msg[NUM_MSG][CONFIG_USART1_TXBUFSIZE];
|
|
|
|
|
|
|
|
|
|
static void heartbeat_blink(void); |
|
|
|
|
static void ring_blink(void); |
|
|
|
|
static void update_mem_usage(void); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* add a debug message to be printed on the console |
|
|
|
@ -128,6 +129,27 @@ show_debug_messages(void)
@@ -128,6 +129,27 @@ show_debug_messages(void)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Get the memory usage at 2 Hz while not armed |
|
|
|
|
*/ |
|
|
|
|
static void |
|
|
|
|
update_mem_usage(void) |
|
|
|
|
{ |
|
|
|
|
if (/* IO armed */ (r_status_flags & PX4IO_P_STATUS_FLAGS_SAFETY_OFF) |
|
|
|
|
/* and FMU is armed */ && (r_setup_arming & PX4IO_P_SETUP_ARMING_FMU_ARMED)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static uint64_t last_mem_time = 0; |
|
|
|
|
uint64_t now = hrt_absolute_time(); |
|
|
|
|
|
|
|
|
|
if (now - last_mem_time > (500 * 1000)) { |
|
|
|
|
struct mallinfo minfo = mallinfo(); |
|
|
|
|
r_page_status[PX4IO_P_STATUS_FREEMEM] = minfo.fordblks; |
|
|
|
|
last_mem_time = now; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
heartbeat_blink(void) |
|
|
|
|
{ |
|
|
|
@ -311,6 +333,7 @@ user_start(int argc, char *argv[])
@@ -311,6 +333,7 @@ user_start(int argc, char *argv[])
|
|
|
|
|
perf_counter_t loop_perf = perf_alloc(PC_INTERVAL, "loop"); |
|
|
|
|
|
|
|
|
|
struct mallinfo minfo = mallinfo(); |
|
|
|
|
r_page_status[PX4IO_P_STATUS_FREEMEM] = minfo.mxordblk; |
|
|
|
|
syslog(LOG_INFO, "MEM: free %u, largest %u\n", minfo.mxordblk, minfo.fordblks); |
|
|
|
|
|
|
|
|
|
/* initialize PWM limit lib */ |
|
|
|
@ -418,6 +441,8 @@ user_start(int argc, char *argv[])
@@ -418,6 +441,8 @@ user_start(int argc, char *argv[])
|
|
|
|
|
LED_BLUE(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
update_mem_usage(); |
|
|
|
|
|
|
|
|
|
ring_blink(); |
|
|
|
|
|
|
|
|
|
check_reboot(); |
|
|
|
|