Added scan indicator (if NOAA disabled)

This commit is contained in:
OneOfEleven 2023-09-18 11:29:28 +01:00
parent 777117c76b
commit 784a4dd79f
16 changed files with 175 additions and 82 deletions

View File

@ -80,6 +80,7 @@ static void ACTION_Monitor(void)
RADIO_SetupRegisters(true);
APP_StartListening(FUNCTION_MONITOR);
return;
}
@ -184,6 +185,10 @@ void ACTION_Scan(bool bRestart)
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
AUDIO_PlaySingleVoice(true);
#endif
// let the user see DW is not active
gDualWatchActive = false;
gUpdateStatus = true;
}
}
}

View File

@ -195,6 +195,7 @@ static void AIRCOPY_Key_MENU(bool bKeyPressed, bool bKeyHeld)
g_FSK_Buffer[35] = 0xDCBA;
AIRCOPY_SendMessage();
GUI_DisplayScreen();
gAircopyState = AIRCOPY_TRANSFER;

View File

@ -638,6 +638,12 @@ static void DUALWATCH_Alternate(void)
{ // toggle between VFO's
gEeprom.RX_CHANNEL = (1 - gEeprom.RX_CHANNEL) & 1;
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
if (!gDualWatchActive)
{ // let the user see DW is active
gDualWatchActive = true;
gUpdateStatus = true;
}
}
RADIO_SetupRegisters(false);
@ -647,12 +653,6 @@ static void DUALWATCH_Alternate(void)
#else
gDualWatchCountdown_10ms = dual_watch_count_toggle_10ms;
#endif
if (!gDualWatchActive)
{ // let the user see DW is active
gDualWatchActive = true;
gUpdateStatus = true;
}
}
void APP_CheckRadioInterrupts(void)
@ -1200,8 +1200,10 @@ void APP_CheckKeys(void)
// scan the hardware keys
Key = KEYBOARD_Poll();
#ifdef ENABLE_BOOT_BEEPS
if (Key != KEY_INVALID)
boot_counter_10ms = 0;
boot_counter_10ms = 0; // cancel bbot beeps if any key pressed
#endif
if (gKeyReading0 != Key)
{ // new key pressed
@ -1300,10 +1302,7 @@ void APP_TimeSlice10ms(void)
if (gCurrentFunction != FUNCTION_TRANSMIT)
{
if (gUpdateStatus)
{
UI_DisplayStatus(false);
gUpdateStatus = false;
}
if (gUpdateDisplay)
{
@ -1406,9 +1405,9 @@ void APP_TimeSlice10ms(void)
BK4819_CssScanResult_t ScanResult;
uint16_t CtcssFreq;
if (gScanDelay > 0)
if (gScanDelay_10ms > 0)
{
gScanDelay--;
gScanDelay_10ms--;
APP_CheckKeys();
return;
}
@ -1451,9 +1450,11 @@ void APP_TimeSlice10ms(void)
gScanProgressIndicator = 0;
gScanCssState = SCAN_CSS_STATE_SCANNING;
GUI_SelectNextDisplay(DISPLAY_SCANNER);
gUpdateStatus = true;
}
gScanDelay = scan_delay_10ms;
//gScanDelay_10ms = scan_delay_10ms;
gScanDelay_10ms = 20 / 10; // 20ms
break;
case SCAN_CSS_STATE_SCANNING:
@ -1472,6 +1473,7 @@ void APP_TimeSlice10ms(void)
gScanCssResultType = CODE_TYPE_DIGITAL;
gScanCssState = SCAN_CSS_STATE_FOUND;
gScanUseCssResult = true;
gUpdateStatus = true;
}
}
else
@ -1486,6 +1488,7 @@ void APP_TimeSlice10ms(void)
{
gScanCssState = SCAN_CSS_STATE_FOUND;
gScanUseCssResult = true;
gUpdateStatus = true;
}
}
else
@ -1499,7 +1502,7 @@ void APP_TimeSlice10ms(void)
if (gScanCssState < SCAN_CSS_STATE_FOUND)
{
BK4819_SetScanFrequency(gScanFrequency);
gScanDelay = scan_delay_10ms;
gScanDelay_10ms = scan_delay_10ms;
break;
}
@ -1730,7 +1733,10 @@ void APP_TimeSlice500ms(void)
gScanCssState = SCAN_CSS_STATE_FOUND;
else
gScanCssState = SCAN_CSS_STATE_FAILED;
gUpdateStatus = true;
}
gUpdateDisplay = true;
}
@ -1840,6 +1846,20 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{
bool bFlag = false;
// const bool backlight_was_on = (gBacklightCountdown > 0 || gEeprom.BACKLIGHT >= 5);
const bool backlight_was_on = GPIO_CheckBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
// if (Key == KEY_EXIT && bKeyPressed && !bKeyHeld && !backlight_was_on)
if (bKeyPressed && !bKeyHeld && !backlight_was_on)
{ // just turn the light on for now
BACKLIGHT_TurnOn();
// gKeyReading0 = KEY_INVALID;
// gKeyReading1 = KEY_INVALID;
gDebounceCounter = 0;
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
return;
}
if (gCurrentFunction == FUNCTION_POWER_SAVE)
FUNCTION_Select(FUNCTION_FOREGROUND);
@ -1939,24 +1959,27 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
}
}
if ((gScanState != SCAN_OFF &&
if (gScanState != SCAN_OFF &&
Key != KEY_PTT &&
Key != KEY_UP &&
Key != KEY_DOWN &&
Key != KEY_EXIT &&
Key != KEY_STAR)
||
(gCssScanMode != CSS_SCAN_MODE_OFF &&
{ // scanning
if (bKeyPressed && !bKeyHeld)
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
return;
}
if (gCssScanMode != CSS_SCAN_MODE_OFF &&
Key != KEY_PTT &&
Key != KEY_UP &&
Key != KEY_DOWN &&
Key != KEY_EXIT &&
Key != KEY_STAR &&
Key != KEY_MENU))
{
if (!bKeyPressed || bKeyHeld)
return;
Key != KEY_MENU)
{ // code scanning
if (bKeyPressed && !bKeyHeld)
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
return;
}

View File

@ -149,11 +149,11 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
case KEY_4:
gWasFKeyPressed = false;
gUpdateStatus = true;
gFlagStartScan = true;
gScanSingleFrequency = false;
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
gUpdateStatus = true;
if (beep)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;

View File

@ -125,6 +125,8 @@
void MENU_StartCssScan(int8_t Direction)
{
gCssScanMode = CSS_SCAN_MODE_SCANNING;
gUpdateStatus = true;
gMenuScrollDirection = Direction;
RADIO_SelectVfos();
@ -138,6 +140,7 @@ void MENU_StartCssScan(int8_t Direction)
void MENU_StopCssScan(void)
{
gCssScanMode = CSS_SCAN_MODE_OFF;
gUpdateStatus = true;
RADIO_SetupRegisters(true);
}
@ -1263,6 +1266,7 @@ static void MENU_Key_MENU(bool bKeyPressed, bool bKeyHeld)
}
gCssScanMode = CSS_SCAN_MODE_OFF;
gUpdateStatus = true;
#ifdef ENABLE_VOICE
if (gMenuCursor == MENU_SCR)

View File

@ -207,6 +207,8 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
gAnotherVoiceID = VOICE_ID_MEMORY_CHANNEL;
#endif
gRequestDisplayScreen = DISPLAY_SCANNER;
gUpdateStatus = true;
break;
case 1:
@ -380,18 +382,24 @@ void SCANNER_Start(void)
gScanCssState = SCAN_CSS_STATE_SCANNING;
gScanFrequency = gRxVfo->pRX->Frequency;
gStepSetting = gRxVfo->STEP_SETTING;
BK4819_PickRXFilterPathBasedOnFrequency(gScanFrequency);
BK4819_SetScanFrequency(gScanFrequency);
gUpdateStatus = true;
}
else
{
gScanCssState = SCAN_CSS_STATE_OFF;
gScanFrequency = 0xFFFFFFFF;
BK4819_PickRXFilterPathBasedOnFrequency(0xFFFFFFFF);
BK4819_EnableFrequencyScan();
gUpdateStatus = true;
}
gScanDelay = scan_delay_10ms;
gScanDelay_10ms = scan_delay_10ms;
gScanCssResultCode = 0xFF;
gScanCssResultType = 0xFF;
gScanHitCount = 0;
@ -441,4 +449,6 @@ void SCANNER_Stop(void)
}
SETTINGS_SaveVfoIndices();
gUpdateStatus = true;
}

