implemented overloaded print & allowing blank lines

This commit is contained in:
Václav Šmejkal 2025-01-20 19:58:07 +01:00
parent 73d3b6f9c1
commit 253ed59793
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -36,18 +36,26 @@ namespace display
}
void print(String line_1, String line_2)
{
print(line_1, line_2, false);
}
void print(String line_1, String line_2, bool end)
{
//CLEAR
lcd.clear();
if (!end) lcd.clear();
//LINE 1
lcd.setCursor(0, 0);
lcd.print(line_1);
if (line_1 != "")
{
lcd.setCursor(end ? 16 - line_1.length() : 0, 0);
lcd.print(line_1);
}
//LINE 2
if (line_2 != NULL)
if (line_2 != "")
{
lcd.setCursor(0, 1);
lcd.setCursor(end ? 16 - line_2.length() : 0, 1);
lcd.print(line_2);
}
}