Skip to content

Commit cec4ca6

Browse files
authored
Merge pull request #258 from armel/feature_update_v3
Feature update v3
2 parents d5db6fe + 46304c7 commit cec4ca6

22 files changed

+308
-24
lines changed

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
4545
ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
4646
ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 1
4747
ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
48+
ENABLE_FEAT_F4HWN_SLEEP ?= 1
4849
ENABLE_FEAT_F4HWN_PMR ?= 0
4950
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 0
5051
ENABLE_FEAT_F4HWN_CA ?= 1
@@ -217,7 +218,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1)
217218
VERSION_STRING_1 ?= v0.22
218219

219220
AUTHOR_STRING_2 ?= F4HWN
220-
VERSION_STRING_2 ?= v3.3
221+
VERSION_STRING_2 ?= v3.4
221222

222223
AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2)
223224
VERSION_STRING ?= $(VERSION_STRING_2)
@@ -418,6 +419,9 @@ endif
418419
ifeq ($(ENABLE_FEAT_F4HWN_CHARGING_C),1)
419420
CFLAGS += -DENABLE_FEAT_F4HWN_CHARGING_C
420421
endif
422+
ifeq ($(ENABLE_FEAT_F4HWN_SLEEP),1)
423+
CFLAGS += -DENABLE_FEAT_F4HWN_SLEEP
424+
endif
421425
ifeq ($(ENABLE_FEAT_F4HWN_PMR),1)
422426
CFLAGS += -DENABLE_FEAT_F4HWN_PMR
423427
endif

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Anyway, have fun.
2626
2727
# Donations
2828

29-
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). That’s so kind of them. Thanks so much 🙏🏻
29+
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). That’s so kind of them. Thanks so much 🙏🏻
3030

3131
## Table of Contents
3232

@@ -82,11 +82,13 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC
8282
* add SetLck menu to set what is locked (Keys or Keys + PTT),
8383
* add SetGui menu to set font size on the VFO baseline (Classic or Tiny),
8484
* add TXLock menu to open TX on channel,
85-
* add SetTmr menu to set RX and TX timers (Off or On)
85+
* add SetTmr menu to set RX and TX timers (Off or On),
86+
* add SetOff menu to set the delay before the transceiver goes into deep sleep (Off or 1 minute to 2 hours),
8687
* rename BatVol menu (52/63) to SysInf, which displays the firmware version in addition to the battery status,
8788
* improve PonMsg menu,
8889
* improve BackLt menu,
8990
* improve TxTOut menu,
91+
* improve ScnRev menu (CARRIER FAST, CARRIER SLOW, STOP, TIMEOUT from 5 secondes to 2 minutes)
9092
* add HAM CA F Lock band (for Canadian zone),
9193
* remove blink and SOS functionality,
9294
* 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
132134
* enabled AIR COPY
133135
* disabled ENABLE_DTMF_CALLING,
134136
* disabled SCRAMBLER,
137+
* remove 200Tx, 350Tx and 500Tx,
135138
* unlock TX on all bands needs only to be repeat 3 times,
136139
* code refactoring and many memory optimization,
137140
* and more...

app/app.c

+92
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
#include "audio.h"
4545
#include "board.h"
4646
#include "bsp/dp32g030/gpio.h"
47+
#ifdef ENABLE_FEAT_F4HWN_SLEEP
48+
#include "bsp/dp32g030/pwmplus.h"
49+
#endif
4750
#include "driver/backlight.h"
4851
#ifdef ENABLE_FMRADIO
4952
#include "driver/bk1080.h"
@@ -380,6 +383,8 @@ static void HandleReceive(void)
380383

