diff --git a/src/display.cpp b/src/display.cpp index d6790ed..b4b9773 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -51,7 +51,7 @@ Display::Display() { setClockWeekday("Mon"); setClockHalted(true); setNumberKnownClients(0); - for (int i=0; i"); + u8g2.print(numberKnownClients); u8g2.print(" Clks"); // ***** client list ***** u8g2.drawVLine(79, 0, u8g2.getDisplayHeight()); for (int i=0; i<5; ++i) { - u8g2.setDrawColor(1); - u8g2.drawBox(81, i * getTextHeight(), 3*3+1, getTextHeight()); - u8g2.setCursor(82, (i+1) * getTextHeight()); - u8g2.setDrawColor(0); - if (i < 10) u8g2.print(0); - u8g2.print(i); - u8g2.setDrawColor(1); - u8g2.setCursor(82+3*3+1+1, (i+1) * getTextHeight()); - u8g2.print(clientName[i]); + if (clientName[i][0] != 0) { + u8g2.setDrawColor(1); + u8g2.drawBox(81, i * getTextHeight(), 3*3+1, getTextHeight()); + u8g2.setCursor(82, (i+1) * getTextHeight()); + u8g2.setDrawColor(0); + if (i < 10) u8g2.print(0); + u8g2.print(i); + u8g2.setDrawColor(1); + u8g2.setCursor(82+3*3+1+1, (i+1) * getTextHeight()); + u8g2.print(clientName[i]); + } } u8g2.sendBuffer(); } diff --git a/src/display.h b/src/display.h index 4676ad9..d711a51 100644 --- a/src/display.h +++ b/src/display.h @@ -23,12 +23,20 @@ public: void showDashboard(void); 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 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 setClockWeekday(const char *weekday) { strncpy(clockWeekday, weekday, MAX_CLOCK_WEEKDAY_LEN); }; void setClockHalted(bool halted) { clockHalted = halted; }; 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 showLog(void); private: