From 4793fb030ada656726bc9bc652e83bbb4714d49b Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 6 Sep 2021 12:50:43 -0500 Subject: [PATCH 01/14] telemetry --- platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio.ini b/platformio.ini index 6bbdc56..15e2e67 100644 --- a/platformio.ini +++ b/platformio.ini @@ -52,6 +52,7 @@ build_flags = -D 'MAX_TIME_TO_NEXT_TX=120000L' ; can be set from www interfeace -D 'FIX_BEACON_INTERVAL=1800000L' ; can be set from www interfeace -D 'NETWORK_GPS_PORT=10110' ; GPS NMEA Port + -D 'ENABLE_TNC_SELF_TELEMETRY' ; send telemetry data about device [env:ttgo-t-beam-v1.0] platform = espressif32 @ 3.0.0 From 123236b968d1c6d56e97e176e378146526cdf124 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 6 Sep 2021 12:58:21 -0500 Subject: [PATCH 02/14] Add default telemetry interval. --- platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio.ini b/platformio.ini index 15e2e67..9bceb1f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -53,6 +53,7 @@ build_flags = -D 'FIX_BEACON_INTERVAL=1800000L' ; can be set from www interfeace -D 'NETWORK_GPS_PORT=10110' ; GPS NMEA Port -D 'ENABLE_TNC_SELF_TELEMETRY' ; send telemetry data about device + -D 'TNC_SELF_TELEMETRY_INTERVAL=1800000L' ; telemetry interval [env:ttgo-t-beam-v1.0] platform = espressif32 @ 3.0.0 From 967c1d0e8db24547bbd5055b03464497a2913945 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 11 Sep 2021 21:46:51 -0500 Subject: [PATCH 03/14] Get working telemetry switch in www interface. --- data_embed/index.html | 4 +++ include/preference_storage.h | 4 ++- platformio.ini | 34 +++++++++++----------- src/TTGO_T-Beam_LoRa_APRS.ino | 54 +++++++++++++++++++++++------------ src/taskWebServer.cpp | 2 ++ 5 files changed, 61 insertions(+), 37 deletions(-) diff --git a/data_embed/index.html b/data_embed/index.html index af976eb..f534083 100644 --- a/data_embed/index.html +++ b/data_embed/index.html @@ -97,6 +97,10 @@ +
+ + +
Fixed Beaconing Settings
diff --git a/include/preference_storage.h b/include/preference_storage.h index 1d539da..6feea31 100644 --- a/include/preference_storage.h +++ b/include/preference_storage.h @@ -7,7 +7,7 @@ #define ENABLE_PREFERENCES extern Preferences preferences; -// MAX 15 chars for preferenece key!!! +// MAX 15 chars for preference key!!! static const char *const PREF_WIFI_SSID = "wifi_ssid"; static const char *const PREF_WIFI_PASSWORD = "wifi_password"; // LoRa settings @@ -35,6 +35,8 @@ 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"; // 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 9bceb1f..e9866dd 100644 --- a/platformio.ini +++ b/platformio.ini @@ -31,29 +31,29 @@ lib_deps = build_flags = -Wl,--gc-sections,--relax -D 'KISS_PROTOCOL' ; leave enabled - -D 'CALLSIGN="N0CALL-0"' ; can be set from www interfeace - -D 'DIGI_PATH="WIDE1-1"' ; can be set from www interfeace - -D 'FIXED_BEACON_EN' ; can be set from www interfeace - -D 'LATIDUDE_PRESET="0000.00N"' ; can be set from www interfeace - -D 'LONGITUDE_PRESET="00000.00E"' ; can be set from www interfeace - -D 'APRS_SYMBOL_TABLE="/"' ; can be set from www interfeace - -D 'APRS_SYMBOL="["' ; can be set from www interfeace - -D 'MY_COMMENT="Lora Tracker"' ; can be set from www interfeace - -D 'SHOW_ALT' ; can be set from www interfeace - -D 'SHOW_BATT' ; can be set from www interfeace - -D 'SHOW_RX_PACKET' ; can be set from www interfeace - -D 'SHOW_RX_TIME=10000' ; can be set from www interfeace + -D 'CALLSIGN="N0CALL-0"' ; can be set from www interface + -D 'DIGI_PATH="WIDE1-1"' ; can be set from www interface + -D 'FIXED_BEACON_EN' ; can be set from www interface + -D 'LATIDUDE_PRESET="0000.00N"' ; can be set from www interface + -D 'LONGITUDE_PRESET="00000.00E"' ; can be set from www interface + -D 'APRS_SYMBOL_TABLE="/"' ; can be set from www interface + -D 'APRS_SYMBOL="["' ; can be set from www interface + -D 'MY_COMMENT="Lora Tracker"' ; can be set from www interface + -D 'SHOW_ALT' ; can be set from www interface + -D 'SHOW_BATT' ; can be set from www interface + -D 'SHOW_RX_PACKET' ; can be set from www interface + -D 'SHOW_RX_TIME=10000' ; can be set from www interface -D 'TXFREQ=433.775' ; set operating frequency -D 'SPEED_1200' ; comment out to set 300baud -D 'TXdbmW=23' ; set power - -D 'ENABLE_OLED' ; can be set from www interfeace - -D 'ENABLE_LED_SIGNALING' ; can be set from www interfeace + -D 'ENABLE_OLED' ; can be set from www interface + -D 'ENABLE_LED_SIGNALING' ; can be set from www interface -D 'NETWORK_TNC_PORT=8001' ; default KISS TCP port - -D 'MAX_TIME_TO_NEXT_TX=120000L' ; can be set from www interfeace - -D 'FIX_BEACON_INTERVAL=1800000L' ; can be set from www interfeace + -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=1800000L' ; telemetry interval + -D 'TNC_SELF_TELEMETRY_INTERVAL=60000L' ; 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 22b1a20..0022cdd 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -114,6 +114,11 @@ boolean show_cmt = true; #else boolean showBattery = false; #endif +#ifdef ENABLE_TNC_SELF_TELEMETRY + boolean enable_tel = true; +#else + boolean enable_tel = false; +#endif #ifdef ENABLE_BLUETOOTH boolean enable_bluetooth = true; #else @@ -134,6 +139,7 @@ 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 @@ -479,28 +485,31 @@ 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() { - #ifdef T_BEAM_V1_0 - uint8_t b_volt = (axp.getBattVoltage() - 3000) / 5.1; - uint8_t b_in_c = (axp.getBattChargeCurrent()) / 10; - uint8_t b_out_c = (axp.getBattDischargeCurrent()) / 10; - uint8_t ac_volt = (axp.getVbusVoltage() - 3000) / 28; - uint8_t ac_c = (axp.getVbusCurrent()) / 10; + void sendTelemetryFrame() { + if(enable_tel == true){ + #ifdef T_BEAM_V1_0 + uint8_t b_volt = (axp.getBattVoltage() - 3000) / 5.1; + uint8_t b_in_c = (axp.getBattChargeCurrent()) / 10; + uint8_t b_out_c = (axp.getBattDischargeCurrent()) / 10; + uint8_t ac_volt = (axp.getVbusVoltage() - 3000) / 28; + uint8_t ac_c = (axp.getVbusCurrent()) / 10; - String telemetryParamsNames = String(":") + Tcall + ":PARM.B Volt,B In,B Out,AC V,AC C"; - String telemetryUnitNames = String(":") + Tcall + ":UNIT.mV,mA,mA,mV,mA"; - String telemetryEquations = String(":") + Tcall + ":EQNS.0,5.1,3000,0,10,0,0,10,0,0,28,3000,0,10,0"; - String telemetryData = String("T#MIC") + String(b_volt) + ","+ String(b_in_c) + ","+ String(b_out_c) + ","+ String(ac_volt) + ","+ String(ac_c) + ",00000000"; - String telemetryBase = ""; - telemetryBase += Tcall + ">APLO01" + ":"; - sendToTNC(telemetryBase + telemetryParamsNames); - sendToTNC(telemetryBase + telemetryUnitNames); - sendToTNC(telemetryBase + telemetryEquations); - sendToTNC(telemetryBase + telemetryData); + String telemetryParamsNames = String(":") + Tcall + ":PARM.B Volt,B In,B Out,AC V,AC C"; + String telemetryUnitNames = String(":") + Tcall + ":UNIT.mV,mA,mA,mV,mA"; + String telemetryEquations = String(":") + Tcall + ":EQNS.0,5.1,3000,0,10,0,0,10,0,0,28,3000,0,10,0"; + String telemetryData = String("T#MIC") + String(b_volt) + ","+ String(b_in_c) + ","+ String(b_out_c) + ","+ String(ac_volt) + ","+ String(ac_c) + ",00000000"; + String telemetryBase = ""; + telemetryBase += Tcall + ">APLO01" + ":"; + sendToTNC(telemetryBase + telemetryParamsNames); + sendToTNC(telemetryBase + telemetryUnitNames); + sendToTNC(telemetryBase + telemetryEquations); + sendToTNC(telemetryBase + telemetryData); + } + #endif + } #endif -} -#endif // + SETUP --------------------------------------------------------------+// void setup(){ @@ -589,6 +598,12 @@ void setup(){ } showBattery = preferences.getBool(PREF_APRS_SHOW_BATTERY); + if (!preferences.getBool(PREF_ENABLE_TNC_SELF_TELEMETRY_INIT)){ + preferences.putBool(PREF_ENABLE_TNC_SELF_TELEMETRY_INIT, true); + preferences.putBool(PREF_ENABLE_TNC_SELF_TELEMETRY, enable_tel); + } + enable_tel = preferences.getBool(PREF_ENABLE_TNC_SELF_TELEMETRY); + if (!preferences.getBool(PREF_APRS_LATITUDE_PRESET_INIT)){ preferences.putBool(PREF_APRS_LATITUDE_PRESET_INIT, true); preferences.putString(PREF_APRS_LATITUDE_PRESET, LATIDUDE_PRESET); @@ -1015,6 +1030,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; diff --git a/src/taskWebServer.cpp b/src/taskWebServer.cpp index 437f40a..669a52c 100644 --- a/src/taskWebServer.cpp +++ b/src/taskWebServer.cpp @@ -171,6 +171,7 @@ void handle_Cfg() { jsonData += jsonLineFromPreferenceBool(PREF_APRS_FIXED_BEACON_PRESET); jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_ALTITUDE); jsonData += jsonLineFromPreferenceBool(PREF_APRS_GPS_EN); + jsonData += jsonLineFromPreferenceBool(PREF_ENABLE_TNC_SELF_TELEMETRY); jsonData += jsonLineFromPreferenceBool(PREF_DEV_OL_EN); jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_CMT); jsonData += jsonLineFromPreferenceBool(PREF_DEV_BT_EN); @@ -257,6 +258,7 @@ void handle_SaveAPRSCfg() { } 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)); preferences.putBool(PREF_APRS_SHOW_ALTITUDE, server.hasArg(PREF_APRS_SHOW_ALTITUDE)); preferences.putBool(PREF_APRS_FIXED_BEACON_PRESET, server.hasArg(PREF_APRS_FIXED_BEACON_PRESET)); preferences.putBool(PREF_APRS_GPS_EN, server.hasArg(PREF_APRS_GPS_EN)); From 5c055cbd16a0f4f6cbdfef5bffc16039a6c627e6 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 11 Sep 2021 22:58:56 -0500 Subject: [PATCH 04/14] 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)); From fd6395df1666220cdfb03192ddfe7e41aaa8ecf0 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 12 Sep 2021 07:54:43 -0500 Subject: [PATCH 05/14] Get telemetry interval to work. --- src/TTGO_T-Beam_LoRa_APRS.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index a0deb68..3123df7 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -1044,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 * 1000); + nextTelemetryFrame = millis() + (tel_interval * 1000); sendTelemetryFrame(); } #endif From 594da346edab58fcb541bae3749e63fa51fdf718 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 12 Sep 2021 19:30:17 -0500 Subject: [PATCH 06/14] Fix telemetry path (for now). --- src/TTGO_T-Beam_LoRa_APRS.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 3123df7..fb7257f 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -500,7 +500,8 @@ String prepareCallsign(const String& callsign){ String telemetryEquations = String(":") + Tcall + ":EQNS.0,5.1,3000,0,10,0,0,10,0,0,28,3000,0,10,0"; String telemetryData = String("T#MIC") + String(b_volt) + ","+ String(b_in_c) + ","+ String(b_out_c) + ","+ String(ac_volt) + ","+ String(ac_c) + ",00000000"; String telemetryBase = ""; - telemetryBase += Tcall + ">APLO01" + ":"; + telemetryBase += Tcall + ">APLO01," + relay_path + ":"; + Serial.print(telemetryBase); sendToTNC(telemetryBase + telemetryParamsNames); sendToTNC(telemetryBase + telemetryUnitNames); sendToTNC(telemetryBase + telemetryEquations); From e572a68103770728e3edbfc2f99fd184dc5cc6d6 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 13 Sep 2021 17:23:05 -0500 Subject: [PATCH 07/14] Pad telemetry callsign and remove MIC from telemetry. --- src/TTGO_T-Beam_LoRa_APRS.ino | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index fb7257f..33c3571 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -494,11 +494,15 @@ String prepareCallsign(const String& callsign){ uint8_t b_out_c = (axp.getBattDischargeCurrent()) / 10; uint8_t ac_volt = (axp.getVbusVoltage() - 3000) / 28; uint8_t ac_c = (axp.getVbusCurrent()) / 10; + // Pad telemetry message address to 9 characters + char Tcall_message_char[9]; + sprintf_P(Tcall_message_char, "%-9s", Tcall); + String Tcall_message = String(Tcall_message_char); - String telemetryParamsNames = String(":") + Tcall + ":PARM.B Volt,B In,B Out,AC V,AC C"; - String telemetryUnitNames = String(":") + Tcall + ":UNIT.mV,mA,mA,mV,mA"; - String telemetryEquations = String(":") + Tcall + ":EQNS.0,5.1,3000,0,10,0,0,10,0,0,28,3000,0,10,0"; - String telemetryData = String("T#MIC") + String(b_volt) + ","+ String(b_in_c) + ","+ String(b_out_c) + ","+ String(ac_volt) + ","+ String(ac_c) + ",00000000"; + String telemetryParamsNames = String(":") + Tcall_message + ":PARM.B Volt,B In,B Out,AC V,AC C"; + String telemetryUnitNames = String(":") + Tcall_message + ":UNIT.mV,mA,mA,mV,mA"; + String telemetryEquations = String(":") + Tcall_message + ":EQNS.0,5.1,3000,0,10,0,0,10,0,0,28,3000,0,10,0"; + String telemetryData = String("T#") + String(b_volt) + ","+ String(b_in_c) + ","+ String(b_out_c) + ","+ String(ac_volt) + ","+ String(ac_c) + ",00000000"; String telemetryBase = ""; telemetryBase += Tcall + ">APLO01," + relay_path + ":"; Serial.print(telemetryBase); From 36c1a09bdd0c8c62a2a7c561fb1202016fb5a822 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 16 Sep 2021 13:42:36 -0500 Subject: [PATCH 08/14] Number telemetry sequence correctly. --- include/preference_storage.h | 2 ++ platformio.ini | 3 ++- src/TTGO_T-Beam_LoRa_APRS.ino | 38 +++++++++++++++++++++++++++++------ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/include/preference_storage.h b/include/preference_storage.h index 9d1f9aa..2eabc67 100644 --- a/include/preference_storage.h +++ b/include/preference_storage.h @@ -39,6 +39,8 @@ 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"; +static const char *const PREF_TNC_SELF_TELEMETRY_SEQ = "tnc_tel_seq"; +static const char *const PREF_TNC_SELF_TELEMETRY_SEQ_INIT = "tnc_tel_seq_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 ab71b65..c9e20bb 100644 --- a/platformio.ini +++ b/platformio.ini @@ -53,7 +53,8 @@ build_flags = -D 'FIX_BEACON_INTERVAL=1800000L' ; can be set from www interface -D 'NETWORK_GPS_PORT=10110' ; GPS NMEA Port -D 'ENABLE_TNC_SELF_TELEMETRY' ; can be set from www interface - -D 'TNC_SELF_TELEMETRY_INTERVAL=60L' ; telemetry interval (milliseconds) + -D 'TNC_SELF_TELEMETRY_INTERVAL=3600L' ; can be set from www interface (seconds) + -D 'TNC_SELF_TELEMETRY_SEQ=0L' [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 33c3571..b2763e6 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -104,6 +104,7 @@ boolean t_lock = false; boolean fixed_beacon_enabled = false; boolean show_cmt = true; int tel_interval; +int tel_sequence; #ifdef SHOW_ALT boolean showAltitude = true; @@ -499,10 +500,16 @@ String prepareCallsign(const String& callsign){ sprintf_P(Tcall_message_char, "%-9s", Tcall); String Tcall_message = String(Tcall_message_char); + // Determine sequence number (or 'MIC') + // Pad to 3 digits + char tel_sequence_char[3]; + sprintf_P(tel_sequence_char, "%03i", tel_sequence); + String tel_sequence_str = String(tel_sequence_char); + String telemetryParamsNames = String(":") + Tcall_message + ":PARM.B Volt,B In,B Out,AC V,AC C"; String telemetryUnitNames = String(":") + Tcall_message + ":UNIT.mV,mA,mA,mV,mA"; String telemetryEquations = String(":") + Tcall_message + ":EQNS.0,5.1,3000,0,10,0,0,10,0,0,28,3000,0,10,0"; - String telemetryData = String("T#") + String(b_volt) + ","+ String(b_in_c) + ","+ String(b_out_c) + ","+ String(ac_volt) + ","+ String(ac_c) + ",00000000"; + String telemetryData = String("T#") + tel_sequence_str + "," + String(b_volt) + "," + String(b_in_c) + "," + String(b_out_c) + "," + String(ac_volt) + "," + String(ac_c) + ",00000000"; String telemetryBase = ""; telemetryBase += Tcall + ">APLO01," + relay_path + ":"; Serial.print(telemetryBase); @@ -510,6 +517,19 @@ String prepareCallsign(const String& callsign){ sendToTNC(telemetryBase + telemetryUnitNames); sendToTNC(telemetryBase + telemetryEquations); sendToTNC(telemetryBase + telemetryData); + + // Show when telemetry is being sent + writedisplaytext("((TEL TX))","","","","",""); + + // Flash the light when telemetry is being sent + // CODE HERE + + // Update the telemetry sequence number + if(tel_sequence >= 0 & tel_sequence < 999){ + tel_sequence = tel_sequence + 1; + } else { + tel_sequence = 0; + } } #endif } @@ -532,11 +552,11 @@ void setup(){ relay_path = ""; #endif - //#ifdef TNC_SELF_TELEMETRY_INTERVAL - // tel_interval = TNC_SELF_TELEMETRY_INTERVAL; - //#else - // tel_interval = 60; - //#endif + #ifdef TNC_SELF_TELEMETRY_SEQ + tel_sequence = TNC_SELF_TELEMETRY_SEQ; + #else + tel_sequence = 0; + #endif #ifdef FIXED_BEACON_EN fixed_beacon_enabled = true; @@ -620,6 +640,12 @@ void setup(){ } tel_interval = preferences.getInt(PREF_TNC_SELF_TELEMETRY_INTERVAL); + if (!preferences.getBool(PREF_TNC_SELF_TELEMETRY_SEQ_INIT)){ + preferences.putBool(PREF_TNC_SELF_TELEMETRY_SEQ_INIT, true); + preferences.putInt(PREF_TNC_SELF_TELEMETRY_SEQ, tel_sequence); + } + tel_sequence = preferences.getInt(PREF_TNC_SELF_TELEMETRY_SEQ); + if (!preferences.getBool(PREF_APRS_LATITUDE_PRESET_INIT)){ preferences.putBool(PREF_APRS_LATITUDE_PRESET_INIT, true); preferences.putString(PREF_APRS_LATITUDE_PRESET, LATIDUDE_PRESET); From b3adda48e9832278798999ae442c2752812541a0 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 16 Sep 2021 15:23:44 -0500 Subject: [PATCH 09/14] Blink LED when sending telemetry. --- README.md | 1 + platformio.ini | 2 +- src/TTGO_T-Beam_LoRa_APRS.ino | 9 +++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 535852a..d1ce592 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ After connection with APRX based DIGI it can be used as KISS-TNC * ((AUT TX)) - information about sending automatic positioning frame when GPS is turned off * ((KISSTX)) - information about sending the frame sent by KISS * ((WEB TX)) - sending frame as requested via HTTP +* ((TEL TX)) - information about sending telemetry ## How to binary first flash readme... (thanx SP6VWX) * Download the appropriate binary file for your board from: https://github.com/SQ9MDD/TTGO-T-Beam-LoRa-APRS/releases diff --git a/platformio.ini b/platformio.ini index 48254a7..e37b9f3 100644 --- a/platformio.ini +++ b/platformio.ini @@ -54,7 +54,7 @@ build_flags = -D 'NETWORK_GPS_PORT=10110' ; GPS NMEA Port -D 'ENABLE_TNC_SELF_TELEMETRY' ; can be set from www interface -D 'TNC_SELF_TELEMETRY_INTERVAL=3600L' ; can be set from www interface (seconds) - -D 'TNC_SELF_TELEMETRY_SEQ=0L' + -D 'TNC_SELF_TELEMETRY_SEQ=0L' ; start number for telemetry sequence -D 'SHOW_OLED_TIME=15000' ; OLED Timeout [env:ttgo-t-beam-v1.0] diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index eb6ece3..6442aeb 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -511,6 +511,10 @@ String prepareCallsign(const String& callsign){ char Tcall_message_char[9]; sprintf_P(Tcall_message_char, "%-9s", Tcall); String Tcall_message = String(Tcall_message_char); + // Flash the light when telemetry is being sent + #ifdef ENABLE_LED_SIGNALING + digitalWrite(TXLED, LOW); + #endif // Determine sequence number (or 'MIC') // Pad to 3 digits @@ -534,7 +538,9 @@ String prepareCallsign(const String& callsign){ writedisplaytext("((TEL TX))","","","","",""); // Flash the light when telemetry is being sent - // CODE HERE + #ifdef ENABLE_LED_SIGNALING + digitalWrite(TXLED, HIGH); + #endif // Update the telemetry sequence number if(tel_sequence >= 0 & tel_sequence < 999){ @@ -1136,7 +1142,6 @@ void loop() { } } } - //#if (enable_tel == true) && defined(KISS_PROTOCOL) #if defined(ENABLE_TNC_SELF_TELEMETRY) && defined(KISS_PROTOCOL) if (nextTelemetryFrame < millis()){ nextTelemetryFrame = millis() + (tel_interval * 1000); From 052589a608f2ca5e7ac2fe1756e35d141d11ccc4 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 18 Sep 2021 09:59:09 -0500 Subject: [PATCH 10/14] Get telemetry sequence to save. Still needs some cleanup of comments. --- platformio.ini | 2 +- src/TTGO_T-Beam_LoRa_APRS.ino | 33 ++++++++++++++++++++++----------- src/taskWebServer.cpp | 10 +++++++--- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/platformio.ini b/platformio.ini index e37b9f3..b429ada 100644 --- a/platformio.ini +++ b/platformio.ini @@ -54,7 +54,7 @@ build_flags = -D 'NETWORK_GPS_PORT=10110' ; GPS NMEA Port -D 'ENABLE_TNC_SELF_TELEMETRY' ; can be set from www interface -D 'TNC_SELF_TELEMETRY_INTERVAL=3600L' ; can be set from www interface (seconds) - -D 'TNC_SELF_TELEMETRY_SEQ=0L' ; start number for telemetry sequence + ; -D 'TNC_SELF_TELEMETRY_SEQ=0L' ; start number for telemetry sequence -D 'SHOW_OLED_TIME=15000' ; OLED Timeout [env:ttgo-t-beam-v1.0] diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 6442aeb..6783c5c 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -103,8 +103,11 @@ boolean key_up = true; boolean t_lock = false; boolean fixed_beacon_enabled = false; boolean show_cmt = true; +// Telemetry interval, seconds int tel_interval; +// Telemetry sequence, current value int tel_sequence; +//int tel_sequence = preferences.getInt(PREF_TNC_SELF_TELEMETRY_SEQ, 0); #ifdef SHOW_ALT boolean showAltitude = true; @@ -121,6 +124,11 @@ int tel_sequence; #else boolean enable_tel = false; #endif +//#ifdef TNC_SELF_TELEMETRY_SEQ +// int tel_sequence = TNC_SELF_TELEMETRY_SEQ; +//#else +// int tel_sequence = PREF_TNC_SELF_TELEMETRY_SEQ; +//#endif #ifdef ENABLE_BLUETOOTH boolean enable_bluetooth = true; #else @@ -517,9 +525,10 @@ String prepareCallsign(const String& callsign){ #endif // Determine sequence number (or 'MIC') + tel_sequence = preferences.getUInt(PREF_TNC_SELF_TELEMETRY_SEQ, 0); // Pad to 3 digits char tel_sequence_char[3]; - sprintf_P(tel_sequence_char, "%03i", tel_sequence); + sprintf_P(tel_sequence_char, "%03u", tel_sequence); String tel_sequence_str = String(tel_sequence_char); String telemetryParamsNames = String(":") + Tcall_message + ":PARM.B Volt,B In,B Out,AC V,AC C"; @@ -543,11 +552,14 @@ String prepareCallsign(const String& callsign){ #endif // Update the telemetry sequence number - if(tel_sequence >= 0 & tel_sequence < 999){ + //if(tel_sequence >= 0 & tel_sequence < 999){ tel_sequence = tel_sequence + 1; - } else { - tel_sequence = 0; - } + //} + //else { + // tel_sequence = 0; + //} + preferences.putUInt(PREF_TNC_SELF_TELEMETRY_SEQ, tel_sequence); + } #endif } @@ -576,16 +588,14 @@ void setup(){ relay_path = ""; #endif - #ifdef TNC_SELF_TELEMETRY_SEQ - tel_sequence = TNC_SELF_TELEMETRY_SEQ; - #else - tel_sequence = 0; - #endif - #ifdef FIXED_BEACON_EN fixed_beacon_enabled = true; #endif +// This section loads values from saved preferences, +// if available. +// https://randomnerdtutorials.com/esp32-save-data-permanently-preferences/ + #ifdef ENABLE_PREFERENCES int clear_preferences = 0; if(digitalRead(BUTTON)==LOW){ @@ -1144,6 +1154,7 @@ void loop() { } #if defined(ENABLE_TNC_SELF_TELEMETRY) && defined(KISS_PROTOCOL) if (nextTelemetryFrame < millis()){ + // Schedule the next telemetry frame nextTelemetryFrame = millis() + (tel_interval * 1000); sendTelemetryFrame(); } diff --git a/src/taskWebServer.cpp b/src/taskWebServer.cpp index 10a0b24..f76699c 100644 --- a/src/taskWebServer.cpp +++ b/src/taskWebServer.cpp @@ -272,6 +272,12 @@ void handle_SaveAPRSCfg() { if (server.hasArg(PREF_APRS_LONGITUDE_PRESET)){ preferences.putString(PREF_APRS_LONGITUDE_PRESET, server.arg(PREF_APRS_LONGITUDE_PRESET)); } + if (server.hasArg(PREF_TNC_SELF_TELEMETRY_INTERVAL)){ + preferences.putInt(PREF_TNC_SELF_TELEMETRY_INTERVAL, server.arg(PREF_TNC_SELF_TELEMETRY_INTERVAL).toInt()); + } +//Arg(PREF_TNC_SELF_TELEMETRY_SEQ)){ + // preferences.putInt(PREF_TNC_SELF_TELEMETRY_SEQ, server.arg(PREF_TNC_SELF_TELEMETRY_SEQ).toInt()); + //} // Smart Beaconing settings if (server.hasArg(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET)){ @@ -292,9 +298,7 @@ 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)); From afa4121b512f0c7d5cd779426e377dce71a2451d Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 18 Sep 2021 12:44:20 -0500 Subject: [PATCH 11/14] Clean up. --- platformio.ini | 1 - src/TTGO_T-Beam_LoRa_APRS.ino | 15 ++------------- src/taskWebServer.cpp | 3 --- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/platformio.ini b/platformio.ini index b429ada..2e4ac2f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -54,7 +54,6 @@ build_flags = -D 'NETWORK_GPS_PORT=10110' ; GPS NMEA Port -D 'ENABLE_TNC_SELF_TELEMETRY' ; can be set from www interface -D 'TNC_SELF_TELEMETRY_INTERVAL=3600L' ; can be set from www interface (seconds) - ; -D 'TNC_SELF_TELEMETRY_SEQ=0L' ; start number for telemetry sequence -D 'SHOW_OLED_TIME=15000' ; OLED Timeout [env:ttgo-t-beam-v1.0] diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 6783c5c..0dc6af8 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -107,7 +107,6 @@ boolean show_cmt = true; int tel_interval; // Telemetry sequence, current value int tel_sequence; -//int tel_sequence = preferences.getInt(PREF_TNC_SELF_TELEMETRY_SEQ, 0); #ifdef SHOW_ALT boolean showAltitude = true; @@ -124,11 +123,6 @@ int tel_sequence; #else boolean enable_tel = false; #endif -//#ifdef TNC_SELF_TELEMETRY_SEQ -// int tel_sequence = TNC_SELF_TELEMETRY_SEQ; -//#else -// int tel_sequence = PREF_TNC_SELF_TELEMETRY_SEQ; -//#endif #ifdef ENABLE_BLUETOOTH boolean enable_bluetooth = true; #else @@ -552,13 +546,8 @@ String prepareCallsign(const String& callsign){ #endif // Update the telemetry sequence number - //if(tel_sequence >= 0 & tel_sequence < 999){ - tel_sequence = tel_sequence + 1; - //} - //else { - // tel_sequence = 0; - //} - preferences.putUInt(PREF_TNC_SELF_TELEMETRY_SEQ, tel_sequence); + tel_sequence = tel_sequence + 1; + preferences.putUInt(PREF_TNC_SELF_TELEMETRY_SEQ, tel_sequence); } #endif diff --git a/src/taskWebServer.cpp b/src/taskWebServer.cpp index f76699c..3c801da 100644 --- a/src/taskWebServer.cpp +++ b/src/taskWebServer.cpp @@ -275,9 +275,6 @@ void handle_SaveAPRSCfg() { if (server.hasArg(PREF_TNC_SELF_TELEMETRY_INTERVAL)){ preferences.putInt(PREF_TNC_SELF_TELEMETRY_INTERVAL, server.arg(PREF_TNC_SELF_TELEMETRY_INTERVAL).toInt()); } -//Arg(PREF_TNC_SELF_TELEMETRY_SEQ)){ - // preferences.putInt(PREF_TNC_SELF_TELEMETRY_SEQ, server.arg(PREF_TNC_SELF_TELEMETRY_SEQ).toInt()); - //} // Smart Beaconing settings if (server.hasArg(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET)){ From eb25ea2cbff584f8a7b746b35853869153fc6577 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 18 Sep 2021 16:51:51 -0500 Subject: [PATCH 12/14] Add www option for MIC telemetry sequence. --- data_embed/index.html | 14 +++++++++++++- include/preference_storage.h | 2 ++ src/TTGO_T-Beam_LoRa_APRS.ino | 27 ++++++++++++++++++++++----- src/taskWebServer.cpp | 4 ++++ 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/data_embed/index.html b/data_embed/index.html index d60e0d8..25a51f9 100644 --- a/data_embed/index.html +++ b/data_embed/index.html @@ -101,14 +101,26 @@
+ +
+
Telemetry Settings
+
+
- +
+
+ + +
Fixed Beaconing Settings
diff --git a/include/preference_storage.h b/include/preference_storage.h index f401627..c61a7d0 100644 --- a/include/preference_storage.h +++ b/include/preference_storage.h @@ -41,6 +41,8 @@ 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"; static const char *const PREF_TNC_SELF_TELEMETRY_SEQ = "tnc_tel_seq"; static const char *const PREF_TNC_SELF_TELEMETRY_SEQ_INIT = "tnc_tel_seq_i"; +static const char *const PREF_TNC_SELF_TELEMETRY_MIC = "tnc_tel_mic"; +static const char *const PREF_TNC_SELF_TELEMETRY_MIC_INIT = "tnc_tel_mic_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/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 0dc6af8..787984e 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -123,6 +123,11 @@ int tel_sequence; #else boolean enable_tel = false; #endif +#ifdef TNC_SELF_TELEMETRY_MIC + int tel_mic = 1; // telemetry as "T#MIC" +#else + int tel_mic = 0; // telemetry as "T#001" +#endif #ifdef ENABLE_BLUETOOTH boolean enable_bluetooth = true; #else @@ -519,11 +524,17 @@ String prepareCallsign(const String& callsign){ #endif // Determine sequence number (or 'MIC') - tel_sequence = preferences.getUInt(PREF_TNC_SELF_TELEMETRY_SEQ, 0); - // Pad to 3 digits - char tel_sequence_char[3]; - sprintf_P(tel_sequence_char, "%03u", tel_sequence); - String tel_sequence_str = String(tel_sequence_char); + String tel_sequence_str; + if(tel_mic == 1){ + tel_sequence_str = "MIC"; + }else{ + // Get the current saved telemetry sequence + tel_sequence = preferences.getUInt(PREF_TNC_SELF_TELEMETRY_SEQ, 0); + // Pad to 3 digits + char tel_sequence_char[3]; + sprintf_P(tel_sequence_char, "%03u", tel_sequence); + tel_sequence_str = String(tel_sequence_char); + } String telemetryParamsNames = String(":") + Tcall_message + ":PARM.B Volt,B In,B Out,AC V,AC C"; String telemetryUnitNames = String(":") + Tcall_message + ":UNIT.mV,mA,mA,mV,mA"; @@ -669,6 +680,12 @@ void setup(){ } tel_sequence = preferences.getInt(PREF_TNC_SELF_TELEMETRY_SEQ); + if (!preferences.getBool(PREF_TNC_SELF_TELEMETRY_MIC_INIT)){ + preferences.putBool(PREF_TNC_SELF_TELEMETRY_MIC_INIT, true); + preferences.putInt(PREF_TNC_SELF_TELEMETRY_MIC, tel_mic); + } + tel_mic = preferences.getInt(PREF_TNC_SELF_TELEMETRY_MIC); + if (!preferences.getBool(PREF_APRS_LATITUDE_PRESET_INIT)){ preferences.putBool(PREF_APRS_LATITUDE_PRESET_INIT, true); preferences.putString(PREF_APRS_LATITUDE_PRESET, LATIDUDE_PRESET); diff --git a/src/taskWebServer.cpp b/src/taskWebServer.cpp index 3c801da..460b0c4 100644 --- a/src/taskWebServer.cpp +++ b/src/taskWebServer.cpp @@ -206,6 +206,7 @@ void handle_Cfg() { jsonData += jsonLineFromPreferenceBool(PREF_APRS_GPS_EN); jsonData += jsonLineFromPreferenceBool(PREF_ENABLE_TNC_SELF_TELEMETRY); jsonData += jsonLineFromPreferenceInt(PREF_TNC_SELF_TELEMETRY_INTERVAL); + jsonData += jsonLineFromPreferenceInt(PREF_TNC_SELF_TELEMETRY_MIC); jsonData += jsonLineFromPreferenceBool(PREF_DEV_OL_EN); jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_CMT); jsonData += jsonLineFromPreferenceBool(PREF_DEV_BT_EN); @@ -275,6 +276,9 @@ void handle_SaveAPRSCfg() { if (server.hasArg(PREF_TNC_SELF_TELEMETRY_INTERVAL)){ preferences.putInt(PREF_TNC_SELF_TELEMETRY_INTERVAL, server.arg(PREF_TNC_SELF_TELEMETRY_INTERVAL).toInt()); } + if (server.hasArg(PREF_TNC_SELF_TELEMETRY_MIC)){ + preferences.putInt(PREF_TNC_SELF_TELEMETRY_MIC, server.arg(PREF_TNC_SELF_TELEMETRY_MIC).toInt()); + } // Smart Beaconing settings if (server.hasArg(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET)){ From f5b88208305ea7f20be2dfaec3ca2dc652a302e5 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 18 Sep 2021 17:22:08 -0500 Subject: [PATCH 13/14] Clarify default IP address. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d1ce592..dcbf2fd 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ After connection with APRX based DIGI it can be used as KISS-TNC * In the left column click on the ANT-shaped icon, choose your board and click on "Upload". COM port should be detected automatically Wait for procedure to finish and keep reading ## Configuring parameters -Wait for the board to reboot, connect to "N0CALL AP" WiFi network, password is: xxxxxxxxxx (10 times "x") and point your browser to "192.168.4.1". Hover your mouse to textboxes to get useful hints. +Wait for the board to reboot, connect to "N0CALL AP" WiFi network, password is: xxxxxxxxxx (10 times "x") and point your browser to "http://192.168.4.1" (http, not http*s*). Hover your mouse to textboxes to get useful hints. ### WiFi Settings you can scan for local SSID or manually type in name and password From ff4d343d8cd430746a584c22e98743e767b8c8fc Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 18 Sep 2021 17:22:22 -0500 Subject: [PATCH 14/14] Fix bug in telemetry timing. --- src/TTGO_T-Beam_LoRa_APRS.ino | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index 787984e..8ac1bfc 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -103,8 +103,6 @@ boolean key_up = true; boolean t_lock = false; boolean fixed_beacon_enabled = false; boolean show_cmt = true; -// Telemetry interval, seconds -int tel_interval; // Telemetry sequence, current value int tel_sequence; @@ -122,6 +120,12 @@ int tel_sequence; boolean enable_tel = true; #else boolean enable_tel = false; +#endif + // Telemetry interval, seconds +#ifdef TNC_SELF_TELEMETRY_INTERVAL + int tel_interval = TNC_SELF_TELEMETRY_INTERVAL; +#else + int tel_interval = 3600; #endif #ifdef TNC_SELF_TELEMETRY_MIC int tel_mic = 1; // telemetry as "T#MIC" @@ -557,7 +561,11 @@ String prepareCallsign(const String& callsign){ #endif // Update the telemetry sequence number - tel_sequence = tel_sequence + 1; + if(tel_sequence >= 999){ + tel_sequence = 0; + }else{ + tel_sequence = tel_sequence + 1; + } preferences.putUInt(PREF_TNC_SELF_TELEMETRY_SEQ, tel_sequence); }