This commit is contained in:
Matt 2021-09-11 22:58:56 -05:00
parent 967c1d0e8d
commit 5c055cbd16
5 changed files with 30 additions and 9 deletions

View File

@ -98,8 +98,12 @@
<input name="aprs_batt" id="aprs_batt" type="checkbox" value="1" title=" show battery voltage after personal comment">
</div>
<div>
<label for="aprs_self_tel">Enable Self Telemetry</label>
<input name="aprs_self_tel" id="aprs_self_tel" type="checkbox" value="1" title=" send self telemetry data">
<label for="tnc_tel">Enable Self Telemetry</label>
<input name="tnc_tel" id="tnc_tel" type="checkbox" value="1" title=" send self telemetry data">
</div>
<div>
<label for="tnc_tel_int">Self Telemetry Interval [s]</label>
<input name="tnc_tel_int" id="tnc_tel_int" type="number" min="10" title="time between sending telemetry if Enable Self Telemetry option is selected ">
</div>
</div>
<div class="grid-container full">

View File

@ -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";

View File

@ -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

View File

@ -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

View File

@ -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));