TX on all bands #68

This commit is contained in:
Krzysiek Egzmont 2023-11-08 01:43:06 +01:00
parent f154aebd38
commit 49cec54cd3
10 changed files with 41 additions and 32 deletions

View File

@ -252,7 +252,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
case MENU_500TX:
case MENU_350EN:
case MENU_SCREN:
case MENU_TX_EN:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
break;
@ -759,10 +758,19 @@ void MENU_AcceptSetting(void)
gSetting_350TX = gSubMenuSelection;
break;
case MENU_F_LOCK:
case MENU_F_LOCK: {
static uint8_t cnt;
if(gSubMenuSelection == F_LOCK_NONE) { // select 10 times to enable
cnt++;
if(cnt < 10)
return;
}
else
cnt = 0;
gSetting_F_LOCK = gSubMenuSelection;
break;
}
case MENU_200TX:
gSetting_200TX = gSubMenuSelection;
break;
@ -782,10 +790,6 @@ void MENU_AcceptSetting(void)
gFlagReconfigureVfos = true;
break;
case MENU_TX_EN:
gSetting_TX_EN = gSubMenuSelection;
break;
#ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI:
writeXtalFreqCal(gSubMenuSelection, true);
@ -1153,10 +1157,6 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gSetting_ScrambleEnable;
break;
case MENU_TX_EN:
gSubMenuSelection = gSetting_TX_EN;
break;
#ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI:
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;

View File

@ -701,14 +701,14 @@ void BOARD_EEPROM_Init(void)
// 0F40..0F47
EEPROM_ReadBuffer(0x0F40, Data, 8);
gSetting_F_LOCK = (Data[0] < 6) ? Data[0] : F_LOCK_OFF;
gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF;
gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true
gSetting_KILLED = (Data[2] < 2) ? Data[2] : false;
gSetting_200TX = (Data[3] < 2) ? Data[3] : false;
gSetting_500TX = (Data[4] < 2) ? Data[4] : false;
gSetting_350EN = (Data[5] < 2) ? Data[5] : true;
gSetting_ScrambleEnable = (Data[6] < 2) ? Data[6] : true;
gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
//gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
gSetting_live_DTMF_decoder = (Data[7] & (1u << 1)) ? true : false;
gSetting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3 : 2;
#ifdef ENABLE_AUDIO_BAR

View File

@ -147,7 +147,7 @@ int TX_freq_check(const uint32_t Frequency)
switch (gSetting_F_LOCK)
{
case F_LOCK_OFF:
case F_LOCK_DEF:
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < frequencyBandTable[BAND3_137MHz].upper)
return 0;
if (Frequency >= frequencyBandTable[BAND4_174MHz].lower && Frequency < frequencyBandTable[BAND4_174MHz].upper)
@ -197,6 +197,15 @@ int TX_freq_check(const uint32_t Frequency)
if (Frequency >= 40000000 && Frequency < 43800000)
return 0;
break;
case F_LOCK_ALL:
break;
case F_LOCK_NONE:
for (uint8_t i = 0; i < ARRAY_SIZE(frequencyBandTable); i++)
if (Frequency >= frequencyBandTable[i].lower && Frequency < frequencyBandTable[i].upper)
return 0;
break;
}
// dis-allowed TX frequency

1
misc.c
View File

@ -82,7 +82,6 @@ bool gSetting_KILLED;
bool gSetting_200TX;
bool gSetting_500TX;
bool gSetting_350EN;
bool gSetting_TX_EN;
uint8_t gSetting_F_LOCK;
bool gSetting_ScrambleEnable;

1
misc.h
View File

@ -146,7 +146,6 @@ extern bool gSetting_KILLED;
extern bool gSetting_200TX;
extern bool gSetting_500TX;
extern bool gSetting_350EN;
extern bool gSetting_TX_EN;
extern uint8_t gSetting_F_LOCK;
extern bool gSetting_ScrambleEnable;

View File

@ -1011,7 +1011,7 @@ void RADIO_PrepareTX(void)
}
else
#endif
if (!gSetting_TX_EN || gSerialConfigCountDown_500ms > 0)
if (gSerialConfigCountDown_500ms > 0)
{ // TX is disabled or config upload/download in progress
State = VFO_STATE_TX_DISABLE;
}

View File

@ -174,7 +174,7 @@ void SETTINGS_SaveSettings(void)
State[4] = gSetting_500TX;
State[5] = gSetting_350EN;
State[6] = gSetting_ScrambleEnable;
if (!gSetting_TX_EN) State[7] &= ~(1u << 0);
//if (!gSetting_TX_EN) State[7] &= ~(1u << 0);
if (!gSetting_live_DTMF_decoder) State[7] &= ~(1u << 1);
State[7] = (State[7] & ~(3u << 2)) | ((gSetting_battery_text & 3u) << 2);
#ifdef ENABLE_AUDIO_BAR

View File

@ -34,12 +34,15 @@ enum POWER_OnDisplayMode_t {
typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;
enum {
F_LOCK_OFF = 0,
F_LOCK_DEF, //all default frequencies + configurable
F_LOCK_FCC,
F_LOCK_CE,
F_LOCK_GB,
F_LOCK_430,
F_LOCK_438
F_LOCK_438,
F_LOCK_ALL, // disable TX on all frequencies
F_LOCK_NONE, // enable TX on all frequencies
F_LOCK_LEN
};
enum {

View File

@ -129,7 +129,6 @@ const t_menu_item MenuList[] =
{"Tx 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
{"350 En", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
{"ScraEn", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
{"TxEnab", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
#ifdef ENABLE_F_CAL_MENU
{"FrCali", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
#endif
@ -270,14 +269,16 @@ const char gSubMenu_RESET[][4] =
"ALL"
};
const char gSubMenu_F_LOCK[][4] =
const char * gSubMenu_F_LOCK[] =
{
"OFF",
"FCC",
"CE",
"GB",
"430",
"438"
"DEFAULT+\n137-174\n400-470",
"FCC HAM\n144-148\n420-450",
"CE HAM\n144-146\n430-440",
"GB HAM\n144-148\n430-440",
"137-174\n400-430",
"137-174\n400-438",
"DISABLE\nALL",
"UNLOCK\nALL",
};
const char gSubMenu_BACKLIGHT[][7] =
@ -634,7 +635,6 @@ void UI_DisplayMenu(void)
case MENU_500TX:
case MENU_350EN:
case MENU_SCREN:
case MENU_TX_EN:
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
break;

View File

@ -21,6 +21,7 @@
#include <stdint.h>
#include "audio.h" // VOICE_ID_t
#include "settings.h"
typedef struct {
const char name[7]; // menu display area only has room for 6 characters
@ -110,8 +111,6 @@ enum
MENU_500TX,
MENU_350EN,
MENU_SCREN,
MENU_TX_EN, // enable TX
#ifdef ENABLE_F_CAL_MENU
MENU_F_CALI, // reference xtal calibration
#endif
@ -148,7 +147,7 @@ extern const char* gSubMenu_PTT_ID[5];
extern const char gSubMenu_PONMSG[4][8];
extern const char gSubMenu_ROGER[3][6];
extern const char gSubMenu_RESET[2][4];
extern const char gSubMenu_F_LOCK[6][4];
extern const char* gSubMenu_F_LOCK[F_LOCK_LEN];
extern const char gSubMenu_BACKLIGHT[8][7];
extern const char gSubMenu_RX_TX[4][6];
#ifdef ENABLE_AM_FIX_TEST1