Browse Source

Using a PROGMEM string for sms buffer init. Side effects : avoid gcc optimization that declares the buffer as a global variable, which overflow the available SRAM

tags/v1.2.0
Bertrand Lemasle 6 years ago
parent
commit
56fa127bb7
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      GpsTracker/Core.cpp

+ 2
- 1
GpsTracker/Core.cpp View File

@@ -54,7 +54,7 @@ namespace core {

uint8_t notifyFailures(PositionEntryMetadata &metadata) {
SIM808RegistrationStatus networkStatus;
char buffer[SMS_BUFFER_SIZE] = "Alerts !\n";
char buffer[SMS_BUFFER_SIZE];
const __FlashStringHelper * backupFailureString = F(" Backup battery failure ?\n");

uint8_t triggered = alerts::getTriggered(metadata);
@@ -65,6 +65,7 @@ namespace core {

if (!network::isAvailable(networkStatus.stat)) return NO_ALERTS_NOTIFIED;

details::appendToSmsBuffer(buffer, PSTR("Alerts !\n"));
if (bitRead(triggered, ALERT_BATTERY_LEVEL_1) || bitRead(triggered, ALERT_BATTERY_LEVEL_2)) {
details::appendToSmsBuffer(buffer, PSTR("- Battery at %d%%.\n"), metadata.batteryLevel);
}


Loading…
Cancel
Save