From 55525ed4adda76ab2ac60c25158837c23286a1f9 Mon Sep 17 00:00:00 2001 From: sommermorgentraum <24917424+zxkmm@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:53:15 +0800 Subject: [PATCH] fix wrong cast in morse app (#2436) * fix wrong cast * sorry, forgot to use enum --- firmware/application/external/morse_tx/ui_morse.cpp | 5 ++--- firmware/application/external/morse_tx/ui_morse.hpp | 9 +++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/firmware/application/external/morse_tx/ui_morse.cpp b/firmware/application/external/morse_tx/ui_morse.cpp index 99af99bd..e6421ab0 100644 --- a/firmware/application/external/morse_tx/ui_morse.cpp +++ b/firmware/application/external/morse_tx/ui_morse.cpp @@ -232,9 +232,8 @@ MorseView::MorseView( set_foxhunt(foxhunt_code); }; - options_modulation.on_change = [this](size_t i, int32_t value) { - (void)i; // avoid unused warning - mode_cw = (bool)value; + options_modulation.on_change = [this](size_t, OptionsField::value_t v) { + mode_cw = (bool)v; }; options_loop.on_change = [this](size_t i, uint32_t value) { diff --git a/firmware/application/external/morse_tx/ui_morse.hpp b/firmware/application/external/morse_tx/ui_morse.hpp index d3783af0..57da2cad 100644 --- a/firmware/application/external/morse_tx/ui_morse.hpp +++ b/firmware/application/external/morse_tx/ui_morse.hpp @@ -41,6 +41,11 @@ using namespace morse; namespace ui::external_app::morse_tx { +enum Modulation { + FM = 0, + CW = 1 +}; + class MorseView : public View { public: MorseView(NavigationView& nav); @@ -137,8 +142,8 @@ class MorseView : public View { OptionsField options_modulation{ {15 * 8, 10 * 8}, 2, - {{"CW", true}, - {"FM", false}}}; + {{"CW", Modulation::CW}, + {"FM", Modulation::FM}}}; OptionsField options_loop{ {9 * 8, 12 * 8},