diff --git a/am_fix.c b/am_fix.c index cb0e732..d6c46a8 100644 --- a/am_fix.c +++ b/am_fix.c @@ -104,10 +104,10 @@ static const t_gain_table gain_table[] = {0x005E, -50}, // 1 .. 0 2 3 6 .. -33dB -14dB 0dB -3dB .. -50dB {0x015E, -47}, // 2 .. 1 2 3 6 .. -30dB -14dB 0dB -3dB .. -47dB {0x025E, -41}, // 3 .. 2 2 3 6 .. -24dB -14dB 0dB -3dB .. -41dB - {0x035E, -17} // 4 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original + {0x035E, -17} // 4 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB }; -static const unsigned int original_index = 3; +static const unsigned int original_index = 0; #else {0x0000, -98}, // 1 .. 0 0 0 0 .. -33dB -24dB -8dB -33dB .. -98dB diff --git a/app/app.c b/app/app.c index 5222058..d7944db 100644 --- a/app/app.c +++ b/app/app.c @@ -647,11 +647,19 @@ void APP_stop_scan(void) static void APP_next_freq(void) { - uint32_t freq = g_rx_vfo->freq_config_rx.frequency; - const uint32_t step = g_rx_vfo->step_freq; + uint32_t freq = g_tx_vfo->freq_config_rx.frequency; + const uint32_t step = g_tx_vfo->step_freq; const frequency_band_t band = FREQUENCY_GetBand(freq); - const uint32_t upper = FREQ_BAND_TABLE[band].upper; - const uint32_t lower = FREQ_BAND_TABLE[band].lower; + uint32_t upper = FREQ_BAND_TABLE[band].upper; + uint32_t lower = FREQ_BAND_TABLE[band].lower; + + if (band == BAND2_108MHz) + { // air band + if (freq < 11800000) + upper = 11800000; // lower airband half + else + lower = 11800000; // upper airband half + } #ifdef ENABLE_SCAN_IGNORE_LIST do { @@ -671,9 +679,9 @@ static void APP_next_freq(void) } while (FI_freq_ignored(freq) >= 0); #endif - g_rx_vfo->freq_in_channel = 0xff; + g_tx_vfo->freq_in_channel = 0xff; - g_rx_vfo->freq_config_rx.frequency = freq; + g_tx_vfo->freq_config_rx.frequency = freq; #if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG) // UART_printf("APP_next_freq %u %u\r\n", freq, new_band); @@ -682,8 +690,8 @@ static void APP_next_freq(void) #if 0 // original slower method - RADIO_ApplyOffset(g_rx_vfo, false); - RADIO_ConfigureSquelchAndOutputPower(g_rx_vfo); + RADIO_ApplyOffset(g_tx_vfo, false); + RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo); RADIO_setup_registers(true); @@ -696,10 +704,11 @@ static void APP_next_freq(void) #else // don't need to go through all the other stuff .. speed things up !! -// RADIO_ApplyOffset(g_rx_vfo, false); + BK4819_set_rf_frequency(g_tx_vfo->freq_config_rx.frequency, true); + BK4819_set_rf_filter_path(g_tx_vfo->freq_config_rx.frequency); - BK4819_set_rf_frequency(g_rx_vfo->freq_config_rx.frequency, true); - BK4819_set_rf_filter_path(g_rx_vfo->freq_config_rx.frequency); + RADIO_ApplyOffset(g_tx_vfo, false); + RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo); #ifdef ENABLE_FASTER_CHANNEL_SCAN //g_scan_pause_tick_10ms = 10; // 100ms diff --git a/app/main.c b/app/main.c index 5f91e17..e220c7e 100644 --- a/app/main.c +++ b/app/main.c @@ -1004,8 +1004,16 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t directio uint32_t freq = g_tx_vfo->freq_config_rx.frequency; const uint32_t step = g_tx_vfo->step_freq; const frequency_band_t band = FREQUENCY_GetBand(freq); - const uint32_t upper = FREQ_BAND_TABLE[band].upper; - const uint32_t lower = FREQ_BAND_TABLE[band].lower; + uint32_t upper = FREQ_BAND_TABLE[band].upper; + uint32_t lower = FREQ_BAND_TABLE[band].lower; + + if (band == BAND2_108MHz) + { // air band + if (freq < 11800000) + upper = 11800000; // lower airband half + else + lower = 11800000; // upper airband half + } freq += step * direction; @@ -1015,7 +1023,7 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t directio while (freq < lower) freq += upper - lower; - if (band == BAND2_108MHz) // air band uses set channels. so round to those channels + if (band == BAND2_108MHz) // air band uses set channels freq = lower + ((((freq - lower) + (step / 2)) / step) * step); if (FREQUENCY_rx_freq_check(freq) < 0) @@ -1026,8 +1034,6 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t directio g_tx_vfo->freq_config_rx.frequency = freq; - RADIO_ApplyOffset(g_tx_vfo, false); - // find the first channel that contains this frequency .. currently takes too long // //if (!key_held && key_pressed) @@ -1037,6 +1043,9 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t directio g_tx_vfo->freq_in_channel = 0xff; #if 0 + RADIO_ApplyOffset(g_tx_vfo, false); + RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo); + // original slow method g_request_save_channel = 1; #else @@ -1053,12 +1062,14 @@ void MAIN_Key_UP_DOWN(bool key_pressed, bool key_held, scan_state_dir_t directio g_manual_scanning = true; g_monitor_enabled = true; GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); -// APP_start_listening(); } #endif BK4819_set_rf_frequency(freq, true); // set the VCO/PLL BK4819_set_rf_filter_path(freq); // set the proper LNA/PA filter path + + RADIO_ApplyOffset(g_tx_vfo, false); + RADIO_ConfigureSquelchAndOutputPower(g_tx_vfo); #endif return; diff --git a/firmware.bin b/firmware.bin index 98fc812..a96a8fa 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index e8cb5c1..b30f5f6 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