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

vox update - disabled while in menu mode

This commit is contained in:
OneOfEleven 2023-11-02 14:38:03 +00:00
parent bb3b6812c6
commit 5055586035
19 changed files with 195 additions and 116 deletions

View File

@ -30,6 +30,7 @@ ENABLE_VOICE := 0
ENABLE_MUTE_RADIO_FOR_VOICE := 0
# Tx on Voice 1.0 kB
ENABLE_VOX := 1
ENABLE_VOX_MORE_SENSITIVE := 1
ENABLE_REDUCE_LOW_MID_TX_POWER := 1
# Tx Alarm 600 B
ENABLE_ALARM := 0
@ -348,6 +349,9 @@ endif
ifeq ($(ENABLE_VOX),1)
CFLAGS += -DENABLE_VOX
endif
ifeq ($(ENABLE_VOX_MORE_SENSITIVE),1)
CFLAGS += -DENABLE_VOX_MORE_SENSITIVE
endif
ifeq ($(ENABLE_REDUCE_LOW_MID_TX_POWER),1)
CFLAGS += -DENABLE_REDUCE_LOW_MID_TX_POWER
endif

View File

@ -54,6 +54,7 @@ ENABLE_NOAA := 0 everything NOAA (only of any use in
ENABLE_VOICE := 0 want to hear voices ?
ENABLE_MUTE_RADIO_FOR_VOICE := 1 mute the radios audio when a voice is playing
ENABLE_VOX := 0 voice operated transmission
ENABLE_VOX_MORE_SENSITIVE := 1 make VOX more sensitive
ENABLE_REDUCE_LOW_MID_TX_POWER := 1 reduce the low and mid TX power levels (high remains unchanged)
ENABLE_ALARM := 0 TX alarms
ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access)

View File

