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_500TX:
case MENU_350EN: case MENU_350EN:
case MENU_SCREN: case MENU_SCREN:
case MENU_TX_EN:
*pMin = 0; *pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1; *pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
break; break;
@@ -759,10 +758,19 @@ void MENU_AcceptSetting(void)
gSetting_350TX = gSubMenuSelection; gSetting_350TX = gSubMenuSelection;
break; 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; gSetting_F_LOCK = gSubMenuSelection;
break; break;
}
case MENU_200TX: case MENU_200TX:
gSetting_200TX = gSubMenuSelection; gSetting_200TX = gSubMenuSelection;
break; break;
@@ -782,10 +790,6 @@ void MENU_AcceptSetting(void)
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
break; break;
case MENU_TX_EN:
gSetting_TX_EN = gSubMenuSelection;
break;
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI: case MENU_F_CALI:
writeXtalFreqCal(gSubMenuSelection, true); writeXtalFreqCal(gSubMenuSelection, true);
@@ -1153,10 +1157,6 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gSetting_ScrambleEnable; gSubMenuSelection = gSetting_ScrambleEnable;
break; break;
case MENU_TX_EN:
gSubMenuSelection = gSetting_TX_EN;
break;
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI: case MENU_F_CALI:
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW; gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;

View File

@@ -701,14 +701,14 @@ void BOARD_EEPROM_Init(void)
// 0F40..0F47 // 0F40..0F47
EEPROM_ReadBuffer(0x0F40, Data, 8); 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_350TX = (Data[1] < 2) ? Data[1] : false; // was true
gSetting_KILLED = (Data[2] < 2) ? Data[2] : false; gSetting_KILLED = (Data[2] < 2) ? Data[2] : false;
gSetting_200TX = (Data[3] < 2) ? Data[3] : false; gSetting_200TX = (Data[3] < 2) ? Data[3] : false;
gSetting_500TX = (Data[4] < 2) ? Data[4] : false; gSetting_500TX = (Data[4] < 2) ? Data[4] : false;
gSetting_350EN = (Data[5] < 2) ? Data[5] : true; gSetting_350EN = (Data[5] < 2) ? Data[5] : true;
gSetting_ScrambleEnable = (Data[6] < 2) ? Data[6] : 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_live_DTMF_decoder = (Data[7] & (1u << 1)) ? true : false;
gSetting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3 : 2; gSetting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3 : 2;
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR

View File

@@ -147,7 +147,7 @@ int TX_freq_check(const uint32_t Frequency)
switch (gSetting_F_LOCK) switch (gSetting_F_LOCK)
{ {
case F_LOCK_OFF: case F_LOCK_DEF:
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < frequencyBandTable[BAND3_137MHz].upper) if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < frequencyBandTable[BAND3_137MHz].upper)
return 0; return 0;
if (Frequency >= frequencyBandTable[BAND4_174MHz].lower && Frequency < frequencyBandTable[BAND4_174MHz].upper) 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) if (Frequency >= 40000000 && Frequency < 43800000)
return 0; return 0;
break; 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 // dis-allowed TX frequency

1
misc.c
View File

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

1
misc.h
View File

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

View File

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

View File

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

View File

@@ -34,12 +34,15 @@ enum POWER_OnDisplayMode_t {
typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t; typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;
enum { enum {
F_LOCK_OFF = 0, F_LOCK_DEF, //all default frequencies + configurable
F_LOCK_FCC, F_LOCK_FCC,
F_LOCK_CE, F_LOCK_CE,
F_LOCK_GB, F_LOCK_GB,
F_LOCK_430, 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 { enum {

View File

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

View File

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