From a980fe21ac470260c73408352d559a14afabbb6d Mon Sep 17 00:00:00 2001 From: Totoo Date: Thu, 5 Jun 2025 11:32:26 +0200 Subject: [PATCH] removed some std stuff only used here (#2681) --- firmware/application/external/morse_tx/ui_morse.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/firmware/application/external/morse_tx/ui_morse.cpp b/firmware/application/external/morse_tx/ui_morse.cpp index 66197f804..054eee695 100644 --- a/firmware/application/external/morse_tx/ui_morse.cpp +++ b/firmware/application/external/morse_tx/ui_morse.cpp @@ -102,8 +102,15 @@ void MorseView::on_set_tone(NavigationView& nav) { tone_input_buffer = to_string_dec_uint(tone); text_prompt(nav, tone_input_buffer, 4, ENTER_KEYBOARD_MODE_DIGITS, [this](std::string& buffer) { - if (!buffer.empty() && std::all_of(buffer.begin(), buffer.end(), ::isdigit)) { - int new_tone = std::stoi(buffer); + bool is_digit_only = true; + for (size_t i = 0; i < tone_input_buffer.size(); ++i) { + if (tone_input_buffer[i] < '0' || tone_input_buffer[i] > '9') { + is_digit_only = false; + break; + } + } + if (!buffer.empty() && is_digit_only) { + int new_tone = atoi(buffer.c_str()); if (new_tone >= 100 && new_tone <= 9999) { tone = new_tone; field_tone.set_value(tone); @@ -116,7 +123,6 @@ void MorseView::on_set_tone(NavigationView& nav) { } }); } - void MorseView::on_set_text(NavigationView& nav) { text_prompt(nav, buffer, 28, ENTER_KEYBOARD_MODE_ALPHA); }