Merge pull request #258 from armel/feature_update_v3

Feature update v3
This commit is contained in:
Armel FAUVEAU
2024-09-29 01:04:04 +02:00
committed by GitHub
22 changed files with 308 additions and 24 deletions

View File

@@ -45,6 +45,7 @@ ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
ENABLE_FEAT_F4HWN_SPECTRUM ?= 1 ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 1 ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 1
ENABLE_FEAT_F4HWN_CHARGING_C ?= 1 ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
ENABLE_FEAT_F4HWN_SLEEP ?= 1
ENABLE_FEAT_F4HWN_PMR ?= 0 ENABLE_FEAT_F4HWN_PMR ?= 0
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 0 ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 0
ENABLE_FEAT_F4HWN_CA ?= 1 ENABLE_FEAT_F4HWN_CA ?= 1
@@ -217,7 +218,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1)
VERSION_STRING_1 ?= v0.22 VERSION_STRING_1 ?= v0.22
AUTHOR_STRING_2 ?= F4HWN AUTHOR_STRING_2 ?= F4HWN
VERSION_STRING_2 ?= v3.3 VERSION_STRING_2 ?= v3.4
AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2) AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2)
VERSION_STRING ?= $(VERSION_STRING_2) VERSION_STRING ?= $(VERSION_STRING_2)
@@ -418,6 +419,9 @@ endif
ifeq ($(ENABLE_FEAT_F4HWN_CHARGING_C),1) ifeq ($(ENABLE_FEAT_F4HWN_CHARGING_C),1)
CFLAGS += -DENABLE_FEAT_F4HWN_CHARGING_C CFLAGS += -DENABLE_FEAT_F4HWN_CHARGING_C
endif endif
ifeq ($(ENABLE_FEAT_F4HWN_SLEEP),1)
CFLAGS += -DENABLE_FEAT_F4HWN_SLEEP
endif
ifeq ($(ENABLE_FEAT_F4HWN_PMR),1) ifeq ($(ENABLE_FEAT_F4HWN_PMR),1)
CFLAGS += -DENABLE_FEAT_F4HWN_PMR CFLAGS += -DENABLE_FEAT_F4HWN_PMR
endif endif

View File

