From 1e20d26ba930faaaafe2f08dc1ae7b9cbea9a9f3 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell <tridge@samba.org>
Date: Mon, 22 Oct 2012 18:57:08 +1100
Subject: [PATCH] ACM: saved some more memory for strings

---
 ArduCopter/Log.pde    | 12 ++++++------
 ArduCopter/defines.h  |  2 +-
 ArduCopter/limits.pde |  8 ++++----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/ArduCopter/Log.pde b/ArduCopter/Log.pde
index 56761ff43..5c847839d 100644
--- a/ArduCopter/Log.pde
+++ b/ArduCopter/Log.pde
@@ -636,11 +636,11 @@ static void Log_Read_Nav_Tuning()
 
     for(int8_t i = 1; i < 8; i++ ) {
         temp = DataFlash.ReadInt();
-        Serial.printf("%d, ", (int)temp);
+        Serial.printf_P(PSTR("%d, "), (int)temp);
     }
     // read 8
     temp = DataFlash.ReadInt();
-    Serial.printf("%d\n", (int)temp);
+    Serial.printf_P(PSTR("%d\n"), (int)temp);
 }
 
 
@@ -672,11 +672,11 @@ static void Log_Read_Control_Tuning()
 
     for(uint8_t i = 1; i < 8; i++ ) {
         temp = DataFlash.ReadInt();
-        Serial.printf("%d, ", (int)temp);
+        Serial.printf_P(PSTR("%d, "), (int)temp);
     }
     // read 8
     temp = DataFlash.ReadInt();
-    Serial.printf("%d\n", (int)temp);
+    Serial.printf_P(PSTR("%d\n"), (int)temp);
 }
 
 static void Log_Write_Iterm()
@@ -710,7 +710,7 @@ static void Log_Read_Iterm()
 
     for(uint8_t i = 1; i < 12; i++ ) {
         temp = DataFlash.ReadInt();
-        Serial.printf("%d, ", (int)temp);
+        Serial.printf_P(PSTR("%d, "), (int)temp);
     }
     // read 12
     temp = DataFlash.ReadInt();
@@ -1002,7 +1002,7 @@ static void Log_Read(int16_t start_page, int16_t end_page)
  #endif
 
 #if CLI_ENABLED == ENABLED
-	setup_show(NULL, NULL);
+	setup_show(0, NULL);
 #endif
 
     if(start_page > end_page) {
diff --git a/ArduCopter/defines.h b/ArduCopter/defines.h
index 12d40b6a1..80257e6a6 100644
--- a/ArduCopter/defines.h
+++ b/ArduCopter/defines.h
@@ -406,7 +406,7 @@ enum gcs_severity {
 #define ONBOARD_PARAM_NAME_LENGTH 15
 
 // fence points are stored at the end of the EEPROM
-#define MAX_FENCEPOINTS 20
+#define MAX_FENCEPOINTS 6
 #define FENCE_WP_SIZE sizeof(Vector2l)
 #define FENCE_START_BYTE (EEPROM_MAX_ADDR-(MAX_FENCEPOINTS*FENCE_WP_SIZE))
 
diff --git a/ArduCopter/limits.pde b/ArduCopter/limits.pde
index 424e1d5c8..bcf97a2de 100644
--- a/ArduCopter/limits.pde
+++ b/ArduCopter/limits.pde
@@ -136,7 +136,7 @@ static void limits_loop() {
         if (motors.armed() && limits.enabled() && !limits.mods_triggered) {
 
             // All clear.
-            if (limits.debug()) gcs_send_text(SEVERITY_LOW, "Limits - All Clear");
+	    if (limits.debug()) gcs_send_text_P(SEVERITY_LOW, PSTR("Limits - All Clear"));
             limits.last_clear = millis();
         }
 
@@ -156,9 +156,9 @@ static void limits_loop() {
 #endif
 
         if (limits.debug()) {
-            if (limits.mods_triggered & LIMIT_GPSLOCK) gcs_send_text(SEVERITY_LOW, "!GPSLock");
-            if (limits.mods_triggered & LIMIT_GEOFENCE) gcs_send_text(SEVERITY_LOW, "!Geofence");
-            if (limits.mods_triggered & LIMIT_ALTITUDE) gcs_send_text(SEVERITY_LOW, "!Altitude");
+		if (limits.mods_triggered & LIMIT_GPSLOCK) gcs_send_text_P(SEVERITY_LOW, PSTR("!GPSLock"));
+		if (limits.mods_triggered & LIMIT_GEOFENCE) gcs_send_text_P(SEVERITY_LOW, PSTR("!Geofence"));
+		if (limits.mods_triggered & LIMIT_ALTITUDE) gcs_send_text_P(SEVERITY_LOW, PSTR("!Altitude"));
         }
 
         // If the motors are not armed, we have triggered pre-arm checks. Do nothing
-- 
GitLab