Pārlūkot izejas kodu

Display alerts on Serial when available to avoid SMS costs while debugging

tags/v1.2.0
Bertrand Lemasle pirms 6 gadiem
vecāks
revīzija
0d68f8766d
2 mainītis faili ar 24 papildinājumiem un 6 dzēšanām
  1. +14
    -6
      Config.h
  2. +10
    -0
      Core.cpp

+ 14
- 6
Config.h Parādīt failu

@@ -15,11 +15,6 @@
#define CONFIG_RESERVED_SIZE 128
#define CONFIG_SEED 13
#define VERSION "1.10"
#define CONFIG_DEFAULT_BATTERY_ALERT_LEVEL1 45
#define CONFIG_DEFAULT_BATTERY_ALERT_LEVEL2 38
#define CONFIG_DEFAULT_BATTERY_ALERT_CLEAR 60
#define CONFIG_DEFAULT_ACTIVE_ALERTS 0
#define CONFIG_DEFAULT_CONTACT_PHONE "+642568452"

#define SLEEP_TIMING_TIME(hours, minutes) hours * 60 + minutes

@@ -31,8 +26,15 @@
Hard coded value for default sleep time between position acquisitions.
Exprimed in seconds
*/

#define CONFIG_DEFAULT_BATTERY_ALERT_LEVEL1 45
#define CONFIG_DEFAULT_BATTERY_ALERT_LEVEL2 38
#define CONFIG_DEFAULT_BATTERY_ALERT_CLEAR 60
#define CONFIG_DEFAULT_ACTIVE_ALERTS 0
#define CONFIG_DEFAULT_CONTACT_PHONE "+642568452"

#define SLEEP_DEFAULT_TIME_SECONDS 1800
#define SLEEP_DEFAULT_STOPPED_THRESHOLD 5
#define SLEEP_DEFAULT_STOPPED_THRESHOLD 5
#define SLEEP_DEFAULT_PAUSING_TIME_SECONDS 270

#define SLEEP_TIMING_MIN SLEEP_TIMING_TIME(0, 0)
@@ -48,6 +50,12 @@
#define NETWORK_DEFAULT_NO_NETWORK_QUALITY_THRESHOLD 8
#define NETWORK_DEFAULT_NO_NETWORK_TRIES 5

#define ALERTS_ON_SERIAL_IF_AVAILABLE 1
/**
\def ALERTS_ON_SERIAL_IF_AVAILABLE
Display alerts on serial when connected rather than sending an SMS.
Useful for debugging purpose and avoid costs related to SMS sending.
*/
#define ALERT_SUSPICIOUS_RTC_TEMPERATURE 0

#pragma endregion


+ 10
- 0
Core.cpp Parādīt failu

@@ -80,7 +80,17 @@ namespace core {
details::appendToSmsBuffer(buffer, PSTR("\n- RTC was stopped.%S"), backupFailureString);
}

#if ALERTS_ON_SERIAL_IF_AVAILABLE
if(Serial) {
NOTICE_FORMAT("notifyFailure", "%s", buffer);
notified = true;
}
else {
#endif
notified = network::sendSms(buffer);
#if ALERTS_ON_SERIAL_IF_AVAILABLE
}
#endif
if (!notified) NOTICE_MSG("notifyFailure", "SMS not sent !");
}



Notiek ielāde…
Atcelt
Saglabāt