@@ -26,7 +26,7 @@ Anyway, have fun.
# Donations # Donations
Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas, Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern, Joseph Roth, Pierre-Yves Colin, Frank DJ7FG, Marcel Testaz, Brian Frobisher, Yannick F4JFO, Paolo Bussola, Dirk DL8DF, Szőke Levente and Bernard-Michel Herrera for their [donations](https://www.paypal.com/paypalme/F4HWN). Thats so kind of them. Thanks so much 🙏🏻 Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas, Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern, Joseph Roth, Pierre-Yves Colin, Frank DJ7FG, Marcel Testaz, Brian Frobisher, Yannick F4JFO, Paolo Bussola, Dirk DL8DF, Szőke Levente, Bernard-Michel Herrera, Jérôme Saintespes and Paul Davies for their [donations](https://www.paypal.com/paypalme/F4HWN). Thats so kind of them. Thanks so much 🙏🏻
## Table of Contents ## Table of Contents
@@ -82,11 +82,13 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC
* add SetLck menu to set what is locked (Keys or Keys + PTT), * add SetLck menu to set what is locked (Keys or Keys + PTT),
* add SetGui menu to set font size on the VFO baseline (Classic or Tiny), * add SetGui menu to set font size on the VFO baseline (Classic or Tiny),
* add TXLock menu to open TX on channel, * add TXLock menu to open TX on channel,
* add SetTmr menu to set RX and TX timers (Off or On) * add SetTmr menu to set RX and TX timers (Off or On),
* add SetOff menu to set the delay before the transceiver goes into deep sleep (Off or 1 minute to 2 hours),
* rename BatVol menu (52/63) to SysInf, which displays the firmware version in addition to the battery status, * rename BatVol menu (52/63) to SysInf, which displays the firmware version in addition to the battery status,
* improve PonMsg menu, * improve PonMsg menu,
* improve BackLt menu, * improve BackLt menu,
* improve TxTOut menu, * improve TxTOut menu,
* improve ScnRev menu (CARRIER FAST, CARRIER SLOW, STOP, TIMEOUT from 5 secondes to 2 minutes)
* add HAM CA F Lock band (for Canadian zone), * add HAM CA F Lock band (for Canadian zone),
* remove blink and SOS functionality, * remove blink and SOS functionality,
* remove AM Fix menu (AM Fix is ENABLED by default), * remove AM Fix menu (AM Fix is ENABLED by default),
@@ -132,6 +134,7 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC
* enabled AIR COPY * enabled AIR COPY
* disabled ENABLE_DTMF_CALLING, * disabled ENABLE_DTMF_CALLING,
* disabled SCRAMBLER, * disabled SCRAMBLER,
* remove 200Tx, 350Tx and 500Tx,
* unlock TX on all bands needs only to be repeat 3 times, * unlock TX on all bands needs only to be repeat 3 times,
* code refactoring and many memory optimization, * code refactoring and many memory optimization,
* and more... * and more...

View File

@@ -44,6 +44,9 @@
#include "audio.h" #include "audio.h"
#include "board.h" #include "board.h"
#include "bsp/dp32g030/gpio.h" #include "bsp/dp32g030/gpio.h"
#ifdef ENABLE_FEAT_F4HWN_SLEEP
#include "bsp/dp32g030/pwmplus.h"
#endif
#include "driver/backlight.h" #include "driver/backlight.h"
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
#include "driver/bk1080.h" #include "driver/bk1080.h"
@@ -380,6 +383,8 @@ Skip:
if (gScanStateDir != SCAN_OFF) if (gScanStateDir != SCAN_OFF)
{ {
/*
switch (gEeprom.SCAN_RESUME_MODE) switch (gEeprom.SCAN_RESUME_MODE)
{ {
case SCAN_RESUME_TO: case SCAN_RESUME_TO:
@@ -394,6 +399,41 @@ Skip:
CHFRSCANNER_Stop(); CHFRSCANNER_Stop();
break; break;
} }
*/
if(gEeprom.SCAN_RESUME_MODE < 2)
{
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms + (scan_pause_delay_in_6_10ms * 24 * gEeprom.SCAN_RESUME_MODE);
gScheduleScanListen = false;
}
else if(gEeprom.SCAN_RESUME_MODE == 2)
{
CHFRSCANNER_Stop();
}
/*
switch (gEeprom.SCAN_RESUME_MODE)
{
case 0:
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
gScheduleScanListen = false;
break;
case 1:
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms * 5;
gScheduleScanListen = false;
break;
case 26:
CHFRSCANNER_Stop();
break;
//default:
// gScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms * (gEeprom.SCAN_RESUME_MODE - 1) * 5;
// break;
}
*/
} }
break; break;
@@ -1071,7 +1111,18 @@ void APP_Update(void)
{ // dual watch mode off or scanning or rssi update request { // dual watch mode off or scanning or rssi update request
// go back to sleep // go back to sleep
#ifdef ENABLE_FEAT_F4HWN_SLEEP
if(gWakeUp)
{
gPowerSave_10ms = 1000; // Why ? Why not :) 10s
}
else
{
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10; gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
}
#else
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
#endif
gRxIdleMode = true; gRxIdleMode = true;
goToSleep = false; goToSleep = false;
@@ -1530,6 +1581,47 @@ void APP_TimeSlice500ms(void)
BACKLIGHT_TurnOff(); BACKLIGHT_TurnOff();
} }
#ifdef ENABLE_FEAT_F4HWN_SLEEP
if (gSleepModeCountdown_500ms == gSetting_set_off * 120 && gWakeUp) {
ST7565_Init();
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
gWakeUp = false;
}
if(gCurrentFunction != FUNCTION_TRANSMIT && !FUNCTION_IsRx())
{
if (gSleepModeCountdown_500ms > 0 && --gSleepModeCountdown_500ms == 0) {
gBacklightCountdown_500ms = 0;
gPowerSave_10ms = 1;
gWakeUp = true;
PWM_PLUS0_CH0_COMP = 0;
ST7565_ShutDown();
}
else if(gSleepModeCountdown_500ms < 60 && gSetting_set_off != 0)
{
if(gSleepModeCountdown_500ms % 2 == 0)
{
PWM_PLUS0_CH0_COMP = 0;
}
else
{
PWM_PLUS0_CH0_COMP = value[gEeprom.BACKLIGHT_MAX] * 4; // Max brightness
}
}
}
else
{
gSleepModeCountdown_500ms = gSetting_set_off * 120;
}
if (gWakeUp) {
static bool swap = true;
swap = !swap; // Alterne l'état à chaque exécution
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, swap);
}
#endif
if (gReducedService) if (gReducedService)
{ {
BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent); BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent);

View File

