Reconsidered the logic

pull/123/head
Hieromon Ikasamo 6 years ago
parent 379298091f
commit d2eac80930
  1. 41
      src/AutoConnectUpdate.cpp

@ -525,30 +525,29 @@ void AutoConnectUpdateAct::_progress(void) {
switch (_webServer->method()) { switch (_webServer->method()) {
case HTTP_POST: case HTTP_POST:
if (_webServer->hasArg(reqOperation)) { reqOperand = _webServer->arg(reqOperation);
reqOperand = _webServer->arg(reqOperation); switch (_status) {
case UPDATE_IDLE:
if (reqOperand == String(UPDATE_NOTIFY_START)) { if (reqOperand == String(UPDATE_NOTIFY_START)) {
if (_status == UPDATE_IDLE) { httpCode = 200;
httpCode = 200; _status = UPDATE_START;
_status = UPDATE_START;
}
else {
payload = String(FPSTR(reply_msg_seq));
httpCode = 500;
}
} }
else if (reqOperand == String(UPDATE_NOTIFY_REBOOT)) { else {
if (_status == UPDATE_SUCCESS) { payload = String(FPSTR(reply_msg_seq));
_status = UPDATE_RESET; httpCode = 500;
httpCode = 200;
}
else {
payload = String(FPSTR(reply_msg_seq));
httpCode = 500;
}
} }
} break;
else { case UPDATE_SUCCESS:
if (reqOperand == String(UPDATE_NOTIFY_REBOOT)) {
_status = UPDATE_RESET;
httpCode = 200;
}
else {
payload = String(FPSTR(reply_msg_seq));
httpCode = 500;
}
break;
default:
payload = String(FPSTR(reply_msg_op)); payload = String(FPSTR(reply_msg_op));
httpCode = 500; httpCode = 500;
} }

Loading…
Cancel
Save