From 1083522e5507c1168fc65a95881a5771505b2898 Mon Sep 17 00:00:00 2001 From: Bertrand Lemasle Date: Sat, 4 Aug 2018 18:07:54 +1200 Subject: [PATCH] Added clear alerts debug command --- GpsTracker/Debug.cpp | 16 ++++++++++++++++ GpsTracker/Debug.h | 2 ++ GpsTracker/GpsTracker.ino | 3 +++ 3 files changed, 21 insertions(+) diff --git a/GpsTracker/Debug.cpp b/GpsTracker/Debug.cpp index 1ebb8ae..7da8b83 100644 --- a/GpsTracker/Debug.cpp +++ b/GpsTracker/Debug.cpp @@ -2,6 +2,7 @@ #include "Flash.h" #include "Positions.h" #include "Core.h" +#include "Alerts.h" #define LOGGER_NAME "Debug" @@ -30,6 +31,7 @@ MENU_ENTRY(EEPROM_GET_LAST_ENTRY, "[p] Get EEPROM last entry"); MENU_ENTRY(EEPROM_ADD_ENTRY, "[a] Add last entry to EEPROM"); MENU_ENTRY(EEPROM_BACKUP_ENTRIES, "[B] Backup EEPROM entries"); MENU_ENTRY(NOTIFY_FAILURES, "[F] Notify failures"); +MENU_ENTRY(CLEAR_ALERTS, "[A] Clear alerts"); MENU_ENTRY(SLEEP, "[S] Sleep for 8s"); MENU_ENTRY(SLEEP_DEEP, "[s] Deep sleep for 10s"); MENU_ENTRY(QUESTION, "?"); @@ -53,6 +55,7 @@ const PROGMEM uint8_t commandIdMapping[] = { 'a', static_cast(debug::GPSTRACKER_DEBUG_COMMAND::EEPROM_ADD_ENTRY), 'B', static_cast(debug::GPSTRACKER_DEBUG_COMMAND::EEPROM_BACKUP_ENTRIES), 'F', static_cast(debug::GPSTRACKER_DEBUG_COMMAND::NOTIFY_FAILURES), + 'A', static_cast(debug::GPSTRACKER_DEBUG_COMMAND::CLEAR_ALERTS), 'S', static_cast(debug::GPSTRACKER_DEBUG_COMMAND::SLEEP), 's', static_cast(debug::GPSTRACKER_DEBUG_COMMAND::SLEEP_DEEP), }; @@ -91,6 +94,7 @@ const char * const MENU_ENTRIES[] PROGMEM = { MENU_SEPARATOR, MENU_NOTIFY_FAILURES, + MENU_CLEAR_ALERTS, MENU_SEPARATOR, MENU_SLEEP, @@ -276,4 +280,16 @@ namespace debug { core::notifyFailures(metadata); } + + void clearAlerts() { + PositionEntryMetadata metadata = { + 100, //all battery alert should goes off with this + 3800, //doesn't matter + 10, + 0, + SIM808_GPS_STATUS::OFF + }; + + alerts::clear(metadata); + } } \ No newline at end of file diff --git a/GpsTracker/Debug.h b/GpsTracker/Debug.h index db3ffbe..d9a1cd0 100644 --- a/GpsTracker/Debug.h +++ b/GpsTracker/Debug.h @@ -32,6 +32,7 @@ namespace debug { EEPROM_ADD_ENTRY, EEPROM_BACKUP_ENTRIES, NOTIFY_FAILURES, + CLEAR_ALERTS, SLEEP, SLEEP_DEEP }; @@ -57,4 +58,5 @@ namespace debug { void addLastPositionToEeprom(); void notifyFailures(); + void clearAlerts(); } diff --git a/GpsTracker/GpsTracker.ino b/GpsTracker/GpsTracker.ino index 1e6b7fd..6e382a1 100644 --- a/GpsTracker/GpsTracker.ino +++ b/GpsTracker/GpsTracker.ino @@ -83,6 +83,9 @@ void loop() { case debug::GPSTRACKER_DEBUG_COMMAND::NOTIFY_FAILURES: debug::notifyFailures(); break; + case debug::GPSTRACKER_DEBUG_COMMAND::CLEAR_ALERTS: + debug::clearAlerts(); + break; case debug::GPSTRACKER_DEBUG_COMMAND::SLEEP: mainunit::sleep(period_t::SLEEP_8S); break;