@@ -102,6 +102,36 @@ void CHFRSCANNER_ContinueScanning(void)
void CHFRSCANNER_Found(void) void CHFRSCANNER_Found(void)
{ {
if (gEeprom.SCAN_RESUME_MODE > 2) {
if (!gScanPauseMode) {
gScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms * (gEeprom.SCAN_RESUME_MODE - 2) * 5;
gScanPauseMode = true;
}
} else {
gScanPauseDelayIn_10ms = 0;
}
// gScheduleScanListen is always false...
gScheduleScanListen = false;
/*
if(gEeprom.SCAN_RESUME_MODE > 1 && gEeprom.SCAN_RESUME_MODE < 26)
{
if (!gScanPauseMode)
{
gScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms * (gEeprom.SCAN_RESUME_MODE - 1) * 5;
gScheduleScanListen = false;
gScanPauseMode = true;
}
}
else
{
gScanPauseDelayIn_10ms = 0;
gScheduleScanListen = false;
}
*/
/*
switch (gEeprom.SCAN_RESUME_MODE) switch (gEeprom.SCAN_RESUME_MODE)
{ {
case SCAN_RESUME_TO: case SCAN_RESUME_TO:
@@ -119,6 +149,7 @@ void CHFRSCANNER_Found(void)
gScheduleScanListen = false; gScheduleScanListen = false;
break; break;
} }
*/
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
lastFoundFrqOrChanOld = lastFoundFrqOrChan; lastFoundFrqOrChanOld = lastFoundFrqOrChan;

View File

@@ -176,7 +176,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
case MENU_SC_REV: case MENU_SC_REV:
//*pMin = 0; //*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SC_REV) - 1; *pMax = 26;
break; break;
case MENU_ROGER: case MENU_ROGER:
@@ -248,9 +248,11 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
case MENU_NOAA_S: case MENU_NOAA_S:
#endif #endif
#ifndef ENABLE_FEAT_F4HWN
case MENU_350TX: case MENU_350TX:
case MENU_200TX: case MENU_200TX:
case MENU_500TX: case MENU_500TX:
#endif
case MENU_350EN: case MENU_350EN:
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN: case MENU_SCREN:
@@ -376,6 +378,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMax = gSubMenu_SIDEFUNCTIONS_size-1; *pMax = gSubMenu_SIDEFUNCTIONS_size-1;
break; break;
#ifdef ENABLE_FEAT_F4HWN_SLEEP
case MENU_SET_OFF:
*pMax = 120;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
case MENU_SET_PWR: case MENU_SET_PWR:
*pMax = ARRAY_SIZE(gSubMenu_SET_PWR) - 1; *pMax = ARRAY_SIZE(gSubMenu_SET_PWR) - 1;
@@ -789,9 +797,11 @@ void MENU_AcceptSetting(void)
SETTINGS_FactoryReset(gSubMenuSelection); SETTINGS_FactoryReset(gSubMenuSelection);
return; return;
#ifndef ENABLE_FEAT_F4HWN
case MENU_350TX: case MENU_350TX:
gSetting_350TX = gSubMenuSelection; gSetting_350TX = gSubMenuSelection;
break; break;
#endif
case MENU_F_LOCK: { case MENU_F_LOCK: {
if(gSubMenuSelection == F_LOCK_NONE) { // select 10 times to enable if(gSubMenuSelection == F_LOCK_NONE) { // select 10 times to enable
@@ -809,6 +819,7 @@ void MENU_AcceptSetting(void)
gSetting_F_LOCK = gSubMenuSelection; gSetting_F_LOCK = gSubMenuSelection;
break; break;
} }
#ifndef ENABLE_FEAT_F4HWN
case MENU_200TX: case MENU_200TX:
gSetting_200TX = gSubMenuSelection; gSetting_200TX = gSubMenuSelection;
break; break;
@@ -816,13 +827,12 @@ void MENU_AcceptSetting(void)
case MENU_500TX: case MENU_500TX:
gSetting_500TX = gSubMenuSelection; gSetting_500TX = gSubMenuSelection;
break; break;
#endif
case MENU_350EN: case MENU_350EN:
gSetting_350EN = gSubMenuSelection; gSetting_350EN = gSubMenuSelection;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD; gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
gFlagResetVfos = true; gFlagResetVfos = true;
break; break;
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN: case MENU_SCREN:
gSetting_ScrambleEnable = gSubMenuSelection; gSetting_ScrambleEnable = gSubMenuSelection;
@@ -868,6 +878,12 @@ void MENU_AcceptSetting(void)
} }
break; break;
#ifdef ENABLE_FEAT_F4HWN_SLEEP
case MENU_SET_OFF:
gSetting_set_off = gSubMenuSelection;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
case MENU_SET_PWR: case MENU_SET_PWR:
gSetting_set_pwr = gSubMenuSelection; gSetting_set_pwr = gSubMenuSelection;
@@ -1230,14 +1246,17 @@ void MENU_ShowCurrentSetting(void)
#endif #endif
break; break;
#ifndef ENABLE_FEAT_F4HWN
case MENU_350TX: case MENU_350TX:
gSubMenuSelection = gSetting_350TX; gSubMenuSelection = gSetting_350TX;
break; break;
#endif
case MENU_F_LOCK: case MENU_F_LOCK:
gSubMenuSelection = gSetting_F_LOCK; gSubMenuSelection = gSetting_F_LOCK;
break; break;
#ifndef ENABLE_FEAT_F4HWN
case MENU_200TX: case MENU_200TX:
gSubMenuSelection = gSetting_200TX; gSubMenuSelection = gSetting_200TX;
break; break;
@@ -1246,6 +1265,7 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gSetting_500TX; gSubMenuSelection = gSetting_500TX;
break; break;
#endif
case MENU_350EN: case MENU_350EN:
gSubMenuSelection = gSetting_350EN; gSubMenuSelection = gSetting_350EN;
break; break;
@@ -1294,6 +1314,12 @@ void MENU_ShowCurrentSetting(void)
break; break;
} }
#ifdef ENABLE_FEAT_F4HWN_SLEEP
case MENU_SET_OFF:
gSubMenuSelection = gSetting_set_off;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
case MENU_SET_PWR: case MENU_SET_PWR:
gSubMenuSelection = gSetting_set_pwr; gSubMenuSelection = gSetting_set_pwr;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -31,6 +31,14 @@
uint16_t gBacklightCountdown_500ms = 0; uint16_t gBacklightCountdown_500ms = 0;
bool backlightOn; bool backlightOn;
#ifdef ENABLE_FEAT_F4HWN
const uint8_t value[] = {0, 3, 6, 9, 15, 24, 38, 62, 100, 159, 255};
#endif
#ifdef ENABLE_FEAT_F4HWN_SLEEP
uint16_t gSleepModeCountdown_500ms = 0;
#endif
void BACKLIGHT_InitHardware() void BACKLIGHT_InitHardware()
{ {
// 48MHz / 94 / 1024 ~ 500Hz // 48MHz / 94 / 1024 ~ 500Hz
@@ -73,6 +81,10 @@ static void BACKLIGHT_Sound(void)
void BACKLIGHT_TurnOn(void) void BACKLIGHT_TurnOn(void)
{ {
#ifdef ENABLE_FEAT_F4HWN_SLEEP
gSleepModeCountdown_500ms = gSetting_set_off * 120;
#endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
gBacklightBrightnessOld = BACKLIGHT_GetBrightness(); gBacklightBrightnessOld = BACKLIGHT_GetBrightness();
#endif #endif
@@ -146,8 +158,6 @@ static uint8_t currentBrightness;
void BACKLIGHT_SetBrightness(uint8_t brigtness) void BACKLIGHT_SetBrightness(uint8_t brigtness)
{ {
const uint8_t value[] = {0, 3, 6, 9, 15, 24, 38, 62, 100, 159, 255};
currentBrightness = brigtness; currentBrightness = brigtness;
PWM_PLUS0_CH0_COMP = value[brigtness] * 4; PWM_PLUS0_CH0_COMP = value[brigtness] * 4;
//PWM_PLUS0_CH0_COMP = (1 << brigtness) - 1; //PWM_PLUS0_CH0_COMP = (1 << brigtness) - 1;

View File

@@ -23,6 +23,14 @@
extern uint16_t gBacklightCountdown_500ms; extern uint16_t gBacklightCountdown_500ms;
extern uint8_t gBacklightBrightness; extern uint8_t gBacklightBrightness;
#ifdef ENABLE_FEAT_F4HWN
extern const uint8_t value[11];
#endif
#ifdef ENABLE_FEAT_F4HWN_SLEEP
extern uint16_t gSleepModeCountdown_500ms;
#endif
#ifdef ENABLE_BLMIN_TMP_OFF #ifdef ENABLE_BLMIN_TMP_OFF
typedef enum { typedef enum {
BLMIN_STAT_ON, BLMIN_STAT_ON,

View File

@@ -256,6 +256,17 @@ void ST7565_Init(void)
ST7565_FillScreen(0x00); ST7565_FillScreen(0x00);
} }
#ifdef ENABLE_FEAT_F4HWN_SLEEP
void ST7565_ShutDown(void)
{
SPI_ToggleMasterMode(&SPI0->CR, false);
ST7565_WriteByte(ST7565_CMD_POWER_CIRCUIT | 0b000); // VB=0 VR=1 VF=1
ST7565_WriteByte(ST7565_CMD_SET_START_LINE | 0); // line 0
ST7565_WriteByte(ST7565_CMD_DISPLAY_ON_OFF | 0); // D=1
SPI_ToggleMasterMode(&SPI0->CR, true);
}
#endif
void ST7565_FixInterfGlitch(void) void ST7565_FixInterfGlitch(void)
{ {
SPI_ToggleMasterMode(&SPI0->CR, false); SPI_ToggleMasterMode(&SPI0->CR, false);

View File

@@ -33,6 +33,9 @@ void ST7565_BlitLine(unsigned line);
void ST7565_BlitStatusLine(void); void ST7565_BlitStatusLine(void);
void ST7565_FillScreen(uint8_t Value); void ST7565_FillScreen(uint8_t Value);
void ST7565_Init(void); void ST7565_Init(void);
#ifdef ENABLE_FEAT_F4HWN_SLEEP
void ST7565_ShutDown(void);
#endif
void ST7565_FixInterfGlitch(void); void ST7565_FixInterfGlitch(void);
void ST7565_HardwareReset(void); void ST7565_HardwareReset(void);
void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line); void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line);

View File

@@ -175,15 +175,23 @@ int32_t TX_freq_check(const uint32_t Frequency)
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)
#ifndef ENABLE_FEAT_F4HWN
if (gSetting_200TX) if (gSetting_200TX)
#endif
return 0; return 0;
if (Frequency >= frequencyBandTable[BAND5_350MHz].lower && Frequency < frequencyBandTable[BAND5_350MHz].upper) if (Frequency >= frequencyBandTable[BAND5_350MHz].lower && Frequency < frequencyBandTable[BAND5_350MHz].upper)
#ifndef ENABLE_FEAT_F4HWN
if (gSetting_350TX && gSetting_350EN) if (gSetting_350TX && gSetting_350EN)
#else
if (gSetting_350EN)
#endif
return 0; return 0;
if (Frequency >= frequencyBandTable[BAND6_400MHz].lower && Frequency < frequencyBandTable[BAND6_400MHz].upper) if (Frequency >= frequencyBandTable[BAND6_400MHz].lower && Frequency < frequencyBandTable[BAND6_400MHz].upper)
return 0; return 0;
if (Frequency >= frequencyBandTable[BAND7_470MHz].lower && Frequency <= 60000000) if (Frequency >= frequencyBandTable[BAND7_470MHz].lower && Frequency <= 60000000)
#ifndef ENABLE_FEAT_F4HWN
if (gSetting_500TX) if (gSetting_500TX)
#endif
return 0; return 0;
break; break;

View File

@@ -118,7 +118,18 @@ void FUNCTION_Foreground(const FUNCTION_Type_t PreviousFunction)
} }
void FUNCTION_PowerSave() { void FUNCTION_PowerSave() {
#ifdef ENABLE_FEAT_F4HWN_SLEEP
if(gWakeUp)
{
gPowerSave_10ms = 1000; // Why ? Why not :) 10s
}
else
{
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10; gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
}
#else
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
#endif
gPowerSaveCountdownExpired = false; gPowerSaveCountdownExpired = false;
gRxIdleMode = true; gRxIdleMode = true;

View File

@@ -102,6 +102,7 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
gAircopyState = AIRCOPY_READY; gAircopyState = AIRCOPY_READY;
gEeprom.BACKLIGHT_TIME = 61; gEeprom.BACKLIGHT_TIME = 61;
gEeprom.KEY_LOCK = 0;
GUI_SelectNextDisplay(DISPLAY_AIRCOPY); GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
} }

4
main.c
View File

@@ -130,9 +130,13 @@ void Main(void)
SETTINGS_SaveSettings(); SETTINGS_SaveSettings();
#ifndef ENABLE_VOX #ifndef ENABLE_VOX
gMenuCursor = 64; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar gMenuCursor = 64; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
#else
#ifdef ENABLE_FEAT_F4HWN_SLEEP
gMenuCursor = 67; // move to hidden section, fix me if change... !!!
#else #else
gMenuCursor = 66; // move to hidden section, fix me if change... !!! gMenuCursor = 66; // move to hidden section, fix me if change... !!!
#endif #endif
#endif
gSubMenuSelection = gSetting_F_LOCK; gSubMenuSelection = gSetting_F_LOCK;
#endif #endif
} }

11
misc.c
View File

@@ -88,12 +88,18 @@ const uint32_t gDefaultAesKey[4] = {0x4AA5CC60, 0x0312CC5F, 0x
const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31}; const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
#ifndef ENABLE_FEAT_F4HWN
bool gSetting_350TX; bool gSetting_350TX;
#endif
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
bool gSetting_KILLED; bool gSetting_KILLED;
#endif #endif
#ifndef ENABLE_FEAT_F4HWN
bool gSetting_200TX; bool gSetting_200TX;
bool gSetting_500TX; bool gSetting_500TX;
#endif
bool gSetting_350EN; bool gSetting_350EN;
uint8_t gSetting_F_LOCK; uint8_t gSetting_F_LOCK;
bool gSetting_ScrambleEnable; bool gSetting_ScrambleEnable;
@@ -104,6 +110,11 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
bool gSetting_AM_fix = true; bool gSetting_AM_fix = true;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_SLEEP
uint8_t gSetting_set_off = 1;
bool gWakeUp = false;
#endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
uint8_t gSetting_set_pwr = 1; uint8_t gSetting_set_pwr = 1;
bool gSetting_set_ptt = 0; bool gSetting_set_ptt = 0;

12
misc.h
View File

@@ -140,12 +140,19 @@ extern const uint16_t scan_pause_delay_in_7_10ms;
extern const uint8_t gMicGain_dB2[5]; extern const uint8_t gMicGain_dB2[5];
#ifndef ENABLE_FEAT_F4HWN
extern bool gSetting_350TX; extern bool gSetting_350TX;
#endif
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
extern bool gSetting_KILLED; extern bool gSetting_KILLED;
#endif #endif
#ifndef ENABLE_FEAT_F4HWN
extern bool gSetting_200TX; extern bool gSetting_200TX;
extern bool gSetting_500TX; extern bool gSetting_500TX;
#endif
extern bool gSetting_350EN; extern bool gSetting_350EN;
extern uint8_t gSetting_F_LOCK; extern uint8_t gSetting_F_LOCK;
extern bool gSetting_ScrambleEnable; extern bool gSetting_ScrambleEnable;
@@ -156,6 +163,11 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
extern bool gSetting_AM_fix; extern bool gSetting_AM_fix;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_SLEEP
extern uint8_t gSetting_set_off;
extern bool gWakeUp;
#endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
extern uint8_t gSetting_set_pwr; extern uint8_t gSetting_set_pwr;
extern bool gSetting_set_ptt; extern bool gSetting_set_ptt;

View File

@@ -119,7 +119,7 @@ void SETTINGS_InitEEPROM(void)
gEeprom.KEY_1_LONG_PRESS_ACTION = (Data[2] < ACTION_OPT_LEN) ? Data[2] : ACTION_OPT_NONE; gEeprom.KEY_1_LONG_PRESS_ACTION = (Data[2] < ACTION_OPT_LEN) ? Data[2] : ACTION_OPT_NONE;
gEeprom.KEY_2_SHORT_PRESS_ACTION = (Data[3] < ACTION_OPT_LEN) ? Data[3] : ACTION_OPT_SCAN; gEeprom.KEY_2_SHORT_PRESS_ACTION = (Data[3] < ACTION_OPT_LEN) ? Data[3] : ACTION_OPT_SCAN;
gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE; gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE;
gEeprom.SCAN_RESUME_MODE = (Data[5] < 3) ? Data[5] : SCAN_RESUME_CO; gEeprom.SCAN_RESUME_MODE = (Data[5] < 27) ? Data[5] : 1;
gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 2) ? Data[6] : false; gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 2) ? Data[6] : false;
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 6) ? Data[7] : POWER_ON_DISPLAY_MODE_VOLTAGE; gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 6) ? Data[7] : POWER_ON_DISPLAY_MODE_VOLTAGE;
@@ -259,14 +259,17 @@ void SETTINGS_InitEEPROM(void)
// 0F40..0F47 // 0F40..0F47
EEPROM_ReadBuffer(0x0F40, Data, 8); EEPROM_ReadBuffer(0x0F40, Data, 8);
gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF; gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF;
#ifndef ENABLE_FEAT_F4HWN
gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true
#endif
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
gSetting_KILLED = (Data[2] < 2) ? Data[2] : false; gSetting_KILLED = (Data[2] < 2) ? Data[2] : false;
#endif #endif
#ifndef ENABLE_FEAT_F4HWN
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;
#endif
gSetting_350EN = (Data[5] < 2) ? Data[5] : true; gSetting_350EN = (Data[5] < 2) ? Data[5] : true;
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
gSetting_ScrambleEnable = false; gSetting_ScrambleEnable = false;
#else #else
@@ -346,7 +349,10 @@ void SETTINGS_InitEEPROM(void)
int ctr_value = Data[5] & 0x0F; int ctr_value = Data[5] & 0x0F;
gSetting_set_ctr = (ctr_value > 0 && ctr_value < 16) ? ctr_value : 10; gSetting_set_ctr = (ctr_value > 0 && ctr_value < 16) ? ctr_value : 10;
gSetting_set_tmr = Data[4] & 1; gSetting_set_tmr = Data[4] & 0x01;
#ifdef ENABLE_FEAT_F4HWN_SLEEP
gSetting_set_off = Data[4] >> 1;
#endif
// Warning // Warning
// Be aware, Data[3] is use by Spectrum // Be aware, Data[3] is use by Spectrum
@@ -688,14 +694,17 @@ void SETTINGS_SaveSettings(void)
memset(State, 0xFF, sizeof(State)); memset(State, 0xFF, sizeof(State));
State[0] = gSetting_F_LOCK; State[0] = gSetting_F_LOCK;
#ifndef ENABLE_FEAT_F4HWN
State[1] = gSetting_350TX; State[1] = gSetting_350TX;
#endif
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
State[2] = gSetting_KILLED; State[2] = gSetting_KILLED;
#endif #endif
#ifndef ENABLE_FEAT_F4HWN
State[3] = gSetting_200TX; State[3] = gSetting_200TX;
State[4] = gSetting_500TX; State[4] = gSetting_500TX;
#endif
State[5] = gSetting_350EN; State[5] = gSetting_350EN;
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
State[6] = false; State[6] = false;
#else #else
@@ -740,7 +749,11 @@ void SETTINGS_SaveSettings(void)
tmp = tmp | (1 << 3); tmp = tmp | (1 << 3);
*/ */
#ifdef ENABLE_FEAT_F4HWN_SLEEP
State[4] = (gSetting_set_off << 1) | (gSetting_set_tmr & 0x01);
#else
State[4] = gSetting_set_tmr ? (1 << 0) : 0; State[4] = gSetting_set_tmr ? (1 << 0) : 0;
#endif
tmp = (gSetting_set_inv << 0) | tmp = (gSetting_set_inv << 0) |
(gSetting_set_lck << 1) | (gSetting_set_lck << 1) |

