From c2d2409bffe17e6e9a7363ede96fb2c30a136f1b Mon Sep 17 00:00:00 2001 From: Mark Thompson <129641948+NotherNgineer@users.noreply.github.com> Date: Tue, 9 Jan 2024 23:32:58 -0600 Subject: [PATCH] Modify encoder handler to not call "on_encoder" functions if no change (#1749) --- firmware/application/apps/ui_scanner.cpp | 2 +- firmware/application/event_m0.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/firmware/application/apps/ui_scanner.cpp b/firmware/application/apps/ui_scanner.cpp index 902f697d..194ed9ce 100644 --- a/firmware/application/apps/ui_scanner.cpp +++ b/firmware/application/apps/ui_scanner.cpp @@ -275,7 +275,7 @@ ScannerView::~ScannerView() { } 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) { text_max_index.set_style(&Styles::red); diff --git a/firmware/application/event_m0.cpp b/firmware/application/event_m0.cpp index 964d17fb..12fc8197 100644 --- a/firmware/application/event_m0.cpp +++ b/firmware/application/event_m0.cpp @@ -410,6 +410,9 @@ void EventDispatcher::handle_encoder() { const uint32_t encoder_now = get_encoder_position(); const int32_t delta = static_cast(encoder_now - encoder_last); + if (delta == 0) + return; + encoder_last = encoder_now; const auto event = static_cast(delta); event_bubble_encoder(event);