mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-04 23:45:26 +00:00
Modify encoder handler to not call "on_encoder" functions if no change (#1749)
This commit is contained in:
parent
485f57d86b
commit
c2d2409bff
@ -275,7 +275,7 @@ ScannerView::~ScannerView() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScannerView::show_max_index() { // show total number of freqs to scan
|
void ScannerView::show_max_index() { // show total number of freqs to scan
|
||||||
field_current_index.set_text("---");
|
field_current_index.set_text("<->");
|
||||||
|
|
||||||
if (entries.size() == FREQMAN_MAX_PER_FILE) {
|
if (entries.size() == FREQMAN_MAX_PER_FILE) {
|
||||||
text_max_index.set_style(&Styles::red);
|
text_max_index.set_style(&Styles::red);
|
||||||
|
@ -410,6 +410,9 @@ void EventDispatcher::handle_encoder() {
|
|||||||
|
|
||||||
const uint32_t encoder_now = get_encoder_position();
|
const uint32_t encoder_now = get_encoder_position();
|
||||||
const int32_t delta = static_cast<int32_t>(encoder_now - encoder_last);
|
const int32_t delta = static_cast<int32_t>(encoder_now - encoder_last);
|
||||||
|
if (delta == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
encoder_last = encoder_now;
|
encoder_last = encoder_now;
|
||||||
const auto event = static_cast<ui::EncoderEvent>(delta);
|
const auto event = static_cast<ui::EncoderEvent>(delta);
|
||||||
event_bubble_encoder(event);
|
event_bubble_encoder(event);
|
||||||
|
Loading…
Reference in New Issue
Block a user