mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
.
This commit is contained in:
parent
7a03bbcf64
commit
26da598d56
10
app/main.c
10
app/main.c
@ -281,6 +281,10 @@ void processFKeyFunction(const key_code_t Key)
|
||||
|
||||
g_request_display_screen = DISPLAY_MAIN;
|
||||
|
||||
#ifdef ENABLE_PANADAPTER
|
||||
PAN_restart(true);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
||||
case KEY_2: // A/B
|
||||
@ -1108,7 +1112,7 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t directio
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_PANADAPTER
|
||||
g_panadapter_vfo_tick = 20; // 200ms
|
||||
PAN_restart(false);
|
||||
#endif
|
||||
|
||||
BK4819_set_rf_frequency(freq, true); // set the VCO/PLL
|
||||
@ -1126,6 +1130,10 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t directio
|
||||
|
||||
g_tx_vfo->freq_in_channel = 0xff;
|
||||
|
||||
#ifdef ENABLE_PANADAPTER
|
||||
PAN_restart(true);
|
||||
#endif
|
||||
|
||||
Next = RADIO_FindNextChannel(Channel + direction, direction, false, 0);
|
||||
if (Next == 0xFF)
|
||||
return;
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
17
panadapter.c
17
panadapter.c
@ -33,6 +33,14 @@ int panadapter_delay; // used to give the VCO/PLL/RSSI time t
|
||||
|
||||
const uint8_t panadapter_min_rssi = (-147 + 160) * 2; // -147dBm (S0) min RSSI value
|
||||
|
||||
inline void PAN_restart(const bool full)
|
||||
{
|
||||
if (full)
|
||||
g_panadapter_cycles = 0;
|
||||
panadapter_rssi_index = 0;
|
||||
panadapter_delay = 3;
|
||||
}
|
||||
|
||||
bool PAN_scanning(void)
|
||||
{
|
||||
return (g_eeprom.config.setting.panadapter && g_panadapter_enabled && g_panadapter_vfo_tick <= 0) ? true : false;
|
||||
@ -143,7 +151,6 @@ void PAN_process_10ms(void)
|
||||
PAN_set_freq();
|
||||
g_update_display = true;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -156,10 +163,8 @@ void PAN_process_10ms(void)
|
||||
|
||||
if (!g_panadapter_enabled)
|
||||
{ // enable the panadapter
|
||||
PAN_restart(false);
|
||||
g_panadapter_vfo_tick = 0;
|
||||
panadapter_rssi_index = 0;
|
||||
panadapter_delay = 3; // give the VCO/PLL/RSSI a little more time to settle
|
||||
// g_panadapter_cycles = 0;
|
||||
g_panadapter_enabled = true;
|
||||
PAN_set_freq();
|
||||
g_update_display = true;
|
||||
@ -168,8 +173,8 @@ void PAN_process_10ms(void)
|
||||
|
||||
if (panadapter_rssi_index < 0)
|
||||
{ // guess we've just come out of TX mode
|
||||
PAN_restart(false);
|
||||
PAN_set_freq();
|
||||
panadapter_rssi_index = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -217,7 +222,7 @@ void PAN_process_10ms(void)
|
||||
panadapter_delay = 3; // give the VCO/PLL/RSSI a little more time to settle
|
||||
}
|
||||
|
||||
if (g_tx_vfo->channel.mod_mode == MOD_MODE_FM)
|
||||
if (g_tx_vfo->channel.mod_mode == MOD_MODE_FM && g_panadapter_cycles > 0)
|
||||
{ // switch back to the VFO/center frequency for 100ms once every 400ms
|
||||
g_panadapter_vfo_tick = ((panadapter_rssi_index % 40) == 0) ? 10 : 0;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ extern uint8_t g_panadapter_rssi[PANADAPTER_BINS + 1 + PANADAPTER_BINS];
|
||||
extern uint8_t g_panadapter_max_rssi;
|
||||
extern uint8_t g_panadapter_min_rssi;
|
||||
|
||||
void PAN_restart(const bool full);
|
||||
bool PAN_scanning(void);
|
||||
void PAN_process_10ms(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user