Skip to content

Commit

Permalink
Changed 'reset' to 'reboot' for user interaction (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoseperez committed Dec 8, 2017
1 parent 38baf85 commit 569b937
Show file tree
Hide file tree
Showing 8 changed files with 3,079 additions and 3,079 deletions.
2 changes: 1 addition & 1 deletion code/espurna/api.ino
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void _onRPC(AsyncWebServerRequest *request) {
String action = p->value();
DEBUG_MSG_P(PSTR("[RPC] Action: %s\n"), action.c_str());

if (action.equals("reset")) {
if (action.equals("reboot")) {
response = 200;
deferredReset(100, CUSTOM_RESET_RPC);
}
Expand Down
16 changes: 8 additions & 8 deletions code/espurna/config/general.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@
#include <pgmspace.h>

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* const custom_reset_string[] = {
custom_reset_hardware, custom_reset_web, custom_reset_terminal,
Expand Down Expand Up @@ -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_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)
#define MQTT_CONNECT_EVENT 0
Expand Down
Binary file modified code/espurna/data/index.html.gz
Binary file not shown.
6,096 changes: 3,048 additions & 3,048 deletions code/espurna/static/index.html.gz.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion code/espurna/ws.ino
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void _wsParse(AsyncWebSocketClient *client, uint8_t * payload, size_t length) {
(_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("restore")) {
Expand Down
2 changes: 1 addition & 1 deletion code/html/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
.button-update {
background: #1f8dd6;
}
.button-reset,
.button-reboot,
.button-reconnect,
.button-ha-del,
.button-rfb-forget {
Expand Down
24 changes: 12 additions & 12 deletions code/html/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var messages = [];
var webhost;

var numChanged = 0;
var numReset = 0;
var numReboot = 0;
var numReconnect = 0;
var numReload = 0;

Expand Down Expand Up @@ -137,11 +137,11 @@ function doUpdate() {
numChanged = 0;
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) {
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);
} 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?");
Expand Down Expand Up @@ -225,7 +225,7 @@ function doUpdatePassword() {
return false;
}

function doReset(ask) {
function doReboot(ask) {

ask = (typeof ask == 'undefined') ? true : ask;

Expand All @@ -235,11 +235,11 @@ function doReset(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;
}

websock.send(JSON.stringify({'action': 'reset'}));
websock.send(JSON.stringify({'action': 'reboot'}));
doReload(5000);
return false;

Expand Down Expand Up @@ -845,15 +845,15 @@ function hasChanged() {
if (hasChanged == 0) {
++numChanged;
if (action == "reconnect") ++numReconnect;
if (action == "reset") ++numReset;
if (action == "reboot") ++numReboot;
if (action == "reload") ++numReload;
$(this).attr("hasChanged", 1);
}
} else {
if (hasChanged == 1) {
--numChanged;
if (action == "reconnect") --numReconnect;
if (action == "reset") --numReset;
if (action == "reboot") --numReboot;
if (action == "reload") --numReload;
$(this).attr("hasChanged", 0);
}
Expand All @@ -868,7 +868,7 @@ function resetOriginals() {
$("select").each(function() {
$(this).attr("original", $(this).val());
})
numReset = numReconnect = numReload = 0;
numReboot = numReconnect = numReload = 0;
}

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -916,7 +916,7 @@ function init() {

$(".button-update").on('click', doUpdate);
$(".button-update-password").on('click', doUpdatePassword);
$(".button-reset").on('click', doReset);
$(".button-reboot").on('click', doReboot);
$(".button-reconnect").on('click', doReconnect);
$(".button-settings-backup").on('click', doBackup);
$(".button-settings-restore").on('click', doRestore);
Expand Down
16 changes: 8 additions & 8 deletions code/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ <h2>Before using this device you have to change the default password for the use
<div class="main-buttons">
<button class="pure-button button-update">Save</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 class="footer">
Expand Down Expand Up @@ -304,20 +304,20 @@ <h2>General configuration values</h2>

<div class="pure-g">
<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-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 class="pure-g">
<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-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.
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 />
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>

Expand Down Expand Up @@ -350,7 +350,7 @@ <h2>General configuration values</h2>

<div class="pure-g module module-ds module-dht">
<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-4">&nbsp;</div>
<div class="pure-u-1 pure-u-md-3-4 hint">
Expand Down Expand Up @@ -511,7 +511,7 @@ <h2>Device administration and security settings</h2>

<div class="pure-g">
<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-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 />
Expand All @@ -520,12 +520,12 @@ <h2>Device administration and security settings</h2>

<div class="pure-g">
<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 class="pure-g">
<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-1 pure-u-md-3-4 hint">
This is the port for the web interface and API requests.<br />
Expand Down

0 comments on commit 569b937

Please sign in to comment.