diff --git a/Makefile b/Makefile index 86583cfa..6971f4bf 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ ENABLE_FMRADIO := 1 ENABLE_NOAA := 0 ENABLE_VOICE := 0 ENABLE_ALARM := 0 -#ENABLE_1750HZ := 0 +ENABLE_TX1750 := 0 ENABLE_BIG_FREQ := 0 ENABLE_SMALL_BOLD := 1 ENABLE_KEEP_MEM_NAME := 1 @@ -198,8 +198,8 @@ endif ifeq ($(ENABLE_ALARM),1) CFLAGS += -DENABLE_ALARM endif -ifeq ($(ENABLE_1750HZ),1) - CFLAGS += -DENABLE_1750HZ +ifeq ($(ENABLE_TX1750),1) + CFLAGS += -DENABLE_TX1750 endif ifeq ($(ENABLE_KEEP_MEM_NAME),1) CFLAGS += -DKEEP_MEM_NAME diff --git a/README.md b/README.md index 1e678529..114ee68d 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ ENABLE_FMRADIO := 1 WBFM VHF band 2 RX ENABLE_NOAA := 0 everything NOAA ENABLE_VOICE := 0 want to hear voices ? ENABLE_ALARM := 0 TX alarms -#ENABLE_1750HZ := 0 not not implemented .. side key 1750Hz TX tone +ENABLE_1750HZ := 0 side key 1750Hz TX tone ENABLE_BIG_FREQ := 0 big font frequencies ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode) ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel diff --git a/app/action.c b/app/action.c index 5acb8c56..3fa0ca5e 100644 --- a/app/action.c +++ b/app/action.c @@ -235,17 +235,27 @@ void ACTION_Vox(void) gUpdateStatus = true; } -#ifdef ENABLE_ALARM +#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) static void ACTION_AlarmOr1750(bool b1750) { - gInputBoxIndex = 0; - gAlarmState = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM; - gAlarmRunningCounter = 0; - gFlagPrepareTX = true; + gInputBoxIndex = 0; + + #if defined(ENABLE_ALARM) && defined(ENABLE_TX1750) + gAlarmState = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM; + gAlarmRunningCounter = 0; + #elif defined(ENABLE_ALARM) + gAlarmState = ALARM_STATE_TXALARM; + gAlarmRunningCounter = 0; + #else + gAlarmState = ALARM_STATE_TX1750; + #endif + + gFlagPrepareTX = true; gRequestDisplayScreen = DISPLAY_MAIN; } #endif + #ifdef ENABLE_FMRADIO void ACTION_FM(void) { @@ -368,7 +378,7 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) break; #endif case ACTION_OPT_1750: - #ifdef ENABLE_ALARM + #ifdef ENABLE_TX1750 ACTION_AlarmOr1750(true); #endif break; diff --git a/app/app.c b/app/app.c index 20724d83..cc6b2b67 100644 --- a/app/app.c +++ b/app/app.c @@ -1968,7 +1968,7 @@ void APP_TimeSlice500ms(void) } } -#ifdef ENABLE_ALARM +#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) static void ALARM_Off(void) { gAlarmState = ALARM_STATE_OFF; @@ -2186,7 +2186,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) if (gCurrentFunction == FUNCTION_TRANSMIT) { // transmitting - #ifdef ENABLE_ALARM + #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) if (gAlarmState == ALARM_STATE_OFF) #endif { @@ -2242,7 +2242,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) } } } - #ifdef ENABLE_ALARM + #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) else if (!bKeyHeld && bKeyPressed) { diff --git a/app/main.c b/app/main.c index 3acd3d65..f7c9e8a6 100644 --- a/app/main.c +++ b/app/main.c @@ -729,7 +729,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) { // step/down in frequency const uint32_t frequency = APP_SetFrequencyByStep(gTxVfo, Direction); - if (RX_FREQUENCY_Check(frequency) < 0) + if (RX_freq_check(frequency) < 0) { // frequency not allowed gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; return; diff --git a/firmware.bin b/firmware.bin index 9304648a..5bfecc08 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 4c6b888c..5d3c9c4a 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/frequencies.c b/frequencies.c index 65f070ff..404a6641 100644 --- a/frequencies.c +++ b/frequencies.c @@ -157,7 +157,7 @@ uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower) return Lower + (Step * Index); } /* -int TX_FREQUENCY_Check(VFO_Info_t *pInfo) +int TX_freq_check(VFO_Info_t *pInfo) { // return '0' if TX frequency is allowed // otherwise return '-1' @@ -168,7 +168,7 @@ int TX_FREQUENCY_Check(VFO_Info_t *pInfo) return -1; #endif */ -int TX_FREQUENCY_Check(const uint32_t Frequency) +int TX_freq_check(const uint32_t Frequency) { // return '0' if TX frequency is allowed // otherwise return '-1' @@ -235,7 +235,7 @@ int TX_FREQUENCY_Check(const uint32_t Frequency) return -1; } -int RX_FREQUENCY_Check(const uint32_t Frequency) +int RX_freq_check(const uint32_t Frequency) { // return '0' if RX frequency is allowed // otherwise return '-1' diff --git a/frequencies.h b/frequencies.h index 168936fb..7202518c 100644 --- a/frequencies.h +++ b/frequencies.h @@ -55,9 +55,9 @@ FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency); uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency); uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower); -//int TX_FREQUENCY_Check(VFO_Info_t *pInfo); -int TX_FREQUENCY_Check(const uint32_t Frequency); -int RX_FREQUENCY_Check(const uint32_t Frequency); +//int TX_freq_check(VFO_Info_t *pInfo); +int TX_freq_check(const uint32_t Frequency); +int RX_freq_check(const uint32_t Frequency); #endif diff --git a/functions.c b/functions.c index 5394fde4..389018d4 100644 --- a/functions.c +++ b/functions.c @@ -192,18 +192,27 @@ void FUNCTION_Select(FUNCTION_Type_t Function) DTMF_Reply(); - #ifdef ENABLE_ALARM + #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) if (gAlarmState != ALARM_STATE_OFF) { - BK4819_TransmitTone(true, (gAlarmState == ALARM_STATE_TX1750) ? 1750 : 500); + #ifdef ENABLE_TX1750 + if (gAlarmState == ALARM_STATE_TX1750) + BK4819_TransmitTone(true, 1750); + #endif + #ifdef ENABLE_ALARM + if (gAlarmState == ALARM_STATE_TXALARM) + BK4819_TransmitTone(true, 500); + #endif SYSTEM_DelayMs(2); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); - gAlarmToneCounter = 0; - gEnableSpeaker = true; + #ifdef ENABLE_ALARM + gAlarmToneCounter = 0; + #endif + gEnableSpeaker = true; break; } #endif - + if (gCurrentVfo->SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable) BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1); else diff --git a/misc.c b/misc.c index 9132342f..a54fcec1 100644 --- a/misc.c +++ b/misc.c @@ -149,7 +149,7 @@ uint8_t gReducedService; uint8_t gBatteryVoltageIndex; CssScanMode_t gCssScanMode; bool gUpdateRSSI; -#ifdef ENABLE_ALARM +#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) AlarmState_t gAlarmState; #endif uint8_t gVoltageMenuCountdown; diff --git a/radio.c b/radio.c index 9d779d97..39624f83 100644 --- a/radio.c +++ b/radio.c @@ -892,8 +892,9 @@ void RADIO_SetVfoState(VfoState_t State) } else { - const uint8_t Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL; - VfoState[Channel] = State; + unsigned int chan = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) ? (gEeprom.RX_CHANNEL + 1) & 1 : gEeprom.RX_CHANNEL; // 1of11 + chan = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.TX_CHANNEL : chan; + VfoState[chan] = State; } #ifdef ENABLE_FMRADIO @@ -928,10 +929,16 @@ void RADIO_PrepareTX(void) RADIO_SelectCurrentVfo(); - #ifdef ENABLE_ALARM + #if defined(ENABLE_ALARM) && defined(ENABLE_TX1750) if (gAlarmState == ALARM_STATE_OFF || gAlarmState == ALARM_STATE_TX1750 || (gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE)) + #elif defined(ENABLE_ALARM) + if (gAlarmState == ALARM_STATE_OFF || + (gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE)) + #elif defined(ENABLE_TX1750) + if (gAlarmState == ALARM_STATE_OFF || + gAlarmState == ALARM_STATE_TX1750) #endif { #ifndef ENABLE_TX_WHEN_AM @@ -946,8 +953,9 @@ void RADIO_PrepareTX(void) State = VFO_STATE_TX_DISABLE; } else - //if (TX_FREQUENCY_Check(gCurrentVfo->pTX->Frequency) == 0 || gCurrentVfo->CHANNEL_SAVE <= FREQ_CHANNEL_LAST) - if (TX_FREQUENCY_Check(gCurrentVfo->pTX->Frequency) == 0) + //if (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0 || gCurrentVfo->CHANNEL_SAVE <= FREQ_CHANNEL_LAST) + //if (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0) + if (TX_freq_check(gEeprom.VfoInfo[gEeprom.TX_CHANNEL].pTX->Frequency) == 0) { // TX frequency is allowed if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE) State = VFO_STATE_BUSY; // busy RX'ing a station @@ -966,7 +974,7 @@ void RADIO_PrepareTX(void) if (State != VFO_STATE_NORMAL) { // TX not allowed RADIO_SetVfoState(State); - #ifdef ENABLE_ALARM + #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) gAlarmState = ALARM_STATE_OFF; #endif gDTMF_ReplyState = DTMF_REPLY_NONE; @@ -994,7 +1002,8 @@ void RADIO_PrepareTX(void) FUNCTION_Select(FUNCTION_TRANSMIT); gTxTimerCountdown_500ms = 0; // no timeout - #ifdef ENABLE_ALARM + + #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) if (gAlarmState == ALARM_STATE_OFF) #endif { diff --git a/settings.c b/settings.c index 649eca49..a38fa495 100644 --- a/settings.c +++ b/settings.c @@ -121,7 +121,7 @@ void SETTINGS_SaveSettings(void) EEPROM_WriteBuffer(0x0EA0, State); #endif - #ifdef ENABLE_ALARM + #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) State[0] = gEeprom.ALARM_MODE; #else State[0] = false; diff --git a/settings.h b/settings.h index 3b94b8cf..47dcdb3c 100644 --- a/settings.h +++ b/settings.h @@ -176,7 +176,7 @@ typedef struct { #endif bool AUTO_KEYPAD_LOCK; - #ifdef ENABLE_ALARM + #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) ALARM_Mode_t ALARM_MODE; #endif POWER_OnDisplayMode_t POWER_ON_DISPLAY_MODE; diff --git a/ui/main.c b/ui/main.c index f3873f21..dd06fb8e 100644 --- a/ui/main.c +++ b/ui/main.c @@ -318,13 +318,14 @@ void UI_DisplayMain(void) for (vfo_num = 0; vfo_num < 2; vfo_num++) { - const unsigned int rx_line = (gEeprom.RX_CHANNEL == 0) ? line0 : line1; -// const unsigned int tx_line = (gEeprom.TX_CHANNEL == 0) ? line0 : line1; - const unsigned int line = (vfo_num == 0) ? line0 : line1; - uint8_t channel = gEeprom.TX_CHANNEL; - const bool same_vfo = (channel == vfo_num) ? true : false; - uint8_t *p_line0 = gFrameBuffer[line + 0]; - uint8_t *p_line1 = gFrameBuffer[line + 1]; + const unsigned int line = (vfo_num == 0) ? line0 : line1; + uint8_t channel = gEeprom.TX_CHANNEL; +// uint8_t tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL; + const bool same_vfo = (channel == vfo_num) ? true : false; + uint8_t *p_line0 = gFrameBuffer[line + 0]; + uint8_t *p_line1 = gFrameBuffer[line + 1]; + uint32_t duff_beer = 0; + uint8_t state; if (single_vfo) { // we're in single VFO mode - screen is dedicated to just one VFO @@ -405,8 +406,6 @@ void UI_DisplayMain(void) memmove(p_line0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault)); } - uint32_t duff_beer = 0; - if (gCurrentFunction == FUNCTION_TRANSMIT) { // transmitting @@ -428,7 +427,7 @@ void UI_DisplayMain(void) { // receiving .. show the RX symbol duff_beer = 2; if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == vfo_num) - UI_PrintStringSmall("RX", 14, 0, rx_line); + UI_PrintStringSmall("RX", 14, 0, line); } if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) @@ -468,7 +467,7 @@ void UI_DisplayMain(void) // ************ - uint8_t state = VfoState[vfo_num]; + state = VfoState[vfo_num]; #ifdef ENABLE_ALARM if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM) diff --git a/version.c b/version.c index b4963337..c10615c1 100644 --- a/version.c +++ b/version.c @@ -4,7 +4,7 @@ #ifdef GIT_HASH #define VER GIT_HASH #else - #define VER "230929" + #define VER "231002" #endif #ifndef ONE_OF_ELEVEN_VER