From 3e0795eb8d6c2631cb6354f611c7a8158444cf93 Mon Sep 17 00:00:00 2001 From: wu58430 Date: Mon, 4 Dec 2023 14:18:36 +0800 Subject: [PATCH] reduce flash --- .idea/workspace.xml | 34 ++++++++++++---------------------- app/menu.c | 20 ++++++++++---------- settings.c | 34 +++++++++++++++++----------------- settings.h | 26 +++++++++++++------------- ui/menu.c | 12 ++++++------ ui/menu.h | 2 +- ui/welcome.c | 7 +------ 7 files changed, 60 insertions(+), 75 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 3ac06dd..cdf4e3d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -20,25 +20,7 @@ - - - - - - - - - - - - - - - - - - - + @@ -329,6 +318,7 @@ - \ No newline at end of file diff --git a/app/menu.c b/app/menu.c index eb0a403..ceef832 100644 --- a/app/menu.c +++ b/app/menu.c @@ -183,10 +183,10 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) *pMax = ARRAY_SIZE(gSubMenu_ROGER) - 1; break; - case MENU_PONMSG: - *pMin = 0; - *pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1; - break; +// case MENU_PONMSG: +// *pMin = 0; +// *pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1; +// break; case MENU_R_DCS: case MENU_T_DCS: @@ -692,9 +692,9 @@ void MENU_AcceptSetting(void) } return; #endif - case MENU_PONMSG: - gEeprom.POWER_ON_DISPLAY_MODE = gSubMenuSelection; - break; +// case MENU_PONMSG: +// gEeprom.POWER_ON_DISPLAY_MODE = gSubMenuSelection; +// break; case MENU_ROGER: gEeprom.ROGER = gSubMenuSelection; @@ -1078,9 +1078,9 @@ void MENU_ShowCurrentSetting(void) gSubMenuSelection = gSetting_live_DTMF_decoder; break; - case MENU_PONMSG: - gSubMenuSelection = gEeprom.POWER_ON_DISPLAY_MODE; - break; +// case MENU_PONMSG: +// gSubMenuSelection = gEeprom.POWER_ON_DISPLAY_MODE; +// break; case MENU_ROGER: gSubMenuSelection = gEeprom.ROGER; diff --git a/settings.c b/settings.c index ea7cfdc..fc94075 100644 --- a/settings.c +++ b/settings.c @@ -63,7 +63,7 @@ void SETTINGS_InitEEPROM(void) // 0E78..0E7F EEPROM_ReadBuffer(0x0E78, Data, 8); gEeprom.BACKLIGHT_MAX = (Data[0] & 0xF) <= 10 ? (Data[0] & 0xF) : 10; - gEeprom.BACKLIGHT_MIN = (Data[0] >> 4) < gEeprom.BACKLIGHT_MAX ? (Data[0] >> 4) : 0; + //gEeprom.BACKLIGHT_MIN = (Data[0] >> 4) < gEeprom.BACKLIGHT_MAX ? (Data[0] >> 4) : 0; #ifdef ENABLE_BLMIN_TMP_OFF gEeprom.BACKLIGHT_MIN_STAT = BLMIN_STAT_ON; #endif @@ -118,14 +118,14 @@ void SETTINGS_InitEEPROM(void) // 0E90..0E97 EEPROM_ReadBuffer(0x0E90, Data, 8); gEeprom.BEEP_CONTROL = Data[0] & 1; - gEeprom.KEY_M_LONG_PRESS_ACTION = ((Data[0] >> 1) < ACTION_OPT_LEN) ? (Data[0] >> 1) : ACTION_OPT_NONE; - gEeprom.KEY_1_SHORT_PRESS_ACTION = (Data[1] < ACTION_OPT_LEN) ? Data[1] : ACTION_OPT_MONITOR; - gEeprom.KEY_1_LONG_PRESS_ACTION = (Data[2] < ACTION_OPT_LEN) ? Data[2] : ACTION_OPT_FLASHLIGHT; - gEeprom.KEY_2_SHORT_PRESS_ACTION = (Data[3] < ACTION_OPT_LEN) ? Data[3] : ACTION_OPT_SCAN; - gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE; +// gEeprom.KEY_M_LONG_PRESS_ACTION = ((Data[0] >> 1) < ACTION_OPT_LEN) ? (Data[0] >> 1) : ACTION_OPT_NONE; +// gEeprom.KEY_1_SHORT_PRESS_ACTION = (Data[1] < ACTION_OPT_LEN) ? Data[1] : ACTION_OPT_MONITOR; +// gEeprom.KEY_1_LONG_PRESS_ACTION = (Data[2] < ACTION_OPT_LEN) ? Data[2] : ACTION_OPT_FLASHLIGHT; +// gEeprom.KEY_2_SHORT_PRESS_ACTION = (Data[3] < ACTION_OPT_LEN) ? Data[3] : ACTION_OPT_SCAN; +// gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE; gEeprom.SCAN_RESUME_MODE = (Data[5] < 3) ? Data[5] : SCAN_RESUME_CO; - gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 2) ? Data[6] : false; - gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 4) ? Data[7] : POWER_ON_DISPLAY_MODE_MESSAGE; +// gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 2) ? Data[6] : false; +// gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 4) ? Data[7] : POWER_ON_DISPLAY_MODE_MESSAGE; // 0E98..0E9F EEPROM_ReadBuffer(0x0E98, Data, 8); @@ -494,7 +494,7 @@ void SETTINGS_SaveSettings(void) State[7] = gEeprom.MIC_SENSITIVITY; EEPROM_WriteBuffer(0x0E70, State); - State[0] = (gEeprom.BACKLIGHT_MIN << 4) + gEeprom.BACKLIGHT_MAX; + State[0] = (/*gEeprom.BACKLIGHT_MIN*/0 << 4) + gEeprom.BACKLIGHT_MAX; State[1] = gEeprom.CHANNEL_DISPLAY_MODE; State[2] = gEeprom.CROSS_BAND_RX_TX; State[3] = gEeprom.BATTERY_SAVE; @@ -505,14 +505,14 @@ void SETTINGS_SaveSettings(void) EEPROM_WriteBuffer(0x0E78, State); State[0] = gEeprom.BEEP_CONTROL; - State[0] |= gEeprom.KEY_M_LONG_PRESS_ACTION << 1; - State[1] = gEeprom.KEY_1_SHORT_PRESS_ACTION; - State[2] = gEeprom.KEY_1_LONG_PRESS_ACTION; - State[3] = gEeprom.KEY_2_SHORT_PRESS_ACTION; - State[4] = gEeprom.KEY_2_LONG_PRESS_ACTION; - State[5] = gEeprom.SCAN_RESUME_MODE; - State[6] = gEeprom.AUTO_KEYPAD_LOCK; - State[7] = gEeprom.POWER_ON_DISPLAY_MODE; + State[0] |= 0;//gEeprom.KEY_M_LONG_PRESS_ACTION << 1; + State[1] = 0;//gEeprom.KEY_1_SHORT_PRESS_ACTION; + State[2] = 0;//gEeprom.KEY_1_LONG_PRESS_ACTION; + State[3] = 0;//gEeprom.KEY_2_SHORT_PRESS_ACTION; + State[4] = 0;//gEeprom.KEY_2_LONG_PRESS_ACTION; + State[5] = //gEeprom.SCAN_RESUME_MODE; + State[6] = 0;//gEeprom.AUTO_KEYPAD_LOCK; + State[7] = 0;//gEeprom.POWER_ON_DISPLAY_MODE; EEPROM_WriteBuffer(0x0E90, State); memset(Password, 0xFF, sizeof(Password)); diff --git a/settings.h b/settings.h index d7d6198..27d740a 100644 --- a/settings.h +++ b/settings.h @@ -25,11 +25,11 @@ #include "radio.h" #include -enum POWER_OnDisplayMode_t { - POWER_ON_DISPLAY_MODE_NONE -, - POWER_ON_DISPLAY_MODE_MESSAGE, -}; +//enum POWER_OnDisplayMode_t { +// POWER_ON_DISPLAY_MODE_NONE +//, +// POWER_ON_DISPLAY_MODE_MESSAGE, +//}; typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t; enum { @@ -183,17 +183,17 @@ typedef struct { uint8_t field37_0x32; uint8_t field38_0x33; - bool AUTO_KEYPAD_LOCK; +// bool AUTO_KEYPAD_LOCK; #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) ALARM_Mode_t ALARM_MODE; #endif - POWER_OnDisplayMode_t POWER_ON_DISPLAY_MODE; + // POWER_OnDisplayMode_t POWER_ON_DISPLAY_MODE; ROGER_Mode_t ROGER; uint8_t REPEATER_TAIL_TONE_ELIMINATION; - uint8_t KEY_1_SHORT_PRESS_ACTION; - uint8_t KEY_1_LONG_PRESS_ACTION; - uint8_t KEY_2_SHORT_PRESS_ACTION; - uint8_t KEY_2_LONG_PRESS_ACTION; +// uint8_t KEY_1_SHORT_PRESS_ACTION; +// uint8_t KEY_1_LONG_PRESS_ACTION; +// uint8_t KEY_2_SHORT_PRESS_ACTION; +// uint8_t KEY_2_LONG_PRESS_ACTION; uint8_t MIC_SENSITIVITY; uint8_t MIC_SENSITIVITY_TUNING; uint8_t CHAN_1_CALL; @@ -243,8 +243,8 @@ typedef struct { uint8_t field78_0x96; uint8_t field79_0x97; - uint8_t KEY_M_LONG_PRESS_ACTION; - uint8_t BACKLIGHT_MIN; +// uint8_t KEY_M_LONG_PRESS_ACTION; +// uint8_t BACKLIGHT_MIN; #ifdef ENABLE_BLMIN_TMP_OFF BLMIN_STAT_t BACKLIGHT_MIN_STAT; #endif diff --git a/ui/menu.c b/ui/menu.c index c12d9bf..f9058f4 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -60,7 +60,7 @@ const t_menu_item MenuList[] = {/*"BatSav",*/ VOICE_ID_SAVE_MODE, MENU_SAVE ,省电模式}, // was "SAVE" {/*"Mic",*/ VOICE_ID_INVALID, MENU_MIC ,麦克风增益}, {/*"ChDisp",*/ VOICE_ID_INVALID, MENU_MDF ,信道显示模式}, // was "MDF" - {/*"POnMsg",*/ VOICE_ID_INVALID, MENU_PONMSG ,开机显示}, + // {/*"POnMsg",*/ VOICE_ID_INVALID, MENU_PONMSG ,开机显示}, {/*"BackLt",*/ VOICE_ID_INVALID, MENU_ABR ,自动背光}, // was "ABR" {/*"BLMax",*/ VOICE_ID_INVALID, MENU_ABR_MAX ,背光亮度}, {/*"Roger",*/ VOICE_ID_INVALID, MENU_ROGER ,发送结束音}, @@ -840,11 +840,11 @@ void UI_DisplayMenu(void) { memmove(String, Contact, 8); break; #endif - case MENU_PONMSG: - strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]); - - - break; +// case MENU_PONMSG: +// strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]); +// +// +// break; case MENU_ROGER: strcpy(String, gSubMenu_ROGER[gSubMenuSelection]); diff --git a/ui/menu.h b/ui/menu.h index 85a8b0f..52e0957 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -99,7 +99,7 @@ enum #endif MENU_D_LIVE_DEC, - MENU_PONMSG, + // MENU_PONMSG, MENU_ROGER, // MENU_VOL, //MENU_BAT_TXT, diff --git a/ui/welcome.c b/ui/welcome.c index d457c78..3cd9f7b 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -51,12 +51,7 @@ void UI_DisplayWelcome(void) { memset(gStatusLine, 0, sizeof(gStatusLine)); memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); - if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_NONE) { - ST7565_FillScreen(0xFF); - } - - else { # @@ -85,6 +80,6 @@ void UI_DisplayWelcome(void) { } - } + }