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

fix contrast bug

This commit is contained in:
OneOfEleven 2023-11-03 23:14:56 +00:00
parent 2c007d7e50
commit 935e552b02
10 changed files with 12 additions and 31 deletions

View File

@ -54,7 +54,7 @@ ENABLE_TX_WHEN_AM := 0
ENABLE_F_CAL_MENU := 0
ENABLE_TX_UNLOCK := 0
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
ENABLE_CONTRAST := 0
ENABLE_CONTRAST := 1
ENABLE_BOOT_BEEPS := 0
ENABLE_DTMF_CALL_FLASH_LIGHT := 1
ENABLE_FLASH_LIGHT_SOS_TONE := 1

View File

@ -564,8 +564,8 @@ void MENU_AcceptSetting(void)
#ifdef ENABLE_CONTRAST
case MENU_CONTRAST:
g_setting_contrast = g_sub_menu_selection;
ST7565_SetContrast(g_setting_contrast);
g_eeprom.config.setting.lcd_contrast = g_sub_menu_selection;
ST7565_SetContrast(g_eeprom.config.setting.lcd_contrast);
break;
#endif
@ -1060,11 +1060,11 @@ void MENU_ShowCurrentSetting(void)
g_sub_menu_selection = g_eeprom.config.setting.backlight_on_tx_rx;
break;
#ifdef ENABLE_CONTRAST
#ifdef ENABLE_CONTRAST
case MENU_CONTRAST:
g_sub_menu_selection = g_setting_contrast;
g_sub_menu_selection = g_eeprom.config.setting.lcd_contrast;
break;
#endif
#endif
case MENU_DUAL_WATCH:
// g_sub_menu_selection = g_eeprom.config.setting.dual_watch;

View File

@ -245,7 +245,7 @@ void ST7565_WriteByte(const uint8_t Value)
#ifdef ENABLE_CONTRAST
void ST7565_SetContrast(const uint8_t value)
{
contrast = (value <= 63) ? value : 63;
contrast = (value > 45) ? 45 : (value < 26) ? 26 : value;
}
uint8_t ST7565_GetContrast(void)

Binary file not shown.

Binary file not shown.

2
main.c
View File

@ -187,7 +187,7 @@ void Main(void)
BOARD_ADC_GetBatteryInfo(&g_usb_current_voltage, &g_usb_current);
#ifdef ENABLE_CONTRAST
ST7565_SetContrast(g_setting_contrast);
ST7565_SetContrast(g_eeprom.config.setting.lcd_contrast);
#endif
#if defined(ENABLE_UART)

9
misc.c
View File

@ -85,15 +85,6 @@ const uint32_t g_default_aes_key[4] = {0x4AA5CC60, 0x0312CC5F
const uint8_t g_mic_gain_dB_2[5] = {3, 8, 16, 24, 31};
#ifdef ENABLE_CONTRAST
uint8_t g_setting_contrast;
#endif
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 g_monitor_enabled;
bool g_has_aes_key;

9
misc.h
View File

@ -177,15 +177,6 @@ extern const uint16_t scan_pause_chan_10ms;
extern const uint8_t g_mic_gain_dB_2[5];
#ifdef ENABLE_CONTRAST
extern uint8_t g_setting_contrast;
#endif
extern uint8_t g_setting_side1_short;
extern uint8_t g_setting_side1_long;
extern uint8_t g_setting_side2_short;
extern uint8_t g_setting_side2_long;
extern bool g_monitor_enabled;
extern const uint32_t g_default_aes_key[4];

View File

@ -122,10 +122,6 @@ void SETTINGS_read_eeprom(void)
#endif
g_eeprom.config.setting.mic_sensitivity = (g_eeprom.config.setting.mic_sensitivity < 5) ? g_eeprom.config.setting.mic_sensitivity : 4;
#ifdef ENABLE_CONTRAST
g_eeprom.config.setting.lcd_contrast = (g_eeprom.config.setting.lcd_contrast > 45) ? 31 : (g_eeprom.config.setting.lcd_contrast < 26) ? 31 : g_eeprom.config.setting.lcd_contrast;
g_setting_contrast = g_eeprom.config.setting.lcd_contrast;
#endif
g_eeprom.config.setting.channel_display_mode = (g_eeprom.config.setting.channel_display_mode < 4) ? g_eeprom.config.setting.channel_display_mode : MDF_FREQUENCY; // 4 instead of 3 - extra display mode
g_eeprom.config.setting.cross_vfo = (g_eeprom.config.setting.cross_vfo < 3) ? g_eeprom.config.setting.cross_vfo : CROSS_BAND_OFF;
g_eeprom.config.setting.battery_save_ratio = (g_eeprom.config.setting.battery_save_ratio < 5) ? g_eeprom.config.setting.battery_save_ratio : 4;
@ -322,6 +318,10 @@ void SETTINGS_read_eeprom(void)
#endif
#ifdef ENABLE_CONTRAST
g_eeprom.config.setting.lcd_contrast = (g_eeprom.config.setting.lcd_contrast > 45) ? 31 : (g_eeprom.config.setting.lcd_contrast < 26) ? 31 : g_eeprom.config.setting.lcd_contrast;
#endif
// 0F48..0F4F
g_eeprom.config.setting.scan_hold_time = (g_eeprom.config.setting.scan_hold_time > 40) ? 6 : (g_eeprom.config.setting.scan_hold_time < 2) ? 6 : g_eeprom.config.setting.scan_hold_time;

View File

@ -763,7 +763,6 @@ void UI_DisplayMenu(void)
case MENU_CONTRAST:
strcpy(str, "CONTRAST\n");
sprintf(str + strlen(str), "%d", g_sub_menu_selection);
//g_setting_contrast = g_sub_menu_selection
ST7565_SetContrast(g_sub_menu_selection);
g_update_display = true;
break;