const int str2pin_map[] = {
D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, 0, 0, 0, 0, 0, 0, 0, 0, 0,
A0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
int str2pin(const char * s) {
if (s[0] >= '0' && s[0] <= '9')
return atoi(s);
return str2pin_map[atoi(s+1) + ((s[0]=='A') ? 20 : 0)];
}
/* reads settings into json object */
void load_settings () {
if (LittleFS.exists("settings.json")) {
File s = LittleFS.open("settings.json", "r");
if (s)
deserializeJson(settings, s);
s.close();
}
}
/* stores settings from json object to file */
void store_settings () {
File s = LittleFS.open("settings.json", "w");
serializeJson(settings, s);
s.close();
}
void notFound(AsyncWebServerRequest *request) {
request->send(404, "text/plain", "404");
}