Get working telemetry switch in www interface.
rodzic
123236b968
commit
967c1d0e8d
|
@ -97,6 +97,10 @@
|
|||
<label for="aprs_batt">Show Battery</label>
|
||||
<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">
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid-container full">
|
||||
<h5 class="u-full-width">Fixed Beaconing Settings</h5>
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
Ładowanie…
Reference in New Issue