57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
#include "display.h"
|
|
#include "config.h"
|
|
|
|
|
|
void LCDPrintLine(LiquidCrystal* display, uint8_t y, const char* value, uint8_t margin)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
void LCDPrintLineCentered(LiquidCrystal* display, uint8_t y, const char* value, uint8_t margin)
|
|
{
|
|
/*
|
|
const char* title = mItems[mSelected]->getTitle();
|
|
uint8_t titleLength = strlen(title);
|
|
uint8_t maxWidth = LCDWidth - 2;
|
|
|
|
display->setCursor(1, 0);
|
|
|
|
if (titleLength >= maxWidth)
|
|
{
|
|
// Title too long, cut off
|
|
char* character = (char*)title;
|
|
for (uint8_t i = 0; i < maxWidth; i++)
|
|
{
|
|
display->write(byte(*character));
|
|
character++;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// Center title
|
|
uint8_t offset = (maxWidth - titleLength) / 2;
|
|
|
|
for (uint8_t i = 0; i < offset; i++)
|
|
display->write(' ');
|
|
|
|
display->print(title);
|
|
offset += titleLength;
|
|
|
|
while (offset < LCDWidth - 2)
|
|
{
|
|
display->print(' ');
|
|
offset++;
|
|
}
|
|
}
|
|
*/
|
|
}
|
|
|
|
|
|
const char* FormatTime(unsigned int time)
|
|
{
|
|
String minutes = String(time / 60);
|
|
String seconds = String(time % 60);
|
|
|
|
return (minutes + ':' + (seconds.length() == 1 ? '0' + seconds : seconds)).c_str();
|
|
} |