66 lines
1.1 KiB
C++
66 lines
1.1 KiB
C++
|
|
String current_string = "";
|
|
|
|
void display_text(String text1, String text2){
|
|
if (current_string != text1 + text2){
|
|
//write_log("Display:");
|
|
lcd.clear();
|
|
lcd.setCursor(freespace(text1), 0);
|
|
lcd.print(text1);
|
|
//write_log(text1);
|
|
lcd.setCursor(freespace(text2), 1);
|
|
lcd.print(text2);
|
|
//write_log(text2);
|
|
//ledMatrix.clear();
|
|
//ledMatrix.setText(text);
|
|
//ledMatrix.drawText();
|
|
//ledMatrix.commit();
|
|
current_string = text1 + text2;
|
|
}
|
|
}
|
|
|
|
int freespace(String text){
|
|
if (text.length() > 14)
|
|
{
|
|
return 1;
|
|
}
|
|
else{
|
|
int freespace = 16 - text.length();
|
|
freespace = freespace / 2;
|
|
return freespace;
|
|
}
|
|
}
|
|
|
|
bool light_on = true;
|
|
|
|
void toggle_bg_light(){
|
|
if (light_on == true){
|
|
setBrightnes(false);
|
|
}
|
|
else{
|
|
setBrightnes(true);
|
|
}
|
|
}
|
|
|
|
void setBrightnes(bool on_off){
|
|
if (on_off == true){
|
|
lcd.backlight();
|
|
light_on = true;
|
|
}
|
|
else{
|
|
lcd.noBacklight();
|
|
light_on = false;
|
|
}
|
|
}
|
|
|
|
void delay_gui(int millis_s){
|
|
block_gui = millis() + millis_s;
|
|
}
|
|
|
|
void release_gui(int currentMillis){
|
|
if (block_gui < currentMillis)
|
|
block_gui = -1;
|
|
else
|
|
return;
|
|
}
|