add reboot to control buttons (#111)

pull/104/head^2
Michael Carter 2021-07-26 20:09:03 +01:00 zatwierdzone przez GitHub
rodzic 7f2b9ef611
commit 4dc3ea6974
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -783,23 +783,24 @@ const char *handleConfigPost(AsyncWebServerRequest *request) {
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)",
"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() {
char *ptr = message;
strcpy(ptr, HTMLHEAD); strcat(ptr, "</head>");
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, ctrlid[i]);
strcat(ptr, "\" value=\"");
strcat(ptr, ctrllabel[i]);
strcat(ptr, "\"></input>");
if (i == 3) {
if (i == 3 || i == 7 ) {
strcat(ptr, "<p></p>");
}
}
@ -847,6 +848,10 @@ const char *handleControlPost(AsyncWebServerRequest *request) {
Serial.println("equals wifi2");
button2.pressed = KP_LONG;
}
else if (param.equals("reboot")) {
Serial.println("equals reboot");
ESP.restart();
}
}
return "";
}