mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
FM radio tidy up
This commit is contained in:
parent
d676c77e85
commit
8c21a0e543
@ -2272,8 +2272,10 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
|
||||
|
||||
backlight_turn_on();
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (!g_fm_radio_mode)
|
||||
#endif
|
||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
// AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
|
||||
// keypad is locked, tell the user
|
||||
g_keypad_locked = 4; // 2 second pop-up
|
||||
@ -2533,9 +2535,14 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
|
||||
ACTION_Handle(Key, key_pressed, key_held);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (!g_fm_radio_mode)
|
||||
#endif
|
||||
if (!key_held && key_pressed)
|
||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
}
|
||||
}
|
||||
|
||||
Skip:
|
||||
if (g_beep_to_play != BEEP_NONE)
|
||||
|
6
app/fm.c
6
app/fm.c
@ -192,8 +192,6 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
||||
//if (Deviation > -281 && Deviation < 280)
|
||||
if (Deviation < 280 || Deviation > 3815)
|
||||
{
|
||||
// not BLE(less than or equal)
|
||||
|
||||
if (Frequency > LowerLimit && (Frequency - BK1080_BaseFrequency) == 1)
|
||||
{
|
||||
if (BK1080_FrequencyDeviation & 0x800)
|
||||
@ -203,8 +201,6 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
||||
goto Bail;
|
||||
}
|
||||
|
||||
// not BLT(less than)
|
||||
|
||||
if (Frequency >= LowerLimit && (BK1080_BaseFrequency - Frequency) == 1)
|
||||
{
|
||||
if ((BK1080_FrequencyDeviation & 0x800) == 0)
|
||||
@ -285,7 +281,9 @@ static void FM_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
uint32_t Frequency;
|
||||
|
||||
g_input_box_index = 0;
|
||||
|
||||
NUMBER_Get(g_input_box, &Frequency);
|
||||
|
||||
Frequency /= 10000;
|
||||
|
||||
if (Frequency < g_eeprom.fm_lower_limit || g_eeprom.fm_upper_limit < Frequency)
|
||||
|
@ -40,6 +40,9 @@ void GENERIC_Key_F(bool key_pressed, bool key_held)
|
||||
|
||||
if (g_input_box_index > 0)
|
||||
{
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (!g_fm_radio_mode)
|
||||
#endif
|
||||
if (!key_held && key_pressed)
|
||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
@ -69,6 +72,9 @@ void GENERIC_Key_F(bool key_pressed, bool key_held)
|
||||
|
||||
if (key_pressed)
|
||||
{
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (!g_fm_radio_mode)
|
||||
#endif
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
40
app/main.c
40
app/main.c
@ -65,21 +65,17 @@ void toggle_chan_scanlist(void)
|
||||
g_flag_reset_vfos = true;
|
||||
}
|
||||
|
||||
static void processFKeyFunction(const key_code_t Key, const bool beep)
|
||||
static void processFKeyFunction(const key_code_t Key)
|
||||
{
|
||||
uint8_t Band;
|
||||
uint8_t Vfo = g_eeprom.tx_vfo;
|
||||
|
||||
if (g_screen_to_display == DISPLAY_MENU)
|
||||
{
|
||||
// if (beep)
|
||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
||||
// if (beep)
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
switch (Key)
|
||||
{
|
||||
case KEY_0:
|
||||
@ -119,11 +115,9 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
|
||||
g_request_save_vfo = true;
|
||||
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
||||
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
|
||||
if (beep)
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
break;
|
||||
|
||||
case KEY_2:
|
||||
@ -144,11 +138,9 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
|
||||
g_request_save_settings = 1;
|
||||
g_flag_reconfigure_vfos = true;
|
||||
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
|
||||
if (beep)
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
break;
|
||||
|
||||
case KEY_3:
|
||||
@ -163,11 +155,15 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
|
||||
if (IS_USER_CHANNEL(g_tx_vfo->channel_save))
|
||||
{ // swap to frequency mode
|
||||
g_eeprom.screen_channel[Vfo] = g_eeprom.freq_channel[g_eeprom.tx_vfo];
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
g_another_voice_id = VOICE_ID_FREQUENCY_MODE;
|
||||
#endif
|
||||
|
||||
g_request_save_vfo = true;
|
||||
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
||||
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -175,18 +171,21 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
|
||||
if (Channel != 0xFF)
|
||||
{ // swap to channel mode
|
||||
g_eeprom.screen_channel[Vfo] = Channel;
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||
AUDIO_SetDigitVoice(1, Channel + 1);
|
||||
g_another_voice_id = (voice_id_t)0xFE;
|
||||
#endif
|
||||
|
||||
g_request_save_vfo = true;
|
||||
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
|
||||
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (beep)
|
||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
|
||||
break;
|
||||
@ -199,9 +198,7 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
|
||||
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
|
||||
g_update_status = true;
|
||||
|
||||
// if (beep)
|
||||
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
break;
|
||||
|
||||
case KEY_5:
|
||||
@ -227,10 +224,12 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
break;
|
||||
|
||||
case KEY_6:
|
||||
ACTION_Power();
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
break;
|
||||
|
||||
case KEY_7:
|
||||
@ -239,11 +238,13 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
|
||||
#else
|
||||
toggle_chan_scanlist();
|
||||
#endif
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
break;
|
||||
|
||||
case KEY_8:
|
||||
g_tx_vfo->frequency_reverse = g_tx_vfo->frequency_reverse == false;
|
||||
g_request_save_channel = 1;
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
break;
|
||||
|
||||
case KEY_9:
|
||||
@ -261,7 +262,6 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
|
||||
break;
|
||||
}
|
||||
|
||||
if (beep)
|
||||
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
break;
|
||||
|
||||
@ -269,7 +269,9 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
|
||||
g_update_status = true;
|
||||
g_fkey_pressed = false;
|
||||
|
||||
if (beep)
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (!g_fm_radio_mode)
|
||||
#endif
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
break;
|
||||
}
|
||||
@ -293,7 +295,7 @@ static void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
g_fkey_pressed = false;
|
||||
g_update_status = true;
|
||||
|
||||
processFKeyFunction(Key, false);
|
||||
processFKeyFunction(Key);
|
||||
}
|
||||
}
|
||||
|
||||
@ -469,7 +471,7 @@ static void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
g_fkey_pressed = false;
|
||||
g_update_status = true;
|
||||
|
||||
processFKeyFunction(Key, true);
|
||||
processFKeyFunction(Key);
|
||||
}
|
||||
|
||||
static void MAIN_Key_EXIT(bool key_pressed, bool key_held)
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
12
ui/fmradio.c
12
ui/fmradio.c
@ -14,8 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "app/fm.h"
|
||||
@ -74,7 +72,7 @@ void UI_DisplayFM(void)
|
||||
{
|
||||
if (g_eeprom.fm_frequency_playing == g_fm_channels[i])
|
||||
{
|
||||
sprintf(String, "VFO(CH%02u)", i + 1);
|
||||
sprintf(String, "VFO (CH %u)", i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -83,13 +81,13 @@ void UI_DisplayFM(void)
|
||||
strcpy(String, "VFO");
|
||||
}
|
||||
else
|
||||
sprintf(String, "MR(CH%02u)", g_eeprom.fm_selected_channel + 1);
|
||||
sprintf(String, "CH %2u", g_eeprom.fm_selected_channel + 1);
|
||||
}
|
||||
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", g_fm_channel_position + 1);
|
||||
}
|
||||
|
||||
UI_PrintString(String, 0, 127, 2, 10);
|
||||
@ -117,7 +115,7 @@ void UI_DisplayFM(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(String, "CH-%02u", g_eeprom.fm_selected_channel + 1);
|
||||
sprintf(String, "CH %2u", g_eeprom.fm_selected_channel + 1);
|
||||
UI_PrintString(String, 0, 127, 4, 10);
|
||||
}
|
||||
|
||||
@ -125,5 +123,3 @@ void UI_DisplayFM(void)
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user