mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
fix tx offset entry in menu "Tx OFS"
This commit is contained in:
parent
4397931cfb
commit
39fdb7ed33
2
Makefile
2
Makefile
@ -12,7 +12,7 @@ ENABLE_OVERLAY := 0
|
||||
ENABLE_LTO := 1
|
||||
# UART Programming 2.9 kB
|
||||
ENABLE_UART := 1
|
||||
ENABLE_UART_DEBUG := 0
|
||||
ENABLE_UART_DEBUG := 1
|
||||
# AirCopy 2.5 kB
|
||||
ENABLE_AIRCOPY := 1
|
||||
ENABLE_AIRCOPY_REMEMBER_FREQ := 1
|
||||
|
113
am_fix.c
113
am_fix.c
@ -86,8 +86,8 @@
|
||||
// if I don't add the brackets, reading the table returns unexpected/different values !!!
|
||||
//
|
||||
//
|
||||
//// static const int16_t lna_short_dB[] = { -19, -16, -11, 0}; // was (but wrong)
|
||||
// static const int16_t lna_short_dB[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
||||
//// static const int16_t lnas_dB[] = { -19, -16, -11, 0}; // was (but wrong)
|
||||
// static const int16_t lnas_dB[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
||||
// static const int16_t lna_dB[] = { (-24), (-19), (-14), ( -9), (-6), (-4), (-2), 0};
|
||||
// static const int16_t mixer_dB[] = { ( -8), ( -6), ( -3), 0};
|
||||
// static const int16_t pga_dB[] = { (-33), (-27), (-21), (-15), (-9), (-6), (-3), 0};
|
||||
@ -96,7 +96,7 @@
|
||||
//
|
||||
static const t_gain_table gain_table[] =
|
||||
{
|
||||
{0x035E, -17}, // 0 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||
{0x03BE, -7}, // 3 5 3 6 .. 0dB -4dB 0dB -3dB .. -7dB original
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
|
||||
@ -199,15 +199,15 @@
|
||||
{0x038F, -12}, // 85 .. 3 4 1 7 .. 0dB -6dB -6dB 0dB .. -12dB
|
||||
{0x03E6, -11}, // 86 .. 3 7 0 6 .. 0dB 0dB -8dB -3dB .. -11dB
|
||||
{0x03AF, -10}, // 87 .. 3 5 1 7 .. 0dB -4dB -6dB 0dB .. -10dB
|
||||
{0x03F5, -9 }, // 88 .. 3 7 2 5 .. 0dB 0dB -3dB -6dB .. -9dB
|
||||
{0x03D6, -8 }, // 89 .. 3 6 2 6 .. 0dB -2dB -3dB -3dB .. -8dB
|
||||
{0x03BE, -7 }, // 90 .. 3 5 3 6 .. 0dB -4dB 0dB -3dB .. -7dB original
|
||||
{0x03F6, -6 }, // 91 .. 3 7 2 6 .. 0dB 0dB -3dB -3dB .. -6dB
|
||||
{0x03DE, -5 }, // 92 .. 3 6 3 6 .. 0dB -2dB 0dB -3dB .. -5dB
|
||||
{0x03BF, -4 }, // 93 .. 3 5 3 7 .. 0dB -4dB 0dB 0dB .. -4dB
|
||||
{0x03F7, -3 }, // 94 .. 3 7 2 7 .. 0dB 0dB -3dB 0dB .. -3dB
|
||||
{0x03DF, -2 }, // 95 .. 3 6 3 7 .. 0dB -2dB 0dB 0dB .. -2dB
|
||||
{0x03FF, 0 }, // 96 .. 3 7 3 7 .. 0dB 0dB 0dB 0dB .. 0dB
|
||||
{0x03F5, -9}, // 88 .. 3 7 2 5 .. 0dB 0dB -3dB -6dB .. -9dB
|
||||
{0x03D6, -8}, // 89 .. 3 6 2 6 .. 0dB -2dB -3dB -3dB .. -8dB
|
||||
{0x03BE, -7}, // 90 .. 3 5 3 6 .. 0dB -4dB 0dB -3dB .. -7dB original
|
||||
{0x03F6, -6}, // 91 .. 3 7 2 6 .. 0dB 0dB -3dB -3dB .. -6dB
|
||||
{0x03DE, -5}, // 92 .. 3 6 3 6 .. 0dB -2dB 0dB -3dB .. -5dB
|
||||
{0x03BF, -4}, // 93 .. 3 5 3 7 .. 0dB -4dB 0dB 0dB .. -4dB
|
||||
{0x03F7, -3}, // 94 .. 3 7 2 7 .. 0dB 0dB -3dB 0dB .. -3dB
|
||||
{0x03DF, -2}, // 95 .. 3 6 3 7 .. 0dB -2dB 0dB 0dB .. -2dB
|
||||
{0x03FF, 0}, // 96 .. 3 7 3 7 .. 0dB 0dB 0dB 0dB .. 0dB
|
||||
};
|
||||
|
||||
static const unsigned int original_index = 90;
|
||||
@ -217,7 +217,7 @@
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
// display update rate
|
||||
static const unsigned int display_update_rate = 250 / 10; // max 250ms display update rate
|
||||
unsigned int counter = 0;
|
||||
unsigned int display_update_tick = 0;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
@ -230,78 +230,57 @@
|
||||
// used simply to detect a changed gain setting
|
||||
unsigned int gain_table_index_prev[2] = {0, 0};
|
||||
|
||||
// holds the previous RSSI level .. we do an average of old + new RSSI reading
|
||||
int16_t prev_rssi[2] = {0, 0};
|
||||
|
||||
// to help reduce gain hunting, peak hold count down tick
|
||||
unsigned int hold_counter[2] = {0, 0};
|
||||
|
||||
// holds the previous RSSI level .. we do an average of old + new RSSI reading
|
||||
int16_t prev_rssi[2] = {0, 0};
|
||||
|
||||
// used to correct the RSSI readings after our RF gain adjustments
|
||||
int16_t rssi_gain_diff[2] = {0, 0};
|
||||
|
||||
// used to limit the max RF gain
|
||||
unsigned int max_index = ARRAY_SIZE(gain_table) - 1;
|
||||
|
||||
#ifndef ENABLE_AM_FIX_TEST1
|
||||
// -89dBm, any higher and the AM demodulator starts to saturate/clip/distort
|
||||
// -89 dBm, any higher and the AM demodulator starts to saturate/clip/distort
|
||||
const int16_t desired_rssi = (-89 + 160) * 2;
|
||||
#endif
|
||||
|
||||
void AM_fix_init(void)
|
||||
{ // called at boot-up
|
||||
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
unsigned int vfo;
|
||||
for (vfo = 0; vfo < 2; vfo++)
|
||||
{
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
gain_table_index[i] = 1 + g_setting_am_fix_test1;
|
||||
gain_table_index[vfo] = 1 + g_setting_am_fix_test1;
|
||||
#else
|
||||
gain_table_index[i] = original_index; // re-start with original QS setting
|
||||
gain_table_index[vfo] = original_index; // re-start with original QS setting
|
||||
#endif
|
||||
// AM_fix_reset(vfo);
|
||||
}
|
||||
|
||||
#if 0
|
||||
{ // set a maximum gain to use
|
||||
// const int16_t max_gain_dB = gain_dB[original_index];
|
||||
const int16_t max_gain_dB = -10;
|
||||
|
||||
max_index = ARRAY_SIZE(gain_table);
|
||||
while (--max_index > 1)
|
||||
// if (gain_dB[max_index] <= max_gain_dB)
|
||||
if (gain_table[max_index].gain_dB <= max_gain_dB)
|
||||
break;
|
||||
}
|
||||
#else
|
||||
// use the full range of available gains
|
||||
max_index = ARRAY_SIZE(gain_table) - 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void AM_fix_reset(const int vfo)
|
||||
{ // reset the AM fixer upper
|
||||
|
||||
if (vfo < 0 || vfo >= 2)
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
counter = 0;
|
||||
display_update_tick = 0;
|
||||
#endif
|
||||
|
||||
prev_rssi[vfo] = 0;
|
||||
|
||||
hold_counter[vfo] = 0;
|
||||
|
||||
rssi_gain_diff[vfo] = 0;
|
||||
|
||||
gain_table_index_prev[vfo] = 0;
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
// gain_table_index[vfo] = 1 + g_setting_am_fix_test1;
|
||||
#else
|
||||
// gain_table_index[vfo] = original_index; // re-start with original QS setting
|
||||
#endif
|
||||
|
||||
gain_table_index_prev[vfo] = 0;
|
||||
}
|
||||
|
||||
// adjust the RX gain to try and prevent the AM demodulator from
|
||||
// saturating/overloading/clipping (distorted AM audio)
|
||||
// saturating (distorted AM audio)
|
||||
//
|
||||
// we're actually doing the BK4819's job for it here, but as the chip
|
||||
// won't/don't do it for itself, we're left to bodging it ourself by
|
||||
@ -318,31 +297,31 @@
|
||||
case FUNCTION_PANADAPTER:
|
||||
case FUNCTION_POWER_SAVE:
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
counter = display_update_rate; // queue up a display update as soon as we switch to RX mode
|
||||
display_update_tick = display_update_rate; // queue up a display update as soon as we switch to RX mode
|
||||
#endif
|
||||
return;
|
||||
|
||||
// only adjust stuff if we're in one of these modes
|
||||
case FUNCTION_FOREGROUND:
|
||||
case FUNCTION_NEW_RECEIVE:
|
||||
case FUNCTION_RECEIVE:
|
||||
case FUNCTION_MONITOR:
|
||||
case FUNCTION_NEW_RECEIVE:
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
if (counter > 0)
|
||||
if (display_update_tick > 0)
|
||||
{
|
||||
if (++counter >= display_update_rate)
|
||||
if (++display_update_tick >= display_update_rate)
|
||||
{ // trigger a display update
|
||||
counter = 0;
|
||||
display_update_tick = 0;
|
||||
g_update_display = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // sample the current RSSI level
|
||||
// average it with the previous rssi (a bit of noise/spike immunity)
|
||||
// average it with the previous rssi (a teeny bit of noise/spike immunity)
|
||||
const int16_t new_rssi = BK4819_GetRSSI();
|
||||
rssi = (prev_rssi[vfo] > 0) ? (prev_rssi[vfo] + new_rssi) / 2 : new_rssi;
|
||||
prev_rssi[vfo] = new_rssi;
|
||||
@ -356,9 +335,9 @@
|
||||
{
|
||||
g_current_rssi[vfo] = new_rssi;
|
||||
|
||||
if (counter == 0)
|
||||
if (display_update_tick == 0)
|
||||
{ // trigger a display update
|
||||
counter = 1;
|
||||
display_update_tick = 1;
|
||||
g_update_display = true;
|
||||
}
|
||||
}
|
||||
@ -418,11 +397,11 @@
|
||||
index--; // slow step-by-step gain reduction
|
||||
}
|
||||
|
||||
index = (index < 1) ? 1 : (index > max_index) ? max_index : index;
|
||||
index = (index < 1) ? 1 : (index > (ARRAY_SIZE(gain_table) - 1)) ? ARRAY_SIZE(gain_table) - 1 : index;
|
||||
|
||||
if (gain_table_index[vfo] != index)
|
||||
{
|
||||
gain_table_index[vfo] = index;
|
||||
gain_table_index[vfo] = index; // save new gain setting to use
|
||||
hold_counter[vfo] = 30; // 300ms hold
|
||||
}
|
||||
}
|
||||
@ -433,23 +412,19 @@
|
||||
if (hold_counter[vfo] == 0)
|
||||
{ // hold has been released, we're free to increase gain
|
||||
const unsigned int index = gain_table_index[vfo] + 1; // move up to next gain index
|
||||
gain_table_index[vfo] = (index <= max_index) ? index : max_index; // limit the gain index
|
||||
gain_table_index[vfo] = (index < ARRAY_SIZE(gain_table)) ? index : ARRAY_SIZE(gain_table) - 1; // limit the gain level we use
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (gain_table_index[vfo] == gain_table_index_prev[vfo])
|
||||
return; // no gain change - this is to reduce writing to the BK chip on ever call
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
{ // apply the new settings to the front end registers
|
||||
|
||||
const unsigned int index = gain_table_index[vfo];
|
||||
|
||||
// remember the new table index
|
||||
// remember the new gain table index
|
||||
gain_table_index_prev[vfo] = index;
|
||||
|
||||
// set the RF front end gains
|
||||
BK4819_WriteRegister(0x13, gain_table[index].reg_val);
|
||||
|
||||
// offset the RSSI reading to the rest of the firmware to cancel out the gain adjustments we make
|
||||
@ -462,9 +437,9 @@
|
||||
g_current_rssi[vfo] = rssi - rssi_gain_diff[vfo];
|
||||
|
||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||
if (counter == 0)
|
||||
if (display_update_tick == 0)
|
||||
{
|
||||
counter = 1;
|
||||
display_update_tick = 1;
|
||||
g_update_display = true;
|
||||
}
|
||||
#endif
|
||||
@ -479,7 +454,7 @@
|
||||
const unsigned int index = gain_table_index[vfo];
|
||||
// sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_table[index].gain_dB, prev_rssi[vfo]);
|
||||
sprintf(s, "%2u %4ddB %3u", index, gain_table[index].gain_dB, prev_rssi[vfo]);
|
||||
counter = 0;
|
||||
display_update_tick = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ void AIRCOPY_init(void)
|
||||
|
||||
g_fsk_write_index = 0;
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off
|
||||
BK4819_start_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
|
||||
BK4819_start_aircopy_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
|
||||
}
|
||||
@ -281,13 +281,13 @@ void AIRCOPY_process_fsk_tx_10ms(void)
|
||||
if (g_aircopy_state == AIRCOPY_RX)
|
||||
{
|
||||
g_fsk_write_index = 0;
|
||||
BK4819_start_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
|
||||
BK4819_start_aircopy_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
|
||||
}
|
||||
else
|
||||
if (g_aircopy_state == AIRCOPY_TX)
|
||||
{
|
||||
g_fsk_write_index = 0;
|
||||
BK4819_start_fsk_rx(AIRCOPY_REQ_PACKET_SIZE);
|
||||
BK4819_start_aircopy_fsk_rx(AIRCOPY_REQ_PACKET_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,7 +352,7 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
{ // FSK RX is disabled, enable it
|
||||
g_fsk_write_index = 0;
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off
|
||||
BK4819_start_fsk_rx((g_aircopy_state == AIRCOPY_TX) ? AIRCOPY_REQ_PACKET_SIZE : AIRCOPY_DATA_PACKET_SIZE);
|
||||
BK4819_start_aircopy_fsk_rx((g_aircopy_state == AIRCOPY_TX) ? AIRCOPY_REQ_PACKET_SIZE : AIRCOPY_DATA_PACKET_SIZE);
|
||||
}
|
||||
|
||||
status = BK4819_ReadRegister(0x0C);
|
||||
@ -415,7 +415,7 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
|
||||
// restart the RX
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off
|
||||
BK4819_start_fsk_rx((g_aircopy_state == AIRCOPY_TX) ? AIRCOPY_REQ_PACKET_SIZE : AIRCOPY_DATA_PACKET_SIZE);
|
||||
BK4819_start_aircopy_fsk_rx((g_aircopy_state == AIRCOPY_TX) ? AIRCOPY_REQ_PACKET_SIZE : AIRCOPY_DATA_PACKET_SIZE);
|
||||
|
||||
g_update_display = true;
|
||||
|
||||
@ -601,7 +601,7 @@ send_req:
|
||||
}
|
||||
AIRCOPY_stop_fsk_tx();
|
||||
|
||||
BK4819_start_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
|
||||
BK4819_start_aircopy_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
|
||||
}
|
||||
|
||||
static void AIRCOPY_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
@ -733,7 +733,7 @@ static void AIRCOPY_Key_EXIT(bool key_pressed, bool key_held)
|
||||
g_aircopy_rx_errors_crc = 0;
|
||||
g_aircopy_state = AIRCOPY_RX;
|
||||
|
||||
BK4819_start_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
|
||||
BK4819_start_aircopy_fsk_rx(AIRCOPY_DATA_PACKET_SIZE);
|
||||
|
||||
g_update_display = true;
|
||||
GUI_DisplayScreen();
|
||||
|
12
app/app.c
12
app/app.c
@ -69,7 +69,7 @@
|
||||
|
||||
// original QS front end register settings
|
||||
// 0x03BE 00000 011 101 11 110
|
||||
const uint8_t orig_lna_short = 3; // 0dB
|
||||
const uint8_t orig_lnas = 3; // 0dB
|
||||
const uint8_t orig_lna = 5; // -4dB
|
||||
const uint8_t orig_mixer = 3; // 0dB
|
||||
const uint8_t orig_pga = 6; // -3dB
|
||||
@ -558,12 +558,6 @@ bool APP_start_listening(function_type_t Function, const bool reset_am_fix)
|
||||
#ifdef ENABLE_AM_FIX
|
||||
{ // RF RX front end gain
|
||||
|
||||
// original setting
|
||||
uint16_t lna_short = orig_lna_short;
|
||||
uint16_t lna = orig_lna;
|
||||
uint16_t mixer = orig_mixer;
|
||||
uint16_t pga = orig_pga;
|
||||
|
||||
if (g_rx_vfo->am_mode && g_setting_am_fix)
|
||||
{ // AM RX mode
|
||||
if (reset_am_fix)
|
||||
@ -571,8 +565,8 @@ bool APP_start_listening(function_type_t Function, const bool reset_am_fix)
|
||||
AM_fix_10ms(chan);
|
||||
}
|
||||
else
|
||||
{
|
||||
BK4819_WriteRegister(0x13, (lna_short << 8) | (lna << 5) | (mixer << 3) | (pga << 0));
|
||||
{ // original setting
|
||||
BK4819_WriteRegister(0x13, (orig_lnas << 8) | (orig_lna << 5) | (orig_mixer << 3) | (orig_pga << 0));
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "frequencies.h"
|
||||
#include "radio.h"
|
||||
|
||||
extern const uint8_t orig_lna_short;
|
||||
extern const uint8_t orig_lnas;
|
||||
extern const uint8_t orig_lna;
|
||||
extern const uint8_t orig_mixer;
|
||||
extern const uint8_t orig_pga;
|
||||
|
91
app/menu.c
91
app/menu.c
@ -32,6 +32,7 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "driver/uart.h"
|
||||
#include "frequencies.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
@ -44,10 +45,6 @@
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
void writeXtalFreqCal(const int32_t value, const bool update_eeprom)
|
||||
{
|
||||
@ -1442,7 +1439,7 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
||||
{
|
||||
uint32_t Frequency;
|
||||
|
||||
if (g_input_box_index < 6)
|
||||
if (g_input_box_index < 8)
|
||||
{ // not yet enough characters
|
||||
#ifdef ENABLE_VOICE
|
||||
g_another_voice_id = (voice_id_t)Key;
|
||||
@ -1457,7 +1454,23 @@ static void MENU_Key_0_to_9(key_code_t Key, bool key_pressed, bool key_held)
|
||||
NUMBER_Get(g_input_box, &Frequency);
|
||||
g_input_box_index = 0;
|
||||
|
||||
g_sub_menu_selection = FREQUENCY_floor_to_step(Frequency + (g_tx_vfo->step_freq / 2), g_tx_vfo->step_freq, 0, Frequency + (g_tx_vfo->step_freq / 2));
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("offset 3 %u\r\n", Frequency);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
{ // round
|
||||
const uint32_t step_size = g_tx_vfo->step_freq;
|
||||
Frequency = ((Frequency + (step_size / 2)) / step_size) * step_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("offset 4 %u\r\n", Frequency);
|
||||
#endif
|
||||
|
||||
g_sub_menu_selection = Frequency;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1617,16 +1630,16 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
|
||||
|
||||
if (!g_in_sub_menu)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
#ifdef ENABLE_VOICE
|
||||
if (g_menu_cursor != MENU_SCRAMBLER)
|
||||
g_another_voice_id = g_menu_list[g_menu_list_sorted[g_menu_cursor]].voice_id;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
#if 1
|
||||
if (g_menu_cursor == MENU_MEM_DEL || g_menu_cursor == MENU_MEM_NAME)
|
||||
if (!RADIO_CheckValidChannel(g_sub_menu_selection, false, 0))
|
||||
return; // invalid channel
|
||||
#endif
|
||||
#endif
|
||||
|
||||
g_ask_for_confirmation = 0;
|
||||
g_in_sub_menu = true;
|
||||
@ -1705,18 +1718,18 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
|
||||
|
||||
if (g_menu_cursor == MENU_RESET)
|
||||
{
|
||||
#ifdef ENABLE_VOICE
|
||||
#ifdef ENABLE_VOICE
|
||||
AUDIO_SetVoiceID(0, VOICE_ID_CONFIRM);
|
||||
AUDIO_PlaySingleVoice(true);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
MENU_AcceptSetting();
|
||||
|
||||
#if defined(ENABLE_OVERLAY)
|
||||
#if defined(ENABLE_OVERLAY)
|
||||
overlay_FLASH_RebootToBootloader();
|
||||
#else
|
||||
#else
|
||||
NVIC_SystemReset();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
g_flag_accept_setting = true;
|
||||
@ -1737,12 +1750,12 @@ static void MENU_Key_MENU(const bool key_pressed, const bool key_held)
|
||||
g_update_status = true;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
#ifdef ENABLE_VOICE
|
||||
if (g_menu_cursor == MENU_SCRAMBLER)
|
||||
g_another_voice_id = (g_sub_menu_selection == 0) ? VOICE_ID_SCRAMBLER_OFF : VOICE_ID_SCRAMBLER_ON;
|
||||
else
|
||||
g_another_voice_id = VOICE_ID_CONFIRM;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
g_input_box_index = 0;
|
||||
}
|
||||
@ -1874,22 +1887,6 @@ static void MENU_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Direction)
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_menu_cursor == MENU_OFFSET)
|
||||
{
|
||||
int32_t Offset = (Direction * g_tx_vfo->step_freq) + g_sub_menu_selection;
|
||||
if (Offset < 99999990)
|
||||
{
|
||||
if (Offset < 0)
|
||||
Offset = 99999990;
|
||||
}
|
||||
else
|
||||
Offset = 0;
|
||||
|
||||
g_sub_menu_selection = FREQUENCY_floor_to_step(Offset, g_tx_vfo->step_freq, 0, Offset);
|
||||
g_request_display_screen = DISPLAY_MENU;
|
||||
return;
|
||||
}
|
||||
|
||||
VFO = 0;
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
@ -1897,6 +1894,34 @@ static void MENU_Key_UP_DOWN(bool key_pressed, bool key_held, int8_t Direction)
|
||||
|
||||
switch (g_menu_cursor)
|
||||
{
|
||||
case MENU_OFFSET:
|
||||
{
|
||||
const int32_t max_freq = 100000000;
|
||||
const int32_t step_size = g_tx_vfo->step_freq;
|
||||
int32_t offset = (int32_t)g_sub_menu_selection + (Direction * step_size);
|
||||
|
||||
// wrap
|
||||
if (offset >= max_freq)
|
||||
offset = 0;
|
||||
else
|
||||
if (offset < 0)
|
||||
offset = max_freq - step_size;
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("offset 1 %u %u\r\n", offset, step_size);
|
||||
#endif
|
||||
|
||||
offset = ((offset + (step_size / 2)) / step_size) * step_size; // round
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("offset 2 %u %u\r\n", offset, step_size);
|
||||
#endif
|
||||
|
||||
g_sub_menu_selection = offset;
|
||||
g_request_display_screen = DISPLAY_MENU;
|
||||
return;
|
||||
}
|
||||
|
||||
case MENU_MEM_DEL:
|
||||
case MENU_1_CALL:
|
||||
case MENU_MEM_NAME:
|
||||
|
199
driver/bk4819.c
199
driver/bk4819.c
@ -1348,8 +1348,8 @@ void BK4819_PlayDTMF(char Code)
|
||||
|
||||
if (index < 16)
|
||||
{
|
||||
BK4819_WriteRegister(0x71, (((uint32_t)tones[0][index] * 103244U) + 5000U) / 10000U); // with rounding
|
||||
BK4819_WriteRegister(0x72, (((uint32_t)tones[1][index] * 103244U) + 5000U) / 10000U); // with rounding
|
||||
BK4819_WriteRegister(0x71, (((uint32_t)tones[0][index] * 103244u) + 5000u) / 10000u); // with rounding
|
||||
BK4819_WriteRegister(0x72, (((uint32_t)tones[1][index] * 103244u) + 5000u) / 10000u); // with rounding
|
||||
}
|
||||
}
|
||||
|
||||
@ -1881,9 +1881,7 @@ uint8_t BK4819_GetCTCType(void)
|
||||
|
||||
void BK4819_reset_fsk(void)
|
||||
{
|
||||
BK4819_WriteRegister(0x3F, 0); // disable interrupts
|
||||
|
||||
BK4819_WriteRegister(0x59, // 0x0068); // 0 0 0 0 0 0 0 0 0110 1 000
|
||||
const uint16_t fsk_reg59 =
|
||||
(0u << 15) | // 0 or 1 1 = clear TX FIFO
|
||||
(0u << 14) | // 0 or 1 1 = clear RX FIFO
|
||||
(0u << 13) | // 0 or 1 1 = scramble
|
||||
@ -1894,13 +1892,17 @@ void BK4819_reset_fsk(void)
|
||||
(0u << 8) | // 0 or 1 ???
|
||||
(6u << 4) | // 0 ~ 15 preamble Length Selection
|
||||
(1u << 3) | // 0 or 1 sync length selection
|
||||
(0u << 0)); // 0 ~ 7 ???
|
||||
(0u << 0); // 0 ~ 7 ???
|
||||
|
||||
BK4819_WriteRegister(0x3F, 0); // disable interrupts
|
||||
BK4819_WriteRegister(0x59, (1u << 15) | (1u << 14) | fsk_reg59); // clear FIFO's
|
||||
BK4819_WriteRegister(0x59, (0u << 15) | (0u << 14) | fsk_reg59);
|
||||
BK4819_Idle();
|
||||
}
|
||||
|
||||
void BK4819_start_fsk_rx(const unsigned int packet_size)
|
||||
{
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
void BK4819_start_aircopy_fsk_rx(const unsigned int packet_size)
|
||||
{
|
||||
uint16_t fsk_reg59;
|
||||
|
||||
BK4819_reset_fsk();
|
||||
@ -1912,7 +1914,7 @@ void BK4819_start_fsk_rx(const unsigned int packet_size)
|
||||
|
||||
BK4819_RX_TurnOn();
|
||||
|
||||
// BK4819_WriteRegister(0x3F, BK4819_REG_3F_FSK_RX_FINISHED | BK4819_REG_3F_FSK_FIFO_ALMOST_FULL);
|
||||
// BK4819_WriteRegister(0x3F, BK4819_REG_3F_FSK_RX_FINISHED | BK4819_REG_3F_FSK_FIFO_ALMOST_FULL);
|
||||
BK4819_WriteRegister(0x3F, BK4819_REG_3F_FSK_RX_SYNC | BK4819_REG_3F_FSK_RX_FINISHED | BK4819_REG_3F_FSK_FIFO_ALMOST_FULL);
|
||||
|
||||
// REG_59
|
||||
@ -1960,19 +1962,179 @@ void BK4819_start_fsk_rx(const unsigned int packet_size)
|
||||
(0u << 10) | // 0 or 1 1 = invert data when RX
|
||||
(0u << 9) | // 0 or 1 1 = invert data when TX
|
||||
(0u << 8) | // 0 or 1 ???
|
||||
// (6u << 4) | // 0 ~ 15 preamble Length Selection
|
||||
// (6u << 4) | // 0 ~ 15 preamble Length Selection
|
||||
(4u << 4) | // 0 ~ 15 preamble Length Selection .. 1of11 .. a little shorter than the TX length
|
||||
(1u << 3) | // 0 or 1 sync length selection
|
||||
(0u << 0); // 0 ~ 7 ???
|
||||
|
||||
BK4819_WriteRegister(0x59, (1u << 14) | fsk_reg59); // clear RX fifo
|
||||
BK4819_WriteRegister(0x59, (1u << 13) | (1u << 12) | fsk_reg59); // enable scrambler, enable RX
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MDC1200
|
||||
void BK4819_enable_mdc1200_ffsk_rx(const bool enable)
|
||||
{
|
||||
// REG_70
|
||||
//
|
||||
// <15> 0 TONE-1
|
||||
// 1 = enable
|
||||
// 0 = disable
|
||||
//
|
||||
// <14:8> 0 TONE-1 gain
|
||||
//
|
||||
// <7> 0 TONE-2
|
||||
// 1 = enable
|
||||
// 0 = disable
|
||||
//
|
||||
// <6:0> 0 TONE-2 / FSK gain
|
||||
// 0 ~ 127
|
||||
//
|
||||
// enable tone-2, set gain
|
||||
|
||||
void BK4819_send_MDC1200(const uint8_t op, const uint8_t arg, const uint16_t id)
|
||||
{
|
||||
// REG_72
|
||||
//
|
||||
// <15:0> 0x2854 TONE-2 / FSK frequency control word
|
||||
// = freq(Hz) * 10.32444 for XTAL 13M / 26M or
|
||||
// = freq(Hz) * 10.48576 for XTAL 12.8M / 19.2M / 25.6M / 38.4M
|
||||
//
|
||||
// tone-2 = 1200Hz
|
||||
|
||||
// REG_58
|
||||
//
|
||||
// <15:13> 1 FSK TX mode selection
|
||||
// 0 = FSK 1.2K and FSK 2.4K TX .. no tones, direct FM
|
||||
// 1 = FFSK 1200 / 1800 TX
|
||||
// 2 = ???
|
||||
// 3 = FFSK 1200 / 2400 TX
|
||||
// 4 = ???
|
||||
// 5 = NOAA SAME TX
|
||||
// 6 = ???
|
||||
// 7 = ???
|
||||
//
|
||||
// <12:10> 0 FSK RX mode selection
|
||||
// 0 = FSK 1.2K, FSK 2.4K RX and NOAA SAME RX .. no tones, direct FM
|
||||
// 1 = ???
|
||||
// 2 = ???
|
||||
// 3 = ???
|
||||
// 4 = FFSK 1200 / 2400 RX
|
||||
// 5 = ???
|
||||
// 6 = ???
|
||||
// 7 = FFSK 1200 / 1800 RX
|
||||
//
|
||||
// <9:8> 0 FSK RX gain
|
||||
// 0 ~ 3
|
||||
//
|
||||
// <7:6> 0 ???
|
||||
// 0 ~ 3
|
||||
//
|
||||
// <5:4> 0 FSK preamble type selection
|
||||
// 0 = 0xAA or 0x55 due to the MSB of FSK sync byte 0
|
||||
// 1 = ???
|
||||
// 2 = 0x55
|
||||
// 3 = 0xAA
|
||||
//
|
||||
// <3:1> 1 FSK RX bandwidth setting
|
||||
// 0 = FSK 1.2K .. no tones, direct FM
|
||||
// 1 = FFSK 1200 / 1800
|
||||
// 2 = NOAA SAME RX
|
||||
// 3 = ???
|
||||
// 4 = FSK 2.4K and FFSK 1200 / 2400
|
||||
// 5 = ???
|
||||
// 6 = ???
|
||||
// 7 = ???
|
||||
//
|
||||
// <0> 1 FSK enable
|
||||
// 0 = disable
|
||||
// 1 = enable
|
||||
|
||||
// REG_5C
|
||||
//
|
||||
// <15:7> ???
|
||||
//
|
||||
// <6> 1 CRC option enable
|
||||
// 0 = disable
|
||||
// 1 = enable
|
||||
//
|
||||
// <5:0> ???
|
||||
//
|
||||
// disable CRC
|
||||
|
||||
// REG_5D
|
||||
//
|
||||
// set the packet size
|
||||
|
||||
if (enable)
|
||||
{
|
||||
BK4819_WriteRegister(0x70, // 0 0000000 1 1100000
|
||||
( 0u << 15) | // 0
|
||||
( 0u << 8) | // 0
|
||||
( 1u << 7) | // 1
|
||||
(96u << 0)); // 96 (127 looks better)
|
||||
|
||||
BK4819_WriteRegister(0x72, ((1200u * 103244) + 5000) / 10000); // with rounding
|
||||
|
||||
BK4819_WriteRegister(0x58, // 0x37C3); 001 101 11 11 00 001 1
|
||||
(1u << 13) | // 1 FSK TX mode selection
|
||||
// 0 = FSK 1.2K and FSK 2.4K TX .. no tones, direct FM
|
||||
// 1 = FFSK 1200 / 1800 TX
|
||||
// 2 = ???
|
||||
// 3 = FFSK 1200 / 2400 TX
|
||||
// 4 = ???
|
||||
// 5 = NOAA SAME TX
|
||||
// 6 = ???
|
||||
// 7 = ???
|
||||
//
|
||||
(7u << 10) | // 0 FSK RX mode selection
|
||||
// 0 = FSK 1.2K, FSK 2.4K RX and NOAA SAME RX .. no tones, direct FM
|
||||
// 1 = ???
|
||||
// 2 = ???
|
||||
// 3 = ???
|
||||
// 4 = FFSK 1200 / 2400 RX
|
||||
// 5 = ???
|
||||
// 6 = ???
|
||||
// 7 = FFSK 1200 / 1800 RX
|
||||
//
|
||||
(3u << 8) | // 0 FSK RX gain
|
||||
// 0 ~ 3
|
||||
//
|
||||
(3u << 6) | // 0 ???
|
||||
// 0 ~ 3
|
||||
//
|
||||
(0u << 4) | // 0 FSK preamble type selection
|
||||
// 0 = 0xAA or 0x55 due to the MSB of FSK sync byte 0
|
||||
// 1 = ???
|
||||
// 2 = 0x55
|
||||
// 3 = 0xAA
|
||||
//
|
||||
(1u << 1) | // 1 FSK RX bandwidth setting
|
||||
// 0 = FSK 1.2K .. no tones, direct FM
|
||||
// 1 = FFSK 1200 / 1800
|
||||
// 2 = NOAA SAME RX
|
||||
// 3 = ???
|
||||
// 4 = FSK 2.4K and FFSK 1200 / 2400
|
||||
// 5 = ???
|
||||
// 6 = ???
|
||||
// 7 = ???
|
||||
//
|
||||
(1u << 0)); // 1 FSK enable
|
||||
// 0 = disable
|
||||
// 1 = enable
|
||||
|
||||
// enable CRC ???
|
||||
BK4819_WriteRegister(0x5C, 0x5665); // 010101100 1 100101
|
||||
|
||||
BK4819_WriteRegister(0x5D, (15u << 8)); // packet size (16 bytes)
|
||||
}
|
||||
else
|
||||
{
|
||||
BK4819_WriteRegister(0x70, 0);
|
||||
BK4819_WriteRegister(0x58, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void BK4819_send_MDC1200(const uint8_t op, const uint8_t arg, const uint16_t id)
|
||||
{
|
||||
uint16_t fsk_reg59;
|
||||
uint8_t packet[42];
|
||||
|
||||
@ -1985,7 +2147,7 @@ void BK4819_send_MDC1200(const uint8_t op, const uint8_t arg, const uint16_t id)
|
||||
if (code_enabled)
|
||||
{ // need to turn off CTCSS/CDCSS
|
||||
BK4819_WriteRegister(0x51, BK4819_ReadRegister(0x51) & ~(1u << 15));
|
||||
// BK4819_ExitSubAu();
|
||||
// BK4819_ExitSubAu();
|
||||
SYSTEM_DelayMs(10);
|
||||
}
|
||||
|
||||
@ -1993,7 +2155,7 @@ void BK4819_send_MDC1200(const uint8_t op, const uint8_t arg, const uint16_t id)
|
||||
const unsigned int size = MDC1200_encode_single_packet(packet, op, arg, id);
|
||||
|
||||
BK4819_SetAF(BK4819_AF_MUTE);
|
||||
// BK4819_SetAF(BK4819_AF_BEEP);
|
||||
// BK4819_SetAF(BK4819_AF_BEEP);
|
||||
|
||||
BK4819_EnableTXLink();
|
||||
SYSTEM_DelayMs(10);
|
||||
@ -2078,7 +2240,7 @@ void BK4819_send_MDC1200(const uint8_t op, const uint8_t arg, const uint16_t id)
|
||||
( 0u << 15) | // 0
|
||||
( 0u << 8) | // 0
|
||||
( 1u << 7) | // 1
|
||||
// (96u << 0)); // 96
|
||||
// (96u << 0)); // 96
|
||||
(127u << 0)); // produces the best undistorted waveform, this is not gain but affects filtering
|
||||
|
||||
// REG_59
|
||||
@ -2164,7 +2326,7 @@ void BK4819_send_MDC1200(const uint8_t op, const uint8_t arg, const uint16_t id)
|
||||
//
|
||||
// disable CRC
|
||||
//
|
||||
// BK4819_WriteRegister(0x5C, 0xAA30); // 101010100 0 110000
|
||||
// BK4819_WriteRegister(0x5C, 0xAA30); // 101010100 0 110000
|
||||
BK4819_WriteRegister(0x5C, 0); // setting to '0' doesn't make any difference !
|
||||
|
||||
{ // load the entire packet data into the TX FIFO buffer
|
||||
@ -2209,8 +2371,7 @@ void BK4819_send_MDC1200(const uint8_t op, const uint8_t arg, const uint16_t id)
|
||||
|
||||
if (code_enabled)
|
||||
BK4819_WriteRegister(0x51, BK4819_ReadRegister(0x51) | (1u << 15));
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void BK4819_Enable_AfDac_DiscMode_TxDsp(void)
|
||||
|
@ -106,9 +106,12 @@ void BK4819_EnterTxMute(void);
|
||||
void BK4819_ExitTxMute(void);
|
||||
void BK4819_Sleep(void);
|
||||
void BK4819_TurnsOffTones_TurnsOnRX(void);
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
void BK4819_SetupAircopy(const unsigned int packet_size);
|
||||
void BK4819_start_aircopy_fsk_rx(const unsigned int packet_size);
|
||||
#endif
|
||||
|
||||
void BK4819_reset_fsk(void);
|
||||
void BK4819_Idle(void);
|
||||
void BK4819_ExitBypass(void);
|
||||
@ -153,11 +156,10 @@ uint8_t BK4819_get_CDCSS_code_type(void);
|
||||
uint8_t BK4819_GetCTCShift(void);
|
||||
uint8_t BK4819_GetCTCType(void);
|
||||
|
||||
void BK4819_start_fsk_rx(const unsigned int packet_size);
|
||||
|
||||
void BK4819_PlayRoger(void);
|
||||
|
||||
#ifdef ENABLE_MDC1200
|
||||
void BK4819_enable_mdc1200_ffsk_rx(const bool enable);
|
||||
void BK4819_send_MDC1200(const uint8_t op, const uint8_t arg, const uint16_t id);
|
||||
#endif
|
||||
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
4
radio.c
4
radio.c
@ -259,7 +259,7 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
|
||||
EEPROM_ReadBuffer(Base, &m_channel, sizeof(m_channel));
|
||||
|
||||
p_vfo->freq_config_rx.frequency = m_channel.frequency;
|
||||
p_vfo->tx_offset_freq = (m_channel.offset <= 100000000) ? m_channel.offset : 1000000;
|
||||
p_vfo->tx_offset_freq = (m_channel.offset < 100000000) ? m_channel.offset : 0;
|
||||
p_vfo->tx_offset_freq_dir = (m_channel.tx_offset_dir <= TX_OFFSET_FREQ_DIR_SUB) ? m_channel.tx_offset_dir : TX_OFFSET_FREQ_DIR_OFF;
|
||||
p_vfo->am_mode = m_channel.am_mode;
|
||||
p_vfo->step_setting = (m_channel.step_setting < ARRAY_SIZE(STEP_FREQ_TABLE)) ? m_channel.step_setting : STEP_12_5kHz;
|
||||
@ -356,7 +356,7 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
|
||||
else
|
||||
if (Channel > USER_CHANNEL_LAST)
|
||||
{
|
||||
p_vfo->tx_offset_freq = FREQUENCY_floor_to_step(p_vfo->tx_offset_freq, p_vfo->step_freq, 0, p_vfo->tx_offset_freq);
|
||||
p_vfo->tx_offset_freq = FREQUENCY_floor_to_step(p_vfo->tx_offset_freq + (p_vfo->step_freq / 2), p_vfo->step_freq, 0, p_vfo->tx_offset_freq + p_vfo->step_freq);
|
||||
}
|
||||
|
||||
RADIO_ApplyOffset(p_vfo);
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "misc.h"
|
||||
#include "ui/inputbox.h"
|
||||
|
||||
char g_input_box[8];
|
||||
@ -24,6 +25,9 @@ uint8_t g_input_box_index;
|
||||
uint32_t INPUTBOX_value(void)
|
||||
{
|
||||
int i = g_input_box_index;
|
||||
if (i > (int)ARRAY_SIZE(g_input_box))
|
||||
i = ARRAY_SIZE(g_input_box);
|
||||
|
||||
uint32_t val = 0;
|
||||
uint32_t mul = 1;
|
||||
while (--i >= 0)
|
||||
@ -34,6 +38,7 @@ uint32_t INPUTBOX_value(void)
|
||||
mul *= 10;
|
||||
}
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
48
ui/menu.c
48
ui/menu.c
@ -661,25 +661,29 @@ void UI_DisplayMenu(void)
|
||||
if (!g_in_sub_menu || g_input_box_index == 0)
|
||||
{
|
||||
sprintf(str, "%d.%05u", g_sub_menu_selection / 100000, abs(g_sub_menu_selection) % 100000);
|
||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||
NUMBER_trim_trailing_zeros(str);
|
||||
#endif
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 1, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
str[i + 0] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||
str[3] = '.';
|
||||
for (i = 3; i < 6; i++)
|
||||
str[i + 1] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||
str[ 7] = '-';
|
||||
str[ 8] = '-';
|
||||
str[ 9] = 0;
|
||||
str[10] = 0;
|
||||
str[11] = 0;
|
||||
memset(str, 0, sizeof(str));
|
||||
i = 0;
|
||||
while (i < 3)
|
||||
{
|
||||
str[i] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||
i++;
|
||||
}
|
||||
str[i] = '.';
|
||||
while (i < 8)
|
||||
{
|
||||
str[1 + i] = (g_input_box[i] == 10) ? '-' : g_input_box[i] + '0';
|
||||
i++;
|
||||
}
|
||||
UI_PrintString(str, sub_menu_x1, sub_menu_x2, 1, 8);
|
||||
}
|
||||
|
||||
UI_PrintString("MHz", sub_menu_x1, sub_menu_x2, 3, 8);
|
||||
|
||||
already_printed = true;
|
||||
break;
|
||||
|
||||
@ -847,6 +851,10 @@ void UI_DisplayMenu(void)
|
||||
{ // show the frequency so that the user knows the channels frequency
|
||||
const uint32_t frequency = BOARD_fetchChannelFrequency(g_sub_menu_selection);
|
||||
sprintf(str + strlen(str), "\n%u.%05u", frequency / 100000, frequency % 100000);
|
||||
|
||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||
NUMBER_trim_trailing_zeros(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1060,14 +1068,14 @@ void UI_DisplayMenu(void)
|
||||
g_usb_current);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_SIDE_BUTT_MENU
|
||||
#ifdef ENABLE_SIDE_BUTT_MENU
|
||||
case MENU_SIDE1_SHORT:
|
||||
case MENU_SIDE1_LONG:
|
||||
case MENU_SIDE2_SHORT:
|
||||
case MENU_SIDE2_LONG:
|
||||
strcpy(str, g_sub_menu_side_butt[g_sub_menu_selection]);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
case MENU_VERSION:
|
||||
{ // show the version string on multiple lines - if need be
|
||||
@ -1135,11 +1143,11 @@ void UI_DisplayMenu(void)
|
||||
case FREQ_LOCK_446:
|
||||
strcpy(str, "446.00625\n~\n446.19375");
|
||||
break;
|
||||
#ifdef ENABLE_TX_UNLOCK
|
||||
#ifdef ENABLE_TX_UNLOCK
|
||||
case FREQ_LOCK_TX_UNLOCK:
|
||||
sprintf(str, "UNLOCKED\n%u~%u", BX4819_BAND1.lower / 100000, BX4819_BAND2.upper / 100000);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1151,9 +1159,15 @@ void UI_DisplayMenu(void)
|
||||
|
||||
writeXtalFreqCal(g_sub_menu_selection, false);
|
||||
|
||||
sprintf(str, "%d\n%u.%06u\nMHz",
|
||||
sprintf(str, "%d\n%u.%06u",
|
||||
g_sub_menu_selection,
|
||||
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||
|
||||
#ifdef ENABLE_TRIM_TRAILING_ZEROS
|
||||
NUMBER_trim_trailing_zeros(str);
|
||||
#endif
|
||||
|
||||
strcat(str, "\nMHz");
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user