moving cconfig to www

pull/22/head
Rysiek Labus 2021-03-08 23:59:33 +01:00
rodzic deec9b55f2
commit 7afc4b56af
4 zmienionych plików z 41 dodań i 9 usunięć

Wyświetl plik

@ -64,7 +64,11 @@
<div>
<label for="aprs_alt">Show Altitude</label>
<input name="aprs_alt" id="aprs_alt" type="checkbox" value="1" title=" show altitude as frame part">
</div>
</div>
<div>
<label for="show_cmt">Show Comment</label>
<input name="show_cmt" id="show_cmt" type="checkbox" value="1" title=" show comment text">
</div>
<div>
<label for="aprs_comment">Comment</label>
<input class="u-full-width" type="text" minlength="0" maxlength="64" name="aprs_comment" id="aprs_comment" title=" personal comment">

Wyświetl plik

@ -37,8 +37,12 @@ static const char *const PREF_APRS_FIXED_BEACON_INTERVAL_PRESET = "aprs_fb_inter
static const char *const PREF_APRS_FIXED_BEACON_INTERVAL_PRESET_INIT = "aprs_fb_in_init";
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";
static const char *const PREF_APRS_SHOW_CMT_INIT = "show_cmt_init";
static const char *const PREF_DEV_BT_EN = "bt_enabled";
static const char *const PREF_DEV_BT_EN_INIT = "bt_enabled_init";
static const char *const PREF_DEV_OL_EN = "oled_enabled";
static const char *const PREF_DEV_OL_EN_INIT = "oled_enabled_init";
typedef struct {
String callsign;

Wyświetl plik

@ -67,6 +67,7 @@ boolean gps_state = true;
boolean key_up = true;
boolean t_lock = false;
boolean fixed_beacon_enabled = false;
boolean show_cmt = true;
#ifdef SHOW_ALT
boolean showAltitude = true;
#else
@ -82,6 +83,11 @@ boolean fixed_beacon_enabled = false;
#else
boolean enable_bluetooth = false;
#endif
#ifdef ENABLE_OLED
boolean enabled_oled = true;
#else
boolean enabled_oled = false;
#endif
// Variables and Constants
String loraReceivedFrameString = ""; //data on buff is copied to this string
@ -232,8 +238,10 @@ void prepareAPRSFrame(){
outString += aprsLonPreset;
outString += aprsSymbol;
}
outString += aprsComment;
if(show_cmt){
outString += aprsComment;
}
if (showBattery) {
outString += " Batt=";
outString += String(BattVolts, 2);
@ -476,11 +484,23 @@ void setup(){
}
if (!preferences.getBool(PREF_APRS_SHOW_CMT_INIT)){
preferences.putBool(PREF_APRS_SHOW_CMT_INIT, true);
preferences.putBool(PREF_APRS_SHOW_CMT, show_cmt);
}
show_cmt = preferences.getBool(PREF_APRS_SHOW_CMT);
if (!preferences.getBool(PREF_DEV_BT_EN_INIT)){
preferences.putBool(PREF_DEV_BT_EN_INIT, true);
preferences.putBool(PREF_DEV_BT_EN, enable_bluetooth);
}
enable_bluetooth = preferences.getBool(PREF_DEV_BT_EN);
enable_bluetooth = preferences.getBool(PREF_DEV_BT_EN);
if (!preferences.getBool(PREF_DEV_OL_EN_INIT)){
preferences.putBool(PREF_DEV_OL_EN_INIT, true);
preferences.putBool(PREF_DEV_OL_EN,enabled_oled);
}
enabled_oled = preferences.getBool(PREF_DEV_OL_EN);
#endif
for (int i=0;i<ANGLE_AVGS;i++) { // set average_course to "0"
@ -500,11 +520,6 @@ void setup(){
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // switch on GPS
axp.setPowerOutPut(AXP192_DCDC2, AXP202_ON);
axp.setPowerOutPut(AXP192_EXTEN, AXP202_ON);
#ifdef ENABLE_OLED
axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON); // enable oled
#else
axp.setPowerOutPut(AXP192_DCDC1, AXP202_OFF); // disable oled
#endif
axp.setDCDC1Voltage(3300);
// Enable ADC to measure battery current, USB voltage etc.
axp.adc1Enable(0xfe, true);
@ -591,6 +606,11 @@ void setup(){
digitalWrite(TXLED, HIGH);
#ifdef T_BEAM_V1_0
axp.setChgLEDMode(AXP20X_LED_OFF);
if (enabled_oled){
axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON); // enable oled
}else{
axp.setPowerOutPut(AXP192_DCDC1, AXP202_OFF); // disable oled
}
#endif
}

Wyświetl plik

@ -119,6 +119,8 @@ 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_DEV_OL_EN);
jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_CMT);
jsonData += jsonLineFromPreferenceBool(PREF_DEV_BT_EN);
jsonData += jsonLineFromString("FreeHeap", String(ESP.getFreeHeap()).c_str());
jsonData += jsonLineFromString("HeapSize", String(ESP.getHeapSize()).c_str());
@ -157,6 +159,7 @@ void handle_SaveAPRSCfg() {
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));
preferences.putBool(PREF_APRS_SHOW_CMT, server.hasArg(PREF_APRS_SHOW_CMT));
server.sendHeader("Location", "/");
server.send(302,"text/html", "");
@ -164,6 +167,7 @@ void handle_SaveAPRSCfg() {
void handle_saveDeviceCfg(){
preferences.putBool(PREF_DEV_BT_EN, server.hasArg(PREF_DEV_BT_EN));
preferences.putBool(PREF_DEV_OL_EN, server.hasArg(PREF_DEV_OL_EN));
server.sendHeader("Location", "/");
server.send(302,"text/html", "");