Browse Source

Переменные определили, теперь привязываем их куда нужно

pull/1/head
US1GHQ 3 months ago
parent
commit
d78bd2f502
  1. 7
      data_embed/index.html
  2. 2
      include/preference_storage.h
  3. 11
      src/TTGO_T-Beam_LoRa_APRS.ino
  4. 6
      src/taskWebServer.cpp

7
data_embed/index.html

@ -144,17 +144,18 @@
<div class="grid-container quarters">
<div>
<label for="aprs_freq">APRS FREQ MHz:</label>
<input class="u-full-width" type="number" min="0" step="0.001" name="aprs_freq" id="aprs_freq" title="APRS FREQ Default 433.775">
<input class="u-full-width" type="number" min="0" step="0.001" name="aprs_freq" id="aprs_freq" title="APRS FREQ Default: 433.775">
</div>
<div>
<label for="aprs_mode">APRS MODE:</label>
<select name="aprs_mode" id="aprs_mode" title="APRS MODE 1200 or 300">
<select name="aprs_mode" id="aprs_mode" title="APRS MODE 1200 or 300 Default: 300">
<option value="1200">1200</option>
<option value="300">300</option>
</select>
</div>
<div>
<label for="aprs_txpower">APRS TX POWER dBm:</label>
<input class="u-full-width" type="number" min="0" max="23" name="aprs_txpower" id="aprs_txpower" title="APRS TX POWER Default: 20">
</div>
<div>

2
include/preference_storage.h

@ -45,6 +45,8 @@ static const char *const PREF_APRS_FREQ = "aprs_freq"; //freq default: 433.775
static const char *const PREF_APRS_FREQ_INIT = "aprs_freq_i";
static const char *const PREF_APRS_MODE = "aprs_mode"; //300 or 1200b
static const char *const PREF_APRS_MODE_INIT = "aprs_mode_i";
static const char *const PREF_APRS_TXPOWER = "aprs_txpower"; //default 20dbm
static const char *const PREF_APRS_TXPOWER_INIT = "aprs_txpower_i";
//Other settings
static const char *const PREF_APRS_GPS_EN = "gps_enabled";

11
src/TTGO_T-Beam_LoRa_APRS.ino

@ -115,6 +115,7 @@ String aprsLatPreset = LATIDUDE_PRESET;
String aprsLonPreset = LONGITUDE_PRESET;
String aprsFreq = "433.775";
String aprsMode = "1200";
String txPwr = "20";
boolean gps_state = true;
boolean key_up = true;
@ -664,12 +665,18 @@ void setup(){
preferences.putString(PREF_APRS_FREQ, aprsFreq);
}
aprsFreq = preferences.getString(PREF_APRS_FREQ);
if (!preferences.getBool(PREF_APRS_MODE_INIT)){
preferences.putBool(PREF_APRS_MODE_INIT, true);
preferences.putString(PREF_APRS_MODE, aprsMode);
}
aprsMode = preferences.getString(PREF_APRS_MODE);
if (!preferences.getBool(PREF_APRS_TXPOWER_INIT)){
preferences.putBool(PREF_APRS_TXPOWER_INIT, true);
preferences.putString(PREF_APRS_TXPOWER, txPwr);
}
txPwr = preferences.getString(PREF_APRS_TXPOWER);
//End set parameters
if (!preferences.getBool(PREF_DEV_SHOW_RX_TIME_INIT)){
preferences.putBool(PREF_DEV_SHOW_RX_TIME_INIT, true);
@ -819,7 +826,7 @@ void setup(){
#else
rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096);
#endif
rf95.setFrequency(433.775);
rf95.setFrequency(433.767);
rf95.setTxPower(txPower);
delay(250);
#ifdef KISS_PROTOCOL

6
src/taskWebServer.cpp

@ -148,6 +148,7 @@ void handle_Cfg() {
jsonData += jsonLineFromPreferenceBool(PREF_APRS_GPS_EN);
jsonData += jsonLineFromPreferenceString(PREF_APRS_FREQ);
jsonData += jsonLineFromPreferenceString(PREF_APRS_MODE);
jsonData += jsonLineFromPreferenceString(PREF_APRS_TXPOWER);
jsonData += jsonLineFromPreferenceBool(PREF_DEV_OL_EN);
jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_CMT);
jsonData += jsonLineFromPreferenceBool(PREF_DEV_BT_EN);
@ -243,7 +244,10 @@ void handle_saveDeviceCfg(){
}
if (server.hasArg(PREF_APRS_MODE)){
preferences.putString(PREF_APRS_MODE, server.arg(PREF_APRS_MODE));
}
}
if (server.hasArg(PREF_APRS_TXPOWER)){
preferences.putString(PREF_APRS_TXPOWER, server.arg(PREF_APRS_TXPOWER));
}
server.sendHeader("Location", "/");
server.send(302,"text/html", "");
}

Loading…
Cancel
Save