Browse Source

Changed 'reset' to 'reboot' for user interaction (#315)

fastled
Xose Pérez 7 years ago
parent
commit
569b937d6c
8 changed files with 3079 additions and 3079 deletions
  1. +1
    -1
      code/espurna/api.ino
  2. +8
    -8
      code/espurna/config/general.h
  3. BIN
      code/espurna/data/index.html.gz
  4. +3048
    -3048
      code/espurna/static/index.html.gz.h
  5. +1
    -1
      code/espurna/ws.ino
  6. +1
    -1
      code/html/custom.css
  7. +12
    -12
      code/html/custom.js
  8. +8
    -8
      code/html/index.html

+ 1
- 1
code/espurna/api.ino View File

@ -149,7 +149,7 @@ void _onRPC(AsyncWebServerRequest *request) {
String action = p->value(); String action = p->value();
DEBUG_MSG_P(PSTR("[RPC] Action: %s\n"), action.c_str()); DEBUG_MSG_P(PSTR("[RPC] Action: %s\n"), action.c_str());
if (action.equals("reset")) {
if (action.equals("reboot")) {
response = 200; response = 200;
deferredReset(100, CUSTOM_RESET_RPC); deferredReset(100, CUSTOM_RESET_RPC);
} }


+ 8
- 8
code/espurna/config/general.h View File

@ -148,13 +148,13 @@
#include <pgmspace.h> #include <pgmspace.h>
PROGMEM const char custom_reset_hardware[] = "Hardware button"; PROGMEM const char custom_reset_hardware[] = "Hardware button";
PROGMEM const char custom_reset_web[] = "Reset from web interface";
PROGMEM const char custom_reset_terminal[] = "Reset from terminal";
PROGMEM const char custom_reset_mqtt[] = "Reset from MQTT";
PROGMEM const char custom_reset_rpc[] = "Reset from RPC";
PROGMEM const char custom_reset_ota[] = "Reset after successful OTA update";
PROGMEM const char custom_reset_nofuss[] = "Reset after successful NoFUSS update";
PROGMEM const char custom_reset_upgrade[] = "Reset after successful web update";
PROGMEM const char custom_reset_web[] = "Reboot from web interface";
PROGMEM const char custom_reset_terminal[] = "Reboot from terminal";
PROGMEM const char custom_reset_mqtt[] = "Reboot from MQTT";
PROGMEM const char custom_reset_rpc[] = "Reboot from RPC";
PROGMEM const char custom_reset_ota[] = "Reboot after successful OTA update";
PROGMEM const char custom_reset_nofuss[] = "Reboot after successful NoFUSS update";
PROGMEM const char custom_reset_upgrade[] = "Reboot after successful web update";
PROGMEM const char custom_reset_factory[] = "Factory reset"; PROGMEM const char custom_reset_factory[] = "Factory reset";
PROGMEM const char* const custom_reset_string[] = { PROGMEM const char* const custom_reset_string[] = {
custom_reset_hardware, custom_reset_web, custom_reset_terminal, custom_reset_hardware, custom_reset_web, custom_reset_terminal,
@ -471,7 +471,7 @@ PROGMEM const char* const custom_reset_string[] = {
#define MQTT_STATUS_ONLINE "1" // Value for the device ON message #define MQTT_STATUS_ONLINE "1" // Value for the device ON message
#define MQTT_STATUS_OFFLINE "0" // Value for the device OFF message (will) #define MQTT_STATUS_OFFLINE "0" // Value for the device OFF message (will)
#define MQTT_ACTION_RESET "reset" // RESET MQTT topic particle
#define MQTT_ACTION_RESET "reboot" // RESET MQTT topic particle
// Internal MQTT events (do not change) // Internal MQTT events (do not change)
#define MQTT_CONNECT_EVENT 0 #define MQTT_CONNECT_EVENT 0


BIN
code/espurna/data/index.html.gz View File


+ 3048
- 3048
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 1
- 1
code/espurna/ws.ino View File

@ -63,7 +63,7 @@ void _wsParse(AsyncWebSocketClient *client, uint8_t * payload, size_t length) {
(_ws_on_action_callbacks[i])(action.c_str(), data); (_ws_on_action_callbacks[i])(action.c_str(), data);
} }
if (action.equals("reset")) deferredReset(100, CUSTOM_RESET_WEB);
if (action.equals("reboot")) deferredReset(100, CUSTOM_RESET_WEB);
if (action.equals("reconnect")) _web_defer.once_ms(100, wifiDisconnect); if (action.equals("reconnect")) _web_defer.once_ms(100, wifiDisconnect);
if (action.equals("restore")) { if (action.equals("restore")) {


+ 1
- 1
code/html/custom.css View File

@ -45,7 +45,7 @@
.button-update { .button-update {
background: #1f8dd6; background: #1f8dd6;
} }
.button-reset,
.button-reboot,
.button-reconnect, .button-reconnect,
.button-ha-del, .button-ha-del,
.button-rfb-forget { .button-rfb-forget {


+ 12
- 12
code/html/custom.js View File

@ -5,7 +5,7 @@ var messages = [];
var webhost; var webhost;
var numChanged = 0; var numChanged = 0;
var numReset = 0;
var numReboot = 0;
var numReconnect = 0; var numReconnect = 0;
var numReload = 0; var numReload = 0;
@ -137,11 +137,11 @@ function doUpdate() {
numChanged = 0; numChanged = 0;
setTimeout(function() { setTimeout(function() {
if (numReset > 0) {
var response = window.confirm("You have to reset the board for the changes to take effect, do you want to do it now?");
if (response == true) doReset(false);
if (numReboot > 0) {
var response = window.confirm("You have to reboot the board for the changes to take effect, do you want to do it now?");
if (response == true) doReboot(false);
} else if (numReconnect > 0) { } else if (numReconnect > 0) {
var response = window.confirm("You have to reset the wifi connection for the changes to take effect, do you want to do it now?");
var response = window.confirm("You have to reconnect to the WiFi for the changes to take effect, do you want to do it now?");
if (response == true) doReconnect(false); if (response == true) doReconnect(false);
} else if (numReload > 0) { } else if (numReload > 0) {
var response = window.confirm("You have to reload the page to see the latest changes, do you want to do it now?"); var response = window.confirm("You have to reload the page to see the latest changes, do you want to do it now?");
@ -225,7 +225,7 @@ function doUpdatePassword() {
return false; return false;
} }
function doReset(ask) {
function doReboot(ask) {
ask = (typeof ask == 'undefined') ? true : ask; ask = (typeof ask == 'undefined') ? true : ask;
@ -235,11 +235,11 @@ function doReset(ask) {
} }
if (ask) { if (ask) {
var response = window.confirm("Are you sure you want to reset the device?");
var response = window.confirm("Are you sure you want to reboot the device?");
if (response == false) return false; if (response == false) return false;
} }
websock.send(JSON.stringify({'action': 'reset'}));
websock.send(JSON.stringify({'action': 'reboot'}));
doReload(5000); doReload(5000);
return false; return false;
@ -845,7 +845,7 @@ function hasChanged() {
if (hasChanged == 0) { if (hasChanged == 0) {
++numChanged; ++numChanged;
if (action == "reconnect") ++numReconnect; if (action == "reconnect") ++numReconnect;
if (action == "reset") ++numReset;
if (action == "reboot") ++numReboot;
if (action == "reload") ++numReload; if (action == "reload") ++numReload;
$(this).attr("hasChanged", 1); $(this).attr("hasChanged", 1);
} }
@ -853,7 +853,7 @@ function hasChanged() {
if (hasChanged == 1) { if (hasChanged == 1) {
--numChanged; --numChanged;
if (action == "reconnect") --numReconnect; if (action == "reconnect") --numReconnect;
if (action == "reset") --numReset;
if (action == "reboot") --numReboot;
if (action == "reload") --numReload; if (action == "reload") --numReload;
$(this).attr("hasChanged", 0); $(this).attr("hasChanged", 0);
} }
@ -868,7 +868,7 @@ function resetOriginals() {
$("select").each(function() { $("select").each(function() {
$(this).attr("original", $(this).val()); $(this).attr("original", $(this).val());
}) })
numReset = numReconnect = numReload = 0;
numReboot = numReconnect = numReload = 0;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -916,7 +916,7 @@ function init() {
$(".button-update").on('click', doUpdate); $(".button-update").on('click', doUpdate);
$(".button-update-password").on('click', doUpdatePassword); $(".button-update-password").on('click', doUpdatePassword);
$(".button-reset").on('click', doReset);
$(".button-reboot").on('click', doReboot);
$(".button-reconnect").on('click', doReconnect); $(".button-reconnect").on('click', doReconnect);
$(".button-settings-backup").on('click', doBackup); $(".button-settings-backup").on('click', doBackup);
$(".button-settings-restore").on('click', doRestore); $(".button-settings-restore").on('click', doRestore);


+ 8
- 8
code/html/index.html View File

@ -131,7 +131,7 @@
<div class="main-buttons"> <div class="main-buttons">
<button class="pure-button button-update">Save</button> <button class="pure-button button-update">Save</button>
<button class="pure-button button-reconnect">Reconnect</button> <button class="pure-button button-reconnect">Reconnect</button>
<button class="pure-button button-reset">Reset</button>
<button class="pure-button button-reboot">Reboot</button>
</div> </div>
<div class="footer"> <div class="footer">
@ -304,20 +304,20 @@
<div class="pure-g"> <div class="pure-g">
<label class="pure-u-1 pure-u-md-1-4">Hostname</label> <label class="pure-u-1 pure-u-md-1-4">Hostname</label>
<input name="hostname" class="pure-u-1 pure-u-md-3-4" type="text" action="reset" tabindex="1" />
<input name="hostname" class="pure-u-1 pure-u-md-3-4" type="text" action="reboot" tabindex="1" />
<div class="pure-u-0 pure-u-md-1-4">&nbsp;</div> <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
<div class="pure-u-1 pure-u-md-3-4 hint">This name will identify this device in your network (http://&lt;hostname&gt;.local). For this setting to take effect you should restart the wifi interface clicking the "Reconnect" button.</div> <div class="pure-u-1 pure-u-md-3-4 hint">This name will identify this device in your network (http://&lt;hostname&gt;.local). For this setting to take effect you should restart the wifi interface clicking the "Reconnect" button.</div>
</div> </div>
<div class="pure-g"> <div class="pure-g">
<label class="pure-u-1 pure-u-md-1-4">Double click delay</label> <label class="pure-u-1 pure-u-md-1-4">Double click delay</label>
<input name="btnDelay" class="pure-u-1 pure-u-md-3-4" type="number" action="reset" min="0" step="100" max="1000" tabindex="6" />
<input name="btnDelay" class="pure-u-1 pure-u-md-3-4" type="number" action="reboot" min="0" step="100" max="1000" tabindex="6" />
<div class="pure-u-0 pure-u-md-1-4">&nbsp;</div> <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
<div class="pure-u-1 pure-u-md-3-4 hint">Delay in milliseconds to detect a double click (from 0 to 1000ms).<br /> <div class="pure-u-1 pure-u-md-3-4 hint">Delay in milliseconds to detect a double click (from 0 to 1000ms).<br />
The lower this number the faster the device will respond to button clicks but the harder it will be to get a double click. The lower this number the faster the device will respond to button clicks but the harder it will be to get a double click.
Increase this number if you are having trouble to double click the button. Increase this number if you are having trouble to double click the button.
Set this value to 0 to disable double click. You won't be able to set the device in AP mode manually but your device will respond immediately to button clicks.<br /> Set this value to 0 to disable double click. You won't be able to set the device in AP mode manually but your device will respond immediately to button clicks.<br />
You will have to <strong>reset the device</strong> after updating for this setting to apply.
You will have to <strong>reboot the device</strong> after updating for this setting to apply.
</div> </div>
</div> </div>
@ -350,7 +350,7 @@
<div class="pure-g module module-ds module-dht"> <div class="pure-g module module-ds module-dht">
<label class="pure-u-1 pure-u-md-1-4">Temperature correction</label> <label class="pure-u-1 pure-u-md-1-4">Temperature correction</label>
<input name="tmpCorrection" class="pure-u-1 pure-u-md-1-4" type="number" action="reset" min="-100" step="0.1" max="100" tabindex="18" />
<input name="tmpCorrection" class="pure-u-1 pure-u-md-1-4" type="number" action="reboot" min="-100" step="0.1" max="100" tabindex="18" />
<div class="pure-u-0 pure-u-md-1-2">&nbsp;</div> <div class="pure-u-0 pure-u-md-1-2">&nbsp;</div>
<div class="pure-u-0 pure-u-md-1-4">&nbsp;</div> <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
<div class="pure-u-1 pure-u-md-3-4 hint"> <div class="pure-u-1 pure-u-md-3-4 hint">
@ -511,7 +511,7 @@
<div class="pure-g"> <div class="pure-g">
<label class="pure-u-1 pure-u-md-1-4">Admin password</label> <label class="pure-u-1 pure-u-md-1-4">Admin password</label>
<input name="adminPass1" class="pure-u-1 pure-u-md-3-4" type="password" action="reset" tabindex="11" autocomplete="false" />
<input name="adminPass1" class="pure-u-1 pure-u-md-3-4" type="password" action="reboot" tabindex="11" autocomplete="false" />
<div class="pure-u-0 pure-u-md-1-4">&nbsp;</div> <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
<div class="pure-u-1 pure-u-md-3-4 hint"> <div class="pure-u-1 pure-u-md-3-4 hint">
The administrator password is used to access this web interface (user 'admin'), but also to connect to the device when in AP mode or to flash a new firmware over-the-air (OTA).<br /> The administrator password is used to access this web interface (user 'admin'), but also to connect to the device when in AP mode or to flash a new firmware over-the-air (OTA).<br />
@ -520,12 +520,12 @@
<div class="pure-g"> <div class="pure-g">
<label class="pure-u-1 pure-u-md-1-4">Repeat password</label> <label class="pure-u-1 pure-u-md-1-4">Repeat password</label>
<input name="adminPass2" class="pure-u-1 pure-u-md-3-4" type="password" action="reset" tabindex="12" autocomplete="false" />
<input name="adminPass2" class="pure-u-1 pure-u-md-3-4" type="password" action="reboot" tabindex="12" autocomplete="false" />
</div> </div>
<div class="pure-g"> <div class="pure-g">
<label class="pure-u-1 pure-u-md-1-4">HTTP port</label> <label class="pure-u-1 pure-u-md-1-4">HTTP port</label>
<input name="webPort" class="pure-u-1 pure-u-md-3-4" type="text" action="reset" tabindex="13" />
<input name="webPort" class="pure-u-1 pure-u-md-3-4" type="text" action="reboot" tabindex="13" />
<div class="pure-u-0 pure-u-md-1-4">&nbsp;</div> <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
<div class="pure-u-1 pure-u-md-3-4 hint"> <div class="pure-u-1 pure-u-md-3-4 hint">
This is the port for the web interface and API requests.<br /> This is the port for the web interface and API requests.<br />


Loading…
Cancel
Save