mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 14:48:03 +03:00
Renamed lots more
This commit is contained in:
333
misc.c
333
misc.c
@ -19,252 +19,253 @@
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
|
||||
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
||||
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
|
||||
const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
|
||||
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
|
||||
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
|
||||
// ***********************************************
|
||||
|
||||
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
|
||||
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
||||
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
||||
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
|
||||
const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
|
||||
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
|
||||
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
|
||||
|
||||
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
||||
const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
||||
const uint8_t DTMF_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds .. time we sound the ringing for
|
||||
const uint8_t DTMF_txstop_countdown_500ms = 3000 / 500; // 6 seconds
|
||||
const uint8_t menu_timeout_500ms = 30000 / 500; // 30 seconds
|
||||
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
||||
|
||||
const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 seconds
|
||||
const uint16_t key_repeat_delay_10ms = 400 / 10; // 400ms
|
||||
const uint16_t key_repeat_10ms = 80 / 10; // 80ms .. MUST be less than 'key_repeat_delay'
|
||||
const uint16_t key_debounce_10ms = 20 / 10; // 20ms
|
||||
const uint8_t dtmf_rx_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
||||
const uint8_t dtmf_rx_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
||||
const uint8_t dtmf_decode_ring_countdown_500ms = 15000 / 500; // 15 seconds .. time we sound the ringing for
|
||||
const uint8_t dtmf_txstop_countdown_500ms = 3000 / 500; // 6 seconds
|
||||
|
||||
const uint8_t scan_freq_css_delay_10ms = 210 / 10; // 210ms .. don't reduce this
|
||||
const uint8_t key_input_timeout_500ms = 6000 / 500; // 6 seconds
|
||||
const uint16_t key_repeat_delay_10ms = 400 / 10; // 400ms
|
||||
const uint16_t key_repeat_10ms = 80 / 10; // 80ms .. MUST be less than 'key_repeat_delay'
|
||||
const uint16_t key_debounce_10ms = 20 / 10; // 20ms
|
||||
|
||||
const uint16_t dual_watch_count_after_tx_10ms = 3600 / 10; // 3.6 sec after TX ends
|
||||
const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec after RX ends ?
|
||||
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
|
||||
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
|
||||
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
|
||||
const uint8_t scan_freq_css_delay_10ms = 210 / 10; // 210ms .. don't reduce this
|
||||
|
||||
const uint16_t dual_watch_count_after_tx_10ms = 3600 / 10; // 3.6 sec after TX ends
|
||||
const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec after RX ends ?
|
||||
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
|
||||
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
|
||||
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
|
||||
#ifdef ENABLE_VOX
|
||||
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
|
||||
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
|
||||
#endif
|
||||
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
|
||||
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
|
||||
|
||||
const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
||||
const uint16_t scan_pause_delay_in_2_10ms = 500 / 10; // 500ms
|
||||
const uint16_t scan_pause_delay_in_3_10ms = 200 / 10; // 200ms
|
||||
const uint16_t scan_pause_delay_in_4_10ms = 300 / 10; // 300ms
|
||||
const uint16_t scan_pause_delay_in_5_10ms = 1000 / 10; // 1 sec
|
||||
const uint16_t scan_pause_delay_in_6_10ms = 100 / 10; // 100ms
|
||||
const uint16_t scan_pause_delay_in_7_10ms = 3600 / 10; // 3.6 seconds
|
||||
const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
||||
const uint16_t scan_pause_delay_in_2_10ms = 500 / 10; // 500ms
|
||||
const uint16_t scan_pause_delay_in_3_10ms = 200 / 10; // 200ms
|
||||
const uint16_t scan_pause_delay_in_4_10ms = 300 / 10; // 300ms
|
||||
const uint16_t scan_pause_delay_in_5_10ms = 1000 / 10; // 1 sec
|
||||
const uint16_t scan_pause_delay_in_6_10ms = 100 / 10; // 100ms
|
||||
const uint16_t scan_pause_delay_in_7_10ms = 3600 / 10; // 3.6 seconds
|
||||
|
||||
const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
|
||||
const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
|
||||
|
||||
const uint16_t power_save1_10ms = 100 / 10; // 100ms
|
||||
const uint16_t power_save2_10ms = 200 / 10; // 200ms
|
||||
const uint16_t power_save1_10ms = 100 / 10; // 100ms
|
||||
const uint16_t power_save2_10ms = 200 / 10; // 200ms
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
const uint16_t vox_stop_count_down_10ms = 1000 / 10; // 1 second
|
||||
#endif
|
||||
|
||||
const uint16_t NOAA_countdown_10ms = 5000 / 10; // 5 seconds
|
||||
const uint16_t NOAA_countdown_2_10ms = 500 / 10; // 500ms
|
||||
const uint16_t NOAA_countdown_3_10ms = 200 / 10; // 200ms
|
||||
const uint16_t noaa_count_down_10ms = 5000 / 10; // 5 seconds
|
||||
const uint16_t noaa_count_down_2_10ms = 500 / 10; // 500ms
|
||||
const uint16_t noaa_count_down_3_10ms = 200 / 10; // 200ms
|
||||
|
||||
//const uint16_t gMax_bat_v = 840; // 8.4V
|
||||
//const uint16_t gMin_bat_v = 660; // 6.6V
|
||||
// ***********************************************
|
||||
|
||||
const uint32_t gDefaultAesKey[4] = {0x4AA5CC60, 0x0312CC5F, 0xFFD2DABB, 0x6BBA7F92};
|
||||
const uint32_t g_default_aes_key[4] = {0x4AA5CC60, 0x0312CC5F, 0xFFD2DABB, 0x6BBA7F92};
|
||||
|
||||
const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
|
||||
const uint8_t g_mic_gain_dB_2[5] = {3, 8, 16, 24, 31};
|
||||
|
||||
bool gSetting_350TX;
|
||||
bool gSetting_KILLED;
|
||||
bool gSetting_200TX;
|
||||
bool gSetting_500TX;
|
||||
bool gSetting_350EN;
|
||||
bool gSetting_TX_EN;
|
||||
uint8_t gSetting_F_LOCK;
|
||||
bool gSetting_ScrambleEnable;
|
||||
bool g_setting_350_tx_enable;
|
||||
bool g_setting_killed;
|
||||
bool g_setting_200_tx_enable;
|
||||
bool g_setting_500_tx_enable;
|
||||
bool g_setting_350_enable;
|
||||
bool g_Setting_tx_enable;
|
||||
uint8_t g_setting_f_lock;
|
||||
bool g_setting_scramble_enable;
|
||||
|
||||
uint8_t gSetting_backlight_on_tx_rx;
|
||||
uint8_t g_setting_backlight_on_tx_rx;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
bool gSetting_AM_fix;
|
||||
bool g_setting_am_fix;
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
uint8_t gSetting_AM_fix_test1 = 0;
|
||||
uint8_t g_setting_am_fix_test1 = 0;
|
||||
#endif
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
bool gSetting_mic_bar;
|
||||
bool g_setting_mic_bar;
|
||||
#endif
|
||||
bool gSetting_live_DTMF_decoder;
|
||||
uint8_t gSetting_battery_text;
|
||||
bool g_setting_live_dtmf_decoder;
|
||||
uint8_t g_setting_battery_text;
|
||||
|
||||
uint8_t gSetting_side1_short;
|
||||
uint8_t gSetting_side1_long;
|
||||
uint8_t gSetting_side2_short;
|
||||
uint8_t gSetting_side2_long;
|
||||
uint8_t g_setting_side1_short;
|
||||
uint8_t g_setting_side1_long;
|
||||
uint8_t g_setting_side2_short;
|
||||
uint8_t g_setting_side2_long;
|
||||
|
||||
bool gMonitor = false; // true opens the squelch
|
||||
bool g_monitor_enabled = false; // true opens the squelch
|
||||
|
||||
uint32_t gCustomAesKey[4];
|
||||
bool bHasCustomAesKey;
|
||||
uint32_t gChallenge[4];
|
||||
uint8_t gTryCount;
|
||||
uint32_t g_custom_aes_key[4];
|
||||
bool g_has_custom_aes_key;
|
||||
uint32_t g_challenge[4];
|
||||
uint8_t g_try_count;
|
||||
|
||||
uint8_t g_eeprom_1EC0_0[8];
|
||||
uint8_t g_eeprom_1EC0_1[8];
|
||||
uint8_t g_eeprom_1EC0_2[8];
|
||||
uint8_t g_eeprom_1EC0_3[8];
|
||||
uint8_t g_eeprom_1EC0_0[8];
|
||||
uint8_t g_eeprom_1EC0_1[8];
|
||||
uint8_t g_eeprom_1EC0_2[8];
|
||||
uint8_t g_eeprom_1EC0_3[8];
|
||||
|
||||
uint16_t g_eeprom_RSSI_CALIB[2][4];
|
||||
uint16_t g_eeprom_rssi_calib[2][4];
|
||||
|
||||
uint16_t g_eeprom_1F8A;
|
||||
uint16_t g_eeprom_1F8C;
|
||||
uint16_t g_eeprom_1F8A;
|
||||
uint16_t g_eeprom_1F8C;
|
||||
|
||||
uint8_t gUSER_ChannelAttributes[FREQ_CHANNEL_LAST + 1];
|
||||
uint8_t g_user_channel_attributes[FREQ_CHANNEL_LAST + 1];
|
||||
|
||||
volatile uint16_t gBatterySaveCountdown_10ms = battery_save_count_10ms;
|
||||
volatile uint16_t g_battery_save_count_down_10ms = battery_save_count_10ms;
|
||||
|
||||
volatile bool gPowerSaveCountdownExpired;
|
||||
volatile bool gSchedulePowerSave;
|
||||
volatile bool g_power_save_count_down_expired;
|
||||
volatile bool g_schedule_power_save;
|
||||
|
||||
volatile bool gScheduleDualWatch = true;
|
||||
volatile bool g_schedule_dual_watch = true;
|
||||
|
||||
volatile uint16_t gDualWatchCountdown_10ms;
|
||||
volatile bool gDualWatchCountdownExpired = true;
|
||||
bool gDualWatchActive = false;
|
||||
volatile uint16_t g_dual_watch_count_down_10ms;
|
||||
volatile bool g_dual_watch_count_down_expired = true;
|
||||
bool g_dual_watch_active;
|
||||
|
||||
volatile uint8_t gSerialConfigCountDown_500ms;
|
||||
volatile uint8_t g_serial_config_count_down_500ms;
|
||||
|
||||
volatile bool gNextTimeslice_500ms;
|
||||
volatile bool g_next_time_slice_500ms;
|
||||
|
||||
volatile uint16_t gTxTimerCountdown_500ms;
|
||||
volatile bool gTxTimeoutReached;
|
||||
volatile uint16_t g_tx_timer_count_down_500ms;
|
||||
volatile bool g_tx_timeout_reached;
|
||||
|
||||
volatile uint16_t gTailNoteEliminationCountdown_10ms;
|
||||
volatile uint16_t g_tail_tone_elimination_count_down_10ms;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
volatile uint16_t gNOAA_Countdown_10ms;
|
||||
volatile uint16_t g_noaa_count_down_10ms;
|
||||
#endif
|
||||
|
||||
bool gEnableSpeaker;
|
||||
uint8_t gKeyInputCountdown = 0;
|
||||
uint8_t gKeyLockCountdown;
|
||||
uint8_t gRTTECountdown;
|
||||
bool bIsInLockScreen;
|
||||
uint8_t gUpdateStatus;
|
||||
uint8_t gFoundCTCSS;
|
||||
uint8_t gFoundCDCSS;
|
||||
bool gEndOfRxDetectedMaybe;
|
||||
bool g_enable_speaker;
|
||||
uint8_t g_key_input_count_down = 0;
|
||||
uint8_t g_key_lock_count_down;
|
||||
uint8_t g_rtte_count_down;
|
||||
bool g_is_in_lock_screen;
|
||||
uint8_t g_update_status;
|
||||
uint8_t g_found_CTCSS;
|
||||
uint8_t g_found_CDCSS;
|
||||
bool g_end_of_rx_detected_maybe;
|
||||
|
||||
int16_t gVFO_RSSI[2];
|
||||
uint8_t gVFO_RSSI_bar_level[2];
|
||||
int16_t g_vfo_rssi[2];
|
||||
uint8_t g_vfo_rssi_bar_level[2];
|
||||
|
||||
uint8_t gReducedService;
|
||||
uint8_t gBatteryVoltageIndex;
|
||||
CssScanMode_t gCssScanMode;
|
||||
bool gUpdateRSSI;
|
||||
uint8_t g_reduced_service;
|
||||
uint8_t g_battery_voltage_index;
|
||||
css_scan_mode_t g_css_scan_mode;
|
||||
bool g_update_rssi;
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
AlarmState_t gAlarmState;
|
||||
alarm_state_t g_alarm_state;
|
||||
#endif
|
||||
uint16_t gMenuCountdown;
|
||||
bool gPttWasReleased;
|
||||
bool gPttWasPressed;
|
||||
uint8_t gKeypadLocked;
|
||||
bool gFlagReconfigureVfos;
|
||||
uint8_t gVfoConfigureMode;
|
||||
bool gFlagResetVfos;
|
||||
bool gRequestSaveVFO;
|
||||
uint8_t gRequestSaveChannel;
|
||||
bool gRequestSaveSettings;
|
||||
uint16_t g_menu_count_down;
|
||||
bool g_ptt_was_released;
|
||||
bool g_ptt_was_pressed;
|
||||
uint8_t g_keypad_locked;
|
||||
bool g_flag_reconfigure_vfos;
|
||||
uint8_t g_vfo_configure_mode;
|
||||
bool g_flag_reset_vfos;
|
||||
bool g_request_save_vfo;
|
||||
uint8_t g_request_save_channel;
|
||||
bool g_request_save_settings;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
bool gRequestSaveFM;
|
||||
bool g_request_save_fm;
|
||||
#endif
|
||||
bool gFlagPrepareTX;
|
||||
bool g_flag_prepare_tx;
|
||||
|
||||
bool gFlagAcceptSetting;
|
||||
bool gFlagRefreshSetting;
|
||||
bool g_flag_AcceptSetting;
|
||||
bool g_flag_refresh_menu;
|
||||
|
||||
bool gFlagSaveVfo;
|
||||
bool gFlagSaveSettings;
|
||||
bool gFlagSaveChannel;
|
||||
bool g_flag_SaveVfo;
|
||||
bool g_flag_SaveSettings;
|
||||
bool g_flag_SaveChannel;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
bool gFlagSaveFM;
|
||||
bool g_flag_SaveFM;
|
||||
#endif
|
||||
bool g_CDCSS_lost;
|
||||
uint8_t g_CDCSS_code_type;
|
||||
bool g_CTCSS_lost;
|
||||
bool g_CxCSS_tailL_found;
|
||||
bool g_CDCSS_lost;
|
||||
uint8_t g_CDCSS_code_type;
|
||||
bool g_CTCSS_lost;
|
||||
bool g_CxCSS_tail_found;
|
||||
#ifdef ENABLE_VOX
|
||||
bool g_vox_lost;
|
||||
bool gVOX_NoiseDetected;
|
||||
uint16_t gVoxResumeCountdown;
|
||||
uint16_t g_vox_pause_count_down;
|
||||
bool g_vox_lost;
|
||||
bool g_vox_noise_detected;
|
||||
uint16_t g_vox_resume_count_down;
|
||||
uint16_t g_vox_pause_count_down;
|
||||
#endif
|
||||
bool g_SquelchLost;
|
||||
uint8_t gFlashLightState;
|
||||
volatile uint16_t gFlashLightBlinkCounter;
|
||||
bool gFlagEndTransmission;
|
||||
uint16_t gLowBatteryCountdown;
|
||||
uint8_t gNextChannel;
|
||||
ReceptionMode_t gRxReceptionMode;
|
||||
bool g_squelch_lost;
|
||||
uint8_t g_flash_light_state;
|
||||
volatile uint16_t g_flash_light_bBlink_counter;
|
||||
bool g_flag_end_tx;
|
||||
uint16_t g_low_batteryCountdown;
|
||||
uint8_t g_next_channel;
|
||||
reception_mode_t g_rx_reception_mode;
|
||||
|
||||
uint8_t gRestoreUSER_CHANNEL;
|
||||
enum scan_next_chan_t gCurrentScanList;
|
||||
uint32_t gRestoreFrequency;
|
||||
uint8_t g_restore_channel;
|
||||
scan_next_chan_t g_current_scan_list;
|
||||
uint32_t g_restore_frequency;
|
||||
|
||||
bool gRxVfoIsActive;
|
||||
bool g_rx_vfo_is_active;
|
||||
#ifdef ENABLE_ALARM
|
||||
uint8_t gAlarmToneCounter;
|
||||
uint16_t gAlarmRunningCounter;
|
||||
uint8_t g_alarm_tone_counter;
|
||||
uint16_t g_alarm_running_counter;
|
||||
#endif
|
||||
bool gKeyBeingHeld;
|
||||
bool gPttIsPressed;
|
||||
uint8_t gPttDebounceCounter;
|
||||
uint8_t gMenuListCount;
|
||||
uint8_t gBackup_cross_vfo_rx_tx;
|
||||
uint8_t gScanDelay_10ms;
|
||||
bool g_key_being_held;
|
||||
bool g_ptt_is_pressed;
|
||||
uint8_t g_ptt_debounce_counter;
|
||||
uint8_t g_menu_list_count;
|
||||
uint8_t g_backup_cross_vfo_rx_tx;
|
||||
uint8_t g_scan_delay_10ms;
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
uint8_t gAircopySendCountdown;
|
||||
uint8_t g_air_copy_send_count_down;
|
||||
#endif
|
||||
uint8_t gFSKWriteIndex;
|
||||
uint8_t g_fsk_wite_index;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
bool gIsNoaaMode;
|
||||
uint8_t gNoaaChannel;
|
||||
bool g_is_noaa_mode;
|
||||
uint8_t g_noaa_channel;
|
||||
#endif
|
||||
|
||||
bool gUpdateDisplay;
|
||||
bool g_update_display;
|
||||
|
||||
bool gF_LOCK = false;
|
||||
bool g_f_lock = false;
|
||||
|
||||
uint8_t gShowChPrefix;
|
||||
uint8_t g_show_chan_prefix;
|
||||
|
||||
volatile bool gNextTimeslice;
|
||||
volatile uint8_t gFoundCDCSSCountdown_10ms;
|
||||
volatile uint8_t gFoundCTCSSCountdown_10ms;
|
||||
volatile bool g_next_time_slice;
|
||||
volatile uint8_t g_found_CDCSS_count_down_10ms;
|
||||
volatile uint8_t g_found_CTCSS_count_down_10ms;
|
||||
#ifdef ENABLE_VOX
|
||||
volatile uint16_t gVoxStopCountdown_10ms;
|
||||
volatile uint16_t g_vox_stop_count_down_10ms;
|
||||
#endif
|
||||
volatile bool gNextTimeslice40ms;
|
||||
volatile bool g_next_time_slice_40ms;
|
||||
#ifdef ENABLE_NOAA
|
||||
volatile uint16_t gNOAACountdown_10ms = 0;
|
||||
volatile bool gScheduleNOAA = true;
|
||||
volatile uint16_t g_noaa_count_down_10ms = 0;
|
||||
volatile bool g_schedule_noaa = true;
|
||||
#endif
|
||||
volatile bool gFlagTailNoteEliminationComplete;
|
||||
volatile bool g_flag_tail_tone_elimination_complete;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
volatile bool gScheduleFM;
|
||||
volatile bool g_schedule_fm;
|
||||
#endif
|
||||
|
||||
volatile uint8_t boot_counter_10ms;
|
||||
volatile uint8_t g_boot_counter_10ms;
|
||||
|
||||
int16_t gCurrentRSSI[2] = {0, 0}; // now one per VFO
|
||||
int16_t g_current_rssi[2] = {0, 0}; // now one per VFO
|
||||
|
||||
uint8_t gIsLocked = 0xFF;
|
||||
uint8_t g_is_locked = 0xFF;
|
||||
|
||||
unsigned int get_rx_VFO(void)
|
||||
unsigned int get_RX_VFO(void)
|
||||
{
|
||||
unsigned int rx_vfo = g_eeprom.tx_vfo;
|
||||
if (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_CHAN_B)
|
||||
@ -281,7 +282,7 @@ unsigned int get_rx_VFO(void)
|
||||
return rx_vfo;
|
||||
}
|
||||
|
||||
unsigned int get_tx_VFO(void)
|
||||
unsigned int get_TX_VFO(void)
|
||||
{
|
||||
unsigned int tx_vfo = g_eeprom.tx_vfo;
|
||||
if (g_eeprom.cross_vfo_rx_tx == CROSS_BAND_CHAN_B)
|
||||
|
Reference in New Issue
Block a user