381384
if (gScanStateDir != SCAN_OFF)
382385
{
386+
387+
/*
383388
switch (gEeprom.SCAN_RESUME_MODE)
384389
{
385390
case SCAN_RESUME_TO:
@@ -394,6 +399,41 @@ static void HandleReceive(void)
394399
CHFRSCANNER_Stop();
395400
break;
396401
}
402+
*/
403+
404+
if(gEeprom.SCAN_RESUME_MODE < 2)
405+
{
406+
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms + (scan_pause_delay_in_6_10ms * 24 * gEeprom.SCAN_RESUME_MODE);
407+
gScheduleScanListen = false;
408+
409+
}
410+
else if(gEeprom.SCAN_RESUME_MODE == 2)
411+
{
412+
CHFRSCANNER_Stop();
413+
}
414+
415+
/*
416+
switch (gEeprom.SCAN_RESUME_MODE)
417+
{
418+
case 0:
419+
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
420+
gScheduleScanListen = false;
421+
break;
422+
423+
case 1:
424+
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms * 5;
425+
gScheduleScanListen = false;
426+
break;
427+
428+
case 26:
429+
CHFRSCANNER_Stop();
430+
break;
431+
432+
//default:
433+
// gScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms * (gEeprom.SCAN_RESUME_MODE - 1) * 5;
434+
// break;
435+
}
436+
*/
397437
}
398438

399439
break;
@@ -1071,7 +1111,18 @@ void APP_Update(void)
10711111
{ // dual watch mode off or scanning or rssi update request
10721112
// go back to sleep
10731113

1114+
#ifdef ENABLE_FEAT_F4HWN_SLEEP
1115+
if(gWakeUp)
1116+
{
1117+
gPowerSave_10ms = 1000; // Why ? Why not :) 10s
1118+
}
1119+
else
1120+
{
1121+
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
1122+
}
1123+
#else
10741124
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
1125+
#endif
10751126
gRxIdleMode = true;
10761127
goToSleep = false;
10771128

@@ -1530,6 +1581,47 @@ void APP_TimeSlice500ms(void)
15301581
BACKLIGHT_TurnOff();
15311582
}
15321583

1584+
#ifdef ENABLE_FEAT_F4HWN_SLEEP
1585+
if (gSleepModeCountdown_500ms == gSetting_set_off * 120 && gWakeUp) {
1586+
ST7565_Init();
1587+
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
1588+
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
1589+
gWakeUp = false;
1590+
}
1591+
1592+
if(gCurrentFunction != FUNCTION_TRANSMIT && !FUNCTION_IsRx())
1593+
{
1594+
if (gSleepModeCountdown_500ms > 0 && --gSleepModeCountdown_500ms == 0) {
1595+
gBacklightCountdown_500ms = 0;
1596+
gPowerSave_10ms = 1;
1597+
gWakeUp = true;
1598+
PWM_PLUS0_CH0_COMP = 0;
1599+
ST7565_ShutDown();
1600+
}
1601+
else if(gSleepModeCountdown_500ms < 60 && gSetting_set_off != 0)
1602+
{
1603+
if(gSleepModeCountdown_500ms % 2 == 0)
1604+
{
1605+
PWM_PLUS0_CH0_COMP = 0;
1606+
}
1607+
else
1608+
{
1609+
PWM_PLUS0_CH0_COMP = value[gEeprom.BACKLIGHT_MAX] * 4; // Max brightness
1610+
}
1611+
}
1612+
}
1613+
else
1614+
{
1615+
gSleepModeCountdown_500ms = gSetting_set_off * 120;
1616+
}
1617+
1618+
if (gWakeUp) {
1619+
static bool swap = true;
1620+
swap = !swap; // Alterne l'état à chaque exécution
1621+
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, swap);
1622+
}
1623+
#endif
1624+
15331625
if (gReducedService)
15341626
{
15351627
BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent);

app/chFrScanner.c

+31
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,36 @@ void CHFRSCANNER_ContinueScanning(void)
102102

