From 5c055cbd16a0f4f6cbdfef5bffc16039a6c627e6 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 11 Sep 2021 22:58:56 -0500 Subject: [PATCH] Shelve. --- data_embed/index.html | 8 ++++++-- include/preference_storage.h | 6 ++++-- platformio.ini | 4 ++-- src/TTGO_T-Beam_LoRa_APRS.ino | 17 ++++++++++++++--- src/taskWebServer.cpp | 4 ++++ 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/data_embed/index.html b/data_embed/index.html index f534083..8e678b7 100644 --- a/data_embed/index.html +++ b/data_embed/index.html @@ -98,8 +98,12 @@
- - + + +
+
+ +
diff --git a/include/preference_storage.h b/include/preference_storage.h index 6feea31..9d1f9aa 100644 --- a/include/preference_storage.h +++ b/include/preference_storage.h @@ -35,8 +35,10 @@ static const char *const PREF_APRS_FIXED_BEACON_PRESET = "aprs_fixed_beac"; static const char *const PREF_APRS_FIXED_BEACON_PRESET_INIT = "aprs_fix_b_init"; static const char *const PREF_APRS_FIXED_BEACON_INTERVAL_PRESET = "aprs_fb_interv"; static const char *const PREF_APRS_FIXED_BEACON_INTERVAL_PRESET_INIT = "aprs_fb_in_init"; -static const char *const PREF_ENABLE_TNC_SELF_TELEMETRY = "aprs_self_tel"; -static const char *const PREF_ENABLE_TNC_SELF_TELEMETRY_INIT = "aprs_self_tel_i"; +static const char *const PREF_ENABLE_TNC_SELF_TELEMETRY = "tnc_tel"; +static const char *const PREF_ENABLE_TNC_SELF_TELEMETRY_INIT = "tnc_tel_i"; +static const char *const PREF_TNC_SELF_TELEMETRY_INTERVAL = "tnc_tel_int"; +static const char *const PREF_TNC_SELF_TELEMETRY_INTERVAL_INIT = "tnc_tel_int_i"; // SMART BEACONING static const char *const PREF_APRS_SB_MIN_INTERVAL_PRESET = "sb_min_interv"; static const char *const PREF_APRS_SB_MIN_INTERVAL_PRESET_INIT = "sb_min_interv_i"; diff --git a/platformio.ini b/platformio.ini index e9866dd..ab71b65 100644 --- a/platformio.ini +++ b/platformio.ini @@ -52,8 +52,8 @@ build_flags = -D 'MAX_TIME_TO_NEXT_TX=120000L' ; can be set from www interface -D 'FIX_BEACON_INTERVAL=1800000L' ; can be set from www interface -D 'NETWORK_GPS_PORT=10110' ; GPS NMEA Port - -D 'ENABLE_TNC_SELF_TELEMETRY' ; send telemetry data about device - -D 'TNC_SELF_TELEMETRY_INTERVAL=60000L' ; telemetry interval (milliseconds) + -D 'ENABLE_TNC_SELF_TELEMETRY' ; can be set from www interface + -D 'TNC_SELF_TELEMETRY_INTERVAL=60L' ; telemetry interval (milliseconds) [env:ttgo-t-beam-v1.0] platform = espressif32 @ 3.0.0 diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 0022cdd..a0deb68 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -103,6 +103,7 @@ boolean key_up = true; boolean t_lock = false; boolean fixed_beacon_enabled = false; boolean show_cmt = true; +int tel_interval; #ifdef SHOW_ALT boolean showAltitude = true; @@ -139,7 +140,6 @@ String LatShown=""; String LongFixed=""; String LatFixed=""; -//#if (enable_tel == true) && defined(KISS_PROTOCOL) #if defined(ENABLE_TNC_SELF_TELEMETRY) && defined(KISS_PROTOCOL) time_t nextTelemetryFrame; #endif @@ -485,7 +485,6 @@ String prepareCallsign(const String& callsign){ return tmpString; } -//#if (enable_tel == true) && defined(KISS_PROTOCOL) #if defined(ENABLE_TNC_SELF_TELEMETRY) && defined(KISS_PROTOCOL) void sendTelemetryFrame() { if(enable_tel == true){ @@ -528,6 +527,12 @@ void setup(){ relay_path = ""; #endif + //#ifdef TNC_SELF_TELEMETRY_INTERVAL + // tel_interval = TNC_SELF_TELEMETRY_INTERVAL; + //#else + // tel_interval = 60; + //#endif + #ifdef FIXED_BEACON_EN fixed_beacon_enabled = true; #endif @@ -604,6 +609,12 @@ void setup(){ } enable_tel = preferences.getBool(PREF_ENABLE_TNC_SELF_TELEMETRY); + if (!preferences.getBool(PREF_TNC_SELF_TELEMETRY_INTERVAL_INIT)){ + preferences.putBool(PREF_TNC_SELF_TELEMETRY_INTERVAL_INIT, true); + preferences.putInt(PREF_TNC_SELF_TELEMETRY_INTERVAL, tel_interval); + } + tel_interval = preferences.getInt(PREF_TNC_SELF_TELEMETRY_INTERVAL); + if (!preferences.getBool(PREF_APRS_LATITUDE_PRESET_INIT)){ preferences.putBool(PREF_APRS_LATITUDE_PRESET_INIT, true); preferences.putString(PREF_APRS_LATITUDE_PRESET, LATIDUDE_PRESET); @@ -1033,7 +1044,7 @@ void loop() { //#if (enable_tel == true) && defined(KISS_PROTOCOL) #if defined(ENABLE_TNC_SELF_TELEMETRY) && defined(KISS_PROTOCOL) if (nextTelemetryFrame < millis()){ - nextTelemetryFrame = millis() + TNC_SELF_TELEMETRY_INTERVAL; + nextTelemetryFrame = millis() + (TNC_SELF_TELEMETRY_INTERVAL * 1000); sendTelemetryFrame(); } #endif diff --git a/src/taskWebServer.cpp b/src/taskWebServer.cpp index 669a52c..f57057c 100644 --- a/src/taskWebServer.cpp +++ b/src/taskWebServer.cpp @@ -172,6 +172,7 @@ void handle_Cfg() { jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_ALTITUDE); jsonData += jsonLineFromPreferenceBool(PREF_APRS_GPS_EN); jsonData += jsonLineFromPreferenceBool(PREF_ENABLE_TNC_SELF_TELEMETRY); + jsonData += jsonLineFromPreferenceInt(PREF_TNC_SELF_TELEMETRY_INTERVAL); jsonData += jsonLineFromPreferenceBool(PREF_DEV_OL_EN); jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_CMT); jsonData += jsonLineFromPreferenceBool(PREF_DEV_BT_EN); @@ -256,6 +257,9 @@ void handle_SaveAPRSCfg() { if (server.hasArg(PREF_APRS_SB_ANGLE_PRESET)){ preferences.putDouble(PREF_APRS_SB_ANGLE_PRESET, server.arg(PREF_APRS_SB_ANGLE_PRESET).toDouble()); } + if (server.hasArg(PREF_TNC_SELF_TELEMETRY_INTERVAL)){ + preferences.putInt(PREF_TNC_SELF_TELEMETRY_INTERVAL, server.arg(PREF_TNC_SELF_TELEMETRY_INTERVAL).toInt()); + } preferences.putBool(PREF_APRS_SHOW_BATTERY, server.hasArg(PREF_APRS_SHOW_BATTERY)); preferences.putBool(PREF_ENABLE_TNC_SELF_TELEMETRY, server.hasArg(PREF_ENABLE_TNC_SELF_TELEMETRY));