Pārlūkot izejas kodu

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 pirms 6 gadiem
vecāks
revīzija
56fa127bb7
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. +2
    -1
      GpsTracker/Core.cpp

+ 2
- 1
GpsTracker/Core.cpp Parādīt failu

@@ -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);
}


Notiek ielāde…
Atcelt
Saglabāt