void LCD_ST7565::updateCounter(uint32_t time) { glcd.clear(); glcd.drawstring(0,0,"Operator:"); glcd.drawstring(0,1,"Lord Clancy"); formatHalfTime(time, 2, 0); formatFullTime(time, 2, 61); // 128 pixels - (11 chars * 6 pixels) = 62 - 1 glcd.drawstring(0,4,"Maintain in:"); formatHourTime(time, 4, 79); // 128 pixels - (8 chars * 6 pixels) = 80 - 1 glcd.drawstring(0,6,"Machine Time:"); formatFullTime(time, 7, 0); glcd.display(); }
void LCD_ST7565::formatHalfTime(uint32_t time, uint8_t line, uint8_t offset) { char timestring[6]; uint32_t msToSecond = time/10; int2str(timestring,(msToSecond/60)%60); timestring[2] = ':'; int2str(timestring+3,msToSecond%60); timestring[5] = 0; glcd.drawstring(0+offset,line,timestring); }
void loop() { //glcd.clear(); a5b.update(); byte bm = 1; for ( int i=0; i<5; i++ ) { int state = a5b.getState(bm); if ( state ) { glcd.fillrect(buttonsX[i], startY, squareSize, squareSize, 1); } else { glcd.fillrect(buttonsX[i]+1, startY+1, squareSize-2, squareSize-2, 0); glcd.drawrect(buttonsX[i], startY, squareSize, squareSize, 1); } bm = bm << 1; } unsigned long newtime = millis(); int elapsed = newtime-prevtime; String str(elapsed, DEC); str.toCharArray(elapsedStr, 8); prevtime = newtime; glcd.drawstring(8, 4, blank); glcd.drawstring(8, 4, elapsedStr); glcd.display(); counter++; delay(WAIT_LOOP); }
void LCD_ST7565::formatFullTime(uint32_t time, uint8_t line, uint8_t offset) { char timestring[12]; uint32_t msToSecond = time/10; int2str(timestring,msToSecond/86400); timestring[2] = ':'; int2str(timestring+3,(msToSecond/3600)%24); timestring[5] = ':'; int2str(timestring+6,(msToSecond/60)%60); timestring[8] = ':'; int2str(timestring+9,msToSecond%60); timestring[11] = 0; glcd.drawstring(0+offset,line,timestring); }
void LCD_ST7565::start(void) { glcd.clear(); glcd.drawstring(0,0,"Hello World"); glcd.display(); }