mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-23 12:58:00 +00:00
ISO datetime for Clock, FileManager, Frequency manager
Added option to show/hide clock (with/without date)
This commit is contained in:
@@ -224,9 +224,17 @@ void set_playdead_sequence(const uint32_t new_value) {
|
||||
|
||||
// ui_config is an uint32_t var storing information bitwise
|
||||
// bits 0,1,2 store the backlight timer
|
||||
// bits 31, 30,29,28,27 stores the different single bit configs depicted below
|
||||
// bits 31, 30,29,28,27, 26, 25 stores the different single bit configs depicted below
|
||||
// bits on position 4 to 19 (16 bits) store the clkout frequency
|
||||
|
||||
bool hide_clock() { // clock hidden from main menu
|
||||
return data->ui_config & (1 << 25);
|
||||
}
|
||||
|
||||
bool clock_with_date() { // show clock with date, if not hidden
|
||||
return data->ui_config & (1 << 26);
|
||||
}
|
||||
|
||||
bool clkout_enabled() {
|
||||
return data->ui_config & (1 << 27);
|
||||
}
|
||||
@@ -251,6 +259,14 @@ uint32_t config_backlight_timer() {
|
||||
return timer_seconds[data->ui_config & 7]; //first three bits, 8 possible values
|
||||
}
|
||||
|
||||
void set_clock_hidden(bool v) {
|
||||
data->ui_config = (data->ui_config & ~(1 << 25)) | (v << 25);
|
||||
}
|
||||
|
||||
void set_clock_with_date(bool v) {
|
||||
data->ui_config = (data->ui_config & ~(1 << 26)) | (v << 26);
|
||||
}
|
||||
|
||||
void set_clkout_enabled(bool v) {
|
||||
data->ui_config = (data->ui_config & ~(1 << 27)) | (v << 27);
|
||||
}
|
||||
|
@@ -75,11 +75,15 @@ bool stealth_mode();
|
||||
void set_stealth_mode(const bool v);
|
||||
|
||||
bool config_splash();
|
||||
bool hide_clock();
|
||||
bool clock_with_date();
|
||||
bool config_login();
|
||||
bool config_speaker();
|
||||
uint32_t config_backlight_timer();
|
||||
|
||||
void set_config_splash(bool v);
|
||||
void set_clock_hidden(bool v);
|
||||
void set_clock_with_date(bool v);
|
||||
void set_config_login(bool v);
|
||||
void set_config_speaker(bool v);
|
||||
void set_config_backlight_timer(uint32_t i);
|
||||
|
@@ -410,23 +410,29 @@ void Labels::paint(Painter& painter) {
|
||||
void LiveDateTime::on_tick_second() {
|
||||
rtcGetTime(&RTCD1, &datetime);
|
||||
text = "";
|
||||
|
||||
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(!hide_clock) {
|
||||
if(date_enabled){
|
||||
text = to_string_dec_uint(datetime.year(), 4, '0') + "-" +
|
||||
to_string_dec_uint(datetime.month(), 2, '0') + "-" +
|
||||
to_string_dec_uint(datetime.day(), 2, '0') + " ";
|
||||
}
|
||||
else{
|
||||
text = " ";
|
||||
}
|
||||
|
||||
text = text + to_string_dec_uint(datetime.hour(), 2, '0') + ":" + to_string_dec_uint(datetime.minute(), 2, '0');
|
||||
|
||||
if(seconds_enabled){
|
||||
text += ":";
|
||||
if(seconds_enabled){
|
||||
text += ":";
|
||||
|
||||
if(init_delay==0)
|
||||
text += to_string_dec_uint(datetime.second(), 2, '0');
|
||||
else
|
||||
{
|
||||
// Placeholder while the seconds are not updated
|
||||
text += "XX";
|
||||
init_delay--;
|
||||
if(init_delay==0)
|
||||
text += to_string_dec_uint(datetime.second(), 2, '0');
|
||||
else
|
||||
{
|
||||
// Placeholder while the seconds are not updated
|
||||
text += "XX";
|
||||
init_delay--;
|
||||
}
|
||||
}
|
||||
}
|
||||
set_dirty();
|
||||
@@ -459,6 +465,9 @@ void LiveDateTime::paint(Painter& painter) {
|
||||
text
|
||||
);
|
||||
}
|
||||
void LiveDateTime::set_hide_clock(bool new_value){
|
||||
this->hide_clock = new_value;
|
||||
}
|
||||
|
||||
void LiveDateTime::set_date_enabled(bool new_value){
|
||||
this->date_enabled = new_value;
|
||||
|
@@ -244,6 +244,7 @@ public:
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
void set_hide_clock(bool new_value);
|
||||
void set_seconds_enabled(bool new_value);
|
||||
void set_date_enabled(bool new_value);
|
||||
|
||||
@@ -255,6 +256,7 @@ private:
|
||||
void on_tick_second();
|
||||
|
||||
uint16_t init_delay = 4;
|
||||
bool hide_clock = false;
|
||||
bool date_enabled = true;
|
||||
bool seconds_enabled = false;
|
||||
|
||||
|
Reference in New Issue
Block a user