@ -300,7 +300,8 @@ void ACTION_Scan(bool bRestart)
#ifdef ENABLE_VOX
void ACTION_Vox(void)
{
g_eeprom.config.setting.vox_switch = (g_eeprom.config.setting.vox_switch + 1) & 1u;
// toggle VOX on/off
g_eeprom.config.setting.vox_enabled = (g_eeprom.config.setting.vox_enabled + 1) & 1u;
g_request_save_settings = true;
g_flag_reconfigure_vfos = true;
#ifdef ENABLE_VOICE

View File

@ -1011,9 +1011,15 @@ void APP_process_radio_interrupts(void)
if (int_bits & BK4819_REG_02_VOX_LOST)
{
g_vox_lost = true;
g_vox_pause_tick_10ms = 10;
g_vox_pause_tick_10ms = 10; // 100ms
if (g_eeprom.config.setting.vox_switch)
g_update_status = true;
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_SendText("vox lost\r\n");
#endif
if (g_eeprom.config.setting.vox_enabled)
{
if (g_current_function == FUNCTION_POWER_SAVE && !g_rx_idle_mode)
{
@ -1034,6 +1040,12 @@ void APP_process_radio_interrupts(void)
{
g_vox_lost = false;
g_vox_pause_tick_10ms = 0;
g_update_status = true;
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
// UART_SendText("vox found\r\n");
#endif
}
#endif
@ -1111,26 +1123,18 @@ void APP_end_tx(void)
#ifdef ENABLE_VOX
static void APP_process_vox(void)
{
#ifdef ENABLE_KILL_REVIVE
if (g_eeprom.config.setting.radio_disabled)
return;
#endif
if (g_vox_resume_tick_10ms == 0)
{
if (g_vox_pause_tick_10ms)
if (g_vox_pause_tick_10ms > 0)
return;
}
else
{
g_vox_lost = false;
g_vox_pause_tick_10ms = 0;
}
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode)
return;
#endif
g_update_status = true;
}
if (g_current_function == FUNCTION_RECEIVE || g_monitor_enabled)
return;
@ -1141,18 +1145,20 @@ void APP_end_tx(void)
if (g_vox_noise_detected)
{
if (g_vox_lost)
g_vox_stop_tick_10ms = vox_stop_10ms;
{
g_vox_stop_tick_10ms = vox_stop_10ms; // 1 second
}
else
if (g_vox_stop_tick_10ms == 0)
{
g_vox_noise_detected = false;
g_update_status = true;
}
if (g_current_function == FUNCTION_TRANSMIT &&
!g_ptt_is_pressed &&
!g_vox_noise_detected)
if (g_current_function == FUNCTION_TRANSMIT && !g_ptt_is_pressed && !g_vox_noise_detected)
{
if (g_flag_end_tx)
{
//if (g_current_function != FUNCTION_FOREGROUND)
{ // back to RX mode
FUNCTION_Select(FUNCTION_FOREGROUND);
}
else
@ -1170,24 +1176,47 @@ void APP_end_tx(void)
g_flag_end_tx = false;
}
return;
}
if (g_vox_lost)
{
if (!g_vox_lost)
return;
g_vox_noise_detected = true;
g_update_status = true;
#ifdef ENABLE_KILL_REVIVE
if (g_eeprom.config.setting.radio_disabled)
return;
#endif
if (!g_eeprom.config.setting.tx_enable)
return;
#ifdef ENABLE_FMRADIO
if (g_fm_radio_mode)
return;
#endif
if (g_current_display_screen == DISPLAY_MENU)
return;
if (g_current_function == FUNCTION_POWER_SAVE)
FUNCTION_Select(FUNCTION_FOREGROUND);
if (g_current_function != FUNCTION_TRANSMIT && g_serial_config_tick_500ms == 0)
{
if (g_current_function == FUNCTION_TRANSMIT || g_serial_config_tick_500ms > 0)
return;
// ************* go into TX mode
g_dtmf_reply_state = DTMF_REPLY_NONE;
RADIO_PrepareTX();
g_update_display = true;
}
}
}
#endif
// called every 10ms
@ -1235,9 +1264,9 @@ void APP_check_keys(void)
{ // PTT released
#ifdef ENABLE_KILL_REVIVE
if (g_ptt_is_pressed || g_serial_config_tick_500ms > 0 || !g_eeprom.config.setting.tx_enable || g_current_function == FUNCTION_TRANSMIT || g_eeprom.config.setting.radio_disabled)
if (g_ptt_is_pressed || g_serial_config_tick_500ms > 0 || !g_eeprom.config.setting.tx_enable || g_eeprom.config.setting.radio_disabled)
#else
if (g_ptt_is_pressed || g_serial_config_tick_500ms > 0 || !g_eeprom.config.setting.tx_enable || g_current_function == FUNCTION_TRANSMIT)
if (g_ptt_is_pressed || g_serial_config_tick_500ms > 0 || !g_eeprom.config.setting.tx_enable)
#endif
{
if (--g_ptt_debounce <= 0)
@ -1825,8 +1854,8 @@ void APP_process_power_save(void)
BK4819_Conditional_RX_TurnOn();
#ifdef ENABLE_VOX
if (g_eeprom.config.setting.vox_switch)
BK4819_EnableVox(g_vox_threshold[1], g_vox_threshold[0]);
if (g_eeprom.config.setting.vox_enabled)
RADIO_enable_vox(g_eeprom.config.setting.vox_level);
#endif
if (APP_toggle_dual_watch_vfo())
@ -2401,7 +2430,7 @@ void APP_time_slice_10ms(void)
if (g_vox_pause_tick_10ms > 0)
g_vox_pause_tick_10ms--;
if (g_eeprom.config.setting.vox_switch)
if (g_eeprom.config.setting.vox_enabled)
APP_process_vox();
#endif

View File

@ -557,8 +557,8 @@ void MENU_AcceptSetting(void)
#ifdef ENABLE_VOX
case MENU_VOX:
g_eeprom.config.setting.vox_switch = g_sub_menu_selection != 0;
if (g_eeprom.config.setting.vox_switch)
g_eeprom.config.setting.vox_enabled = (g_sub_menu_selection != 0) ? 1 : 0;
if (g_eeprom.config.setting.vox_enabled)
g_eeprom.config.setting.vox_level = g_sub_menu_selection - 1;
g_flag_reconfigure_vfos = true;
g_update_status = true;
@ -1056,7 +1056,7 @@ void MENU_ShowCurrentSetting(void)
#ifdef ENABLE_VOX
case MENU_VOX:
g_sub_menu_selection = g_eeprom.config.setting.vox_switch ? g_eeprom.config.setting.vox_level + 1 : 0;
g_sub_menu_selection = g_eeprom.config.setting.vox_enabled ? g_eeprom.config.setting.vox_level + 1 : 0;
break;
#endif

View File

@ -134,8 +134,9 @@ const uint8_t BITMAP_F_KEY[6] =
};
#ifdef ENABLE_VOX
const uint8_t BITMAP_VOX[18] =
const uint8_t BITMAP_VOX[17] =
{ // "VOX"
#if 0
__extension__ 0b00000000,
__extension__ 0b00011111,
__extension__ 0b00100000,
@ -146,7 +147,6 @@ const uint8_t BITMAP_F_KEY[6] =
__extension__ 0b00111110,
__extension__ 0b01000001,
__extension__ 0b01000001,
__extension__ 0b01000001,
__extension__ 0b00111110,
__extension__ 0b00000000,
__extension__ 0b01100011,
@ -154,6 +154,46 @@ const uint8_t BITMAP_F_KEY[6] =
__extension__ 0b00001000,
__extension__ 0b00010100,
__extension__ 0b01100011
#else
__extension__ 0b00000000,
__extension__ 0b00111111,
__extension__ 0b01111111,
__extension__ 0b01100000,
__extension__ 0b01111111,
__extension__ 0b00111111,
__extension__ 0b00000000,
__extension__ 0b00111110,
__extension__ 0b01100011,
__extension__ 0b01100011,
__extension__ 0b00111110,
__extension__ 0b00000000,
__extension__ 0b01100011,
__extension__ 0b00110110,
__extension__ 0b00011100,
__extension__ 0b00110110,
__extension__ 0b01100011
#endif
};
const uint8_t BITMAP_VOX_SMALL[17] =
{ // "vox"
__extension__ 0b00000000,
__extension__ 0b00000111,
__extension__ 0b00001000,
__extension__ 0b00010000,
__extension__ 0b00001000,
__extension__ 0b00000111,
__extension__ 0b00000000,
__extension__ 0b00001110,
__extension__ 0b00010001,
__extension__ 0b00010001,
__extension__ 0b00001110,
__extension__ 0b00000000,
__extension__ 0b00010001,
__extension__ 0b00001010,
__extension__ 0b00000100,
__extension__ 0b00001010,
__extension__ 0b00010001
};
#endif

View File

@ -19,7 +19,8 @@ extern const uint8_t BITMAP_USB_C[8];
extern const uint8_t BITMAP_F_KEY[6];
#ifdef ENABLE_VOX
extern const uint8_t BITMAP_VOX[18];
extern const uint8_t BITMAP_VOX[17];
extern const uint8_t BITMAP_VOX_SMALL[17];
#endif
#if 0

View File

@ -399,23 +399,28 @@ void BK4819_set_GPIO_pin(bk4819_gpio_pin_t Pin, bool bSet)
void BK4819_EnableVox(uint16_t VoxEnableThreshold, uint16_t VoxDisableThreshold)
{
// VOX Algorithm
//if (voxamp>VoxEnableThreshold) VOX = 1;
//if (vox_amp > VoxEnableThreshold) VOX = 1;
//else
//if (voxamp<VoxDisableThreshold) (After Delay) VOX = 0;
//if (vox_amp < VoxDisableThreshold) (After Delay) VOX = 0;
const uint16_t REG_31_Value = BK4819_ReadRegister(0x31);
if (VoxEnableThreshold > 2047)
VoxEnableThreshold = 2047;
if (VoxDisableThreshold > 2047)
VoxDisableThreshold = 2047;
// 0xA000 is undocumented?
BK4819_WriteRegister(0x46, 0xA000 | (VoxEnableThreshold & 0x07FF));
BK4819_WriteRegister(0x46, 0xA000 | VoxEnableThreshold);
// 0x1800 is undocumented?
BK4819_WriteRegister(0x79, 0x1800 | (VoxDisableThreshold & 0x07FF));
BK4819_WriteRegister(0x79, 0x1800 | VoxDisableThreshold);
// Bottom 12 bits are undocumented, 15:12 vox disable delay *128ms
BK4819_WriteRegister(0x7A, 0x289A); // vox disable delay = 128*5 = 640ms
// Enable VOX
BK4819_WriteRegister(0x31, REG_31_Value | (1u << 2)); // VOX Enable
BK4819_WriteRegister(0x31, REG_31_Value | (1u << 2));
}
void BK4819_set_TX_deviation(const bool narrow)

Binary file not shown.

Binary file not shown.

View File

@ -69,7 +69,7 @@ void BOOT_ProcessMode(boot_mode_t Mode)
g_eeprom.config.setting.dual_watch = DUAL_WATCH_OFF;
g_eeprom.config.setting.battery_save_ratio = 0;
#ifdef ENABLE_VOX
g_eeprom.config.setting.vox_switch = false;
g_eeprom.config.setting.vox_enabled = false;
#endif
g_eeprom.config.setting.cross_vfo = CROSS_BAND_OFF;
g_eeprom.config.setting.auto_key_lock = 0;

2
misc.c
View File

@ -99,8 +99,6 @@ bool g_monitor_enabled;
bool g_has_aes_key;
uint32_t g_challenge[4];
uint16_t g_vox_threshold[2];
uint16_t g_eeprom_rssi_calib[7][4];
volatile uint16_t g_schedule_power_save_tick_10ms = battery_save_count_10ms;

2
misc.h
View File

@ -296,8 +296,6 @@ extern scan_state_dir_t g_scan_state_dir; // the direction we're sc
extern uint8_t g_rx_vfo_num;
extern bool g_rx_vfo_is_active;
extern uint16_t g_vox_threshold[2];
extern uint16_t g_alarm_tone_counter_10ms;
extern uint16_t g_alarm_running_counter_10ms;
extern uint8_t g_menu_list_count;

35
radio.c
View File

@ -412,6 +412,35 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
p_vfo->freq_in_channel = SETTINGS_find_channel(frequency); // find channel that has this frequency
}
#ifdef ENABLE_VOX
void RADIO_enable_vox(unsigned int level)
{
uint16_t threshold_enable;
uint16_t threshold_disable;
if (level > (ARRAY_SIZE(g_eeprom.calib.vox[0].threshold) - 1))
level = ARRAY_SIZE(g_eeprom.calib.vox[0].threshold) - 1;
// my eeprom values ..
//
// vox threshold enable 30 50 70 90 110 130 150 170 200 230 FFFF FFFF
// vox threshold disable 20 40 60 80 100 120 140 160 190 220 FFFF FFFF
//
#ifdef ENABLE_VOX_MORE_SENSITIVE
// more sensitive
threshold_enable = g_eeprom.calib.vox[0].threshold[level] / 3;
threshold_disable = (threshold_enable > 13) ? threshold_enable - 10 : 3;
#else
threshold_enable = g_eeprom.calib.vox[0].threshold[level];
threshold_disable = g_eeprom.calib.vox[1].threshold[level];
#endif
BK4819_EnableVox(threshold_enable, threshold_disable);
BK4819_WriteRegister(0x3F, BK4819_ReadRegister(0x3F) | BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST);
}
#endif
void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *p_vfo)
{
// uint8_t tx_power[3];
@ -826,11 +855,11 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
#ifdef ENABLE_FMRADIO
!g_fm_radio_mode &&
#endif
g_eeprom.config.setting.vox_switch &&
g_eeprom.config.setting.vox_enabled &&
IS_NOT_NOAA_CHANNEL(g_current_vfo->channel_save) &&
g_current_vfo->am_mode == 0)
{
BK4819_EnableVox(g_vox_threshold[1], g_vox_threshold[0]);
RADIO_enable_vox(g_eeprom.config.setting.vox_level);
interrupt_mask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
}
else
@ -1012,7 +1041,7 @@ void RADIO_set_vfo_state(vfo_state_t State)
void RADIO_PrepareTX(void)
{
vfo_state_t State = VFO_STATE_NORMAL; // default to OK to TX
vfo_state_t State = VFO_STATE_NORMAL; // default to OK for TX
if (g_eeprom.config.setting.dual_watch != DUAL_WATCH_OFF)
{ // dual-RX is enabled

View File

@ -142,6 +142,9 @@ bool RADIO_CheckValidChannel(uint16_t ChNum, bool bCheckScanList, uint8_t Ra
uint8_t RADIO_FindNextChannel(uint8_t ChNum, scan_state_dir_t Direction, bool bCheckScanList, uint8_t RadioNum);
void RADIO_InitInfo(vfo_info_t *p_vfo, const uint8_t ChannelSave, const uint32_t Frequency);
void RADIO_configure_channel(const unsigned int VFO, const unsigned int configure);
#ifdef ENABLE_VOX
void RADIO_enable_vox(unsigned int level);
#endif
void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *p_vfo);
void RADIO_ApplyOffset(vfo_info_t *p_vfo, const bool set_pees);
void RADIO_select_vfos(void);

View File

@ -76,7 +76,7 @@ void SETTINGS_read_eeprom(void)
g_eeprom.config.setting.key_lock = (g_eeprom.config.setting.key_lock < 2) ? g_eeprom.config.setting.key_lock : 0;
#endif
#ifdef ENABLE_VOX
g_eeprom.config.setting.vox_switch = (g_eeprom.config.setting.vox_switch < 2) ? g_eeprom.config.setting.vox_switch : 0;
g_eeprom.config.setting.vox_enabled = (g_eeprom.config.setting.vox_enabled < 2) ? g_eeprom.config.setting.vox_enabled : 0;
g_eeprom.config.setting.vox_level = (g_eeprom.config.setting.vox_level < 10) ? g_eeprom.config.setting.vox_level : 1;
#endif
g_eeprom.config.setting.mic_sensitivity = (g_eeprom.config.setting.mic_sensitivity < 5) ? g_eeprom.config.setting.mic_sensitivity : 4;
@ -287,11 +287,6 @@ void SETTINGS_read_eeprom(void)
}
g_eeprom.calib.battery[5] = 2300;
#ifdef ENABLE_VOX
g_vox_threshold[1] = g_eeprom.calib.vox[0].threshold[g_eeprom.config.setting.vox_level];
g_vox_threshold[0] = g_eeprom.calib.vox[1].threshold[g_eeprom.config.setting.vox_level];
#endif
//EEPROM_ReadBuffer(0x1F80 + g_eeprom.config.setting.mic_sensitivity, &Mic, 1);
//g_mic_sensitivity_tuning = (Mic < 32) ? Mic : 15;
g_mic_sensitivity_tuning = g_mic_gain_dB_2[g_eeprom.config.setting.mic_sensitivity];
@ -343,7 +338,7 @@ void SETTINGS_save(void)
#endif
#ifndef ENABLE_VOX
// g_eeprom.config.setting.vox_switch = 0;
// g_eeprom.config.setting.vox_enabled = 0;
// g_eeprom.config.setting.vox_level = 0;
#endif

View File

@ -233,7 +233,7 @@ typedef struct {
uint8_t tx_timeout; //
uint8_t noaa_auto_scan; //
uint8_t key_lock; //
uint8_t vox_switch; //
uint8_t vox_enabled; //
uint8_t vox_level; //
uint8_t mic_sensitivity; //
#ifdef ENABLE_CONTRAST

View File

@ -36,7 +36,6 @@ void UI_DisplayStatus(const bool test_display)
{
uint8_t *line = g_status_line;
unsigned int x = 0;
unsigned int x1 = 0;
g_update_status = false;
@ -48,7 +47,6 @@ void UI_DisplayStatus(const bool test_display)
if (g_current_function == FUNCTION_TRANSMIT)
{
memcpy(line + x, BITMAP_TX, sizeof(BITMAP_TX));
x1 = x + sizeof(BITMAP_TX);
}
else
if (g_current_function == FUNCTION_RECEIVE ||
@ -56,33 +54,27 @@ void UI_DisplayStatus(const bool test_display)
g_monitor_enabled)
{
memcpy(line + x, BITMAP_RX, sizeof(BITMAP_RX));
x1 = x + sizeof(BITMAP_RX);
}
else
if (g_current_function == FUNCTION_POWER_SAVE || test_display)
{
memcpy(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE));
x1 = x + sizeof(BITMAP_POWERSAVE);
}
x += sizeof(BITMAP_POWERSAVE);
x++;
x += sizeof(BITMAP_POWERSAVE) + 1;
#ifdef ENABLE_NOAA
// NOAA scan indicator
if (g_noaa_mode || test_display)
{
memcpy(line + x, BITMAP_NOAA, sizeof(BITMAP_NOAA));
x1 = x + sizeof(BITMAP_NOAA);
x += sizeof(BITMAP_NOAA);
x += sizeof(BITMAP_NOAA) + 1;
}
x++;
#endif
#ifdef ENABLE_KILL_REVIVE
if (g_eeprom.config.setting.radio_disabled)
{
memset(line + x, 0xFF, 10);
x1 = x + 10;
x += 10;
}
#endif
@ -92,10 +84,8 @@ void UI_DisplayStatus(const bool test_display)
if (g_fm_radio_mode || test_display)
{
memcpy(line + x, BITMAP_FM, sizeof(BITMAP_FM));
x1 = x + sizeof(BITMAP_FM);
x += sizeof(BITMAP_FM);
x += sizeof(BITMAP_FM) + 1;
}
x++;
#endif
// SCAN indicator
@ -119,21 +109,17 @@ void UI_DisplayStatus(const bool test_display)
{ // frequency mode
UI_PrintStringSmallBuffer("S", line + x);
}
x1 = x + 7;
}
x += 7; // font character width
x += 7 + 1; // font character width + 1
}
x++;
#ifdef ENABLE_VOICE
// VOICE indicator
if (g_eeprom.config.setting.voice_prompt != VOICE_PROMPT_OFF || test_display)
{
memcpy(line + x, BITMAP_VOICE_PROMPT, sizeof(BITMAP_VOICE_PROMPT));
x1 = x + sizeof(BITMAP_VOICE_PROMPT);
x += sizeof(BITMAP_VOICE_PROMPT);
x += sizeof(BITMAP_VOICE_PROMPT) + 1;
}
x++;
#endif
// DUAL-WATCH indicator
@ -152,38 +138,30 @@ void UI_DisplayStatus(const bool test_display)
{
memcpy(line + x, BITMAP_TDR_RUNNING, sizeof(BITMAP_TDR_RUNNING));
}
x1 = x + sizeof(BITMAP_TDR_RUNNING);
x += sizeof(BITMAP_TDR_RUNNING);
x += sizeof(BITMAP_TDR_RUNNING) + 1;
}
x++;
// monitor
if (g_monitor_enabled)
{
memcpy(line + x, BITMAP_MONITOR, sizeof(BITMAP_MONITOR));
x1 = x + sizeof(BITMAP_MONITOR);
x += sizeof(BITMAP_MONITOR);
x += sizeof(BITMAP_MONITOR) + 1;
}
x++;
// CROSS-VFO indicator
if (g_eeprom.config.setting.cross_vfo != CROSS_BAND_OFF || test_display)
{
memcpy(line + x, BITMAP_XB, sizeof(BITMAP_XB));
x1 = x + sizeof(BITMAP_XB);
x += sizeof(BITMAP_XB);
x += sizeof(BITMAP_XB) + 1;
}
x++;
#ifdef ENABLE_VOX
// VOX indicator
if (g_eeprom.config.setting.vox_switch || test_display)
if (g_eeprom.config.setting.vox_enabled || test_display)
{
memcpy(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
x1 = x + sizeof(BITMAP_VOX);
x += sizeof(BITMAP_VOX);
memcpy(line + x, g_vox_noise_detected ? BITMAP_VOX : BITMAP_VOX_SMALL, sizeof(BITMAP_VOX));
x += sizeof(BITMAP_VOX) + 1;
}
x++;
#endif
#ifdef ENABLE_KEYLOCK
@ -191,9 +169,7 @@ void UI_DisplayStatus(const bool test_display)
if (g_eeprom.config.setting.key_lock || test_display)
{
memcpy(line + x, BITMAP_KEYLOCK, sizeof(BITMAP_KEYLOCK));
x += sizeof(BITMAP_KEYLOCK);
x1 = x;
x++;
x += sizeof(BITMAP_KEYLOCK) + 1;
}
else
#endif
@ -201,7 +177,6 @@ void UI_DisplayStatus(const bool test_display)
{
memcpy(line + x, BITMAP_F_KEY, sizeof(BITMAP_F_KEY));
x += sizeof(BITMAP_F_KEY);
x1 = x;
}
x++;
@ -225,7 +200,7 @@ void UI_DisplayStatus(const bool test_display)
const uint16_t voltage = (g_battery_voltage_average <= 999) ? g_battery_voltage_average : 999; // limit to 9.99V
sprintf(s, "%u.%02uV", voltage / 100, voltage % 100);
space_needed = (7 * strlen(s));
if (x2 >= (x1 + space_needed))
if (x2 >= (x + space_needed))
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
break;
}
@ -234,7 +209,7 @@ void UI_DisplayStatus(const bool test_display)
{
sprintf(s, "%u%%", BATTERY_VoltsToPercent(g_battery_voltage_average));
space_needed = (7 * strlen(s));
if (x2 >= (x1 + space_needed))
if (x2 >= (x + space_needed))
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
break;
}