Reshuffled a bunch of variables.

This commit is contained in:
Dual Tachyon 2023-09-02 20:18:53 +01:00
parent 06b6f753e7
commit 36f2af04b5
12 changed files with 44 additions and 41 deletions

View File

@ -1141,7 +1141,7 @@ LAB_00004b08:
if (gScreenToDisplay == DISPLAY_SCANNER && gScannerEditState == 0 && gScanCssState < SCAN_CSS_STATE_FOUND) {
g_20000464++;
if (0x20 < g_20000464) {
if (gScanCssState == SCAN_CSS_STATE_SCANNING && g_20000458 == 0) {
if (gScanCssState == SCAN_CSS_STATE_SCANNING && !gScanSingleFrequency) {
gScanCssState = SCAN_CSS_STATE_FOUND;
} else {
gScanCssState = SCAN_CSS_STATE_FAILED;
@ -1221,7 +1221,7 @@ void FUN_000075b0(void)
RADIO_SetupRegisters(true);
gIsNoaaMode = false;
if (g_20000458 == 1) {
if (gScanSingleFrequency) {
gScanCssState = SCAN_CSS_STATE_SCANNING;
gScanFrequency = gRxInfo->pCurrent->Frequency;
gStepSetting = gRxInfo->STEP_SETTING;

View File

@ -38,6 +38,7 @@ volatile int8_t gFM_Step;
bool gFM_AutoScan;
uint8_t gFM_ChannelPosition;
bool gFM_FoundFrequency;
bool gFM_AutoScan;
bool FM_CheckValidChannel(uint8_t Channel)
{

View File

@ -32,6 +32,7 @@ extern uint8_t gFM_ChannelPosition;
// Doubts about whether this should be signed or not.
extern int16_t gFM_FrequencyDeviation;
extern bool gFM_FoundFrequency;
extern bool gFM_AutoScan;
bool FM_CheckValidChannel(uint8_t Channel);
uint8_t FM_FindNextChannel(uint8_t Channel, uint8_t Direction);

View File

@ -16,6 +16,7 @@
#include "app/fm.h"
#include "app/generic.h"
#include "app/scanner.h"
#include "audio.h"
#include "driver/keyboard.h"
#include "dtmf.h"

View File

@ -18,6 +18,7 @@
#include "app/fm.h"
#include "app/generic.h"
#include "app/main.h"
#include "app/scanner.h"
#include "audio.h"
#include "dtmf.h"
#include "frequencies.h"
@ -210,7 +211,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gUpdateStatus = true;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
gFlagStartScan = true;
g_20000458 = 0;
gScanSingleFrequency = false;
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
break;
@ -340,7 +341,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
gUpdateStatus = true;
if (IS_NOT_NOAA_CHANNEL(gTxInfo->CHANNEL_SAVE)) {
gFlagStartScan = true;
g_20000458 = 1;
gScanSingleFrequency = true;
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
} else {

View File

@ -18,6 +18,7 @@
#include "app/dtmf.h"
#include "app/generic.h"
#include "app/menu.h"
#include "app/scanner.h"
#include "audio.h"
#include "board.h"
#include "bsp/dp32g030/gpio.h"

View File

@ -26,6 +26,16 @@
DCS_CodeType_t gCS_ScannedType;
uint8_t gCS_ScannedIndex;
bool gFlagStartScan;
bool gFlagStopScan;
bool gScanSingleFrequency;
uint8_t gScannerEditState;
uint8_t gScanChannel;
uint32_t gScanFrequency;
uint8_t gScanPauseMode;
SCAN_CssState_t gScanCssState;
volatile bool gScheduleScanListen;
volatile uint16_t ScanPauseDelayIn10msec;
static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{
@ -97,13 +107,13 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
if (!bKeyPressed) {
return;
}
if (gScanCssState == SCAN_CSS_STATE_OFF && g_20000458 == 0) {
if (gScanCssState == SCAN_CSS_STATE_OFF && !gScanSingleFrequency) {
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
}
if (gScanCssState == SCAN_CSS_STATE_SCANNING) {
if (g_20000458 == 1) {
if (gScanSingleFrequency) {
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
}
@ -118,7 +128,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
switch (gScannerEditState) {
case 0:
if (g_20000458 == 0) {
if (!gScanSingleFrequency) {
uint32_t Freq250;
uint32_t Freq625;
int16_t Delta250;
@ -165,7 +175,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
break;
case 2:
if (g_20000458 == 0) {
if (!gScanSingleFrequency) {
RADIO_InitInfo(gTxInfo, gTxInfo->CHANNEL_SAVE, FREQUENCY_GetBand(gScanFrequency), gScanFrequency);
if (g_2000045C == 1) {
gTxInfo->ConfigRX.CodeType = gCS_ScannedType;

View File

@ -20,8 +20,27 @@
#include "dcs.h"
#include "driver/keyboard.h"
enum SCAN_CssState_t {
SCAN_CSS_STATE_OFF = 0U,
SCAN_CSS_STATE_SCANNING = 1U,
SCAN_CSS_STATE_FOUND = 2U,
SCAN_CSS_STATE_FAILED = 3U,
};
typedef enum SCAN_CssState_t SCAN_CssState_t;
extern DCS_CodeType_t gCS_ScannedType;
extern uint8_t gCS_ScannedIndex;
extern bool gFlagStartScan;
extern bool gFlagStopScan;
extern bool gScanSingleFrequency;
extern uint8_t gScannerEditState;
extern uint8_t gScanChannel;
extern uint32_t gScanFrequency;
extern uint8_t gScanPauseMode;
extern SCAN_CssState_t gScanCssState;
extern volatile bool gScheduleScanListen;
extern volatile uint16_t ScanPauseDelayIn10msec;
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);

11
misc.c
View File

@ -90,8 +90,6 @@ uint8_t gRequestSaveChannel;
bool gRequestSaveSettings;
bool gRequestSaveFM;
uint8_t g_200003A0;
bool gFlagStartScan;
bool gFlagStopScan;
bool gFlagAcceptSetting;
bool gFlagRefreshSetting;
bool gFlagSaveVfo;
@ -131,12 +129,10 @@ bool gPttIsPressed;
uint8_t gPttDebounceCounter;
bool g_20000439;
uint8_t gMenuListCount;
uint8_t g_20000458;
uint8_t gBackupCROSS_BAND_RX_TX;
uint8_t g_2000045C;
uint8_t g_2000045D;
uint8_t g_2000045F;
uint8_t gScannerEditState;
uint8_t g_20000464;
uint8_t gAircopySendCountdown;
uint8_t gFSKWriteIndex;
@ -147,10 +143,6 @@ volatile bool gNextTimeslice;
uint8_t gNoaaChannel;
bool gUpdateDisplay;
bool gF_LOCK;
uint8_t gScanChannel;
uint32_t gScanFrequency;
uint8_t gScanPauseMode;
SCAN_CssState_t gScanCssState;
uint8_t gShowChPrefix;
volatile uint16_t gSystickCountdown2;
volatile uint8_t gFoundCDCSSCountdown;
@ -162,12 +154,9 @@ volatile bool gSchedulePowerSave;
volatile bool gBatterySaveCountdownExpired;
volatile bool gScheduleDualWatch;
volatile bool gScheduleNOAA;
volatile bool gScheduleScanListen;
volatile bool gSystickFlag10;
volatile bool gScheduleFM;
volatile uint16_t ScanPauseDelayIn10msec;
uint16_t gCurrentRSSI;
volatile int8_t gStepDirection;

21
misc.h
View File

@ -47,15 +47,6 @@ enum {
VFO_CONFIGURE_RELOAD = 2U,
};
enum SCAN_CssState_t {
SCAN_CSS_STATE_OFF = 0U,
SCAN_CSS_STATE_SCANNING = 1U,
SCAN_CSS_STATE_FOUND = 2U,
SCAN_CSS_STATE_FAILED = 3U,
};
typedef enum SCAN_CssState_t SCAN_CssState_t;
extern const uint32_t *gUpperLimitFrequencyBandTable;
extern const uint32_t *gLowerLimitFrequencyBandTable;
@ -124,8 +115,6 @@ extern bool gRequestSaveSettings;
extern bool gRequestSaveFM;
extern uint8_t gKeypadLocked;
extern uint8_t g_200003A0;
extern bool gFlagStartScan;
extern bool gFlagStopScan;
extern bool gFlagAcceptSetting;
extern bool gFlagRefreshSetting;
extern bool gFlagSaveVfo;
@ -165,28 +154,21 @@ extern bool gPttIsPressed;
extern uint8_t gPttDebounceCounter;
extern bool g_20000439;
extern uint8_t gMenuListCount;
extern uint8_t g_20000458;
extern uint8_t gBackupCROSS_BAND_RX_TX;
extern uint8_t g_2000045C;
extern uint8_t g_2000045D;
extern uint8_t g_2000045F;
extern uint8_t gScannerEditState;
extern uint8_t g_20000464;
extern uint8_t gAircopySendCountdown;
extern uint8_t gFSKWriteIndex;
extern uint8_t g_20000474;
extern bool gFM_AutoScan;
extern bool gIsNoaaMode;
extern volatile bool gNextTimeslice;
extern uint8_t gNoaaChannel;
extern bool gUpdateDisplay;
extern uint8_t gFM_ChannelPosition;
extern bool gF_LOCK;
extern uint8_t gScanChannel;
extern uint32_t gScanFrequency;
extern uint8_t gScanPauseMode;
extern SCAN_CssState_t gScanCssState;
extern uint8_t gShowChPrefix;
extern volatile uint16_t gSystickCountdown2;
extern volatile uint8_t gFoundCDCSSCountdown;
@ -198,12 +180,9 @@ extern volatile bool gSchedulePowerSave;
extern volatile bool gBatterySaveCountdownExpired;
extern volatile bool gScheduleDualWatch;
extern volatile bool gScheduleNOAA;
extern volatile bool gScheduleScanListen;
extern volatile bool gSystickFlag10;
extern volatile bool gScheduleFM;
extern volatile uint16_t ScanPauseDelayIn10msec;
extern uint16_t gCurrentRSSI;
extern volatile int8_t gStepDirection;

View File

@ -14,6 +14,7 @@
* limitations under the License.
*/
#include "app/scanner.h"
#include "audio.h"
#include "functions.h"
#include "helper/battery.h"

View File

@ -33,7 +33,7 @@ void UI_DisplayScanner(void)
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
memset(String, 0, sizeof(String));
if (g_20000458 == 1 || (gScanCssState != SCAN_CSS_STATE_OFF && gScanCssState != SCAN_CSS_STATE_FAILED)) {
if (gScanSingleFrequency || (gScanCssState != SCAN_CSS_STATE_OFF && gScanCssState != SCAN_CSS_STATE_FAILED)) {
sprintf(String, "FREQ:%.5f", gScanFrequency * 1e-05);
} else {
sprintf(String, "FREQ:**.*****");