diff --git a/app/app.c b/app/app.c index ea32073..8d9bc3a 100644 --- a/app/app.c +++ b/app/app.c @@ -1814,10 +1814,28 @@ void APP_TimeSlice10ms(void) void cancelUserInputModes(void) { + if (g_ask_to_save) + { + g_ask_to_save = false; + g_update_display = true; + } + if (g_ask_to_delete) + { + g_ask_to_delete = false; + g_update_display = true; + } + if (g_dtmf_input_mode || g_dtmf_input_box_index > 0) { DTMF_clear_input_box(); - g_request_display_screen = DISPLAY_MAIN; + #ifdef ENABLE_FMRADIO + if (g_fm_radio_mode) + g_request_display_screen = DISPLAY_FM; + else + g_request_display_screen = DISPLAY_MAIN; + #else + g_request_display_screen = DISPLAY_MAIN; + #endif g_update_display = true; } diff --git a/app/fm.c b/app/fm.c index c9e789d..cbd67e6 100644 --- a/app/fm.c +++ b/app/fm.c @@ -380,6 +380,8 @@ static void FM_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held) static void FM_Key_STAR(bool key_pressed, bool key_held) { + g_key_input_count_down = key_input_timeout_500ms; + if (key_held && !key_pressed) return; @@ -392,6 +394,8 @@ static void FM_Key_STAR(bool key_pressed, bool key_held) static void FM_Key_EXIT(bool key_pressed, bool key_held) { + g_key_input_count_down = key_input_timeout_500ms; + if (key_held || key_pressed) return; @@ -451,6 +455,8 @@ static void FM_Key_MENU(bool key_pressed, bool key_held) unsigned int i; int channel = -1; + g_key_input_count_down = key_input_timeout_500ms; + if (key_held || key_pressed) return; @@ -518,6 +524,8 @@ static void FM_Key_MENU(bool key_pressed, bool key_held) static void FM_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Step) { + g_key_input_count_down = key_input_timeout_500ms; + if (key_held || !key_pressed) { if (g_input_box_index > 0) diff --git a/driver/bk4819.c b/driver/bk4819.c index be3101b..3bc33ef 100644 --- a/driver/bk4819.c +++ b/driver/bk4819.c @@ -983,7 +983,8 @@ void BK4819_EnableDTMF(void) (1u << BK4819_REG_24_SHIFT_UNKNOWN_6) | BK4819_REG_24_ENABLE | BK4819_REG_24_SELECT_DTMF | - (14u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15 +// (14u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15 + (15u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15 } void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch) diff --git a/firmware.bin b/firmware.bin index 9ba467a..075167c 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 0f783b5..d4fabd6 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/ui/fmradio.c b/ui/fmradio.c index 9ab933e..6b90af5 100644 --- a/ui/fmradio.c +++ b/ui/fmradio.c @@ -34,8 +34,6 @@ void UI_DisplayFM(void) memset(g_frame_buffer, 0, sizeof(g_frame_buffer)); - // ************************************* - if (g_eeprom.key_lock && g_keypad_locked > 0) { // tell user how to unlock the keyboard backlight_turn_on(); @@ -46,19 +44,22 @@ void UI_DisplayFM(void) } // ************************************* - + // upper text line + UI_PrintString("FM", 0, 127, 0, 12); // ************************************* - + // middle text line + if (g_ask_to_save) { - strcpy(String, "SAVE ?"); + const unsigned int freq = g_eeprom.fm_frequency_playing; + sprintf(String, "SAVE %u.%u ?", freq / 10, freq % 10); } else if (g_ask_to_delete) { - strcpy(String, "DEL ?"); + strcpy(String, "DELETE ?"); } else { @@ -72,7 +73,7 @@ void UI_DisplayFM(void) { if (g_eeprom.fm_frequency_playing == g_fm_channels[i]) { - sprintf(String, "VFO (CH %u)", i + 1); + sprintf(String, "VFO (CH %u)", 1 + i); break; } } @@ -81,22 +82,32 @@ void UI_DisplayFM(void) strcpy(String, "VFO"); } else - sprintf(String, "CH %u", g_eeprom.fm_selected_channel + 1); + sprintf(String, "CH %u", 1 + g_eeprom.fm_selected_channel); } else if (!g_fm_auto_scan) strcpy(String, "M-SCAN"); else - sprintf(String, "A-SCAN %u", g_fm_channel_position + 1); + sprintf(String, "A-SCAN %u", 1 + g_fm_channel_position); } UI_PrintString(String, 0, 127, 2, 10); // ************************************* + // lower text line memset(String, 0, sizeof(String)); - if (g_ask_to_save || (g_eeprom.fm_is_channel_mode && g_input_box_index > 0)) + if (g_ask_to_save) + { // channel mode + const unsigned int chan = g_fm_channel_position; + const uint32_t freq = g_fm_channels[chan]; + UI_GenerateChannelString(String, chan, ' '); + if (FM_CheckValidChannel(chan)) + sprintf(String + strlen(String), " (%u.%u)", freq / 10, freq % 10); + } + else + if (g_eeprom.fm_is_channel_mode && g_input_box_index > 0) { // user is entering a channel number UI_GenerateChannelString(String, g_fm_channel_position, ' '); } @@ -104,8 +115,9 @@ void UI_DisplayFM(void) if (!g_ask_to_delete) { if (g_input_box_index == 0) - { - NUMBER_ToDigits(g_eeprom.fm_frequency_playing * 10000, String); + { // frequency mode + const uint32_t freq = g_eeprom.fm_frequency_playing; + NUMBER_ToDigits(freq * 10000, String); UI_DisplayFrequency(String, 23, 4, false, true); } else @@ -114,11 +126,13 @@ void UI_DisplayFM(void) } } else - { - sprintf(String, "CH %u", g_eeprom.fm_selected_channel + 1); + { // delete channel + const uint32_t chan = g_eeprom.fm_selected_channel; + const uint32_t freq = g_fm_channels[chan]; + sprintf(String, "CH %u (%u.%u)", 1 + chan, freq / 10, freq % 10); } - UI_PrintString(String, 0, 127, 4, 10); + UI_PrintString(String, 0, 127, 4, (strlen(String) >= 8) ? 8 : 10); // *************************************