Changed the line position of the global statement

pull/123/head
Hieromon Ikasamo 6 years ago
parent 27c858bcca
commit dfd1479a1b
  1. 36
      examples/ConfigIP/ConfigIP.ino

@ -61,29 +61,29 @@ static const char AUX_CONFIGIP[] PROGMEM = R"(
"name": "staip", "name": "staip",
"type": "ACInput", "type": "ACInput",
"label": "IP", "label": "IP",
"global": true, "pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$" "global": true
}, },
{ {
"name": "gateway", "name": "gateway",
"type": "ACInput", "type": "ACInput",
"label": "Gateway", "label": "Gateway",
"global": true, "pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$" "global": true
}, },
{ {
"name": "netmask", "name": "netmask",
"type": "ACInput", "type": "ACInput",
"label": "Netmask", "label": "Netmask",
"global": true, "pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$" "global": true
}, },
{ {
"name": "dns1", "name": "dns1",
"type": "ACInput", "type": "ACInput",
"label": "DNS", "label": "DNS",
"global": true, "pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"pattern": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$" "global": true
}, },
{ {
"name": "ok", "name": "ok",
@ -116,26 +116,26 @@ static const char AUX_RESTART[] PROGMEM = R"(
{ {
"name": "staip", "name": "staip",
"type": "ACText", "type": "ACText",
"global": true, "format": "IP: %s",
"format": "IP: %s" "global": true
}, },
{ {
"name": "gateway", "name": "gateway",
"type": "ACText", "type": "ACText",
"global": true, "format": "Gateway: %s",
"format": "Gateway: %s" "global": true
}, },
{ {
"name": "netmask", "name": "netmask",
"type": "ACText", "type": "ACText",
"global": true, "format": "Netmask: %s",
"format": "Netmask: %s" "global": true
}, },
{ {
"name": "dns1", "name": "dns1",
"type": "ACText", "type": "ACText",
"global": true, "format": "DNS1: %s",
"format": "DNS1: %s" "global": true
}, },
{ {
"name": "result", "name": "result",
@ -195,7 +195,11 @@ void loadConfig(IPCONFIG* ipconfig) {
// Save current IP configuration to EEPROM // Save current IP configuration to EEPROM
void saveConfig(const IPCONFIG* ipconfig) { void saveConfig(const IPCONFIG* ipconfig) {
// EEPROM.begin will truncate the area to the size given by the argument.
// The part overflowing from the specified size is filled with 0xff,
// so if the argument value is too small, the credentials may be lost.
EEPROM.begin(128); EEPROM.begin(128);
int dp = 0; int dp = 0;
for (uint8_t i = 0; i < 4; i++) { for (uint8_t i = 0; i < 4; i++) {
for (uint8_t d = 0; d < sizeof(uint32_t); d++) for (uint8_t d = 0; d < sizeof(uint32_t); d++)

Loading…
Cancel
Save