Hi - I have a sketch where Auto Format only works up until a certain line in the sketch.
The last line that works with Auto Format is line 37 in the attached sketch. The line is: static const char AUX_TIMEZONE[] PROGMEM = R"( [taken from the Autoconnect library example].
Can anyone verify this code causes Auto Format to fail on their Arduino IDE as well? I'd like to know if the issue is my IDE setup, or if there's something in this code that Auto Format chokes on...and if so, how to fix it.
Thanks...
// THIS TOP PART OF THE SKETCH RESPONDS CORRECTLY TO AUTOFORMAT:
int GPIO_0 = 0;
int GPIO_1 = 1;
int GPIO_2 = 2;
int GPIO_3 = 3;
int GPIO_4 = 4;
int GPIO_5 = 5;
int GPIO_12 = 12;
int GPIO_13 = 13;
int GPIO_14 = 14;
int GPIO_15 = 15;
int GPIO_16 = 16;
// THIS PART OF THE SKETCH RESPONDS CORRECTLY TO AUTOFORMAT UNTIL
// LINE 37 below, THEN AUTOFORMAT STOPS WORKING:
/* Simple.ino, Example for the AutoConnect library.
Copyright (c) 2018, Hieromon Ikasamo
https://github.com/Hieromon/AutoCnnect
Default WiFi PWD: 12345678
Set in: AutoConnectDefs.h
*/
#if defined(ARDUINO_ARCH_ESP8266)
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#elif defined(ARDUINO_ARCH_ESP32)
#include <WiFi.h>
#include <WebServer.h>
#endif
#include <time.h>
#include <AutoConnect.h>
static const char AUX_TIMEZONE[] PROGMEM = R"(
// AUTOFORMAT STOPS WORKING HERE!!!
{
"title": "TimeZone",
"uri": "/timezone",
"menu": true,
"element": [
{
"name": "caption",
"type": "ACText",
"value": "Sets the time zone to get the current local time.",
"style": "font-family:Arial;font-weight:bold;text-align:center;margin-bottom:10px;color:DarkSlateBlue"
},
{
"name": "timezone",
"type": "ACSelect",
"label": "Select TZ name",
"option": [],
"selected": 10
},
{
"name": "newline",
"type": "ACElement",
"value": "
"
},
{
"name": "start",
"type": "ACSubmit",
"value": "OK",
"uri": "/start"
}
]
}
)";
typedef struct {
const char* zone;
const char* ntpServer;
int8_t tzoff;
} Timezone_t;
static const Timezone_t TZ[] = {
{ "Europe/London", "europe.pool.ntp.org", 0 },
{ "Europe/Berlin", "europe.pool.ntp.org", 1 },
{ "Europe/Helsinki", "europe.pool.ntp.org", 2 },
{ "Europe/Moscow", "europe.pool.ntp.org", 3 },
{ "Asia/Dubai", "asia.pool.ntp.org", 4 },
{ "Asia/Karachi", "asia.pool.ntp.org", 5 },
{ "Asia/Dhaka", "asia.pool.ntp.org", 6 },
{ "Asia/Jakarta", "asia.pool.ntp.org", 7 },
{ "Asia/Manila", "asia.pool.ntp.org", 8 },
{ "Asia/Tokyo", "asia.pool.ntp.org", 9 },
{ "Australia/Brisbane", "oceania.pool.ntp.org", 10 },
{ "Pacific/Noumea", "oceania.pool.ntp.org", 11 },
{ "Pacific/Auckland", "oceania.pool.ntp.org", 12 },
{ "Atlantic/Azores", "europe.pool.ntp.org", -1 },
{ "America/Noronha", "south-america.pool.ntp.org", -2 },
{ "America/Araguaina", "south-america.pool.ntp.org", -3 },
{ "America/Blanc-Sablon", "north-america.pool.ntp.org", -4},
{ "America/New_York", "north-america.pool.ntp.org", -5 },
{ "America/Chicago", "north-america.pool.ntp.org", -6 },
{ "America/Denver", "north-america.pool.ntp.org", -7 },
{ "America/Los_Angeles", "north-america.pool.ntp.org", -8 },
{ "America/Anchorage", "north-america.pool.ntp.org", -9 },
{ "Pacific/Honolulu", "north-america.pool.ntp.org", -10 },
{ "Pacific/Samoa", "oceania.pool.ntp.org", -11 }
};
#if defined(ARDUINO_ARCH_ESP8266)
ESP8266WebServer Server;
#elif defined(ARDUINO_ARCH_ESP32)
WebServer Server;
#endif
AutoConnect Portal(Server);
AutoConnectConfig Config; // Enable autoReconnect supported on v0.9.4
AutoConnectAux Timezone;
// AND AUTOFORMAT DOES NOT WORK HERE ANYMORE EITHER!!!
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}