F Lock is a trap... so refactoring

This commit is contained in:
Armel FAUVEAU
2024-07-31 03:21:39 +02:00
parent 5cf119c856
commit b6334e3b91
11 changed files with 68 additions and 20 deletions

View File

@@ -44,8 +44,8 @@ ENABLE_FEAT_F4HWN ?= 1
ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
ENABLE_FEAT_F4HWN_PMR ?= 1
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 1
ENABLE_FEAT_F4HWN_PMR ?= 0
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 0
ENABLE_FEAT_F4HWN_CA ?= 1
# ---- DEBUGGING ----

View File

@@ -390,6 +390,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMin = 1;
*pMax = 15;
break;
case MENU_TX_LOCK:
case MENU_SET_INV:
//*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
@@ -894,6 +895,10 @@ void MENU_AcceptSetting(void)
case MENU_SET_GUI:
gSetting_set_gui = gSubMenuSelection;
break;
case MENU_TX_LOCK:
gTxVfo->TX_LOCK = gSubMenuSelection;
gRequestSaveChannel = 1;
return;
#endif
}
@@ -1311,6 +1316,9 @@ void MENU_ShowCurrentSetting(void)
case MENU_SET_GUI:
gSubMenuSelection = gSetting_set_gui;
break;
case MENU_TX_LOCK:
gSubMenuSelection = gTxVfo->TX_LOCK;
break;
#endif
default:

View File