View File

@ -4,8 +4,10 @@
// all these images are on their right sides
// turn your monitor 90deg anti-clockwise to see the images
const uint8_t BITMAP_PowerSave[] =
{ // "S"
const uint8_t BITMAP_PowerSave[8] =
{
#if 0
// "S"
0b00000000,
0b00100110,
0b01001001,
@ -14,9 +16,20 @@ const uint8_t BITMAP_PowerSave[] =
0b01001001,
0b01001001,
0b00110010
#else
// "PS"
0b00000000,
0b01111111,
0b00010001,
0b00001110,
0b00000000,
0b01000110,
0b01001001,
0b00110001
#endif
};
const uint8_t BITMAP_BatteryLevel1[] =
const uint8_t BITMAP_BatteryLevel1[18] =
{
0b00000000,
0b00111110,
@ -38,7 +51,7 @@ const uint8_t BITMAP_BatteryLevel1[] =
0b01111111
};
const uint8_t BITMAP_BatteryLevel2[] =
const uint8_t BITMAP_BatteryLevel2[18] =
{
0b00000000,
0b00111110,
@ -60,7 +73,7 @@ const uint8_t BITMAP_BatteryLevel2[] =
0b01111111
};
const uint8_t BITMAP_BatteryLevel3[] =
const uint8_t BITMAP_BatteryLevel3[18] =
{
0b00000000,
0b00111110,
@ -82,7 +95,7 @@ const uint8_t BITMAP_BatteryLevel3[] =
0b01111111
};
const uint8_t BITMAP_BatteryLevel4[] =
const uint8_t BITMAP_BatteryLevel4[18] =
{
0b00000000,
0b00111110,
@ -104,7 +117,7 @@ const uint8_t BITMAP_BatteryLevel4[] =
0b01111111
};
const uint8_t BITMAP_BatteryLevel5[] =
const uint8_t BITMAP_BatteryLevel5[18] =
{
0b00000000,
0b00111110,
@ -126,7 +139,7 @@ const uint8_t BITMAP_BatteryLevel5[] =
0b01111111
};
const uint8_t BITMAP_USB_C[] =
const uint8_t BITMAP_USB_C[9] =
{ // USB symbol
0b00000000,
0b00011100,
@ -139,7 +152,7 @@ const uint8_t BITMAP_USB_C[] =
0b00011100
};
const uint8_t BITMAP_KeyLock[] =
const uint8_t BITMAP_KeyLock[9] =
{ // padlock symbol
0b00000000,
0b01111100,
@ -152,7 +165,7 @@ const uint8_t BITMAP_KeyLock[] =
0b01111100
};
const uint8_t BITMAP_F_Key[] =
const uint8_t BITMAP_F_Key[10] =
{ // F-Key symbol
0b11111111,
0b10000001,
@ -166,7 +179,7 @@ const uint8_t BITMAP_F_Key[] =
0b11111111
};
const uint8_t BITMAP_VOX[] =
const uint8_t BITMAP_VOX[18] =
{ // "VOX"
0b00000000,
0b00011111,
@ -191,7 +204,7 @@ const uint8_t BITMAP_VOX[] =
};
#if 0
const uint8_t BITMAP_WX[] =
const uint8_t BITMAP_WX[12] =
{ // "WX"
0b00000000,
0b01111111,
@ -209,7 +222,7 @@ const uint8_t BITMAP_VOX[] =
};
#else
// 'XB' (cross-band)
const uint8_t BITMAP_XB[] =
const uint8_t BITMAP_XB[12] =
{ // "XB"
0b00000000,
0b01100011,
@ -227,7 +240,7 @@ const uint8_t BITMAP_VOX[] =
};
#endif
const uint8_t BITMAP_TDR1[] =
const uint8_t BITMAP_TDR1[12] =
{ // "DW"
0b00000000,
0b01111111,
@ -244,7 +257,7 @@ const uint8_t BITMAP_TDR1[] =
0b01111111
};
const uint8_t BITMAP_TDR2[] =
const uint8_t BITMAP_TDR2[12] =
{ // "--"
0b00000000,
0b00010000,
@ -262,7 +275,7 @@ const uint8_t BITMAP_TDR2[] =
};
#ifdef ENABLE_VOICE
const uint8_t BITMAP_VoicePrompt[] =
const uint8_t BITMAP_VoicePrompt[9] =
{
0b00000000,
0b00011000,
@ -277,7 +290,7 @@ const uint8_t BITMAP_TDR2[] =
#endif
#ifdef ENABLE_FMRADIO
const uint8_t BITMAP_FM[] =
const uint8_t BITMAP_FM[12] =
{ // "FM"
0b00000000,
0b01111111,
@ -296,7 +309,7 @@ const uint8_t BITMAP_TDR2[] =
#endif
#ifdef ENABLE_NOAA
const uint8_t BITMAP_NOAA[] =
const uint8_t BITMAP_NOAA[12] =
{ // "NS"
0b00000000,
0b01111111,
@ -312,9 +325,26 @@ const uint8_t BITMAP_TDR2[] =
0b01001001,
0b00110001
};
#else
const uint8_t BITMAP_SC[12] =
{ // "SC"
0b00000000,
0b01000110,
0b01001001,
0b01001001,
0b01001001,
0b00110001,
0b00000000,
0b00111110,
0b01000001,
0b01000001,
0b01000001,
0b00100010
};
#endif
const uint8_t BITMAP_Antenna[] =
const uint8_t BITMAP_Antenna[5] =
{
0b00000011,
0b00000101,
@ -323,49 +353,49 @@ const uint8_t BITMAP_Antenna[] =
0b00000011
};
const uint8_t BITMAP_AntennaLevel1[] =
const uint8_t BITMAP_AntennaLevel1[3] =
{
0b01100000,
0b01100000,
0b00000000
};
const uint8_t BITMAP_AntennaLevel2[] =
const uint8_t BITMAP_AntennaLevel2[3] =
{
0b01110000,
0b01110000,
0b00000000
};
const uint8_t BITMAP_AntennaLevel3[] =
const uint8_t BITMAP_AntennaLevel3[3] =
{
0b01111000,
0b01111000,
0b00000000
};
const uint8_t BITMAP_AntennaLevel4[] =
const uint8_t BITMAP_AntennaLevel4[3] =
{
0b01111100,
0b01111100,
0b00000000
};
const uint8_t BITMAP_AntennaLevel5[] =
const uint8_t BITMAP_AntennaLevel5[3] =
{
0b01111110,
0b01111110,
0b00000000
};
const uint8_t BITMAP_AntennaLevel6[] =
const uint8_t BITMAP_AntennaLevel6[3] =
{
0b01111111,
0b01111111,
0b00000000
};
const uint8_t BITMAP_CurrentIndicator[] =
const uint8_t BITMAP_CurrentIndicator[8] =
{
0b11111111,
0b11111111,
@ -377,7 +407,7 @@ const uint8_t BITMAP_CurrentIndicator[] =
0b00011000
};
const uint8_t BITMAP_VFO_Default[] =
const uint8_t BITMAP_VFO_Default[8] =
{
0b00000000,
0b01111111,
@ -389,7 +419,7 @@ const uint8_t BITMAP_VFO_Default[] =
0b00001000
};
const uint8_t BITMAP_VFO_NotDefault[] =
const uint8_t BITMAP_VFO_NotDefault[8] =
{
0b00000000,
0b01000001,
@ -401,7 +431,7 @@ const uint8_t BITMAP_VFO_NotDefault[] =
0b00001000
};
const uint8_t BITMAP_ScanList[] =
const uint8_t BITMAP_ScanList[6] =
{ // diamond symbol
0b00001000,
0b00011100,

View File

@ -39,6 +39,8 @@ extern const uint8_t BITMAP_TDR2[12];
#ifdef ENABLE_NOAA
extern const uint8_t BITMAP_NOAA[12];
#else
extern const uint8_t BITMAP_SC[12];
#endif
extern const uint8_t BITMAP_Antenna[5];

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

2
misc.c
View File

@ -167,7 +167,7 @@ bool gPttIsPressed;
uint8_t gPttDebounceCounter;
uint8_t gMenuListCount;
uint8_t gBackupCROSS_BAND_RX_TX;
uint8_t gScanDelay;
uint8_t gScanDelay_10ms;
#ifdef ENABLE_AIRCOPY
uint8_t gAircopySendCountdown;
#endif

2
misc.h
View File

@ -223,7 +223,7 @@ extern bool gPttIsPressed;
extern uint8_t gPttDebounceCounter;
extern uint8_t gMenuListCount;
extern uint8_t gBackupCROSS_BAND_RX_TX;
extern uint8_t gScanDelay;
extern uint8_t gScanDelay_10ms;
#ifdef ENABLE_AIRCOPY
extern uint8_t gAircopySendCountdown;
#endif

View File

@ -436,7 +436,7 @@ void UI_DisplayMain(void)
String[0] = '?';
switch (gEeprom.VfoInfo[vfo_num].CHANNEL_BANDWIDTH)
{
case BANDWIDTH_WIDE: String[0] = 'W'; break;
// case BANDWIDTH_WIDE: String[0] = 'W'; break;
case BANDWIDTH_NARROW: String[0] = 'N'; break;
}
String[1] = '\0';

View File

@ -16,6 +16,7 @@
#include <string.h>
#include "app/scanner.h"
#ifdef ENABLE_FMRADIO
#include "app/fm.h"
#endif
@ -26,11 +27,13 @@
#include "helper/battery.h"
#include "misc.h"
#include "settings.h"
//#include "ui/helper.h"
#include "ui/ui.h"
#include "ui/status.h"
void UI_DisplayStatus(const bool test_display)
{
gUpdateStatus = false;
memset(gStatusLine, 0, sizeof(gStatusLine));
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
@ -39,24 +42,37 @@ void UI_DisplayStatus(const bool test_display)
#ifdef ENABLE_NOAA
if (gIsNoaaMode || test_display)
memmove(gStatusLine + 7, BITMAP_NOAA, sizeof(BITMAP_NOAA));
#else
if (gScanState != SCAN_OFF ||
gCssScanMode != CSS_SCAN_MODE_OFF ||
gScanCssState != SCAN_CSS_STATE_OFF ||
gScreenToDisplay == DISPLAY_SCANNER ||
test_display)
memmove(gStatusLine + 7, BITMAP_SC, sizeof(BITMAP_SC));
#endif
if (gSetting_KILLED || test_display)
memset(gStatusLine + 21, 0xFF, 10);
#ifdef ENABLE_FMRADIO
if (gSetting_KILLED)
memset(gStatusLine + 21, 0xFF, 10);
else
if (gFmRadioMode || test_display)
memmove(gStatusLine + 21, BITMAP_FM, sizeof(BITMAP_FM));
#else
if (test_display)
memset(gStatusLine + 21, 0xFF, 10);
#endif
#ifdef ENABLE_VOICE
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF || test_display)
memmove(gStatusLine + 34, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
#else
if (test_display)
memset(gStatusLine + 35, 0xFF, 8);
#endif
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF || test_display)
{
if (gDualWatchActive)
if (gDualWatchActive || test_display)
memmove(gStatusLine + 45, BITMAP_TDR1, sizeof(BITMAP_TDR1));
else
memmove(gStatusLine + 45, BITMAP_TDR2, sizeof(BITMAP_TDR2));

View File

@ -100,6 +100,8 @@ void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
gWasFKeyPressed = false;
gUpdateStatus = true;
}
gUpdateStatus = true;
}
gUpdateDisplay = true;