Browse Source

Наброски для изменения частоты и режима (300/1200) без перепрошивки

master
US1GHQ 3 months ago
parent
commit
ca605f9c0e
  1. 6
      include/preference_storage.h
  2. 5
      src/taskWebServer.cpp

6
include/preference_storage.h

@ -8,6 +8,11 @@
extern Preferences preferences;
// MAX 15 chars for preferenece key!!!
// FREQ AND MODE SET
static const char *const PREF_APRS_MODE = "aprs_mode"; //300 or 1200b
static const char *const PREF_APRS_FREQ = "aprs_freq"; //freq default: 433.775
//MAIN SETTINGS
static const char *const PREF_WIFI_SSID = "wifi_ssid";
static const char *const PREF_WIFI_PASSWORD = "wifi_password";
static const char *const PREF_APRS_CALLSIGN = "aprs_callsign";
@ -29,6 +34,7 @@ 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";

5
src/taskWebServer.cpp

@ -128,6 +128,8 @@ void handle_Restore() {
void handle_Cfg() {
String jsonData = "{";
jsonData += jsonLineFromPreferenceString(PREF_APRS_MODE);
jsonData += jsonLineFromPreferenceString(PREF_APRS_FREQ);
jsonData += String("\"") + PREF_WIFI_PASSWORD + "\": \"" + jsonEscape((preferences.getString(PREF_WIFI_PASSWORD).isEmpty() ? String("") : "*")) + R"(",)";
jsonData += jsonLineFromPreferenceString(PREF_WIFI_SSID);
jsonData += jsonLineFromPreferenceString(PREF_APRS_CALLSIGN);
@ -178,6 +180,9 @@ void handle_ReceivedList() {
}
void handle_SaveAPRSCfg() {
if (server.hasArg(PREF_APRS_MODE) && !server.arg(PREF_APRS_MODE).isEmpty()){
preferences.putString(PREF_APRS_MODE, server.arg(PREF_APRS_MODE));
}
if (server.hasArg(PREF_APRS_CALLSIGN) && !server.arg(PREF_APRS_CALLSIGN).isEmpty()){
preferences.putString(PREF_APRS_CALLSIGN, server.arg(PREF_APRS_CALLSIGN));
}

Loading…
Cancel
Save