103103
void CHFRSCANNER_Found(void)
104104
{
105+
if (gEeprom.SCAN_RESUME_MODE > 2) {
106+
if (!gScanPauseMode) {
107+
gScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms * (gEeprom.SCAN_RESUME_MODE - 2) * 5;
108+
gScanPauseMode = true;
109+
}
110+
} else {
111+
gScanPauseDelayIn_10ms = 0;
112+
}
113+
114+
// gScheduleScanListen is always false...
115+
gScheduleScanListen = false;
116+
117+
/*
118+
if(gEeprom.SCAN_RESUME_MODE > 1 && gEeprom.SCAN_RESUME_MODE < 26)
119+
{
120+
if (!gScanPauseMode)
121+
{
122+
gScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms * (gEeprom.SCAN_RESUME_MODE - 1) * 5;
123+
gScheduleScanListen = false;
124+
gScanPauseMode = true;
125+
}
126+
}
127+
else
128+
{
129+
gScanPauseDelayIn_10ms = 0;
130+
gScheduleScanListen = false;
131+
}
132+
*/
133+
134+
/*
105135
switch (gEeprom.SCAN_RESUME_MODE)
106136
{
107137
case SCAN_RESUME_TO:
@@ -119,6 +149,7 @@ void CHFRSCANNER_Found(void)
119149
gScheduleScanListen = false;
120150
break;
121151
}
152+
*/
122153

123154
#ifdef ENABLE_FEAT_F4HWN
124155
lastFoundFrqOrChanOld = lastFoundFrqOrChan;

app/menu.c

+29-3
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
176176

177177
case MENU_SC_REV:
178178
//*pMin = 0;
179-
*pMax = ARRAY_SIZE(gSubMenu_SC_REV) - 1;
179+
*pMax = 26;
180180
break;
181181

182182
case MENU_ROGER:
@@ -248,9 +248,11 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
248248
#ifdef ENABLE_NOAA
249249
case MENU_NOAA_S:
250250
#endif
251+
#ifndef ENABLE_FEAT_F4HWN
251252
case MENU_350TX:
252253
case MENU_200TX:
253254
case MENU_500TX:
255+
#endif
254256
case MENU_350EN:
255257
#ifndef ENABLE_FEAT_F4HWN
256258
case MENU_SCREN:
@@ -376,6 +378,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
376378
*pMax = gSubMenu_SIDEFUNCTIONS_size-1;
377379
break;
378380

381+
#ifdef ENABLE_FEAT_F4HWN_SLEEP
382+
case MENU_SET_OFF:
383+
*pMax = 120;
384+
break;
385+
#endif
386+
379387
#ifdef ENABLE_FEAT_F4HWN
380388
case MENU_SET_PWR:
381389
*pMax = ARRAY_SIZE(gSubMenu_SET_PWR) - 1;
@@ -789,9 +797,11 @@ void MENU_AcceptSetting(void)
789797
SETTINGS_FactoryReset(gSubMenuSelection);
790798
return;
791799

800+
#ifndef ENABLE_FEAT_F4HWN
792801
case MENU_350TX:
793802
gSetting_350TX = gSubMenuSelection;
794803
break;
804+
#endif
795805

796806
case MENU_F_LOCK: {
797807
if(gSubMenuSelection == F_LOCK_NONE) { // select 10 times to enable
@@ -809,20 +819,20 @@ void MENU_AcceptSetting(void)
809819
gSetting_F_LOCK = gSubMenuSelection;
810820
break;
811821
}
822+
#ifndef ENABLE_FEAT_F4HWN
812823
case MENU_200TX:
813824
gSetting_200TX = gSubMenuSelection;
814825
break;
815826

816827
case MENU_500TX:
817828
gSetting_500TX = gSubMenuSelection;
818829
break;
819-
830+
#endif
820831
case MENU_350EN:
821832
gSetting_350EN = gSubMenuSelection;
822833
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
823834
gFlagResetVfos = true;
824835
break;
825-
826836
#ifndef ENABLE_FEAT_F4HWN
827837
case MENU_SCREN:
828838
gSetting_ScrambleEnable = gSubMenuSelection;
@@ -868,6 +878,12 @@ void MENU_AcceptSetting(void)
868878
}
869879
break;
870880

881+
#ifdef ENABLE_FEAT_F4HWN_SLEEP
882+
case MENU_SET_OFF:
883+
gSetting_set_off = gSubMenuSelection;
884+
break;
885+
#endif
886+
871887
#ifdef ENABLE_FEAT_F4HWN
872888
case MENU_SET_PWR:
873889
gSetting_set_pwr = gSubMenuSelection;
@@ -1230,14 +1246,17 @@ void MENU_ShowCurrentSetting(void)
12301246
#endif
12311247
break;
12321248

1249+
#ifndef ENABLE_FEAT_F4HWN
12331250
case MENU_350TX:
12341251
gSubMenuSelection = gSetting_350TX;
12351252
break;
1253+
#endif
12361254

12371255
case MENU_F_LOCK:
12381256
gSubMenuSelection = gSetting_F_LOCK;
12391257
break;
12401258

1259+
#ifndef ENABLE_FEAT_F4HWN
12411260
case MENU_200TX:
12421261
gSubMenuSelection = gSetting_200TX;
12431262
break;
@@ -1246,6 +1265,7 @@ void MENU_ShowCurrentSetting(void)
12461265
gSubMenuSelection = gSetting_500TX;
12471266
break;
12481267

1268+
#endif
12491269
case MENU_350EN:
12501270
gSubMenuSelection = gSetting_350EN;
12511271
break;
@@ -1294,6 +1314,12 @@ void MENU_ShowCurrentSetting(void)
12941314
break;
12951315
}
12961316

