ALARM option now removable

This commit is contained in:
OneOfEleven 2023-09-09 09:01:52 +01:00
parent 43e61bf0a1
commit 5b260e2ee0
21 changed files with 314 additions and 235 deletions

View File

@ -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)

View File

@ -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)

View File

@ -182,6 +182,7 @@ void ACTION_Vox(void)
gUpdateStatus = true;
}
#ifndef DISABLE_ALARM
static void ACTION_AlarmOr1750(bool b1750)
{
gInputBoxIndex = 0;
@ -190,6 +191,7 @@ static void ACTION_AlarmOr1750(bool b1750)
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:
#ifndef DISABLE_ALARM
ACTION_AlarmOr1750(false);
#endif
break;
case 7:
ACTION_FM();
break;
case 8:
#ifndef DISABLE_ALARM
ACTION_AlarmOr1750(true);
#endif
break;
}
}

View File

@ -24,7 +24,9 @@ void ACTION_Power(void);
//static void ACTION_Monitor(void)
void ACTION_Scan(bool bFlag);
void ACTION_Vox(void);
#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);

View File

@ -1055,6 +1055,7 @@ void APP_TimeSlice10ms(void)
if (gCurrentFunction == FUNCTION_TRANSMIT)
{
#ifndef DISABLE_ALARM
if (gAlarmState == ALARM_STATE_TXALARM || gAlarmState == ALARM_STATE_ALARM)
{
uint16_t Tone;
@ -1099,6 +1100,7 @@ void APP_TimeSlice10ms(void)
}
}
}
#endif
if (gRTTECountdown)
{
@ -1458,6 +1460,7 @@ void APP_TimeSlice500ms(void)
}
}
#ifndef DISABLE_ALARM
static void ALARM_Off(void)
{
gAlarmState = ALARM_STATE_OFF;
@ -1477,6 +1480,7 @@ static void ALARM_Off(void)
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)
{
#ifndef DISABLE_ALARM
if (gAlarmState == ALARM_STATE_OFF)
#endif
{
if (Key == KEY_PTT)
{
@ -1719,6 +1725,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
}
}
}
#ifndef DISABLE_ALARM
else
if (!bKeyHeld && bKeyPressed)
{
@ -1734,6 +1741,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
else
gPttWasReleased = true;
}
#endif
}
else
if (Key != KEY_SIDE1 && Key != KEY_SIDE2)

View File

@ -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:
#ifndef DISABLE_ALARM
case MENU_AL_MOD:
#endif
case MENU_D_ST:
case MENU_D_DCD:
case MENU_AM:
@ -469,9 +471,11 @@ void MENU_AcceptSetting(void)
gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection - 1;
break;
#ifndef DISABLE_ALARM
case MENU_AL_MOD:
gEeprom.ALARM_MODE = gSubMenuSelection;
break;
#endif
case MENU_D_ST:
gEeprom.DTMF_SIDE_TONE = gSubMenuSelection;
@ -809,9 +813,11 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = RADIO_FindNextChannel(0, 1, true, 1);
break;
#ifndef DISABLE_ALARM
case MENU_AL_MOD:
gSubMenuSelection = gEeprom.ALARM_MODE;
break;
#endif
case MENU_D_ST:
gSubMenuSelection = gEeprom.DTMF_SIDE_TONE;

View File

@ -431,7 +431,9 @@ void BOARD_EEPROM_Init(void)
// 0EA8..0EAF
EEPROM_ReadBuffer(0x0EA8, Data, 8);
#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;

BIN
firmware

Binary file not shown.

Binary file not shown.

BIN
firmware.packed.bin Normal file

Binary file not shown.

View File

@ -127,11 +127,12 @@ 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) {
#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);
@ -145,6 +146,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
gAlarmToneCounter = 0;
break;
}
#endif
GUI_DisplayScreen();
RADIO_SetTxParameters();
@ -152,23 +154,27 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
DTMF_Reply();
if (gAlarmState != ALARM_STATE_OFF) {
if (gAlarmState == ALARM_STATE_TX1750) {
#ifndef DISABLE_ALARM
if (gAlarmState != ALARM_STATE_OFF)
{
if (gAlarmState == ALARM_STATE_TX1750)
BK4819_TransmitTone(true, 1750);
} else {
else
BK4819_TransmitTone(true, 500);
}
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;

3
main.c
View File

@ -109,6 +109,9 @@ void Main(void)
SYSTEM_DelayMs(2000);
gMenuListCount = 51;
#ifdef DISABLE_ALARM
gMenuListCount--;
#endif
#ifdef DISABLE_VOICE
gMenuListCount--;
#endif

4
misc.c
View File

@ -77,7 +77,9 @@ uint8_t gReducedService;
uint8_t gBatteryVoltageIndex;
CssScanMode_t gCssScanMode;
bool gUpdateRSSI;
#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;
#ifndef DISABLE_ALARM
uint8_t gAlarmToneCounter;
uint16_t gAlarmRunningCounter;
#endif
bool gKeyBeingHeld;
bool gPttIsPressed;
uint8_t gPttDebounceCounter;

View File

@ -802,7 +802,9 @@ void RADIO_PrepareTX(void)
RADIO_SelectCurrentVfo();
#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,7 +826,9 @@ void RADIO_PrepareTX(void)
RADIO_SetVfoState(State);
#ifndef DISABLE_ALARM
gAlarmState = ALARM_STATE_OFF;
#endif
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
@ -851,7 +855,11 @@ Skip:
FUNCTION_Select(FUNCTION_TRANSMIT);
#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;

39
radio.h
View File

@ -19,6 +19,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "dcs.h"
enum {
@ -33,19 +34,20 @@ enum {
};
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;
#if 0
enum STEP_Setting_t {
STEP_2_5kHz,
STEP_5_0kHz,
@ -55,17 +57,28 @@ enum STEP_Setting_t {
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;

View File

@ -122,7 +122,11 @@ void SETTINGS_SaveSettings(void)
EEPROM_WriteBuffer(0x0EA0, State);
#endif
#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;

View File

@ -19,85 +19,86 @@
#include <stdbool.h>
#include <stdint.h>
#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;
#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;

View File

@ -153,11 +153,13 @@ void UI_DisplayMain(void)
if (gCurrentFunction == FUNCTION_TRANSMIT)
{
#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,6 +216,8 @@ void UI_DisplayMain(void)
// 0x8FEC
uint8_t State = VfoState[i];
#ifndef DISABLE_ALARM
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
{
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
@ -223,6 +227,7 @@ void UI_DisplayMain(void)
if (Channel == i)
State = VFO_STATE_ALARM;
}
#endif
if (State)
{

View File

@ -72,7 +72,9 @@ static const char MenuList[][7] =
"SLIST1",
// 32
"SLIST2",
#ifndef DISABLE_ALARM
"AL-MOD",
#endif
"ANI-ID",
"UPCODE",
"DWCODE",
@ -195,11 +197,13 @@ static const char gSubMenu_MDF[3][5] =
"NAME",
};
#ifndef DISABLE_ALARM
static const char gSubMenu_AL_MOD[2][5] =
{
"SITE",
"TONE",
};
#endif
static const char gSubMenu_D_RSP[4][6] =
{
@ -441,9 +445,11 @@ void UI_DisplayMenu(void)
sprintf(String, "LIST%d", 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);

View File

@ -57,7 +57,9 @@ enum
MENU_S_LIST,
MENU_SLIST1,
MENU_SLIST2,
#ifndef DISABLE_ALARM
MENU_AL_MOD,
#endif
MENU_ANI_ID,
MENU_UPCODE,
MENU_DWCODE,

View File

@ -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