Client clock list displayed only, if clients are present.
This commit is contained in:
		@@ -51,7 +51,7 @@ Display::Display() {
 | 
			
		||||
  setClockWeekday("Mon");
 | 
			
		||||
  setClockHalted(true);
 | 
			
		||||
  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) {
 | 
			
		||||
@@ -183,20 +183,22 @@ void Display::showDashboard(void) {
 | 
			
		||||
  // ***** # of clients *****
 | 
			
		||||
  setSmallTextSize();
 | 
			
		||||
  u8g2.setCursor(55, getTextHeight());
 | 
			
		||||
  u8g2.print(numberKnownClients); u8g2.print(" -->");
 | 
			
		||||
  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();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user