View File

@@ -59,11 +59,13 @@ enum TxLockModes_t {
F_LOCK_LEN F_LOCK_LEN
}; };
/*
enum { enum {
SCAN_RESUME_TO = 0, SCAN_RESUME_TO = 0,
SCAN_RESUME_CO, SCAN_RESUME_CO,
SCAN_RESUME_SE SCAN_RESUME_SE
}; };
*/
enum { enum {
CROSS_BAND_OFF = 0, CROSS_BAND_OFF = 0,

View File

@@ -147,13 +147,18 @@ const t_menu_item MenuList[] =
{"SetMet", MENU_SET_MET }, {"SetMet", MENU_SET_MET },
{"SetGui", MENU_SET_GUI }, {"SetGui", MENU_SET_GUI },
{"SetTmr", MENU_SET_TMR }, {"SetTmr", MENU_SET_TMR },
#ifdef ENABLE_FEAT_F4HWN_SLEEP
{"SetOff", MENU_SET_OFF },
#endif
#endif #endif
// hidden menu items from here on // hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on // enabled if pressing both the PTT and upper side button at power-on
{"F Lock", MENU_F_LOCK }, {"F Lock", MENU_F_LOCK },
#ifndef ENABLE_FEAT_F4HWN
{"Tx 200", MENU_200TX }, // was "200TX" {"Tx 200", MENU_200TX }, // was "200TX"
{"Tx 350", MENU_350TX }, // was "350TX" {"Tx 350", MENU_350TX }, // was "350TX"
{"Tx 500", MENU_500TX }, // was "500TX" {"Tx 500", MENU_500TX }, // was "500TX"
#endif
{"350 En", MENU_350EN }, // was "350EN" {"350 En", MENU_350EN }, // was "350EN"
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
{"ScraEn", MENU_SCREN }, // was "SCREN" {"ScraEn", MENU_SCREN }, // was "SCREN"
@@ -227,10 +232,10 @@ const char* const gSubMenu_RXMode[] =
}; };
#endif #endif
const char gSubMenu_SC_REV[][8] = const char gSubMenu_SC_REV[][13] =
{ {
"TIMEOUT", "CARRIER\nFAST",
"CARRIER", "CARRIER\nSLOW",
"STOP" "STOP"
}; };
@@ -687,8 +692,9 @@ void UI_DisplayMenu(void)
sprintf(String, "%s", "ON"); sprintf(String, "%s", "ON");
} }
if(BACKLIGHT_GetBrightness() < 4) // Obsolete ???
BACKLIGHT_SetBrightness(4); //if(BACKLIGHT_GetBrightness() < 4)
// BACKLIGHT_SetBrightness(4);
break; break;
case MENU_ABR_MIN: case MENU_ABR_MIN:
@@ -696,8 +702,9 @@ void UI_DisplayMenu(void)
sprintf(String, "%d", gSubMenuSelection); sprintf(String, "%d", gSubMenuSelection);
if(gIsInSubMenu) if(gIsInSubMenu)
BACKLIGHT_SetBrightness(gSubMenuSelection); BACKLIGHT_SetBrightness(gSubMenuSelection);
else if(BACKLIGHT_GetBrightness() < 4) // Obsolete ???
BACKLIGHT_SetBrightness(4); //else if(BACKLIGHT_GetBrightness() < 4)
// BACKLIGHT_SetBrightness(4);
break; break;
case MENU_AM: case MENU_AM:
@@ -732,9 +739,11 @@ void UI_DisplayMenu(void)
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
case MENU_NOAA_S: case MENU_NOAA_S:
#endif #endif
#ifndef ENABLE_FEAT_F4HWN
case MENU_350TX: case MENU_350TX:
case MENU_200TX: case MENU_200TX:
case MENU_500TX: case MENU_500TX:
#endif
case MENU_350EN: case MENU_350EN:
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN: case MENU_SCREN:
@@ -826,7 +835,14 @@ void UI_DisplayMenu(void)
#endif #endif
case MENU_SC_REV: case MENU_SC_REV:
if(gSubMenuSelection < 3)
{
strcpy(String, gSubMenu_SC_REV[gSubMenuSelection]); strcpy(String, gSubMenu_SC_REV[gSubMenuSelection]);
}
else
{
sprintf(String, "TIMEOUT\n%02dm:%02ds", (((gSubMenuSelection - 2) * 5) / 60), (((gSubMenuSelection - 2) * 5) % 60));
}
break; break;
case MENU_MDF: case MENU_MDF:
@@ -971,6 +987,19 @@ void UI_DisplayMenu(void)
strcpy(String, gSubMenu_SIDEFUNCTIONS[gSubMenuSelection].name); strcpy(String, gSubMenu_SIDEFUNCTIONS[gSubMenuSelection].name);
break; break;
#ifdef ENABLE_FEAT_F4HWN_SLEEP
case MENU_SET_OFF:
if(gSubMenuSelection == 0)
{
sprintf(String, "%s", "OFF");
}
else if(gSubMenuSelection < 121)
{
sprintf(String, "%02dh:%02dm", (gSubMenuSelection / 60), (gSubMenuSelection % 60));
}
break;
#endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
case MENU_SET_PWR: case MENU_SET_PWR:
sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection + 1], gSubMenu_SET_PWR[gSubMenuSelection]); sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection + 1], gSubMenu_SET_PWR[gSubMenuSelection]);

