Add RESTORE_SCAN feature
This commit is contained in:
4
Makefile
4
Makefile
@@ -46,6 +46,7 @@ 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_SLEEP ?= 1
|
||||||
|
ENABLE_FEAT_F4HWN_RESTORE_SCAN ?= 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
|
||||||
@@ -422,6 +423,9 @@ endif
|
|||||||
ifeq ($(ENABLE_FEAT_F4HWN_SLEEP),1)
|
ifeq ($(ENABLE_FEAT_F4HWN_SLEEP),1)
|
||||||
CFLAGS += -DENABLE_FEAT_F4HWN_SLEEP
|
CFLAGS += -DENABLE_FEAT_F4HWN_SLEEP
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_FEAT_F4HWN_RESTORE_SCAN),1)
|
||||||
|
CFLAGS += -DENABLE_FEAT_F4HWN_RESTORE_SCAN
|
||||||
|
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
|
||||||
|
@@ -220,6 +220,9 @@ void ACTION_Scan(bool bRestart)
|
|||||||
|
|
||||||
// channel mode. Keep scanning but toggle between scan lists
|
// channel mode. Keep scanning but toggle between scan lists
|
||||||
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 6;
|
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 6;
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
|
||||||
|
SETTINGS_WriteCurrentState();
|
||||||
|
#endif
|
||||||
|
|
||||||
// jump to the next channel
|
// jump to the next channel
|
||||||
CHFRSCANNER_Start(false, gScanStateDir);
|
CHFRSCANNER_Start(false, gScanStateDir);
|
||||||
|
@@ -196,6 +196,11 @@ void CHFRSCANNER_Stop(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
|
||||||
|
gEeprom.CURRENT_STATE = 0;
|
||||||
|
SETTINGS_WriteCurrentState();
|
||||||
|
#endif
|
||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
|
15
app/main.c
15
app/main.c
@@ -407,6 +407,9 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
switch(Key) {
|
switch(Key) {
|
||||||
case KEY_0...KEY_5:
|
case KEY_0...KEY_5:
|
||||||
gEeprom.SCAN_LIST_DEFAULT = Key;
|
gEeprom.SCAN_LIST_DEFAULT = Key;
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
|
||||||
|
SETTINGS_WriteCurrentState();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -684,6 +687,17 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (!bKeyPressed) // released
|
if (!bKeyPressed) // released
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
|
||||||
|
if(gScanRangeStart == 0) // No ScanRange
|
||||||
|
{
|
||||||
|
gEeprom.CURRENT_STATE = 1;
|
||||||
|
}
|
||||||
|
else // ScanRange
|
||||||
|
{
|
||||||
|
gEeprom.CURRENT_STATE = 2;
|
||||||
|
}
|
||||||
|
SETTINGS_WriteCurrentState();
|
||||||
|
#endif
|
||||||
ACTION_Scan(false);// toggle scanning
|
ACTION_Scan(false);// toggle scanning
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
@@ -732,6 +746,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
|||||||
// scan the CTCSS/DCS code
|
// scan the CTCSS/DCS code
|
||||||
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
|
|
||||||
SCANNER_Start(true);
|
SCANNER_Start(true);
|
||||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||||
}
|
}
|
||||||
|
48
main.c
48
main.c
@@ -29,6 +29,16 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
|
#ifdef ENABLE_FMRADIO
|
||||||
|
#include "app/fm.h"
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_SPECTRUM
|
||||||
|
#include "app/spectrum.h"
|
||||||
|
#endif
|
||||||
|
#include "app/chFrScanner.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
#include "app/dtmf.h"
|
#include "app/dtmf.h"
|
||||||
#include "bsp/dp32g030/gpio.h"
|
#include "bsp/dp32g030/gpio.h"
|
||||||
@@ -242,6 +252,44 @@ void Main(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
|
||||||
|
switch (gEeprom.CURRENT_STATE) {
|
||||||
|
case 1:
|
||||||
|
//gScanRangeStart = 0;
|
||||||
|
//ACTION_Scan(false);
|
||||||
|
gEeprom.SCAN_LIST_DEFAULT = gEeprom.CURRENT_LIST;
|
||||||
|
CHFRSCANNER_Start(true, SCAN_FWD);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
gScanRangeStart = gScanRangeStart ? 0 : gTxVfo->pRX->Frequency;
|
||||||
|
gScanRangeStop = gEeprom.VfoInfo[!gEeprom.TX_VFO].freq_config_RX.Frequency;
|
||||||
|
if(gScanRangeStart > gScanRangeStop)
|
||||||
|
{
|
||||||
|
SWAP(gScanRangeStart, gScanRangeStop);
|
||||||
|
}
|
||||||
|
//ACTION_Scan(false);
|
||||||
|
CHFRSCANNER_Start(true, SCAN_FWD);
|
||||||
|
break;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FMRADIO
|
||||||
|
case 3:
|
||||||
|
FM_Start(); // For compiler alignments and paddings...
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_SPECTRUM
|
||||||
|
case 4:
|
||||||
|
APP_RunSpectrum(); // For compiler alignments and paddings...
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
default:
|
||||||
|
// No action for CURRENT_STATE == 0 or other unexpected values
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
APP_Update();
|
APP_Update();
|
||||||
|
|
||||||
|
23
settings.c
23
settings.c
@@ -69,7 +69,14 @@ void SETTINGS_InitEEPROM(void)
|
|||||||
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
|
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
|
||||||
gEeprom.BACKLIGHT_TIME = (Data[5] < 62) ? Data[5] : 12;
|
gEeprom.BACKLIGHT_TIME = (Data[5] < 62) ? Data[5] : 12;
|
||||||
gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
|
gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
|
||||||
|
gEeprom.VFO_OPEN = Data[7] & 0x01;
|
||||||
|
gEeprom.CURRENT_STATE = (Data[7] >> 1) & 0x07;
|
||||||
|
gEeprom.CURRENT_LIST = (Data[7] >> 4) & 0x07;
|
||||||
|
#else
|
||||||
gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true;
|
gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true;
|
||||||
|
#endif
|
||||||
|
|
||||||
// 0E80..0E87
|
// 0E80..0E87
|
||||||
EEPROM_ReadBuffer(0x0E80, Data, 8);
|
EEPROM_ReadBuffer(0x0E80, Data, 8);
|
||||||
@@ -610,7 +617,12 @@ void SETTINGS_SaveSettings(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
State[6] = gEeprom.TAIL_TONE_ELIMINATION;
|
State[6] = gEeprom.TAIL_TONE_ELIMINATION;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
|
||||||
|
State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) | ((gEeprom.SCAN_LIST_DEFAULT & 0x07) << 4);
|
||||||
|
#else
|
||||||
State[7] = gEeprom.VFO_OPEN;
|
State[7] = gEeprom.VFO_OPEN;
|
||||||
|
#endif
|
||||||
EEPROM_WriteBuffer(0x0E78, State);
|
EEPROM_WriteBuffer(0x0E78, State);
|
||||||
|
|
||||||
State[0] = gEeprom.BEEP_CONTROL;
|
State[0] = gEeprom.BEEP_CONTROL;
|
||||||
@@ -961,3 +973,14 @@ State[1] = 0
|
|||||||
;
|
;
|
||||||
EEPROM_WriteBuffer(0x1FF0, State);
|
EEPROM_WriteBuffer(0x1FF0, State);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
|
||||||
|
void SETTINGS_WriteCurrentState(void)
|
||||||
|
{
|
||||||
|
uint8_t State[8];
|
||||||
|
EEPROM_ReadBuffer(0x0E78, State, sizeof(State));
|
||||||
|
//State[3] = (gEeprom.CURRENT_STATE << 4) | (gEeprom.BATTERY_SAVE & 0x0F);
|
||||||
|
State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) | ((gEeprom.SCAN_LIST_DEFAULT & 0x07) << 4);
|
||||||
|
EEPROM_WriteBuffer(0x0E78, State);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -204,6 +204,10 @@ typedef struct {
|
|||||||
bool SCAN_LIST_ENABLED[3];
|
bool SCAN_LIST_ENABLED[3];
|
||||||
uint8_t SCANLIST_PRIORITY_CH1[3];
|
uint8_t SCANLIST_PRIORITY_CH1[3];
|
||||||
uint8_t SCANLIST_PRIORITY_CH2[3];
|
uint8_t SCANLIST_PRIORITY_CH2[3];
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
|
||||||
|
uint8_t CURRENT_STATE;
|
||||||
|
uint8_t CURRENT_LIST;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t field29_0x26;
|
uint8_t field29_0x26;
|
||||||
uint8_t field30_0x27;
|
uint8_t field30_0x27;
|
||||||
@@ -301,5 +305,8 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration);
|
void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration);
|
||||||
void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool check, bool save);
|
void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool check, bool save);
|
||||||
void SETTINGS_WriteBuildOptions(void);
|
void SETTINGS_WriteBuildOptions(void);
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
|
||||||
|
void SETTINGS_WriteCurrentState(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user