Client clock list displayed only, if clients are present.
This commit is contained in:
parent
708aeb2e72
commit
59a0170b85
|
@ -51,7 +51,7 @@ Display::Display() {
|
||||||
setClockWeekday("Mon");
|
setClockWeekday("Mon");
|
||||||
setClockHalted(true);
|
setClockHalted(true);
|
||||||
setNumberKnownClients(0);
|
setNumberKnownClients(0);
|
||||||
for (int i=0; i<MAX_NUMBER_CLIENTS_DISPLAYED; ++i) setClientName(i, "---");
|
for (int i=0; i<MAX_NUMBER_CLIENTS_DISPLAYED; ++i) setClientName(i, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::begin(void) {
|
void Display::begin(void) {
|
||||||
|
@ -183,11 +183,12 @@ void Display::showDashboard(void) {
|
||||||
// ***** # of clients *****
|
// ***** # of clients *****
|
||||||
setSmallTextSize();
|
setSmallTextSize();
|
||||||
u8g2.setCursor(55, getTextHeight());
|
u8g2.setCursor(55, getTextHeight());
|
||||||
u8g2.print(numberKnownClients); u8g2.print(" -->");
|
u8g2.print(numberKnownClients); u8g2.print(" Clks");
|
||||||
|
|
||||||
// ***** client list *****
|
// ***** client list *****
|
||||||
u8g2.drawVLine(79, 0, u8g2.getDisplayHeight());
|
u8g2.drawVLine(79, 0, u8g2.getDisplayHeight());
|
||||||
for (int i=0; i<5; ++i) {
|
for (int i=0; i<5; ++i) {
|
||||||
|
if (clientName[i][0] != 0) {
|
||||||
u8g2.setDrawColor(1);
|
u8g2.setDrawColor(1);
|
||||||
u8g2.drawBox(81, i * getTextHeight(), 3*3+1, getTextHeight());
|
u8g2.drawBox(81, i * getTextHeight(), 3*3+1, getTextHeight());
|
||||||
u8g2.setCursor(82, (i+1) * getTextHeight());
|
u8g2.setCursor(82, (i+1) * getTextHeight());
|
||||||
|
@ -198,5 +199,6 @@ void Display::showDashboard(void) {
|
||||||
u8g2.setCursor(82+3*3+1+1, (i+1) * getTextHeight());
|
u8g2.setCursor(82+3*3+1+1, (i+1) * getTextHeight());
|
||||||
u8g2.print(clientName[i]);
|
u8g2.print(clientName[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
u8g2.sendBuffer();
|
u8g2.sendBuffer();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,20 @@ public:
|
||||||
void showDashboard(void);
|
void showDashboard(void);
|
||||||
void setClockName(const char *name) { strncpy(clockName, name, MAX_CLOCK_NAME_LEN); };
|
void setClockName(const char *name) { strncpy(clockName, name, MAX_CLOCK_NAME_LEN); };
|
||||||
void setClockSpeed(const char *speed) { strncpy(clockSpeed, speed, MAX_CLOCK_SPEED_LEN); };
|
void setClockSpeed(const char *speed) { strncpy(clockSpeed, speed, MAX_CLOCK_SPEED_LEN); };
|
||||||
void setTime(int hour, int minute) { clockHour = hour; clockMinute = minute; Serial.print("display: new time "); Serial.print(clockHour); Serial.print(":"); Serial.println(clockMinute); }
|
void setTime(int hour, int minute) {
|
||||||
|
clockHour = hour;
|
||||||
|
clockMinute = minute;
|
||||||
|
Serial.print("display: new time "); Serial.print(clockHour); Serial.print(":"); Serial.println(clockMinute);
|
||||||
|
}
|
||||||
//void setClockSpeed(int _msPerModelSecond) { msPerModelSecond = _msPerModelSecond; setClockSpeed("x"); };
|
//void setClockSpeed(int _msPerModelSecond) { msPerModelSecond = _msPerModelSecond; setClockSpeed("x"); };
|
||||||
void setClockWeekday(const char *weekday) { strncpy(clockWeekday, weekday, MAX_CLOCK_WEEKDAY_LEN); };
|
void setClockWeekday(const char *weekday) { strncpy(clockWeekday, weekday, MAX_CLOCK_WEEKDAY_LEN); };
|
||||||
void setClockHalted(bool halted) { clockHalted = halted; };
|
void setClockHalted(bool halted) { clockHalted = halted; };
|
||||||
void setNumberKnownClients(int _numberKnownClients) { numberKnownClients = _numberKnownClients; };
|
void setNumberKnownClients(int _numberKnownClients) { numberKnownClients = _numberKnownClients; };
|
||||||
void setClientName(int clientNumber, const char *name) { if (clientNumber < MAX_NUMBER_CLIENTS_DISPLAYED) { strncpy(clientName[clientNumber], name, MAX_CLIENT_NAME_LEN); }};
|
void setClientName(int clientNumber, const char *name) {
|
||||||
|
if (clientNumber < MAX_NUMBER_CLIENTS_DISPLAYED) {
|
||||||
|
strncpy(clientName[clientNumber], name, MAX_CLIENT_NAME_LEN);
|
||||||
|
}
|
||||||
|
};
|
||||||
void addLogMessage(const char *message);
|
void addLogMessage(const char *message);
|
||||||
void showLog(void);
|
void showLog(void);
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue