From 97df2f64c9e8700d58df05929dce9c4dfe2972b4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 28 Dec 2013 16:02:32 +1100 Subject: [PATCH] Copter: use common available_memory() --- ArduCopter/ArduCopter.pde | 8 ++------ ArduCopter/GCS_Mavlink.pde | 10 +--------- ArduCopter/Log.pde | 2 +- ArduCopter/system.pde | 2 +- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index f4750e3bda..5082883526 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -123,7 +123,6 @@ #include // ArduCopter waypoint navigation library #include // ArduPilot Mega Declination Helper Library #include // Arducopter Fence library -#include // memory limit checker #include // software in the loop support #include // main loop scheduler #include // RC input mapping library @@ -904,11 +903,8 @@ static const AP_Scheduler::Task scheduler_tasks[] PROGMEM = { }; -void setup() { - - // this needs to be the first call, as it fills memory with - // sentinel values - memcheck_init(); +void setup() +{ cliSerial = hal.console; // Load the default values of variables listed in var_info[]s diff --git a/ArduCopter/GCS_Mavlink.pde b/ArduCopter/GCS_Mavlink.pde index b67255c6f8..3026e280f9 100644 --- a/ArduCopter/GCS_Mavlink.pde +++ b/ArduCopter/GCS_Mavlink.pde @@ -218,14 +218,6 @@ static NOINLINE void send_extended_status1(mavlink_channel_t chan, uint16_t pack } -static void NOINLINE send_meminfo(mavlink_channel_t chan) -{ -#if CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_APM2 - extern unsigned __brkval; - mavlink_msg_meminfo_send(chan, __brkval, memcheck_available_memory()); -#endif -} - static void NOINLINE send_location(mavlink_channel_t chan) { uint32_t fix_time; @@ -584,7 +576,7 @@ static bool mavlink_try_send_message(mavlink_channel_t chan, enum ap_message id, case MSG_EXTENDED_STATUS2: CHECK_PAYLOAD_SIZE(MEMINFO); - send_meminfo(chan); + gcs[chan-MAVLINK_COMM_0].send_meminfo(); break; case MSG_ATTITUDE: diff --git a/ArduCopter/Log.pde b/ArduCopter/Log.pde index 09507b1547..880c97e2a1 100644 --- a/ArduCopter/Log.pde +++ b/ArduCopter/Log.pde @@ -787,7 +787,7 @@ static void Log_Read(uint16_t log_num, uint16_t start_page, uint16_t end_page) cliSerial->printf_P(PSTR("\n" FIRMWARE_STRING "\nFree RAM: %u\n"), - (unsigned) memcheck_available_memory()); + (unsigned) hal.util->available_memory()); cliSerial->println_P(PSTR(HAL_BOARD_NAME)); diff --git a/ArduCopter/system.pde b/ArduCopter/system.pde index 55e3c46bd8..d79d3a5916 100644 --- a/ArduCopter/system.pde +++ b/ArduCopter/system.pde @@ -105,7 +105,7 @@ static void init_ardupilot() cliSerial->printf_P(PSTR("\n\nInit " FIRMWARE_STRING "\n\nFree RAM: %u\n"), - memcheck_available_memory()); + hal.util->available_memory()); #if CONFIG_HAL_BOARD == HAL_BOARD_APM2 /*