Skip to content

Commit

Permalink
8 scan lists
Browse files Browse the repository at this point in the history
Manage scan lists from menu.
Change list to scan from menu or using scan key during scan.
Empty scanlists are skipped.
Scan all channels ignoring scanlist available.
  • Loading branch information
reppad committed Nov 27, 2023
1 parent 3b2887c commit 46e247a
Show file tree
Hide file tree
Showing 17 changed files with 179 additions and 62 deletions.
51 changes: 33 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,15 @@ Use at your own risk and remember to back up your SPI memory before installing a
- Displaying registers in single VFO mode
- Displaying dBM when receiving
- Reworked scanner
- 8 Scan lists
- Faster scanning
- Resume mode: Time, Carrier, No
- Skip flagged channels (default)
- Ignore skip flag (launch scan action while scanning)
- Change scan direction while scanning (up/down keys)
- Force scan resume (up/down keys)
- Reworked main menu
- Ability to disable LED toggling when scanning
- And much more!

## Instructions
### SPI memory backup
Use [RT-890-Flasher](https://github.com/DualTachyon/radtel-rt-890-flasher)

### SPI memory restore
Use [RT-890-SPI-restore-CLI](https://github.com/DualTachyon/radtel-rt-890-spi-restore-cli)

### Customizations
```
UART_DEBUG => UART debug output
MOTO_STARTUP_TONE => Moto XPS startup beeps
ENABLE_AM_FIX => Experimental port of the great UV-K5 AM fix from OneOfEleven
ENABLE_LTO => Link Time Optimization
ENABLE_NOAA => NOAA weather channels (always re-set the sidekeys actions from menu after modifying the available actions)
```

### Default Shortcut Keys (long press) - Configurable in main menu
```
1 => Start/stop scanning memory channels
Expand All @@ -65,6 +48,38 @@ Menu => DTMF decoder
Exit => Single/dual VFO display
```

### Scanning guide
Scan list management:
- This firmware has 8 scanlists.
- The current channel can be added to any scanlist using the `Ch In List X` menus.
- The scanlist to be used can be selected in the `List To Scan` menu.
- To ignore scanlists and scan all channels, select `*` in the `List To Scan` menu.

Scanning:
- To start scanning, press a key mapped to the `Freq scanner` action (default: long press on key `1`).
- When scanning is in progress, use the `Freq scanner` key to change the scan list, this action will move to the next non-empty scanlist, or switch to scan all mode if all subsequent lists are empty.
- To change the direction of current scan, use the `up`/`down` keys.
- To force the scan to resume when the scanner stops on a signal, use the `up`/`down` keys.
- Press any key other than `Freq scanner` to stop scanning.



## Update Instructions
### SPI memory backup
Use [RT-890-Flasher](https://github.com/DualTachyon/radtel-rt-890-flasher)

### SPI memory restore
Use [RT-890-SPI-restore-CLI](https://github.com/DualTachyon/radtel-rt-890-spi-restore-cli)

### Customizations
```
UART_DEBUG => UART debug output
MOTO_STARTUP_TONE => Moto XPS startup beeps
ENABLE_AM_FIX => Experimental port of the great UV-K5 AM fix from OneOfEleven
ENABLE_LTO => Link Time Optimization
ENABLE_NOAA => NOAA weather channels (always re-set the sidekeys actions from menu after modifying the available actions)
```

### Build & Flash
See __Compiler__, __Building__ and __Flashing__ sections below.

Expand Down
57 changes: 48 additions & 9 deletions app/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ static const char Menu[][14] = {
"TX Power ",
"Modulation ",
"Band Width ",
"Skip Scan ",
"List To Scan ",
"Ch In List 1 ",
"Ch In List 2 ",
"Ch In List 3 ",
"Ch In List 4 ",
"Ch In List 5 ",
"Ch In List 6 ",
"Ch In List 7 ",
"Ch In List 8 ",
"Busy Lock ",
"Scrambler ",
"DCS Encrypt ",
Expand Down Expand Up @@ -125,7 +133,7 @@ static const ChannelInfo_t EmptyChannel = {

._0x11 = 0xFF,
.Scramble = 0xFF,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = " ",
Expand Down Expand Up @@ -507,11 +515,29 @@ void MENU_AcceptSetting(void)
CHANNELS_SaveVfo();
break;

case MENU_SKIP_SCAN:
gVfoState[gSettings.CurrentVfo].ScanAdd = gSettingIndex;
case MENU_LIST_TO_SCAN:
gExtendedSettings.ScanAll = (gSettingCurrentValue + gSettingIndex) % gSettingMaxValues == 8;
if (!gExtendedSettings.ScanAll) {
gExtendedSettings.CurrentScanList = (gSettingCurrentValue + gSettingIndex) % gSettingMaxValues;
}
SETTINGS_SaveGlobals();
break;

case MENU_SCANLIST_1:
case MENU_SCANLIST_2:
case MENU_SCANLIST_3:
case MENU_SCANLIST_4:
case MENU_SCANLIST_5:
case MENU_SCANLIST_6:
case MENU_SCANLIST_7:
case MENU_SCANLIST_8:
gVfoState[gSettings.CurrentVfo].IsInscanList =
(gVfoState[gSettings.CurrentVfo].IsInscanList & ~(1 << (gMenuIndex - MENU_SCANLIST_1))) // cleaning the bit corresponding to the scanlist
| (gSettingIndex << (gMenuIndex - MENU_SCANLIST_1)); // set the bit to 1 if gSettingIndex = "On"
CHANNELS_SaveVfo();
break;


case MENU_BUSY_LOCK:
gVfoState[gSettings.CurrentVfo].BCL = (gSettingCurrentValue + gSettingIndex) % gSettingMaxValues;
CHANNELS_SaveVfo();
Expand Down Expand Up @@ -879,10 +905,23 @@ void MENU_DrawSetting(void)
UI_DrawSettingBandwidth();
break;

case MENU_SKIP_SCAN:
gSettingIndex = gVfoState[gSettings.CurrentVfo].ScanAdd;
case MENU_LIST_TO_SCAN:
gSettingCurrentValue = gExtendedSettings.ScanAll ? 8 : gExtendedSettings.CurrentScanList;
gSettingMaxValues = 9;
DISPLAY_Fill(0, 159, 1, 55, COLOR_BACKGROUND);
UI_DrawSettingSkipScan();
UI_DrawSettingScanlist(gSettingCurrentValue);
break;

case MENU_SCANLIST_1:
case MENU_SCANLIST_2:
case MENU_SCANLIST_3:
case MENU_SCANLIST_4:
case MENU_SCANLIST_5:
case MENU_SCANLIST_6:
case MENU_SCANLIST_7:
case MENU_SCANLIST_8:
gSettingIndex = ((gVfoState[gSettings.CurrentVfo].IsInscanList >> (gMenuIndex - MENU_SCANLIST_1)) & 1); // pick the bit corresponding to the scanlist
UI_DrawToggle();
break;

case MENU_BUSY_LOCK:
Expand Down Expand Up @@ -1238,8 +1277,8 @@ void MENU_ScrollSetting(uint8_t Key)
UI_DrawSettingBandwidth();
break;

case MENU_SKIP_SCAN:
UI_DrawSettingSkipScan();
case MENU_LIST_TO_SCAN:
UI_DrawSettingScanlist(gSettingCurrentValue);
break;

case MENU_BUSY_LOCK:
Expand Down
10 changes: 9 additions & 1 deletion app/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ enum {
MENU_TX_POWER,
MENU_MODULATION,
MENU_BAND_WIDTH,
MENU_SKIP_SCAN,
MENU_LIST_TO_SCAN,
MENU_SCANLIST_1,
MENU_SCANLIST_2,
MENU_SCANLIST_3,
MENU_SCANLIST_4,
MENU_SCANLIST_5,
MENU_SCANLIST_6,
MENU_SCANLIST_7,
MENU_SCANLIST_8,
MENU_BUSY_LOCK,
MENU_SCRAMBLER,
MENU_DCS_ENCRYPT,
Expand Down
1 change: 0 additions & 1 deletion misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ uint16_t gNoToneCounter;
bool gFrequencyReverse;
bool gManualScanDirection;
bool gForceScan;
bool gScanAll;
uint8_t gSlot;
char gString[32];
char gBigString[40];
Expand Down
1 change: 0 additions & 1 deletion misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ extern uint16_t gNoToneCounter;
extern bool gFrequencyReverse;
extern bool gManualScanDirection;
extern bool gForceScan;
extern bool gScanAll;
extern uint8_t gSlot;
extern char gString[32];
extern char gBigString[40];
Expand Down
34 changes: 19 additions & 15 deletions radio/channels.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static const ChannelInfo_t VfoTemplate[2] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = "----------",
Expand All @@ -76,7 +76,7 @@ static const ChannelInfo_t VfoTemplate[2] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = "----------",
Expand Down Expand Up @@ -104,7 +104,7 @@ static const ChannelInfo_t gNoaaDefaultChannels[11] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
Expand All @@ -128,7 +128,7 @@ static const ChannelInfo_t gNoaaDefaultChannels[11] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
Expand All @@ -152,7 +152,7 @@ static const ChannelInfo_t gNoaaDefaultChannels[11] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
Expand All @@ -176,7 +176,7 @@ static const ChannelInfo_t gNoaaDefaultChannels[11] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
Expand All @@ -200,7 +200,7 @@ static const ChannelInfo_t gNoaaDefaultChannels[11] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
Expand All @@ -224,7 +224,7 @@ static const ChannelInfo_t gNoaaDefaultChannels[11] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
Expand All @@ -248,7 +248,7 @@ static const ChannelInfo_t gNoaaDefaultChannels[11] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
Expand All @@ -272,7 +272,7 @@ static const ChannelInfo_t gNoaaDefaultChannels[11] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
Expand All @@ -296,7 +296,7 @@ static const ChannelInfo_t gNoaaDefaultChannels[11] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
Expand All @@ -320,7 +320,7 @@ static const ChannelInfo_t gNoaaDefaultChannels[11] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
Expand All @@ -344,7 +344,7 @@ static const ChannelInfo_t gNoaaDefaultChannels[11] = {

._0x11 = 0x11,
.Scramble = 0x00,
._0x13 = 0xFF,
.IsInscanList = 0xFF,
._0x14 = 0xFF,
._0x15 = 0xFF,
.Name = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
Expand All @@ -354,16 +354,20 @@ static const ChannelInfo_t gNoaaDefaultChannels[11] = {

uint16_t gFreeChannelsCount;

void CHANNELS_NextChannelMr(uint8_t Key, bool OnlyScan) {
bool CHANNELS_NextChannelMr(uint8_t Key, bool OnlyFromScanlist) {
uint16_t startChannel = gSettings.VfoChNo[gSettings.CurrentVfo];
do {
if (Key == KEY_UP) {
gSettings.VfoChNo[gSettings.CurrentVfo] = CHANNELS_GetChannelUp(gSettings.VfoChNo[gSettings.CurrentVfo], gSettings.CurrentVfo);
} else {
gSettings.VfoChNo[gSettings.CurrentVfo] = CHANNELS_GetChannelDown(gSettings.VfoChNo[gSettings.CurrentVfo], gSettings.CurrentVfo);
}
} while (OnlyScan && !gVfoState[gSettings.CurrentVfo].ScanAdd);
if (gSettings.VfoChNo[gSettings.CurrentVfo] == startChannel)
return false; // empty list
} while (OnlyFromScanlist && !((gVfoState[gSettings.CurrentVfo].IsInscanList >> gExtendedSettings.CurrentScanList) & 1));
RADIO_Tune(gSettings.CurrentVfo);
UI_DrawVfo(gSettings.CurrentVfo);
return true;
}

void CHANNELS_NextChannelVfo(uint8_t Key)
Expand Down
4 changes: 2 additions & 2 deletions radio/channels.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ typedef struct __attribute__((packed)) {
// 0x11
uint8_t _0x11;
uint8_t Scramble;
uint8_t _0x13;
uint8_t IsInscanList; // 8 lists: 1 bit per list
uint8_t _0x14;
uint8_t _0x15;
char Name[10];
} ChannelInfo_t;

extern uint16_t gFreeChannelsCount;

void CHANNELS_NextChannelMr(uint8_t Key, bool OnlyScan);
bool CHANNELS_NextChannelMr(uint8_t Key, bool OnlyFromScanlist);
void CHANNELS_NextChannelVfo(uint8_t Key);
#ifdef ENABLE_NOAA
void CHANNELS_NextNOAA(uint8_t Key);
Expand Down
2 changes: 2 additions & 0 deletions radio/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "task/keyaction.h"
#include "task/scanner.h"
#include "ui/gfx.h"
#include "ui/helper.h"

Calibration_t gCalibration;
char gDeviceName[16];
Expand Down Expand Up @@ -145,6 +146,7 @@ void SETTINGS_SaveState(void)
} else {
CHANNELS_SaveChannel(gSettings.CurrentVfo ? 1000 : 999, &gVfoState[gSettings.CurrentVfo]);
}
UI_DrawScan();
}

void SETTINGS_SaveDTMF(void)
Expand Down
7 changes: 5 additions & 2 deletions radio/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,13 @@ typedef struct __attribute__((packed)) {
uint8_t AmFixEnabled: 1;
uint8_t DarkMode: 1;
uint8_t ScanBlink: 1;
uint8_t Undefined: 3; // free for use
uint8_t CurrentScanList: 3;
// 0x01 - 0x0E
uint8_t KeyShortcut[14];
// 0x0F...
// 0x0F
uint8_t ScanAll: 1;
uint8_t Undefined: 7; // free for use
// 0x10...
} gExtendedSettings_t;

extern Calibration_t gCalibration;
Expand Down
Loading

0 comments on commit 46e247a

Please sign in to comment.