0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00

code moving

This commit is contained in:
OneOfEleven 2023-10-28 23:59:51 +01:00
parent 93c9e5915b
commit 230fdccf10
5 changed files with 69 additions and 78 deletions

142
app/app.c
View File

@ -1838,6 +1838,39 @@ void APP_process_transmit(void)
} }
} }
void APP_process_functions(void)
{
switch (g_current_function)
{
case FUNCTION_FOREGROUND:
APP_check_for_new_receive();
break;
case FUNCTION_TRANSMIT:
if (g_setting_backlight_on_tx_rx == 1 || g_setting_backlight_on_tx_rx == 3)
backlight_turn_on(backlight_tx_rx_time_500ms);
break;
case FUNCTION_NEW_RECEIVE:
APP_process_new_receive();
case FUNCTION_MONITOR:
break;
case FUNCTION_RECEIVE:
APP_process_rx();
break;
case FUNCTION_POWER_SAVE:
if (!g_rx_idle_mode)
APP_check_for_new_receive();
break;
case FUNCTION_PANADAPTER:
break;
}
}
void APP_process_power_save(void) void APP_process_power_save(void)
{ {
if (g_schedule_power_save) if (g_schedule_power_save)
@ -2413,20 +2446,7 @@ void APP_time_slice_10ms(void)
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
} }
#ifdef ENABLE_BOOT_BEEPS if (g_reduced_service || g_serial_config_tick_500ms > 0)
if (g_boot_counter_10ms > 0 && (g_boot_counter_10ms % 25) == 0)
AUDIO_PlayBeep(BEEP_880HZ_40MS_OPTIONAL);
#endif
#ifdef ENABLE_VOICE
if (g_flag_play_queued_voice)
{
g_flag_play_queued_voice = false;
AUDIO_PlayQueuedVoice();
}
#endif
if (g_reduced_service)
{ {
if (g_current_function == FUNCTION_TRANSMIT) if (g_current_function == FUNCTION_TRANSMIT)
g_tx_timeout_reached = true; g_tx_timeout_reached = true;
@ -2445,6 +2465,8 @@ void APP_time_slice_10ms(void)
if (g_current_function != FUNCTION_POWER_SAVE || !g_rx_idle_mode) if (g_current_function != FUNCTION_POWER_SAVE || !g_rx_idle_mode)
APP_process_radio_interrupts(); APP_process_radio_interrupts();
APP_process_functions();
if (g_current_function == FUNCTION_TRANSMIT) if (g_current_function == FUNCTION_TRANSMIT)
{ // transmitting { // transmitting
#ifdef ENABLE_TX_AUDIO_BAR #ifdef ENABLE_TX_AUDIO_BAR
@ -2453,6 +2475,19 @@ void APP_time_slice_10ms(void)
#endif #endif
} }
#ifdef ENABLE_BOOT_BEEPS
if (g_boot_counter_10ms > 0 && (g_boot_counter_10ms % 25) == 0)
AUDIO_PlayBeep(BEEP_880HZ_40MS_OPTIONAL);
#endif
#ifdef ENABLE_VOICE
if (g_flag_play_queued_voice)
{
g_flag_play_queued_voice = false;
AUDIO_PlayQueuedVoice();
}
#endif
if (g_update_display) if (g_update_display)
GUI_DisplayScreen(); GUI_DisplayScreen();
@ -2474,8 +2509,27 @@ void APP_time_slice_10ms(void)
g_vox_pause_count_down--; g_vox_pause_count_down--;
#endif #endif
#ifdef ENABLE_VOX
if (g_eeprom.vox_switch)
APP_process_vox();
#endif
APP_process_transmit(); APP_process_transmit();
#ifdef ENABLE_FMRADIO
if (g_schedule_fm &&
g_fm_scan_state != FM_SCAN_OFF &&
g_current_function != FUNCTION_MONITOR &&
g_current_function != FUNCTION_RECEIVE &&
g_current_function != FUNCTION_TRANSMIT)
{ // switch to FM radio mode
FM_Play();
g_schedule_fm = false;
}
#endif
APP_process_power_save();
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (g_fm_radio_mode && g_fm_restore_tick_10ms > 0) if (g_fm_radio_mode && g_fm_restore_tick_10ms > 0)
{ {
@ -2494,66 +2548,6 @@ void APP_time_slice_10ms(void)
APP_check_keys(); APP_check_keys();
} }
void APP_process(void)
{
if (g_reduced_service || g_serial_config_tick_500ms > 0)
return;
switch (g_current_function)
{
case FUNCTION_FOREGROUND:
APP_check_for_new_receive();
break;
case FUNCTION_TRANSMIT:
if (g_setting_backlight_on_tx_rx == 1 || g_setting_backlight_on_tx_rx == 3)
backlight_turn_on(backlight_tx_rx_time_500ms);
break;
case FUNCTION_NEW_RECEIVE:
APP_process_new_receive();
case FUNCTION_MONITOR:
break;
case FUNCTION_RECEIVE:
APP_process_rx();
break;
case FUNCTION_POWER_SAVE:
if (!g_rx_idle_mode)
APP_check_for_new_receive();
break;
case FUNCTION_PANADAPTER:
break;
}
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode && g_fm_radio_tick_500ms > 0)
return;
#endif
#ifdef ENABLE_VOX
if (g_eeprom.vox_switch)
APP_process_vox();
#endif
#ifdef ENABLE_FMRADIO
if (g_schedule_fm &&
g_fm_scan_state != FM_SCAN_OFF &&
g_current_function != FUNCTION_MONITOR &&
g_current_function != FUNCTION_RECEIVE &&
g_current_function != FUNCTION_TRANSMIT)
{ // switch to FM radio mode
FM_Play();
g_schedule_fm = false;
}
#endif
APP_process_power_save();
}
static void APP_process_key(const key_code_t Key, const bool key_pressed, const bool key_held) static void APP_process_key(const key_code_t Key, const bool key_pressed, const bool key_held)
{ {
bool flag = false; bool flag = false;

View File

@ -33,7 +33,6 @@ void APP_stop_scan(void);
void APP_channel_next(const bool remember_current, const scan_state_dir_t scan_direction); void APP_channel_next(const bool remember_current, const scan_state_dir_t scan_direction);
bool APP_start_listening(function_type_t Function); bool APP_start_listening(function_type_t Function);
uint32_t APP_set_frequency_by_step(vfo_info_t *pInfo, int8_t Step); uint32_t APP_set_frequency_by_step(vfo_info_t *pInfo, int8_t Step);
void APP_process(void);
void APP_time_slice_10ms(void); void APP_time_slice_10ms(void);
void APP_time_slice_500ms(void); void APP_time_slice_500ms(void);

Binary file not shown.

Binary file not shown.

4
main.c
View File

@ -242,7 +242,7 @@ void Main(void)
while (1) while (1)
{ {
#if 0 #if 1
// Mask interrupts // Mask interrupts
__asm volatile ("cpsid i"); __asm volatile ("cpsid i");
if (!g_next_time_slice) if (!g_next_time_slice)
@ -253,8 +253,6 @@ void Main(void)
__asm volatile ("cpsie i"); __asm volatile ("cpsie i");
#endif #endif
APP_process();
if (g_next_time_slice) if (g_next_time_slice)
{ {
APP_time_slice_10ms(); APP_time_slice_10ms();