1317+
#ifdef ENABLE_FEAT_F4HWN_SLEEP
1318+
case MENU_SET_OFF:
1319+
gSubMenuSelection = gSetting_set_off;
1320+
break;
1321+
#endif
1322+
12971323
#ifdef ENABLE_FEAT_F4HWN
12981324
case MENU_SET_PWR:
12991325
gSubMenuSelection = gSetting_set_pwr;
59.5 KB
Binary file not shown.
57.5 KB
Binary file not shown.

archive/f4hwn.voxless.packed.v3.4.bin

59.6 KB
Binary file not shown.

driver/backlight.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@
3131
uint16_t gBacklightCountdown_500ms = 0;
3232
bool backlightOn;
3333

34+
#ifdef ENABLE_FEAT_F4HWN
35+
const uint8_t value[] = {0, 3, 6, 9, 15, 24, 38, 62, 100, 159, 255};
36+
#endif
37+
38+
#ifdef ENABLE_FEAT_F4HWN_SLEEP
39+
uint16_t gSleepModeCountdown_500ms = 0;
40+
#endif
41+
3442
void BACKLIGHT_InitHardware()
3543
{
3644
// 48MHz / 94 / 1024 ~ 500Hz
@@ -73,6 +81,10 @@ static void BACKLIGHT_Sound(void)
7381

7482
void BACKLIGHT_TurnOn(void)
7583
{
84+
#ifdef ENABLE_FEAT_F4HWN_SLEEP
85+
gSleepModeCountdown_500ms = gSetting_set_off * 120;
86+
#endif
87+
7688
#ifdef ENABLE_FEAT_F4HWN
7789
gBacklightBrightnessOld = BACKLIGHT_GetBrightness();
7890
#endif
@@ -146,8 +158,6 @@ static uint8_t currentBrightness;
146158

147159
void BACKLIGHT_SetBrightness(uint8_t brigtness)
148160
{
149-
const uint8_t value[] = {0, 3, 6, 9, 15, 24, 38, 62, 100, 159, 255};
150-
151161
currentBrightness = brigtness;
152162
PWM_PLUS0_CH0_COMP = value[brigtness] * 4;
153163
//PWM_PLUS0_CH0_COMP = (1 << brigtness) - 1;

0 commit comments

Comments
 (0)