diff --git a/Makefile b/Makefile index 0f92f37..1ff162f 100644 --- a/Makefile +++ b/Makefile @@ -95,7 +95,7 @@ CFLAGS += -DDISABLE_NOAA CFLAGS += -DDISABLE_VOICE CFLAGS += -DDISABLE_AIRCOPY CFLAGS += -DKEEP_MEM_NAME -#CFLAGS += -DDISABLE_ALARM +CFLAGS += -DDISABLE_ALARM #CFLAGS += -DBAND_SCOPE ifeq ($(DEBUG),1) diff --git a/README.md b/README.md index b2fe452..1c03d7d 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,14 @@ You can edit those changes by (currently) editing the MakeFile, look for these l * CFLAGS += -DDISABLE_VOICE .. remove spoken VOICES option from the firmware * CFLAGS += -DDISABLE_AIRCOPY .. remove AIRCOPY option * CFLAGS += -DKEEP_MEM_NAME .. don't wipe out the memory channel's name when saving a memory channel -* CFLAGS += -DDISABLE_ALARM .. remove ALARM option from the firmware +* CFLAGS += -DDISABLE_ALARM .. remove the ALARM transmit option from the firmware * #CFLAGS += -DBAND_SCOPE .. not yet implemented To enable the custom option just uncomment the line by removing the starting '#'. # Other changes made +* "STEP" menu option added 1.25kHz option, removed 5kHz option * "ABR" menu option now shows extended backlight times * "MIC" menu option shows actual mic gain in dB's, which now includes the max mic gain setting possible (+15.5dB) diff --git a/app/action.c b/app/action.c index 7fd4fce..e980b91 100644 --- a/app/action.c +++ b/app/action.c @@ -182,14 +182,16 @@ void ACTION_Vox(void) gUpdateStatus = true; } -static void ACTION_AlarmOr1750(bool b1750) -{ - gInputBoxIndex = 0; - gAlarmState = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM; - gAlarmRunningCounter = 0; - gFlagPrepareTX = true; - gRequestDisplayScreen = DISPLAY_MAIN; -} +#ifndef DISABLE_ALARM + static void ACTION_AlarmOr1750(bool b1750) + { + gInputBoxIndex = 0; + gAlarmState = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM; + gAlarmRunningCounter = 0; + gFlagPrepareTX = true; + gRequestDisplayScreen = DISPLAY_MAIN; + } +#endif void ACTION_FM(void) { @@ -290,13 +292,17 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) ACTION_Vox(); break; case 6: - ACTION_AlarmOr1750(false); + #ifndef DISABLE_ALARM + ACTION_AlarmOr1750(false); + #endif break; case 7: ACTION_FM(); break; case 8: - ACTION_AlarmOr1750(true); + #ifndef DISABLE_ALARM + ACTION_AlarmOr1750(true); + #endif break; } } diff --git a/app/action.h b/app/action.h index 1aeb1fb..bf1dc0c 100644 --- a/app/action.h +++ b/app/action.h @@ -24,7 +24,9 @@ void ACTION_Power(void); //static void ACTION_Monitor(void) void ACTION_Scan(bool bFlag); void ACTION_Vox(void); -//static void ACTION_AlarmOr1750(bool b1750) +#ifndef DISABLE_ALARM + //static void ACTION_AlarmOr1750(bool b1750) +#endif void ACTION_FM(void); void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); diff --git a/app/app.c b/app/app.c index 476d21a..8453ff5 100644 --- a/app/app.c +++ b/app/app.c @@ -1055,51 +1055,53 @@ void APP_TimeSlice10ms(void) if (gCurrentFunction == FUNCTION_TRANSMIT) { - if (gAlarmState == ALARM_STATE_TXALARM || gAlarmState == ALARM_STATE_ALARM) - { - uint16_t Tone; - - gAlarmRunningCounter++; - gAlarmToneCounter++; - - Tone = 500 + (gAlarmToneCounter * 25); - if (Tone > 1500) + #ifndef DISABLE_ALARM + if (gAlarmState == ALARM_STATE_TXALARM || gAlarmState == ALARM_STATE_ALARM) { - Tone = 500; - gAlarmToneCounter = 0; - } - - BK4819_SetScrambleFrequencyControlWord(Tone); - - if (gEeprom.ALARM_MODE == ALARM_MODE_TONE && gAlarmRunningCounter == 512) - { - gAlarmRunningCounter = 0; - - if (gAlarmState == ALARM_STATE_TXALARM) + uint16_t Tone; + + gAlarmRunningCounter++; + gAlarmToneCounter++; + + Tone = 500 + (gAlarmToneCounter * 25); + if (Tone > 1500) { - gAlarmState = ALARM_STATE_ALARM; - RADIO_EnableCxCSS(); - BK4819_SetupPowerAmplifier(0, 0); - BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false); - BK4819_Enable_AfDac_DiscMode_TxDsp(); - BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false); - GUI_DisplayScreen(); - } - else - { - gAlarmState = ALARM_STATE_TXALARM; - GUI_DisplayScreen(); - BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true); - RADIO_SetTxParameters(); - BK4819_TransmitTone(true, 500); - SYSTEM_DelayMs(2); - GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); - gEnableSpeaker = true; + Tone = 500; gAlarmToneCounter = 0; } + + BK4819_SetScrambleFrequencyControlWord(Tone); + + if (gEeprom.ALARM_MODE == ALARM_MODE_TONE && gAlarmRunningCounter == 512) + { + gAlarmRunningCounter = 0; + + if (gAlarmState == ALARM_STATE_TXALARM) + { + gAlarmState = ALARM_STATE_ALARM; + RADIO_EnableCxCSS(); + BK4819_SetupPowerAmplifier(0, 0); + BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false); + BK4819_Enable_AfDac_DiscMode_TxDsp(); + BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false); + GUI_DisplayScreen(); + } + else + { + gAlarmState = ALARM_STATE_TXALARM; + GUI_DisplayScreen(); + BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true); + RADIO_SetTxParameters(); + BK4819_TransmitTone(true, 500); + SYSTEM_DelayMs(2); + GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); + gEnableSpeaker = true; + gAlarmToneCounter = 0; + } + } } - } - + #endif + if (gRTTECountdown) { if (--gRTTECountdown == 0) @@ -1458,25 +1460,27 @@ void APP_TimeSlice500ms(void) } } -static void ALARM_Off(void) -{ - gAlarmState = ALARM_STATE_OFF; - GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); - gEnableSpeaker = false; - - if (gEeprom.ALARM_MODE == ALARM_MODE_TONE) +#ifndef DISABLE_ALARM + static void ALARM_Off(void) { - RADIO_SendEndOfTransmission(); - RADIO_EnableCxCSS(); + gAlarmState = ALARM_STATE_OFF; + GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); + gEnableSpeaker = false; + + if (gEeprom.ALARM_MODE == ALARM_MODE_TONE) + { + RADIO_SendEndOfTransmission(); + RADIO_EnableCxCSS(); + } + + gVoxResumeCountdown = 80; + + SYSTEM_DelayMs(5); + + RADIO_SetupRegisters(true); + gRequestDisplayScreen = DISPLAY_MAIN; } - - gVoxResumeCountdown = 80; - - SYSTEM_DelayMs(5); - - RADIO_SetupRegisters(true); - gRequestDisplayScreen = DISPLAY_MAIN; -} +#endif void CHANNEL_Next(bool bFlag, int8_t Direction) { @@ -1665,7 +1669,9 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { if (gCurrentFunction == FUNCTION_TRANSMIT) { - if (gAlarmState == ALARM_STATE_OFF) + #ifndef DISABLE_ALARM + if (gAlarmState == ALARM_STATE_OFF) + #endif { if (Key == KEY_PTT) { @@ -1719,21 +1725,23 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) } } } - else - if (!bKeyHeld && bKeyPressed) - { - ALARM_Off(); - - if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0) - FUNCTION_Select(FUNCTION_FOREGROUND); + #ifndef DISABLE_ALARM else - gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10; - - if (Key == KEY_PTT) - gPttWasPressed = true; - else - gPttWasReleased = true; - } + if (!bKeyHeld && bKeyPressed) + { + ALARM_Off(); + + if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0) + FUNCTION_Select(FUNCTION_FOREGROUND); + else + gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10; + + if (Key == KEY_PTT) + gPttWasPressed = true; + else + gPttWasReleased = true; + } + #endif } else if (Key != KEY_SIDE1 && Key != KEY_SIDE2) diff --git a/app/menu.c b/app/menu.c index f6d6321..12a8b9a 100644 --- a/app/menu.c +++ b/app/menu.c @@ -171,7 +171,9 @@ int MENU_GetLimits(uint8_t Cursor, uint8_t *pMin, uint8_t *pMax) case MENU_S_ADD1: case MENU_S_ADD2: case MENU_STE: - case MENU_AL_MOD: + #ifndef DISABLE_ALARM + case MENU_AL_MOD: + #endif case MENU_D_ST: case MENU_D_DCD: case MENU_AM: @@ -469,10 +471,12 @@ void MENU_AcceptSetting(void) gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection - 1; break; - case MENU_AL_MOD: - gEeprom.ALARM_MODE = gSubMenuSelection; - break; - + #ifndef DISABLE_ALARM + case MENU_AL_MOD: + gEeprom.ALARM_MODE = gSubMenuSelection; + break; + #endif + case MENU_D_ST: gEeprom.DTMF_SIDE_TONE = gSubMenuSelection; break; @@ -809,10 +813,12 @@ void MENU_ShowCurrentSetting(void) gSubMenuSelection = RADIO_FindNextChannel(0, 1, true, 1); break; - case MENU_AL_MOD: - gSubMenuSelection = gEeprom.ALARM_MODE; - break; - + #ifndef DISABLE_ALARM + case MENU_AL_MOD: + gSubMenuSelection = gEeprom.ALARM_MODE; + break; + #endif + case MENU_D_ST: gSubMenuSelection = gEeprom.DTMF_SIDE_TONE; break; diff --git a/board.c b/board.c index 4e98f80..7072bf5 100644 --- a/board.c +++ b/board.c @@ -431,7 +431,9 @@ void BOARD_EEPROM_Init(void) // 0EA8..0EAF EEPROM_ReadBuffer(0x0EA8, Data, 8); - gEeprom.ALARM_MODE = (Data[0] < 2) ? Data[0] : true; + #ifndef DISABLE_ALARM + gEeprom.ALARM_MODE = (Data[0] < 2) ? Data[0] : true; + #endif gEeprom.ROGER = (Data[1] < 3) ? Data[1] : ROGER_MODE_OFF; gEeprom.REPEATER_TAIL_TONE_ELIMINATION = (Data[2] < 11) ? Data[2] : 0; gEeprom.TX_CHANNEL = (Data[3] < 2) ? Data[3] : 0; diff --git a/firmware b/firmware index 50138d5..a2db72f 100644 Binary files a/firmware and b/firmware differ diff --git a/firmware.bin b/firmware.bin index 0c63dea..a5c744a 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin new file mode 100644 index 0000000..bbf1d24 Binary files /dev/null and b/firmware.packed.bin differ diff --git a/functions.c b/functions.c index af8998d..d19189c 100644 --- a/functions.c +++ b/functions.c @@ -127,48 +127,54 @@ void FUNCTION_Select(FUNCTION_Type_t Function) return; case FUNCTION_TRANSMIT: - if (gFmRadioMode) { + if (gFmRadioMode) BK1080_Init(0, false); - } - - if (gAlarmState == ALARM_STATE_TXALARM && gEeprom.ALARM_MODE != ALARM_MODE_TONE) { - gAlarmState = ALARM_STATE_ALARM; - GUI_DisplayScreen(); - GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); - SYSTEM_DelayMs(20); - BK4819_PlayTone(500, 0); - SYSTEM_DelayMs(2); - GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); - gEnableSpeaker = true; - SYSTEM_DelayMs(60); - BK4819_ExitTxMute(); - gAlarmToneCounter = 0; - break; - } + #ifndef DISABLE_ALARM + if (gAlarmState == ALARM_STATE_TXALARM && gEeprom.ALARM_MODE != ALARM_MODE_TONE) + { + gAlarmState = ALARM_STATE_ALARM; + GUI_DisplayScreen(); + GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); + SYSTEM_DelayMs(20); + BK4819_PlayTone(500, 0); + SYSTEM_DelayMs(2); + GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); + gEnableSpeaker = true; + SYSTEM_DelayMs(60); + BK4819_ExitTxMute(); + gAlarmToneCounter = 0; + break; + } + #endif + GUI_DisplayScreen(); RADIO_SetTxParameters(); BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true); DTMF_Reply(); - if (gAlarmState != ALARM_STATE_OFF) { - if (gAlarmState == ALARM_STATE_TX1750) { - BK4819_TransmitTone(true, 1750); - } else { - BK4819_TransmitTone(true, 500); + #ifndef DISABLE_ALARM + if (gAlarmState != ALARM_STATE_OFF) + { + if (gAlarmState == ALARM_STATE_TX1750) + BK4819_TransmitTone(true, 1750); + else + BK4819_TransmitTone(true, 500); + + SYSTEM_DelayMs(2); + GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); + gAlarmToneCounter = 0; + gEnableSpeaker = true; + break; } - SYSTEM_DelayMs(2); - GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); - gAlarmToneCounter = 0; - gEnableSpeaker = true; - break; - } - if (gCurrentVfo->SCRAMBLING_TYPE && gSetting_ScrambleEnable) { + #endif + + if (gCurrentVfo->SCRAMBLING_TYPE && gSetting_ScrambleEnable) BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1U); - } else { + else BK4819_DisableScramble(); - } + break; } gBatterySaveCountdown = 1000; diff --git a/main.c b/main.c index 5838be9..ea34d94 100644 --- a/main.c +++ b/main.c @@ -109,6 +109,9 @@ void Main(void) SYSTEM_DelayMs(2000); gMenuListCount = 51; + #ifdef DISABLE_ALARM + gMenuListCount--; + #endif #ifdef DISABLE_VOICE gMenuListCount--; #endif diff --git a/misc.c b/misc.c index 4d06851..e39f9c6 100644 --- a/misc.c +++ b/misc.c @@ -77,7 +77,9 @@ uint8_t gReducedService; uint8_t gBatteryVoltageIndex; CssScanMode_t gCssScanMode; bool gUpdateRSSI; -AlarmState_t gAlarmState; +#ifndef DISABLE_ALARM + AlarmState_t gAlarmState; +#endif uint8_t gVoltageMenuCountdown; bool gPttWasReleased; bool gPttWasPressed; @@ -117,8 +119,10 @@ uint8_t gCurrentScanList; uint8_t gPreviousMrChannel; uint32_t gRestoreFrequency; uint8_t gRxVfoIsActive; -uint8_t gAlarmToneCounter; -uint16_t gAlarmRunningCounter; +#ifndef DISABLE_ALARM + uint8_t gAlarmToneCounter; + uint16_t gAlarmRunningCounter; +#endif bool gKeyBeingHeld; bool gPttIsPressed; uint8_t gPttDebounceCounter; diff --git a/radio.c b/radio.c index 6d0f615..8ff49ab 100644 --- a/radio.c +++ b/radio.c @@ -802,7 +802,9 @@ void RADIO_PrepareTX(void) RADIO_SelectCurrentVfo(); - if (gAlarmState == ALARM_STATE_OFF || gAlarmState == ALARM_STATE_TX1750 || (gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE)) + #ifndef DISABLE_ALARM + if (gAlarmState == ALARM_STATE_OFF || gAlarmState == ALARM_STATE_TX1750 || (gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE)) + #endif { VfoState_t State; @@ -824,15 +826,17 @@ void RADIO_PrepareTX(void) RADIO_SetVfoState(State); - gAlarmState = ALARM_STATE_OFF; - + #ifndef DISABLE_ALARM + gAlarmState = ALARM_STATE_OFF; + #endif + AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL); gDTMF_ReplyState = DTMF_REPLY_NONE; return; } - + Skip: if (gDTMF_ReplyState == DTMF_REPLY_ANI) { @@ -851,8 +855,12 @@ Skip: FUNCTION_Select(FUNCTION_TRANSMIT); - gTxTimerCountdown = (gAlarmState == ALARM_STATE_OFF) ? gEeprom.TX_TIMEOUT_TIMER * 120 : 0; - + #ifndef DISABLE_ALARM + gTxTimerCountdown = (gAlarmState == ALARM_STATE_OFF) ? gEeprom.TX_TIMEOUT_TIMER * 120 : 0; + #else + gTxTimerCountdown = gEeprom.TX_TIMEOUT_TIMER * 120; + #endif + gTxTimeoutReached = false; gFlagEndTransmission = false; gRTTECountdown = 0; diff --git a/radio.h b/radio.h index 563f737..20ffca9 100644 --- a/radio.h +++ b/radio.h @@ -19,6 +19,7 @@ #include #include + #include "dcs.h" enum { @@ -28,44 +29,56 @@ enum { }; enum { - RADIO_CHANNEL_UP = 0x01U, + RADIO_CHANNEL_UP = 0x01U, RADIO_CHANNEL_DOWN = 0xFFU, }; enum { - BANDWIDTH_WIDE = 0U, - BANDWIDTH_NARROW = 1U, + BANDWIDTH_WIDE = 0, + BANDWIDTH_NARROW }; enum PTT_ID_t { - PTT_ID_OFF = 0U, - PTT_ID_BOT = 1U, - PTT_ID_EOT = 2U, - PTT_ID_BOTH = 3U, + PTT_ID_OFF = 0, + PTT_ID_BOT, + PTT_ID_EOT, + PTT_ID_BOTH }; typedef enum PTT_ID_t PTT_ID_t; -enum STEP_Setting_t { - STEP_2_5kHz, - STEP_5_0kHz, - STEP_6_25kHz, - STEP_10_0kHz, - STEP_12_5kHz, - STEP_25_0kHz, - STEP_8_33kHz, -}; +#if 0 + enum STEP_Setting_t { + STEP_2_5kHz, + STEP_5_0kHz, + STEP_6_25kHz, + STEP_10_0kHz, + STEP_12_5kHz, + STEP_25_0kHz, + STEP_8_33kHz, + }; +#else + enum STEP_Setting_t { + STEP_1_25kHz, + STEP_2_5kHz, + STEP_6_25kHz, + STEP_10_0kHz, + STEP_12_5kHz, + STEP_25_0kHz, + STEP_8_33kHz, + }; +#endif typedef enum STEP_Setting_t STEP_Setting_t; enum VfoState_t { - VFO_STATE_NORMAL = 0U, - VFO_STATE_BUSY = 1U, - VFO_STATE_BAT_LOW = 2U, - VFO_STATE_TX_DISABLE = 3U, - VFO_STATE_TIMEOUT = 4U, - VFO_STATE_ALARM = 5U, - VFO_STATE_VOL_HIGH = 6U, + VFO_STATE_NORMAL = 0, + VFO_STATE_BUSY, + VFO_STATE_BAT_LOW, + VFO_STATE_TX_DISABLE, + VFO_STATE_TIMEOUT, + VFO_STATE_ALARM, + VFO_STATE_VOL_HIGH }; typedef enum VfoState_t VfoState_t; @@ -123,24 +136,24 @@ extern STEP_Setting_t gStepSetting; extern VfoState_t VfoState[2]; -bool RADIO_CheckValidChannel(uint16_t ChNum, bool bCheckScanList, uint8_t RadioNum); -uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum); -void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t ChIndex, uint32_t Frequency); -void RADIO_ConfigureChannel(uint8_t RadioNum, uint32_t Arg); -void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo); -void RADIO_ApplyOffset(VFO_Info_t *pInfo); -void RADIO_SelectVfos(void); -void RADIO_SetupRegisters(bool bSwitchToFunction0); +bool RADIO_CheckValidChannel(uint16_t ChNum, bool bCheckScanList, uint8_t RadioNum); +uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum); +void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t ChIndex, uint32_t Frequency); +void RADIO_ConfigureChannel(uint8_t RadioNum, uint32_t Arg); +void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo); +void RADIO_ApplyOffset(VFO_Info_t *pInfo); +void RADIO_SelectVfos(void); +void RADIO_SetupRegisters(bool bSwitchToFunction0); #ifndef DISABLE_NOAA void RADIO_ConfigureNOAA(void); #endif -void RADIO_SetTxParameters(void); +void RADIO_SetTxParameters(void); -void RADIO_SetVfoState(VfoState_t State); -void RADIO_PrepareTX(void); -void RADIO_EnableCxCSS(void); -void RADIO_PrepareCssTX(void); -void RADIO_SendEndOfTransmission(void); +void RADIO_SetVfoState(VfoState_t State); +void RADIO_PrepareTX(void); +void RADIO_EnableCxCSS(void); +void RADIO_PrepareCssTX(void); +void RADIO_SendEndOfTransmission(void); #endif diff --git a/settings.c b/settings.c index 09d3e44..d896fce 100644 --- a/settings.c +++ b/settings.c @@ -122,7 +122,11 @@ void SETTINGS_SaveSettings(void) EEPROM_WriteBuffer(0x0EA0, State); #endif - State[0] = gEeprom.ALARM_MODE; + #ifndef DISABLE_ALARM + State[0] = gEeprom.ALARM_MODE; + #else + State[0] = false; + #endif State[1] = gEeprom.ROGER; State[2] = gEeprom.REPEATER_TAIL_TONE_ELIMINATION; State[3] = gEeprom.TX_CHANNEL; diff --git a/settings.h b/settings.h index 2c513da..bd644f0 100644 --- a/settings.h +++ b/settings.h @@ -19,85 +19,86 @@ #include #include + #include "radio.h" enum POWER_OnDisplayMode_t { - POWER_ON_DISPLAY_MODE_FULL_SCREEN = 0U, - POWER_ON_DISPLAY_MODE_MESSAGE = 1U, - POWER_ON_DISPLAY_MODE_VOLTAGE = 2U, + POWER_ON_DISPLAY_MODE_FULL_SCREEN = 0, + POWER_ON_DISPLAY_MODE_MESSAGE, + POWER_ON_DISPLAY_MODE_VOLTAGE }; typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t; enum { - F_LOCK_OFF = 0U, - F_LOCK_FCC = 1U, - F_LOCK_CE = 2U, - F_LOCK_GB = 3U, - F_LOCK_430 = 4U, - F_LOCK_438 = 5U, + F_LOCK_OFF = 0, + F_LOCK_FCC, + F_LOCK_CE, + F_LOCK_GB, + F_LOCK_430, + F_LOCK_438 }; enum { - SCAN_RESUME_TO = 0U, - SCAN_RESUME_CO = 1U, - SCAN_RESUME_SE = 2U, + SCAN_RESUME_TO = 0, + SCAN_RESUME_CO, + SCAN_RESUME_SE }; enum { - CROSS_BAND_OFF = 0U, - CROSS_BAND_CHAN_A = 1U, - CROSS_BAND_CHAN_B = 2U, + CROSS_BAND_OFF = 0, + CROSS_BAND_CHAN_A, + CROSS_BAND_CHAN_B }; enum { - DUAL_WATCH_OFF = 0U, - DUAL_WATCH_CHAN_A = 1U, - DUAL_WATCH_CHAN_B = 2U, + DUAL_WATCH_OFF = 0, + DUAL_WATCH_CHAN_A, + DUAL_WATCH_CHAN_B }; enum { - FREQUENCY_DEVIATION_OFF = 0U, - FREQUENCY_DEVIATION_ADD = 1U, - FREQUENCY_DEVIATION_SUB = 2U, + FREQUENCY_DEVIATION_OFF = 0, + FREQUENCY_DEVIATION_ADD, + FREQUENCY_DEVIATION_SUB }; enum { - OUTPUT_POWER_LOW = 0U, - OUTPUT_POWER_MID = 1U, - OUTPUT_POWER_HIGH = 2U, + OUTPUT_POWER_LOW = 0, + OUTPUT_POWER_MID, + OUTPUT_POWER_HIGH }; #ifndef DISABLE_VOICE enum VOICE_Prompt_t { - VOICE_PROMPT_OFF = 0U, - VOICE_PROMPT_CHINESE = 1U, - VOICE_PROMPT_ENGLISH = 2U, + VOICE_PROMPT_OFF = 0, + VOICE_PROMPT_CHINESE, + VOICE_PROMPT_ENGLISH }; typedef enum VOICE_Prompt_t VOICE_Prompt_t; #endif enum ALARM_Mode_t { - ALARM_MODE_SITE = 0U, - ALARM_MODE_TONE = 1U, + ALARM_MODE_SITE = 0, + ALARM_MODE_TONE }; typedef enum ALARM_Mode_t ALARM_Mode_t; enum ROGER_Mode_t { - ROGER_MODE_OFF = 0U, - ROGER_MODE_ROGER = 1U, - ROGER_MODE_MDC = 2U, + ROGER_MODE_OFF = 0, + ROGER_MODE_ROGER, + ROGER_MODE_MDC }; typedef enum ROGER_Mode_t ROGER_Mode_t; enum CHANNEL_DisplayMode_t { - MDF_FREQUENCY = 0U, - MDF_CHANNEL = 1U, - MDF_NAME = 2U, + MDF_FREQUENCY = 0, + MDF_CHANNEL, + MDF_NAME }; typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t; @@ -154,7 +155,9 @@ typedef struct { uint16_t FM_LowerLimit; uint16_t FM_UpperLimit; bool AUTO_KEYPAD_LOCK; - ALARM_Mode_t ALARM_MODE; + #ifndef DISABLE_ALARM + ALARM_Mode_t ALARM_MODE; + #endif POWER_OnDisplayMode_t POWER_ON_DISPLAY_MODE; ROGER_Mode_t ROGER; uint8_t REPEATER_TAIL_TONE_ELIMINATION; diff --git a/ui/main.c b/ui/main.c index df3efd8..a079c0a 100644 --- a/ui/main.c +++ b/ui/main.c @@ -153,11 +153,13 @@ void UI_DisplayMain(void) if (gCurrentFunction == FUNCTION_TRANSMIT) { - if (gAlarmState == ALARM_STATE_ALARM) - { - SomeValue = 2; - } - else + #ifndef DISABLE_ALARM + if (gAlarmState == ALARM_STATE_ALARM) + { + SomeValue = 2; + } + else + #endif { if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) Channel = gEeprom.RX_CHANNEL; @@ -214,16 +216,19 @@ void UI_DisplayMain(void) // 0x8FEC uint8_t State = VfoState[i]; - if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM) - { - if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) - Channel = gEeprom.RX_CHANNEL; - else - Channel = gEeprom.TX_CHANNEL; - if (Channel == i) - State = VFO_STATE_ALARM; - } + #ifndef DISABLE_ALARM + if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM) + { + if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) + Channel = gEeprom.RX_CHANNEL; + else + Channel = gEeprom.TX_CHANNEL; + if (Channel == i) + State = VFO_STATE_ALARM; + } + #endif + if (State) { uint8_t Width = 10; diff --git a/ui/menu.c b/ui/menu.c index fbcfdf7..9ca85c5 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -72,7 +72,9 @@ static const char MenuList[][7] = "SLIST1", // 32 "SLIST2", - "AL-MOD", + #ifndef DISABLE_ALARM + "AL-MOD", + #endif "ANI-ID", "UPCODE", "DWCODE", @@ -195,11 +197,13 @@ static const char gSubMenu_MDF[3][5] = "NAME", }; -static const char gSubMenu_AL_MOD[2][5] = -{ - "SITE", - "TONE", -}; +#ifndef DISABLE_ALARM + static const char gSubMenu_AL_MOD[2][5] = + { + "SITE", + "TONE", + }; +#endif static const char gSubMenu_D_RSP[4][6] = { @@ -441,10 +445,12 @@ void UI_DisplayMenu(void) sprintf(String, "LIST%d", gSubMenuSelection); break; - case MENU_AL_MOD: - sprintf(String, gSubMenu_AL_MOD[gSubMenuSelection]); - break; - + #ifndef DISABLE_ALARM + case MENU_AL_MOD: + sprintf(String, gSubMenu_AL_MOD[gSubMenuSelection]); + break; + #endif + case MENU_ANI_ID: strcpy(String, gEeprom.ANI_DTMF_ID); break; diff --git a/ui/menu.h b/ui/menu.h index 34c39b8..abb3f68 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -57,7 +57,9 @@ enum MENU_S_LIST, MENU_SLIST1, MENU_SLIST2, - MENU_AL_MOD, + #ifndef DISABLE_ALARM + MENU_AL_MOD, + #endif MENU_ANI_ID, MENU_UPCODE, MENU_DWCODE, diff --git a/win_make.bat b/win_make.bat index f369995..83906b2 100644 --- a/win_make.bat +++ b/win_make.bat @@ -13,7 +13,7 @@ del /S /Q *.o >nul 2>nul del /S /Q *.d >nul 2>nul ::python -m pip install --upgrade pip crcmod -::fw-pack.py firmware.bin 20230609-1 firmware.packed.bin +fw-pack.py firmware.bin 230909 firmware.packed.bin ::arm-none-eabi-size firmware