Merge
This commit is contained in:
commit
b279a3c198
|
|
@ -12,3 +12,4 @@ cmake-build-*
|
|||
/include/version.h
|
||||
/data_embed/*.out
|
||||
/src/TTGO_T-Beam_LoRa_APRS.ino.cpp
|
||||
workspace.code-workspace
|
||||
|
|
|
|||
|
|
@ -51,3 +51,8 @@ After connection with APRX based DIGI it can be used as KISS-TNC
|
|||
* Select/Press Flash ESP.
|
||||
* Once complete, “Done! Flashing is complete!” will be shown.
|
||||
* any subsequent updates can be done via WWW
|
||||
|
||||
## Default WiFi Password:
|
||||
|
||||
* Default WiFi Password is: xxxxxxxxxx
|
||||
* that is, 10 times x
|
||||
|
|
|
|||
|
|
@ -45,6 +45,25 @@
|
|||
</div>
|
||||
<article>
|
||||
<form action="/save_aprs_cfg" method="post">
|
||||
<div class="grid-container full">
|
||||
<h5 class="u-full-width">Transmission Settings</h5>
|
||||
</div>
|
||||
<div class="grid-container halves">
|
||||
<div>
|
||||
<label for="lora_freq">Frequency [MHz]</label>
|
||||
<input name="lora_freq" id="lora_freq" type="number" min="433.000" max="434.000" step="0.001" title="LoRa center frequency between 433.001 and 434.000">
|
||||
</div>
|
||||
<div>
|
||||
<label for="lora_speed">Speed [baud]</label>
|
||||
<select id="lora_speed" name="lora_speed">
|
||||
<option value="300">300 baud</option>
|
||||
<option value="1200">1200 baud</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid-container full">
|
||||
<h5 class="u-full-width">Station Settings</h5>
|
||||
</div>
|
||||
<div class="grid-container quarters">
|
||||
<div>
|
||||
<label for="aprs_callsign">Callsign and SSID</label>
|
||||
|
|
@ -79,13 +98,16 @@
|
|||
<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">Fixed Beaconing Settings</h5>
|
||||
</div>
|
||||
<div class="grid-container quarters">
|
||||
<div>
|
||||
<label for="aprs_fixed_beac">Fixed Beacon</label>
|
||||
<input name="aprs_fixed_beac" id="aprs_fixed_beac" type="checkbox" value="1" title="enable fixed beacon when GPS is disabled or no fix">
|
||||
</div>
|
||||
<div>
|
||||
<label for="aprs_fb_interv">Fixed Beacon Interval (s)</label>
|
||||
<label for="aprs_fb_interv">Fixed Beacon Interval [s]</label>
|
||||
<input name="aprs_fb_interv" id="aprs_fb_interv" type="number" min="120" title="time between sending a beacon if Fixed Beacon option is selected ">
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -97,6 +119,31 @@
|
|||
<input class="u-full-width" type="text" minlength="0" name="aprs_lon_p" id="aprs_lon_p" title="longtitude for fixed bicon, APRS format for example 02050.59E">
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid-container full">
|
||||
<h5 class="u-full-width">Smart Beaconing Settings</h5>
|
||||
</div>
|
||||
<div class="grid-container quarters">
|
||||
<div>
|
||||
<label for="sb_min_interv">Min interval [s]</label>
|
||||
<input name="sb_min_interv" id="sb_min_interv" type="number" min="10" title="Minimal time for Smart Beaconing">
|
||||
</div>
|
||||
<div>
|
||||
<label for="sb_max_interv">Max interval [s]</label>
|
||||
<input name="sb_max_interv" id="sb_max_interv" type="number" min="120" title="Maximal time for Smart Beaconing">
|
||||
</div>
|
||||
<div>
|
||||
<label for="sb_min_speed">Min speed [km/h]</label>
|
||||
<input name="sb_min_speed" id="sb_min_speed" type="number" min="0" title="Minimal speed for Smart Beaconing">
|
||||
</div>
|
||||
<div>
|
||||
<label for="sb_max_speed">Max speed [km/h]</label>
|
||||
<input name="sb_max_speed" id="sb_max_speed" type="number" min="1" title="Maximal speed for Smart Beaconing">
|
||||
</div>
|
||||
<div>
|
||||
<label for="sb_angle">Course change [degrees]</label>
|
||||
<input name="sb_angle" id="sb_angle" type="number" min="1" max="360" title="Angle of course change to speed up beacon transmission">
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid-container quarters">
|
||||
<div>
|
||||
<label for="gps_enabled">GPS enabled</label>
|
||||
|
|
@ -222,7 +269,7 @@
|
|||
</section>
|
||||
</div>
|
||||
<footer>
|
||||
<center><b>Contributors in order of appearance:</b> OE1ACM, OE3CJB, SQ9MDD, SQ5RWU, DJ1AN, M0IGA, SQ5WPR, DO2JMG, SP6VWX</center>
|
||||
<center><b>Contributors in order of appearance:</b><br> OE1ACM, OE3CJB, SQ9MDD, SQ5RWU, DJ1AN, M0IGA, SQ5WPR, DO2JMG, SP6VWX, SQ2WB</center>
|
||||
<center><b>Latest stable version:</b> <a href=https://github.com/SQ9MDD/TTGO-T-Beam-LoRa-APRS>https://github.com/SQ9MDD/TTGO-T-Beam-LoRa-APRS</a></center>
|
||||
<center><b>Licensed under:</b> CC BY-NC-SA</center>
|
||||
<center><!--VERSION--></center>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,12 @@ extern Preferences preferences;
|
|||
// MAX 15 chars for preferenece key!!!
|
||||
static const char *const PREF_WIFI_SSID = "wifi_ssid";
|
||||
static const char *const PREF_WIFI_PASSWORD = "wifi_password";
|
||||
// LoRa settings
|
||||
static const char *const PREF_LORA_FREQ_PRESET_INIT = "lora_freq_i";
|
||||
static const char *const PREF_LORA_FREQ_PRESET = "lora_freq";
|
||||
static const char *const PREF_LORA_SPEED_PRESET_INIT = "lora_speed_i";
|
||||
static const char *const PREF_LORA_SPEED_PRESET = "lora_speed";
|
||||
// Station settings
|
||||
static const char *const PREF_APRS_CALLSIGN = "aprs_callsign";
|
||||
static const char *const PREF_APRS_RELAY_PATH = "aprs_relay_path";
|
||||
static const char *const PREF_APRS_RELAY_PATH_INIT = "aprs_relay_init";
|
||||
|
|
@ -29,6 +35,19 @@ 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";
|
||||
// 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";
|
||||
static const char *const PREF_APRS_SB_MAX_INTERVAL_PRESET = "sb_max_interv";
|
||||
static const char *const PREF_APRS_SB_MAX_INTERVAL_PRESET_INIT = "sb_max_interv_i";
|
||||
static const char *const PREF_APRS_SB_MIN_SPEED_PRESET = "sb_min_speed";
|
||||
static const char *const PREF_APRS_SB_MIN_SPEED_PRESET_INIT = "sb_min_speed_i";
|
||||
static const char *const PREF_APRS_SB_MAX_SPEED_PRESET = "sb_max_speed";
|
||||
static const char *const PREF_APRS_SB_MAX_SPEED_PRESET_INIT = "sb_max_speed_i";
|
||||
static const char *const PREF_APRS_SB_ANGLE_PRESET = "sb_angle";
|
||||
static const char *const PREF_APRS_SB_ANGLE_PRESET_INIT = "sb_angle_i";
|
||||
|
||||
//
|
||||
static const char *const PREF_APRS_GPS_EN = "gps_enabled";
|
||||
static const char *const PREF_APRS_GPS_EN_INIT = "gps_state_init";
|
||||
static const char *const PREF_APRS_SHOW_CMT = "show_cmt";
|
||||
|
|
|
|||
|
|
@ -30,28 +30,28 @@ lib_deps =
|
|||
bblanchon/ArduinoJson
|
||||
build_flags =
|
||||
-Wl,--gc-sections,--relax
|
||||
-D 'KISS_PROTOCOL'
|
||||
-D 'CALLSIGN="N0CALL-0"'
|
||||
-D 'DIGI_PATH="ECHO"'
|
||||
-D 'FIXED_BEACON_EN'
|
||||
-D 'LATIDUDE_PRESET="0000.00N"'
|
||||
-D 'LONGITUDE_PRESET="00000.00E"'
|
||||
-D 'APRS_SYMBOL_TABLE="/"'
|
||||
-D 'APRS_SYMBOL="["'
|
||||
-D 'MY_COMMENT="Lora Tracker"'
|
||||
-D 'SHOW_ALT'
|
||||
-D 'SHOW_BATT'
|
||||
-D 'SHOW_RX_PACKET'
|
||||
-D 'SHOW_RX_TIME=10000'
|
||||
-D 'TXFREQ=433.775'
|
||||
-D 'SPEED_1200' ; comment out to set 300baud
|
||||
-D 'TXdbmW=23'
|
||||
-D 'ENABLE_OLED'
|
||||
-D 'ENABLE_LED_SIGNALING'
|
||||
-D 'NETWORK_TNC_PORT=8001'
|
||||
-D 'NETWORK_GPS_PORT=10110'
|
||||
-D 'MAX_TIME_TO_NEXT_TX=360000L'
|
||||
-D 'FIX_BEACON_INTERVAL=1800000L'
|
||||
-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 '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 '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 'NETWORK_GPS_PORT=10110' ; GPS NMEA Port
|
||||
|
||||
[env:ttgo-t-beam-v1.0]
|
||||
platform = espressif32 @ 3.0.0
|
||||
|
|
|
|||
|
|
@ -86,6 +86,10 @@
|
|||
const byte TXLED = 4; //pin number for LED on TX Tracker
|
||||
#endif
|
||||
|
||||
// Variables for LoRa settings
|
||||
ulong lora_speed = 1200;
|
||||
double lora_freq = 433.775;
|
||||
|
||||
// Variables for APRS packaging
|
||||
String Tcall; //your Call Sign for normal position reports
|
||||
String aprsSymbolTable = APRS_SYMBOL_TABLE;
|
||||
|
|
@ -153,12 +157,18 @@ float BattVolts;
|
|||
float InpVolts;
|
||||
|
||||
// variables for smart beaconing
|
||||
float average_speed[5] = {0,0,0,0,0}, average_speed_final=0, max_speed=30, min_speed=0;
|
||||
ulong sb_min_interval = 60000L;
|
||||
ulong sb_max_interval = 360000L;
|
||||
float sb_min_speed = 0;
|
||||
float sb_max_speed = 30;
|
||||
float sb_angle = 30; // angle to send packet at smart beaconing
|
||||
|
||||
float average_speed[5] = {0,0,0,0,0}, average_speed_final=0;
|
||||
float old_course = 0, new_course = 0;
|
||||
int point_avg_speed = 0, point_avg_course = 0;
|
||||
ulong min_time_to_nextTX=60000L; // minimum time period between TX = 60000ms = 60secs = 1min
|
||||
ulong max_time_to_nextTX= MAX_TIME_TO_NEXT_TX;
|
||||
|
||||
ulong nextTX=60000L; // preset time period between TX = 60000ms = 60secs = 1min
|
||||
|
||||
ulong time_to_refresh = 0;
|
||||
ulong next_fixed_beacon = 0;
|
||||
ulong fix_beacon_interval = FIX_BEACON_INTERVAL;
|
||||
|
|
@ -170,7 +180,7 @@ ulong shutdown_countdown_timer = 0;
|
|||
boolean shutdown_active =true;
|
||||
boolean shutdown_countdown_timer_enable = false;
|
||||
boolean shutdown_usb_status_bef = false;
|
||||
#define ANGLE 60 // angle to send packet at smart beaconing
|
||||
|
||||
#define ANGLE_AVGS 3 // angle averaging - x times
|
||||
float average_course[ANGLE_AVGS];
|
||||
float avg_c_y, avg_c_x;
|
||||
|
|
@ -309,7 +319,7 @@ void sendpacket(){
|
|||
#endif
|
||||
batt_read();
|
||||
prepareAPRSFrame();
|
||||
loraSend(txPower, TXFREQ, outString); //send the packet, data is in TXbuff from lora_TXStart to lora_TXEnd
|
||||
loraSend(txPower, lora_freq, outString); //send the packet, data is in TXbuff from lora_TXStart to lora_TXEnd
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -326,11 +336,12 @@ void loraSend(byte lora_LTXPower, float lora_FREQ, const String &message) {
|
|||
|
||||
int messageSize = min(message.length(), sizeof(lora_TXBUFF) - 1);
|
||||
message.toCharArray((char*)lora_TXBUFF, messageSize + 1, 0);
|
||||
#ifdef SPEED_1200
|
||||
if(lora_speed==1200){
|
||||
rf95.setModemConfig(BG_RF95::Bw125Cr47Sf512);
|
||||
#else
|
||||
}
|
||||
else{
|
||||
rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096);
|
||||
#endif
|
||||
}
|
||||
rf95.setFrequency(lora_FREQ);
|
||||
rf95.setTxPower(lora_LTXPower);
|
||||
rf95.sendAPRS(lora_TXBUFF, messageSize);
|
||||
|
|
@ -410,7 +421,13 @@ String getSatAndBatInfo() {
|
|||
}
|
||||
|
||||
void displayInvalidGPS() {
|
||||
writedisplaytext(" " + Tcall, "(TX) at valid GPS", "LAT: not valid", "LON: not valid", "SPD: --- CRS: ---", getSatAndBatInfo());
|
||||
char *nextTxInfo;
|
||||
if (!gps_state){
|
||||
nextTxInfo = (char*)"(TX) GPS DISABLED";
|
||||
} else {
|
||||
nextTxInfo = (char*)"(TX) at valid GPS";
|
||||
}
|
||||
writedisplaytext(" " + Tcall, nextTxInfo, "LAT: not valid", "LON: not valid", "SPD: --- CRS: ---", getSatAndBatInfo());
|
||||
}
|
||||
|
||||
#if defined(KISS_PROTOCOL)
|
||||
|
|
@ -488,7 +505,8 @@ void sendTelemetryFrame() {
|
|||
// + SETUP --------------------------------------------------------------+//
|
||||
void setup(){
|
||||
SPI.begin(SPI_sck,SPI_miso,SPI_mosi,SPI_ss); //DO2JMG Heltec Patch
|
||||
|
||||
Serial.begin(115200);
|
||||
|
||||
#ifdef BUZZER
|
||||
ledcSetup(0,1E5,12);
|
||||
ledcAttachPin(BUZZER,0);
|
||||
|
|
@ -512,6 +530,23 @@ void setup(){
|
|||
}
|
||||
|
||||
preferences.begin("cfg", false);
|
||||
|
||||
// LoRa transmission settings
|
||||
|
||||
if (!preferences.getBool(PREF_LORA_FREQ_PRESET_INIT)){
|
||||
preferences.putBool(PREF_LORA_FREQ_PRESET_INIT, true);
|
||||
preferences.putDouble(PREF_LORA_FREQ_PRESET, lora_freq);
|
||||
}
|
||||
lora_freq = preferences.getDouble(PREF_LORA_FREQ_PRESET);
|
||||
|
||||
if (!preferences.getBool(PREF_LORA_SPEED_PRESET_INIT)){
|
||||
preferences.putBool(PREF_LORA_SPEED_PRESET_INIT, true);
|
||||
preferences.putInt(PREF_LORA_SPEED_PRESET, lora_speed);
|
||||
}
|
||||
lora_speed = preferences.getInt(PREF_LORA_SPEED_PRESET);
|
||||
|
||||
// APRS station settings
|
||||
|
||||
aprsSymbolTable = preferences.getString(PREF_APRS_SYMBOL_TABLE);
|
||||
if (aprsSymbolTable.isEmpty()){
|
||||
preferences.putString(PREF_APRS_SYMBOL_TABLE, APRS_SYMBOL_TABLE);
|
||||
|
|
@ -579,6 +614,40 @@ void setup(){
|
|||
}
|
||||
fix_beacon_interval = preferences.getInt(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET) * 1000;
|
||||
|
||||
// + SMART BEACONING
|
||||
|
||||
if (!preferences.getBool(PREF_APRS_SB_MIN_INTERVAL_PRESET_INIT)){
|
||||
preferences.putBool(PREF_APRS_SB_MIN_INTERVAL_PRESET_INIT, true);
|
||||
preferences.putInt(PREF_APRS_SB_MIN_INTERVAL_PRESET, sb_min_interval/1000);
|
||||
}
|
||||
sb_min_interval = preferences.getInt(PREF_APRS_SB_MIN_INTERVAL_PRESET) * 1000;
|
||||
|
||||
if (!preferences.getBool(PREF_APRS_SB_MAX_INTERVAL_PRESET_INIT)){
|
||||
preferences.putBool(PREF_APRS_SB_MAX_INTERVAL_PRESET_INIT, true);
|
||||
preferences.putInt(PREF_APRS_SB_MAX_INTERVAL_PRESET, sb_max_interval/1000);
|
||||
}
|
||||
sb_max_interval = preferences.getInt(PREF_APRS_SB_MAX_INTERVAL_PRESET) * 1000;
|
||||
|
||||
|
||||
if (!preferences.getBool(PREF_APRS_SB_MIN_SPEED_PRESET_INIT)){
|
||||
preferences.putBool(PREF_APRS_SB_MIN_SPEED_PRESET_INIT, true);
|
||||
preferences.putInt(PREF_APRS_SB_MIN_SPEED_PRESET, sb_min_speed);
|
||||
}
|
||||
sb_min_speed = preferences.getInt(PREF_APRS_SB_MIN_SPEED_PRESET);
|
||||
|
||||
if (!preferences.getBool(PREF_APRS_SB_MAX_SPEED_PRESET_INIT)){
|
||||
preferences.putBool(PREF_APRS_SB_MAX_SPEED_PRESET_INIT, true);
|
||||
preferences.putInt(PREF_APRS_SB_MAX_SPEED_PRESET, sb_max_speed);
|
||||
}
|
||||
sb_max_speed = preferences.getInt(PREF_APRS_SB_MAX_SPEED_PRESET);
|
||||
|
||||
if (!preferences.getBool(PREF_APRS_SB_ANGLE_PRESET_INIT)){
|
||||
preferences.putBool(PREF_APRS_SB_ANGLE_PRESET_INIT, true);
|
||||
preferences.putDouble(PREF_APRS_SB_ANGLE_PRESET, sb_angle);
|
||||
}
|
||||
sb_angle = preferences.getDouble(PREF_APRS_SB_ANGLE_PRESET);
|
||||
//
|
||||
|
||||
if (!preferences.getBool(PREF_DEV_SHOW_RX_TIME_INIT)){
|
||||
preferences.putBool(PREF_DEV_SHOW_RX_TIME_INIT, true);
|
||||
preferences.putInt(PREF_DEV_SHOW_RX_TIME, showRXTime/1000);
|
||||
|
|
@ -636,7 +705,7 @@ void setup(){
|
|||
pinMode(BUTTON, INPUT_PULLUP);
|
||||
#endif
|
||||
digitalWrite(TXLED, LOW); // turn blue LED off
|
||||
Serial.begin(115200);
|
||||
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
|
||||
#ifdef T_BEAM_V1_0
|
||||
|
|
@ -644,7 +713,11 @@ void setup(){
|
|||
}
|
||||
axp.setLowTemp(0xFF); //SP6VWX Set low charging temperature
|
||||
axp.setPowerOutPut(AXP192_LDO2, AXP202_ON); // LoRa
|
||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // switch on GPS
|
||||
if (gps_state){
|
||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // switch on GPS
|
||||
} else {
|
||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF); // switch off GPS
|
||||
}
|
||||
axp.setPowerOutPut(AXP192_DCDC2, AXP202_ON);
|
||||
axp.setPowerOutPut(AXP192_EXTEN, AXP202_ON);
|
||||
axp.setDCDC1Voltage(3300);
|
||||
|
|
@ -694,8 +767,8 @@ void setup(){
|
|||
for(;;); // Don't proceed, loop forever
|
||||
}
|
||||
|
||||
if (max_time_to_nextTX < nextTX){
|
||||
max_time_to_nextTX=nextTX;
|
||||
if (sb_max_interval < nextTX){
|
||||
sb_max_interval=nextTX;
|
||||
}
|
||||
writedisplaytext("LoRa-APRS","","Init:","RF95 OK!","","");
|
||||
writedisplaytext(" "+Tcall,"","Init:","Waiting for GPS","","");
|
||||
|
|
@ -707,12 +780,16 @@ void setup(){
|
|||
#endif
|
||||
batt_read();
|
||||
writedisplaytext("LoRa-APRS","","Init:","ADC OK!","BAT: "+String(BattVolts,1),"");
|
||||
#ifdef SPEED_1200
|
||||
|
||||
if(lora_speed==1200)
|
||||
rf95.setModemConfig(BG_RF95::Bw125Cr47Sf512);
|
||||
#else
|
||||
else
|
||||
rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096);
|
||||
#endif
|
||||
rf95.setFrequency(433.775);
|
||||
|
||||
Serial.printf("LoRa Speed:\t%d\n", lora_speed);
|
||||
|
||||
rf95.setFrequency(lora_freq);
|
||||
Serial.printf("LoRa FREQ:\t%f\n", lora_freq);
|
||||
rf95.setTxPower(txPower);
|
||||
delay(250);
|
||||
#ifdef KISS_PROTOCOL
|
||||
|
|
@ -833,7 +910,7 @@ void loop() {
|
|||
if (xQueueReceive(tncToSendQueue, &TNC2DataFrame, (1 / portTICK_PERIOD_MS)) == pdPASS) {
|
||||
writedisplaytext("((KISSTX))","","","","","");
|
||||
time_to_refresh = millis() + showRXTime;
|
||||
loraSend(txPower, TXFREQ, *TNC2DataFrame);
|
||||
loraSend(txPower, lora_freq, *TNC2DataFrame);
|
||||
delete TNC2DataFrame;
|
||||
}
|
||||
}
|
||||
|
|
@ -883,9 +960,9 @@ void loop() {
|
|||
point_avg_speed=0;
|
||||
}
|
||||
average_speed_final = (average_speed[0]+average_speed[1]+average_speed[2]+average_speed[3]+average_speed[4])/5;
|
||||
nextTX = (max_time_to_nextTX-min_time_to_nextTX)/(max_speed-min_speed)*(max_speed-average_speed_final)+min_time_to_nextTX;
|
||||
if (nextTX < min_time_to_nextTX) {nextTX=min_time_to_nextTX;}
|
||||
if (nextTX > max_time_to_nextTX) {nextTX=max_time_to_nextTX;}
|
||||
nextTX = (sb_max_interval-sb_min_interval)/(sb_max_speed-sb_min_speed)*(sb_max_speed-average_speed_final)+sb_min_interval;
|
||||
if (nextTX < sb_min_interval) {nextTX=sb_min_interval;}
|
||||
if (nextTX > sb_max_interval) {nextTX=sb_max_interval;}
|
||||
average_course[point_avg_course] = gps.course.deg(); // calculate smart beaconing course
|
||||
++point_avg_course;
|
||||
if (point_avg_course>(ANGLE_AVGS-1)) {
|
||||
|
|
@ -900,25 +977,24 @@ void loop() {
|
|||
if (new_course < 0) {
|
||||
new_course=360+new_course;
|
||||
}
|
||||
if ((old_course < ANGLE) && (new_course > (360-ANGLE))) {
|
||||
if (abs(new_course-old_course-360)>=ANGLE) {
|
||||
nextTX = 0;
|
||||
// lastTX = min_time_to_nextTX
|
||||
if ((old_course < sb_angle) && (new_course > (360-sb_angle))) {
|
||||
if (abs(new_course-old_course-360)>=sb_angle) {
|
||||
nextTX = 1; // give one second for turn to finish and then TX
|
||||
}
|
||||
} else {
|
||||
if ((old_course > (360-ANGLE)) && (new_course < ANGLE)) {
|
||||
if (abs(new_course-old_course+360)>=ANGLE) {
|
||||
nextTX = 0;
|
||||
if ((old_course > (360-sb_angle)) && (new_course < sb_angle)) {
|
||||
if (abs(new_course-old_course+360)>=sb_angle) {
|
||||
nextTX = 1;
|
||||
}
|
||||
} else {
|
||||
if (abs(new_course-old_course)>=ANGLE) {
|
||||
nextTX = 0;
|
||||
if (abs(new_course-old_course)>=sb_angle) {
|
||||
nextTX = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
old_course = new_course;
|
||||
}
|
||||
if ((millis()<max_time_to_nextTX)&&(lastTX == 0)) {
|
||||
if ((millis()<sb_max_interval)&&(lastTX == 0)) {
|
||||
nextTX = 0;
|
||||
}
|
||||
if ( (lastTX+nextTX) <= millis() ) {
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ String jsonLineFromPreferenceBool(const char *preferenceName, bool last=false){
|
|||
String jsonLineFromPreferenceInt(const char *preferenceName, bool last=false){
|
||||
return String("\"") + preferenceName + "\":" + (preferences.getInt(preferenceName)) + (last ? + R"()" : + R"(,)");
|
||||
}
|
||||
String jsonLineFromPreferenceDouble(const char *preferenceName, bool last=false){
|
||||
return String("\"") + preferenceName + "\":" + String(preferences.getDouble(preferenceName),3) + (last ? + R"()" : + R"(,)");
|
||||
}
|
||||
String jsonLineFromString(const char *name, const char *value, bool last=false){
|
||||
return String("\"") + name + "\":\"" + jsonEscape(value) + "\"" + (last ? + R"()" : + R"(,)");
|
||||
}
|
||||
|
|
@ -149,6 +152,8 @@ void handle_Cfg() {
|
|||
String jsonData = "{";
|
||||
jsonData += String("\"") + PREF_WIFI_PASSWORD + "\": \"" + jsonEscape((preferences.getString(PREF_WIFI_PASSWORD).isEmpty() ? String("") : "*")) + R"(",)";
|
||||
jsonData += jsonLineFromPreferenceString(PREF_WIFI_SSID);
|
||||
jsonData += jsonLineFromPreferenceDouble(PREF_LORA_FREQ_PRESET);
|
||||
jsonData += jsonLineFromPreferenceInt(PREF_LORA_SPEED_PRESET);
|
||||
jsonData += jsonLineFromPreferenceString(PREF_APRS_CALLSIGN);
|
||||
jsonData += jsonLineFromPreferenceString(PREF_APRS_RELAY_PATH);
|
||||
jsonData += jsonLineFromPreferenceString(PREF_APRS_SYMBOL_TABLE);
|
||||
|
|
@ -157,6 +162,11 @@ void handle_Cfg() {
|
|||
jsonData += jsonLineFromPreferenceString(PREF_APRS_LATITUDE_PRESET);
|
||||
jsonData += jsonLineFromPreferenceString(PREF_APRS_LONGITUDE_PRESET);
|
||||
jsonData += jsonLineFromPreferenceInt(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET);
|
||||
jsonData += jsonLineFromPreferenceInt(PREF_APRS_SB_MIN_INTERVAL_PRESET);
|
||||
jsonData += jsonLineFromPreferenceInt(PREF_APRS_SB_MAX_INTERVAL_PRESET);
|
||||
jsonData += jsonLineFromPreferenceInt(PREF_APRS_SB_MIN_SPEED_PRESET);
|
||||
jsonData += jsonLineFromPreferenceInt(PREF_APRS_SB_MAX_SPEED_PRESET);
|
||||
jsonData += jsonLineFromPreferenceDouble(PREF_APRS_SB_ANGLE_PRESET);
|
||||
jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_BATTERY);
|
||||
jsonData += jsonLineFromPreferenceBool(PREF_APRS_FIXED_BEACON_PRESET);
|
||||
jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_ALTITUDE);
|
||||
|
|
@ -195,6 +205,15 @@ void handle_ReceivedList() {
|
|||
}
|
||||
|
||||
void handle_SaveAPRSCfg() {
|
||||
// LoRa settings
|
||||
if (server.hasArg(PREF_LORA_FREQ_PRESET)){
|
||||
preferences.putDouble(PREF_LORA_FREQ_PRESET, server.arg(PREF_LORA_FREQ_PRESET).toDouble());
|
||||
Serial.printf("FREQ saved:\t%f\n", server.arg(PREF_LORA_FREQ_PRESET).toDouble());
|
||||
}
|
||||
if (server.hasArg(PREF_LORA_SPEED_PRESET)){
|
||||
preferences.putInt(PREF_LORA_SPEED_PRESET, server.arg(PREF_LORA_SPEED_PRESET).toInt());
|
||||
}
|
||||
// APRS station settings
|
||||
if (server.hasArg(PREF_APRS_CALLSIGN) && !server.arg(PREF_APRS_CALLSIGN).isEmpty()){
|
||||
preferences.putString(PREF_APRS_CALLSIGN, server.arg(PREF_APRS_CALLSIGN));
|
||||
}
|
||||
|
|
@ -213,11 +232,28 @@ void handle_SaveAPRSCfg() {
|
|||
if (server.hasArg(PREF_APRS_LATITUDE_PRESET)){
|
||||
preferences.putString(PREF_APRS_LATITUDE_PRESET, server.arg(PREF_APRS_LATITUDE_PRESET));
|
||||
}
|
||||
if (server.hasArg(PREF_APRS_LONGITUDE_PRESET)){
|
||||
preferences.putString(PREF_APRS_LONGITUDE_PRESET, server.arg(PREF_APRS_LONGITUDE_PRESET));
|
||||
}
|
||||
|
||||
// Smart Beaconing settings
|
||||
if (server.hasArg(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET)){
|
||||
preferences.putInt(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET, server.arg(PREF_APRS_FIXED_BEACON_INTERVAL_PRESET).toInt());
|
||||
}
|
||||
if (server.hasArg(PREF_APRS_LONGITUDE_PRESET)){
|
||||
preferences.putString(PREF_APRS_LONGITUDE_PRESET, server.arg(PREF_APRS_LONGITUDE_PRESET));
|
||||
if (server.hasArg(PREF_APRS_SB_MIN_INTERVAL_PRESET)){
|
||||
preferences.putInt(PREF_APRS_SB_MIN_INTERVAL_PRESET, server.arg(PREF_APRS_SB_MIN_INTERVAL_PRESET).toInt());
|
||||
}
|
||||
if (server.hasArg(PREF_APRS_SB_MAX_INTERVAL_PRESET)){
|
||||
preferences.putInt(PREF_APRS_SB_MAX_INTERVAL_PRESET, server.arg(PREF_APRS_SB_MAX_INTERVAL_PRESET).toInt());
|
||||
}
|
||||
if (server.hasArg(PREF_APRS_SB_MIN_SPEED_PRESET)){
|
||||
preferences.putInt(PREF_APRS_SB_MIN_SPEED_PRESET, server.arg(PREF_APRS_SB_MIN_SPEED_PRESET).toInt());
|
||||
}
|
||||
if (server.hasArg(PREF_APRS_SB_MAX_SPEED_PRESET)){
|
||||
preferences.putInt(PREF_APRS_SB_MAX_SPEED_PRESET, server.arg(PREF_APRS_SB_MAX_SPEED_PRESET).toInt());
|
||||
}
|
||||
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));
|
||||
|
|
|
|||
Loading…
Reference in New Issue