From 159a87db17233d0abf759bb44e98121c5e1b80d8 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Mon, 24 Jun 2019 15:47:00 +0100 Subject: [PATCH] Reduce memory usage --- iot/main/gps.cpp | 4 ++-- iot/main/main.ino | 6 +++--- iot/main/power.cpp | 13 +++++++------ iot/main/power.h | 4 ++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/iot/main/gps.cpp b/iot/main/gps.cpp index bbfe2dd..4f49d58 100644 --- a/iot/main/gps.cpp +++ b/iot/main/gps.cpp @@ -12,7 +12,7 @@ void gps_begin() { } void gps_fetch() { - Serial.print("[gps] Getting location: "); + Serial.print(F("[gps] Getting location: ")); uint32_t ms_last_update = millis(); // We WILL discover our location - if it's the last thing we do! while(true) { @@ -40,7 +40,7 @@ void gps_fetch() { } // Hooray! - Serial.println("ok"); + Serial.println(F("ok")); return; } } diff --git a/iot/main/main.ino b/iot/main/main.ino index 9556f69..7dcd296 100644 --- a/iot/main/main.ino +++ b/iot/main/main.ino @@ -15,7 +15,7 @@ void setup() { Serial.begin(BAUD_PC); - Serial.println("[main] Beginning collection sequence."); + Serial.println(F("[main] Beginning collection sequence.")); random_begin(); @@ -27,11 +27,11 @@ void setup() { TinyGPSPlus gps_data = gps_info(); gps_end(); - Serial.print("[main] Location: ("); Serial.print(gps_data.location.lat()); Serial.print(", "); Serial.print(gps_data.location.lng()); Serial.println(")"); + Serial.print(F("[main] Location: (")); Serial.print(gps_data.location.lat()); Serial.print(F(", ")); Serial.print(gps_data.location.lng()); Serial.println(F(")")); uint32_t id = random_get(); - Serial.print("[main] id: "); + Serial.print(F("[main] id: ")); Serial.println(id); // Activate microSD card breakout board on the SPI bus diff --git a/iot/main/power.cpp b/iot/main/power.cpp index 7dbf3f0..082e395 100644 --- a/iot/main/power.cpp +++ b/iot/main/power.cpp @@ -2,19 +2,20 @@ #include "settings.h" - +/* void power_gps_wakeup() { - Serial.println("Warn: GPS wakeup isn't implemented yet."); + Serial.println(F("Warn: GPS wakeup isn't implemented yet.")); } void power_gps_standby() { - Serial.println("Warn: GPS standby isn't implemented yet."); + Serial.println(F("Warn: GPS standby isn't implemented yet.")); } +*/ void power_off() { - Serial.println(F("[power] Beginning shutdown sequence")); - Serial.println(F("[power] Switching GPS module to standby")); - power_gps_standby(); + Serial.println(F("[power] Shutting down")); + // Serial.println(F("[power] Switching GPS module to standby")); + // power_gps_standby(); Serial.println(F("[power] Signalling TPL5111")); pinMode(PIN_TPL_DONE, OUTPUT); diff --git a/iot/main/power.h b/iot/main/power.h index 0f9da8f..6e4f006 100644 --- a/iot/main/power.h +++ b/iot/main/power.h @@ -2,11 +2,11 @@ /** * Wakes the GPS module up from standby. */ -void power_gps_wakeup(); +// void power_gps_wakeup(); /** * Puts the GPS module into standby. */ -void power_gps_standby(); +// void power_gps_standby(); /** * Signals that our work is complete and that we can turn off now to the