mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-14 10:39:30 +00:00
Remove dead _previous_frequency state from BigFrequency widget (#3294)
* Initial plan * Remove unused _previous_frequency member from BigFrequency and remove paint() guard Co-authored-by: gullradriel <3157857+gullradriel@users.noreply.github.com> * Move frequency dirty-check to set() to avoid redundant repaints Co-authored-by: gullradriel <3157857+gullradriel@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: gullradriel <3157857+gullradriel@users.noreply.github.com>
This commit is contained in:
@@ -564,16 +564,14 @@ void LiveDateTime::set_seconds_enabled(bool new_value) {
|
|||||||
|
|
||||||
/* BigFrequency **********************************************************/
|
/* BigFrequency **********************************************************/
|
||||||
|
|
||||||
BigFrequency::BigFrequency(
|
BigFrequency::BigFrequency(Rect parent_rect, rf::Frequency frequency)
|
||||||
Rect parent_rect,
|
: Widget{parent_rect}, _frequency{frequency} {}
|
||||||
rf::Frequency frequency)
|
|
||||||
: Widget{parent_rect},
|
|
||||||
_frequency{frequency} {
|
|
||||||
}
|
|
||||||
|
|
||||||
void BigFrequency::set(const rf::Frequency frequency) {
|
void BigFrequency::set(const rf::Frequency frequency) {
|
||||||
|
if (_frequency != frequency) {
|
||||||
_frequency = frequency;
|
_frequency = frequency;
|
||||||
set_dirty();
|
set_dirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BigFrequency::paint(Painter& painter) {
|
void BigFrequency::paint(Painter& painter) {
|
||||||
@@ -583,9 +581,6 @@ void BigFrequency::paint(Painter& painter) {
|
|||||||
Point digit_pos;
|
Point digit_pos;
|
||||||
ui::Color segment_color;
|
ui::Color segment_color;
|
||||||
|
|
||||||
if (_frequency != _previous_frequency) {
|
|
||||||
_previous_frequency = _frequency;
|
|
||||||
|
|
||||||
rf::Frequency frequency{_frequency};
|
rf::Frequency frequency{_frequency};
|
||||||
const auto rect = screen_rect(); // why not use screen_rect() directly for width, ...? it may be too small, but ...
|
const auto rect = screen_rect(); // why not use screen_rect() directly for width, ...? it may be too small, but ...
|
||||||
|
|
||||||
@@ -641,7 +636,6 @@ void BigFrequency::paint(Painter& painter) {
|
|||||||
digit_pos += {digit_width, 0};
|
digit_pos += {digit_width, 0};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ProgressBar ***********************************************************/
|
/* ProgressBar ***********************************************************/
|
||||||
|
|||||||
@@ -297,7 +297,6 @@ class BigFrequency : public Widget {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
rf::Frequency _frequency;
|
rf::Frequency _frequency;
|
||||||
rf::Frequency _previous_frequency{~0LL};
|
|
||||||
|
|
||||||
static constexpr Dim digit_width = 32;
|
static constexpr Dim digit_width = 32;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user