Number telemetry sequence correctly.

pull/75/head
Matt 2021-09-16 13:42:36 -05:00
rodzic e572a68103
commit 36c1a09bdd
3 zmienionych plików z 36 dodań i 7 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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