From 4cb94db0bd8062fb657003f8e6abf622ee78409d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nidecki?= Date: Mon, 22 Feb 2021 21:30:27 +0100 Subject: [PATCH] Factory reset at startup --- src/TTGO_T-Beam_LoRa_APRS.ino | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 5f96386..0a8f86f 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -386,6 +386,11 @@ void setup(){ #endif #ifdef ENABLE_PREFERENCES + int clear_preferences = 0; + if(digitalRead(BUTTON)==LOW){ + clear_preferences = 1; + } + preferences.begin("cfg", false); aprsSymbolTable = preferences.getString(PREF_APRS_SYMBOL_TABLE); if (aprsSymbolTable.isEmpty()){ @@ -446,7 +451,14 @@ void setup(){ preferences.putInt(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET, fix_beacon_interval/1000); } fix_beacon_interval = preferences.getInt(PREF_APRS_FIXED_BEACON_PRESET) * 1000; + if (clear_preferences){ + delay(1000); + if(digitalRead(BUTTON)==LOW){ + clear_preferences = 2; + preferences.clear(); + } + } #endif for (int i=0;i