Merge branch 'SQ9MDD:master' into telemetry-path

pull/80/head
mattbk 2021-09-19 09:48:58 -05:00 zatwierdzone przez GitHub
commit 434e8ef0ad
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
6 zmienionych plików z 168 dodań i 38 usunięć

Wyświetl plik

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

Wyświetl plik

@ -101,6 +101,26 @@
<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>
<div class="grid-container full">
<h5 class="u-full-width">Telemetry Settings</h5>
</div>
<div class="grid-container quarters">
<div>
<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>
<label for="tnc_tel_mic">Self Telemetry Sequence</label>
<select id="tnc_tel_mic" name="tnc_tel_mic" title="self telemetry sequence type (numeric supported by aprs.fi and aprsdirect.com)">
<option value="0">Numeric</option>
<option value="1">MIC</option>
</select>
</div>
</div>
<div class="grid-container full">
<h5 class="u-full-width">Fixed Beaconing Settings</h5>

Wyświetl plik

@ -6,7 +6,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";
static const char *const PREF_AP_PASSWORD = "ap_password";
@ -35,6 +35,14 @@ 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 = "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";
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";

Wyświetl plik

@ -31,27 +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' ; can be set from www interface
-D 'TNC_SELF_TELEMETRY_INTERVAL=3600L' ; can be set from www interface (seconds)
-D 'SHOW_OLED_TIME=15000' ; OLED Timeout
[env:ttgo-t-beam-v1.0]

Wyświetl plik

@ -111,6 +111,8 @@ boolean key_up = true;
boolean t_lock = false;
boolean fixed_beacon_enabled = false;
boolean show_cmt = true;
// Telemetry sequence, current value
int tel_sequence;
#ifdef SHOW_ALT
boolean showAltitude = true;
@ -122,6 +124,22 @@ boolean show_cmt = true;
#else
boolean showBattery = false;
#endif
#ifdef ENABLE_TNC_SELF_TELEMETRY
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"
#else
int tel_mic = 0; // telemetry as "T#001"
#endif
#ifdef ENABLE_BLUETOOTH
boolean enable_bluetooth = true;
#else
@ -503,27 +521,68 @@ String prepareCallsign(const String& callsign){
}
#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;
// 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);
// Flash the light when telemetry is being sent
#ifdef ENABLE_LED_SIGNALING
digitalWrite(TXLED, LOW);
#endif
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);
// Determine sequence number (or 'MIC')
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";
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#") + 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);
sendToTNC(telemetryBase + telemetryParamsNames);
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
#ifdef ENABLE_LED_SIGNALING
digitalWrite(TXLED, HIGH);
#endif
// Update the telemetry sequence number
if(tel_sequence >= 999){
tel_sequence = 0;
}else{
tel_sequence = tel_sequence + 1;
}
preferences.putUInt(PREF_TNC_SELF_TELEMETRY_SEQ, tel_sequence);
}
#endif
}
#endif
}
#endif
// + SETUP --------------------------------------------------------------+//
void setup(){
@ -552,6 +611,10 @@ void setup(){
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){
@ -618,6 +681,30 @@ 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_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_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_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);
@ -1103,7 +1190,8 @@ void loop() {
}
#if defined(ENABLE_TNC_SELF_TELEMETRY) && defined(KISS_PROTOCOL)
if (nextTelemetryFrame < millis()){
nextTelemetryFrame = millis() + TNC_SELF_TELEMETRY_INTERVAL;
// Schedule the next telemetry frame
nextTelemetryFrame = millis() + (tel_interval * 1000);
sendTelemetryFrame();
}
#endif

Wyświetl plik

@ -211,6 +211,9 @@ 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 += 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);
@ -277,6 +280,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());
}
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)){
@ -297,8 +306,10 @@ 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());
}
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));