View File

@@ -115,9 +115,11 @@ enum
#endif #endif
MENU_RESET, MENU_RESET,
MENU_F_LOCK, MENU_F_LOCK,
#ifndef ENABLE_FEAT_F4HWN
MENU_200TX, MENU_200TX,
MENU_350TX, MENU_350TX,
MENU_500TX, MENU_500TX,
#endif
MENU_350EN, MENU_350EN,
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
MENU_SCREN, MENU_SCREN,
@@ -125,6 +127,9 @@ enum
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
MENU_F_CALI, // reference xtal calibration MENU_F_CALI, // reference xtal calibration
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_SLEEP
MENU_SET_OFF,
#endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
MENU_SET_PWR, MENU_SET_PWR,
MENU_SET_PTT, MENU_SET_PTT,
@@ -160,7 +165,7 @@ extern const char* const gSubMenu_RXMode[4];
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
extern const char gSubMenu_VOICE[3][4]; extern const char gSubMenu_VOICE[3][4];
#endif #endif
extern const char gSubMenu_SC_REV[3][8]; extern const char gSubMenu_SC_REV[3][13];
extern const char* const gSubMenu_MDF[4]; extern const char* const gSubMenu_MDF[4];
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
extern const char gSubMenu_AL_MOD[2][5]; extern const char gSubMenu_AL_MOD[2][5];