Skip to content

Commit

Permalink
1750 compile option + maybe DW AM TX fix
Browse files Browse the repository at this point in the history
  • Loading branch information
OneOfEleven committed Oct 1, 2023
1 parent de174d0 commit c644b30
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 47 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 16 additions & 6 deletions app/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Binary file modified firmware.bin
Binary file not shown.
Binary file modified firmware.packed.bin
Binary file not shown.
6 changes: 3 additions & 3 deletions frequencies.c
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'

Expand Down Expand Up @@ -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'

Expand Down
6 changes: 3 additions & 3 deletions frequencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

19 changes: 14 additions & 5 deletions functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
23 changes: 16 additions & 7 deletions radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 10 additions & 11 deletions ui/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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]))
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion version.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifdef GIT_HASH
#define VER GIT_HASH
#else
#define VER "230929"
#define VER "231002"
#endif

#ifndef ONE_OF_ELEVEN_VER
Expand Down

0 comments on commit c644b30

Please sign in to comment.