Fixed: Change config of fastclock name did apply to fastclock.

This commit is contained in:
Dirk Jahnke 2019-06-06 22:15:29 +02:00
parent d3da31d6db
commit 23df52cbb6
2 changed files with 9 additions and 5 deletions

View File

@ -26,6 +26,7 @@ class ClockClient
void begin(); void begin();
void loop(); void loop();
static void setListenToClock(const char *_name) { name = String(_name); } static void setListenToClock(const char *_name) { name = String(_name); }
static void setListenToClock(String _name) { name = String(_name); }
static const char * const getLastMessage(); static const char * const getLastMessage();
static String const getText() { return text; } static String const getText() { return text; }
static String const getClock() { return clock; } static String const getClock() { return clock; }

View File

@ -107,11 +107,6 @@ const char _FORM_UTC_OFFSET[] PROGMEM = "<label for='utc'>UTC offset (minutes)
const char _FORM_PARAM[] PROGMEM = "<br/><input id='{i}' name='{n}' maxlength={l} placeholder='{p}' value='{v}' {c}>"; const char _FORM_PARAM[] PROGMEM = "<br/><input id='{i}' name='{n}' maxlength={l} placeholder='{p}' value='{v}' {c}>";
const char _FORM_COLOR_HEADLINE[] PROGMEM = "<br/>Display color:<br/>"; const char _FORM_COLOR_HEADLINE[] PROGMEM = "<br/>Display color:<br/>";
const char _FORM_COLOR_template[] PROGMEM = "<input class='r' id='{cid}' name='c' type='radio' value='{cname}' {check}><label for='{cid}'>{cname}</label><br/>"; const char _FORM_COLOR_template[] PROGMEM = "<input class='r' id='{cid}' name='c' type='radio' value='{cname}' {check}><label for='{cid}'>{cname}</label><br/>";
const char _FORM_COLOR_BLUE[] PROGMEM = "<input class='r' id='cb' name='c' type='radio' value='Blue' {check}><label for='cb'>Blue</label><br/>";
const char _FORM_COLOR_RED[] PROGMEM = "<input class='r' id='cr' name='c' type='radio' value='Red' {check}><label for='cr'>Red</label><br/>";
const char _FORM_COLOR_GREEN[] PROGMEM = "<input class='r' id='cg' name='c' type='radio' value='Green' {check}><label for='cg'>Green</label><br/>";
const char _FORM_COLOR_WHITE[] PROGMEM = "<input class='r' id='cw' name='c' type='radio' value='White' {check}><label for='cw'>White</label><br/>";
const char _FORM_COLOR_YELLOW[] PROGMEM = "<input class='r' id='cy' name='c' type='radio' value='Yellow' {check}><label for='cy'>Yellow</label><br/>";
const char _FORM_BRIGHTNESS[] PROGMEM = "<label for='b'>Brightness:</label><input id='b' name='b' type='range' min='10' max='255' value='{bright}'><br/>"; const char _FORM_BRIGHTNESS[] PROGMEM = "<label for='b'>Brightness:</label><input id='b' name='b' type='range' min='10' max='255' value='{bright}'><br/>";
const char _FORM_FASTCLOCK_INFO[] PROGMEM = "<div>Number of fastclocks found: {nfc}</div><br/>"; const char _FORM_FASTCLOCK_INFO[] PROGMEM = "<div>Number of fastclocks found: {nfc}</div><br/>";
const char _FORM_END[] PROGMEM = "<br/><button type='submit'>apply</button></form><br/>"; const char _FORM_END[] PROGMEM = "<br/><button type='submit'>apply</button></form><br/>";
@ -216,6 +211,14 @@ void appConfigSave() {
debug.out(": ", DEBUG_MAX_INFO); debug.out(": ", DEBUG_MAX_INFO);
debug.outln(server->arg(i), DEBUG_MAX_INFO); debug.outln(server->arg(i), DEBUG_MAX_INFO);
} }
if (server->hasArg("n")) {
String clockName = server->arg("n");
config.setString("listenToClock", clockName);
fastclock.setListenToClock(clockName);
page += F("<div>Set fastclock to listen to clock with name ");
page += clockName;
page += F(".</div>");
}
if (server->hasArg("b")) { if (server->hasArg("b")) {
int brightness = server->arg("b").toInt(); int brightness = server->arg("b").toInt();
sevenSegmentClock.setBrightness(brightness); sevenSegmentClock.setBrightness(brightness);