add reboot to control buttons

pull/111/head
michael carter 2021-07-26 17:34:09 +01:00
rodzic 175d196393
commit 13787e553c
1 zmienionych plików z 13 dodań i 8 usunięć

Wyświetl plik

@ -418,15 +418,15 @@ const char *createSondeHubMap() {
if (!sonde.config.sondehub.active) { if (!sonde.config.sondehub.active) {
strcat(ptr, "<div>NOTE: SondeHub uploading is not enabled, detected sonde will not be visable on map</div>"); strcat(ptr, "<div>NOTE: SondeHub uploading is not enabled, detected sonde will not be visable on map</div>");
if ((*s->ser == 0) && (strcmp(sonde.config.sondehub.lat,"null"))) { if ((*s->ser == 0) && (strcmp(sonde.config.sondehub.lat,"null"))) {
sprintf(ptr + strlen(ptr), "<iframe src=\"https://tracker.sondehub.org/&mc=%s,%s\" style=\"border:1px solid #00A3D3;border-radius:20px;height:95vh\"></iframe>", sonde.config.sondehub.lat, sonde.config.sondehub.lon); sprintf(ptr + strlen(ptr), "<iframe src=\"https://sondehub.org/#!mc=%s,%s&mz=8\" style=\"border:1px solid #00A3D3;border-radius:20px;height:95vh\"></iframe>", sonde.config.sondehub.lat, sonde.config.sondehub.lon);
} else { } else {
sprintf(ptr + strlen(ptr), "<iframe src=\"https://tracker.sondehub.org/%s\" style=\"border:1px solid #00A3D3;border-radius:20px;height:95vh\"></iframe>", s-> ser); sprintf(ptr + strlen(ptr), "<iframe src=\"https://sondehub.org/%s\" style=\"border:1px solid #00A3D3;border-radius:20px;height:95vh\"></iframe>", s-> ser);
} }
} else { } else {
if ((*s->ser == 0) && (strcmp(sonde.config.sondehub.lat,"null"))) { if ((*s->ser == 0) && (strcmp(sonde.config.sondehub.lat,"null"))) {
sprintf(ptr, "<iframe src=\"https://tracker.sondehub.org/&mc=%s,%s\" style=\"border:1px solid #00A3D3;border-radius:20px;height:98vh;width:100%%\"></iframe>", sonde.config.sondehub.lat, sonde.config.sondehub.lon); sprintf(ptr, "<iframe src=\"https://sondehub.org/#!mc=%s,%s&mz=8\" style=\"border:1px solid #00A3D3;border-radius:20px;height:98vh;width:100%%\"></iframe>", sonde.config.sondehub.lat, sonde.config.sondehub.lon);
} else { } else {
sprintf(ptr, "<iframe src=\"https://tracker.sondehub.org/%s\" style=\"border:1px solid #00A3D3;border-radius:20px;height:98vh;width:100%%\"></iframe>", s-> ser); sprintf(ptr, "<iframe src=\"https://sondehub.org/%s\" style=\"border:1px solid #00A3D3;border-radius:20px;height:98vh;width:100%%\"></iframe>", s-> ser);
} }
} }
HTMLBODYEND(ptr); HTMLBODYEND(ptr);
@ -783,23 +783,24 @@ const char *handleConfigPost(AsyncWebServerRequest *request) {
return ""; return "";
} }
const char *ctrlid[] = {"rx", "scan", "spec", "wifi", "rx2", "scan2", "spec2", "wifi2"}; const char *ctrlid[] = {"rx", "scan", "spec", "wifi", "rx2", "scan2", "spec2", "wifi2", "reboot"};
const char *ctrllabel[] = {"Receiver/next freq. (short keypress)", "Scanner (double keypress)", "Spectrum (medium keypress)", "WiFi (long keypress)", const char *ctrllabel[] = {"Receiver/next freq. (short keypress)", "Scanner (double keypress)", "Spectrum (medium keypress)", "WiFi (long keypress)",
"Button 2/next screen (short keypress)", "Button 2 (double keypress)", "Button 2 (medium keypress)", "Button 2 (long keypress)" "Button 2/next screen (short keypress)", "Button 2 (double keypress)", "Button 2 (medium keypress)", "Button 2 (long keypress)",
"Reboot"
}; };
const char *createControlForm() { const char *createControlForm() {
char *ptr = message; char *ptr = message;
strcpy(ptr, HTMLHEAD); strcat(ptr, "</head>"); strcpy(ptr, HTMLHEAD); strcat(ptr, "</head>");
HTMLBODY(ptr, "control.html"); HTMLBODY(ptr, "control.html");
for (int i = 0; i < 8; i++) { for (int i = 0; i < 9; i++) {
strcat(ptr, "<input class=\"ctlbtn\" type=\"submit\" name=\""); strcat(ptr, "<input class=\"ctlbtn\" type=\"submit\" name=\"");
strcat(ptr, ctrlid[i]); strcat(ptr, ctrlid[i]);
strcat(ptr, "\" value=\""); strcat(ptr, "\" value=\"");
strcat(ptr, ctrllabel[i]); strcat(ptr, ctrllabel[i]);
strcat(ptr, "\"></input>"); strcat(ptr, "\"></input>");
if (i == 3) { if (i == 3 || i == 7 ) {
strcat(ptr, "<p></p>"); strcat(ptr, "<p></p>");
} }
} }
@ -847,6 +848,10 @@ const char *handleControlPost(AsyncWebServerRequest *request) {
Serial.println("equals wifi2"); Serial.println("equals wifi2");
button2.pressed = KP_LONG; button2.pressed = KP_LONG;
} }
else if (param.equals("reboot")) {
Serial.println("equals reboot");
ESP.restart();
}
} }
return ""; return "";
} }