Cleaned up and tweaked

This commit is contained in:
klockee 2020-08-08 04:24:57 -04:00
parent 9c9021f63b
commit b300cc258e
5 changed files with 38 additions and 104 deletions

View file

@ -409,10 +409,17 @@ void Labels::paint(Painter& painter) {
void LiveDateTime::on_tick_second() {
rtcGetTime(&RTCD1, &datetime);
text = "";
text = to_string_dec_uint(datetime.month(), 2, '0') + "/" + to_string_dec_uint(datetime.day(), 2, '0') + " " +
to_string_dec_uint(datetime.hour(), 2, '0') + ":" + to_string_dec_uint(datetime.minute(), 2, '0');
if(date_enabled){
text = to_string_dec_uint(datetime.month(), 2, '0') + "/" + to_string_dec_uint(datetime.day(), 2, '0') + " ";
}
text = text + to_string_dec_uint(datetime.hour(), 2, '0') + ":" + to_string_dec_uint(datetime.minute(), 2, '0');
if(seconds_enabled){
text = text + ":" + to_string_dec_uint(datetime.second(), 2, '0');
}
set_dirty();
}
@ -444,6 +451,14 @@ void LiveDateTime::paint(Painter& painter) {
);
}
void LiveDateTime::set_date_enabled(bool new_value){
this->date_enabled = new_value;
}
void LiveDateTime::set_seconds_enabled(bool new_value) {
this->seconds_enabled = new_value;
}
/* BigFrequency **********************************************************/
BigFrequency::BigFrequency(
@ -1046,16 +1061,6 @@ bool NewButton::on_touch(const TouchEvent event) {
return false;
}
}
/* DateTimeButton ********************************************************/
DateTimeButton::DateTimeButton(
Rect parent_rect,
std::string text
) : Button { parent_rect , text_}
{
set_focusable(true);
}
/* Image *****************************************************************/