@@ -135,9 +135,19 @@ const uint8_t BITMAP_Antenna[5] =
0b00000011
};
const uint8_t BITMAP_VFO_Default[8] =
const uint8_t BITMAP_VFO_Lock[7] =
{
0b01111100,
0b01000110,
0b01000101,
0b01000101,
0b01000101,
0b01000110,
0b01111100,
};
const uint8_t BITMAP_VFO_Default[7] =
{
0b00000000,
0b01111111,
0b01111111,
0b00111110,
@@ -147,9 +157,8 @@ const uint8_t BITMAP_VFO_Default[8] =
0b00001000
};
const uint8_t BITMAP_VFO_NotDefault[8] =
const uint8_t BITMAP_VFO_NotDefault[7] =
{
0b00000000,
0b01000001,
0b01000001,
0b00100010,

View File

@@ -28,8 +28,9 @@ extern const uint8_t BITMAP_Ready[7];
#endif
extern const uint8_t BITMAP_Antenna[5];
extern const uint8_t BITMAP_VFO_Default[8];
extern const uint8_t BITMAP_VFO_NotDefault[8];
extern const uint8_t BITMAP_VFO_Default[7];
extern const uint8_t BITMAP_VFO_NotDefault[7];
extern const uint8_t BITMAP_VFO_Lock[7];
extern const uint8_t BITMAP_ScanList0[7];
extern const uint8_t BITMAP_ScanList1[7];
extern const uint8_t BITMAP_ScanList2[7];

4
main.c
View File

@@ -129,9 +129,9 @@ void Main(void)
gEeprom.KEY_LOCK = 0;
SETTINGS_SaveSettings();
#ifndef ENABLE_VOX
gMenuCursor = 62; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
gMenuCursor = 63; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
#else
gMenuCursor = 64; // move to hidden section, fix me if change... !!!
gMenuCursor = 65; // move to hidden section, fix me if change... !!!
#endif
gSubMenuSelection = gSetting_F_LOCK;
#endif

18
radio.c
View File

@@ -141,6 +141,7 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t
pInfo->StepFrequency = gStepFrequencyTable[pInfo->STEP_SETTING];
pInfo->CHANNEL_SAVE = ChannelSave;
pInfo->FrequencyReverse = false;
pInfo->TX_LOCK = true;
pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
pInfo->freq_config_RX.Frequency = Frequency;
pInfo->freq_config_TX.Frequency = Frequency;
@@ -250,7 +251,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
{
uint8_t tmp;
uint8_t data[8];
// ***************
EEPROM_ReadBuffer(base + 8, data, sizeof(data));
@@ -332,6 +333,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
pVfo->CHANNEL_BANDWIDTH = BK4819_FILTER_BW_WIDE;
pVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
pVfo->BUSY_CHANNEL_LOCK = false;
pVfo->TX_LOCK = true;
}
else
{
@@ -340,6 +342,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
pVfo->CHANNEL_BANDWIDTH = !!((d4 >> 1) & 1u);
pVfo->OUTPUT_POWER = ((d4 >> 2) & 7u);
pVfo->BUSY_CHANNEL_LOCK = !!((d4 >> 5) & 1u);
pVfo->TX_LOCK = !!((d4 >> 6) & 1u);
}
if (data[5] == 0xFF)
@@ -1053,9 +1056,16 @@ void RADIO_PrepareTX(void)
RADIO_SelectCurrentVfo();
if(TX_freq_check(gCurrentVfo->pTX->Frequency) != 0
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
&& gAlarmState != ALARM_STATE_SITE_ALARM
#ifdef ENABLE_FEAT_F4HWN
if(TX_freq_check(gCurrentVfo->pTX->Frequency) != 0 && gCurrentVfo->TX_LOCK == true
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
&& gAlarmState != ALARM_STATE_SITE_ALARM
#endif
#else
if(TX_freq_check(gCurrentVfo->pTX->Frequency) != 0
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
&& gAlarmState != ALARM_STATE_SITE_ALARM
#endif
#endif
){
// TX frequency not allowed

View File

@@ -107,6 +107,7 @@ typedef struct VFO_Info_t
uint8_t SquelchOpenGlitchThresh;
STEP_Setting_t STEP_SETTING;
uint8_t TX_LOCK;
uint8_t OUTPUT_POWER;
uint8_t TXP_CalculatedSetting;
bool FrequencyReverse;

View File

@@ -745,6 +745,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
State._8[2] = (pVFO->freq_config_TX.CodeType << 4) | pVFO->freq_config_RX.CodeType;
State._8[3] = (pVFO->Modulation << 4) | pVFO->TX_OFFSET_FREQUENCY_DIRECTION;
State._8[4] = 0
| (pVFO->TX_LOCK << 6)
| (pVFO->BUSY_CHANNEL_LOCK << 5)
| (pVFO->OUTPUT_POWER << 2)
| (pVFO->CHANNEL_BANDWIDTH << 1)

View File

@@ -295,14 +295,14 @@ void DisplayRSSIBar(const bool now)
switch(RxBlink)
{
case 0:
UI_PrintStringSmallBold("RX", 14, 0, RxLine);
UI_PrintStringSmallBold("RX", 8, 0, RxLine);
break;
case 1:
UI_PrintStringSmallBold("RX", 14, 0, RxLine);
UI_PrintStringSmallBold("RX", 8, 0, RxLine);
RxBlink = 2;
break;
case 2:
for (uint8_t i = 14; i < 30; i++)
for (uint8_t i = 8; i < 24; i++)
{
gFrameBuffer[RxLine][i] = 0x00;
}
@@ -758,6 +758,14 @@ void UI_DisplayMain(void)
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
if(TX_freq_check(frequency) != 0 && gEeprom.VfoInfo[vfo_num].TX_LOCK == true)
{
if(isMainOnly(false))
memcpy(p_line0 + 14, BITMAP_VFO_Lock, sizeof(BITMAP_VFO_Lock));
else
memcpy(p_line0 + 24, BITMAP_VFO_Lock, sizeof(BITMAP_VFO_Lock));
}
if (gCurrentFunction == FUNCTION_TRANSMIT)
{ // transmitting
@@ -770,7 +778,7 @@ void UI_DisplayMain(void)
if (activeTxVFO == vfo_num)
{ // show the TX symbol
mode = VFO_MODE_TX;
UI_PrintStringSmallBold("TX", 14, 0, line);
UI_PrintStringSmallBold("TX", 8, 0, line);
}
}
}
@@ -793,7 +801,7 @@ void UI_DisplayMain(void)
RxBlink = 0;
}
#else
UI_PrintStringSmallBold("RX", 14, 0, line);
UI_PrintStringSmallBold("RX", 8, 0, line);
#endif
}
#ifdef ENABLE_FEAT_F4HWN
@@ -801,7 +809,7 @@ void UI_DisplayMain(void)
{
if(RxOnVfofrequency == frequency && !isMainOnly(false))
{
UI_PrintStringSmallNormal(">>", 14, 0, line);
UI_PrintStringSmallNormal(">>", 8, 0, line);
//memcpy(p_line0 + 14, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
}

View File

@@ -55,6 +55,9 @@ const t_menu_item MenuList[] =
{"BusyCL", MENU_BCL }, // was "BCL"
{"Compnd", MENU_COMPAND },
{"Mode", MENU_AM }, // was "AM"
#ifdef ENABLE_FEAT_F4HWN
{"TXLock", MENU_TX_LOCK },
#endif
{"ScAdd1", MENU_S_ADD1 },
{"ScAdd2", MENU_S_ADD2 },
{"ScAdd3", MENU_S_ADD3 },
@@ -989,6 +992,10 @@ void UI_DisplayMenu(void)
ST7565_ContrastAndInv();
break;
case MENU_TX_LOCK:
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
break;
case MENU_SET_LCK:
strcpy(String, gSubMenu_SET_LCK[gSubMenuSelection]);
break;

View File

@@ -45,6 +45,9 @@ enum
MENU_SCR,
#endif
MENU_BCL,
#ifdef ENABLE_FEAT_F4HWN
MENU_TX_LOCK,
#endif
MENU_MEM_CH,
MENU_DEL_CH,
MENU_MEM_NAME,