Supports AutoConnectAux

pull/41/head
Hieromon Ikasamo 6 years ago
parent 3058169829
commit a836b4dd12
  1. 37
      examples/Simple/Simple.ino

@ -39,32 +39,7 @@ static const char AUX_TIMEZONE[] PROGMEM = R"(
"name": "timezone", "name": "timezone",
"type": "ACSelect", "type": "ACSelect",
"label": "Select TZ name", "label": "Select TZ name",
"option": [ "option": []
"Europe/London",
"Europe/Berlin",
"Europe/Helsinki",
"Europe/Moscow",
"Asia/Dubai",
"Asia/Karachi",
"Asia/Dhaka",
"Asia/Jakarta",
"Asia/Manila",
"Asia/Tokyo",
"Australia/Brisbane",
"Pacific/Noumea",
"Pacific/Auckland",
"Pacific/Tongatapu",
"Pacific/Kiritimati",
"America/Sao_Paulo",
"America/Santiago",
"America/Detroit",
"America/Chicago",
"America/Denver",
"America/LosAngeles",
"America/Anchorage",
"Pacific/Honolulu",
"Pacific/Samoa"
]
}, },
{ {
"name": "newline", "name": "newline",
@ -179,7 +154,15 @@ void setup() {
Config.autoReconnect = true; Config.autoReconnect = true;
Portal.config(Config); Portal.config(Config);
Timezone.load(AUX_TIMEZONE); // Load aux. page // Load aux. page
Timezone.load(AUX_TIMEZONE);
// Retrieve the select element that holds the time zone code and
// register the zone mnemonic in advance.
AutoConnectSelect& tz = Timezone.getElement<AutoConnectSelect>("timezone");
for (uint8_t n = 0; n < sizeof(TZ) / sizeof(Timezone_t); n++) {
tz.add(String(TZ[n].zone));
}
Portal.join({ Timezone }); // Register aux. page Portal.join({ Timezone }); // Register aux. page
// Behavior a root path of ESP8266WebServer. // Behavior a root path of ESP8266WebServer.

Loading…
Cancel
Save