mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-10-18 06:11:46 +00:00
Cleaned up and tweaked
This commit is contained in:
@@ -111,7 +111,6 @@ public:
|
||||
AudioLevelReport = 51,
|
||||
CodedSquelch = 52,
|
||||
AudioSpectrum = 53,
|
||||
InfoRefresh = 54,
|
||||
MAX
|
||||
};
|
||||
|
||||
@@ -235,14 +234,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class InfoRefreshMessage : public Message {
|
||||
public:
|
||||
constexpr InfoRefreshMessage(
|
||||
) : Message { ID::InfoRefresh }
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class AudioStatisticsMessage : public Message {
|
||||
public:
|
||||
constexpr AudioStatisticsMessage(
|
||||
|
@@ -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 *****************************************************************/
|
||||
|
||||
|
@@ -243,7 +243,10 @@ public:
|
||||
~LiveDateTime();
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
|
||||
void set_seconds_enabled(bool new_value);
|
||||
void set_date_enabled(bool new_value);
|
||||
|
||||
std::string& string() {
|
||||
return text;
|
||||
}
|
||||
@@ -251,6 +254,9 @@ public:
|
||||
private:
|
||||
void on_tick_second();
|
||||
|
||||
bool date_enabled = true;
|
||||
bool seconds_enabled = false;
|
||||
|
||||
rtc::RTC datetime { };
|
||||
SignalToken signal_token_tick_second { };
|
||||
std::string text { };
|
||||
@@ -428,16 +434,6 @@ private:
|
||||
const Bitmap* bitmap_;
|
||||
};
|
||||
|
||||
class DateTimeButton : public Button {
|
||||
public:
|
||||
DateTimeButton(Rect parent_rect, std::string text);
|
||||
void paint(Painter& painter) override;
|
||||
private:
|
||||
std::string text_;
|
||||
void on_tick_second();
|
||||
|
||||
};
|
||||
|
||||
class Image : public Widget {
|
||||
public:
|
||||
Image();
|
||||
|
Reference in New Issue
Block a user