Skip to content

Commit

Permalink
Adding ENABLE_SCANLIST
Browse files Browse the repository at this point in the history
  • Loading branch information
spm81 committed Feb 21, 2024
1 parent 6d1d928 commit 4af4a8a
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 15 deletions.
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ ENABLE_AM_FIX_ON_SPECTRUM := 1
ENABLE_SQUELCH_MORE_SENSITIVE := 0
# Restore FM in 1 second after RX - 0 bytes
ENABLE_FMRADIO_FAST_RESTORE := 1

ENABLE_SCANLIST := 0

# Battery percentage - 296 bytes
ENABLE_STATUS_BATTERY_PERC := 1
# Show current while charging - 136 bytes Thanks Tunas1337
Expand Down Expand Up @@ -179,10 +182,13 @@ endif
ifeq ($(ENABLE_SPECTRUM_NUNU), 1)
OBJS += app/spectrumnunu.o
endif

ifeq ($(ENABLE_UART),1)
OBJS += app/uart.o
endif
ifeq ($(ENABLE_SCANLIST),1)
OBJS += apps/scanlist.o
endif

OBJS += audio.o
OBJS += bitmaps.o
OBJS += board.o
Expand Down Expand Up @@ -225,7 +231,6 @@ OBJS += ui/scanner.o
OBJS += ui/status.o
OBJS += ui/ui.o
OBJS += ui/welcome.o
OBJS += apps/scanlist.o
OBJS += version.o
OBJS += main.o

Expand Down Expand Up @@ -358,6 +363,10 @@ endif
ifeq ($(ENABLE_UART),1)
CFLAGS += -DENABLE_UART
endif
ifeq ($(ENABLE_SCANLIST),1)
CFLAGS += -DENABLE_SCANLIST
endif

LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
##LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld,--gc-sections
LDFLAGS += --specs=nano.specs
Expand Down
4 changes: 4 additions & 0 deletions app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
#ifdef ENABLE_MESSENGER_ENCRYPTION
#include "helper/crypto.h"
#endif
#ifdef ENABLE_SCANLIST
#include "../apps/scanlist.h"
#endif
#include "ARMCM0.h"
#include "audio.h"
#include "board.h"
Expand Down Expand Up @@ -1670,9 +1672,11 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {

if (gAppToDisplay) {
switch (gAppToDisplay) {
#ifdef ENABLE_SCANLIST
case APP_SCANLIST:
SCANLIST_key(Key, bKeyPressed, bKeyHeld);
break;
#endif
#ifdef ENABLE_MESSENGER
case APP_MESSENGER:
MSG_ProcessKeys(Key, bKeyPressed, bKeyHeld);
Expand Down
50 changes: 47 additions & 3 deletions app/appmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ void APPMENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
UI_DisplayWelcome();
//gRequestDisplayScreen = DISPLAY_MAIN;
break;

#ifdef ENABLE_SCANLIST
case KEY_1:
gAppToDisplay = APP_SCANLIST;
gRequestDisplayScreen = DISPLAY_MAIN;
break;
#ifdef ENABLE_MESSENGER
#endif
#if defined (ENABLE_MESSENGER) && defined (ENABLE_SCANLIST)
#if defined (ENABLE_MESSENGER_SHOW_RX_FREQ) && !defined (ENABLE_MESSENGER_SHOW_RX_TX_FREQ)
case KEY_2:
hasNewMessage = false;
Expand Down Expand Up @@ -67,13 +68,56 @@ void APPMENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
break;
#endif
#endif

#if defined (ENABLE_MESSENGER) && !defined (ENABLE_SCANLIST)
#if defined (ENABLE_MESSENGER_SHOW_RX_FREQ) && !defined (ENABLE_MESSENGER_SHOW_RX_TX_FREQ)
case KEY_1:
hasNewMessage = false;
uint32_t frequency = gEeprom.VfoInfo[gEeprom.TX_CHANNEL].pTX->Frequency;
if ( IsTXAllowed(gEeprom.VfoInfo[gEeprom.TX_CHANNEL].pTX->Frequency) ) {
frequency = GetScreenF(frequency);
sprintf(msgFreqInfo, "%u.%05u Mhz", frequency / 100000, frequency % 100000);
} else {
sprintf(msgFreqInfo, "TX DISABLE");
}
gUpdateStatus = true;
gAppToDisplay = APP_MESSENGER;
gRequestDisplayScreen = DISPLAY_MAIN;
break;
#elif defined (ENABLE_MESSENGER_SHOW_RX_TX_FREQ) && !defined (ENABLE_MESSENGER_SHOW_RX_FREQ) || defined (ENABLE_MESSENGER_SHOW_RX_TX_FREQ) && defined (ENABLE_MESSENGER_SHOW_RX_FREQ)
case KEY_1:
hasNewMessage = false;
uint32_t txFrequency = gEeprom.VfoInfo[gEeprom.TX_CHANNEL].pTX->Frequency;
uint32_t rxFrequency = gEeprom.VfoInfo[gEeprom.RX_CHANNEL].pRX->Frequency;

if (IsTXAllowed(txFrequency)) {
txFrequency = GetScreenF(txFrequency);
rxFrequency = GetScreenF(rxFrequency);
sprintf(msgFreqInfo, "R:%u.%05u T:%u.%05u Mhz", rxFrequency / 100000, rxFrequency % 100000, txFrequency / 100000, txFrequency % 100000);
} else {
sprintf(msgFreqInfo, "TX DISABLE");
}

gUpdateStatus = true;
gAppToDisplay = APP_MESSENGER;
gRequestDisplayScreen = DISPLAY_MAIN;
break;
#else
case KEY_1:
hasNewMessage = false;
gUpdateStatus = true;
gAppToDisplay = APP_MESSENGER;
gRequestDisplayScreen = DISPLAY_MAIN;
break;
#endif
#endif
/*
case KEY_1:
gAppToDisplay = APP_SPLIT;
gRequestDisplayScreen = DISPLAY_MAIN;
break;
case KEY_2:
gAppToDisplay = APP_OOK;
1 gAppToDisplay = APP_OOK;
gRequestDisplayScreen = DISPLAY_MAIN;
break;
*/
Expand Down
22 changes: 15 additions & 7 deletions ui/appmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,27 @@ void UI_DisplayAppMenu() {

// UI_PrintStringSmallest(" Press MENU to enter Menu", 0, 1, false, true);
// UI_PrintString("APP MENU", 0, 127, 0, 9, true);
#ifdef ENABLE_MESSENGER
UI_PrintStringSmallest("M. MENU 0. Info", 0, 10, false, true);
#if defined(ENABLE_MESSENGER) || defined(ENABLE_SCANLIST)
UI_PrintStringSmallest("M. MENU 0. Info", 0, 10, false, true);
#else
UI_PrintStringSmallest("M. MENU", 0, 10, false, true);
UI_PrintStringSmallest("M. MENU", 0, 10, false, true);
#endif


#if defined(ENABLE_MESSENGER) && defined(ENABLE_SCANLIST) || defined(ENABLE_SCANLIST)
UI_PrintStringSmallest("1. Edit Scanlist", 0, 19, false, true);
#endif

#ifdef ENABLE_MESSENGER
UI_PrintStringSmallest("2. Messenger", 0, 28, false, true);
#else
UI_PrintStringSmallest("0. Info", 0, 28, false, true);
#if defined(ENABLE_MESSENGER)
#if defined(ENABLE_SCANLIST)
UI_PrintStringSmallest("2. Messenger", 0, 28, false, true);
#else
UI_PrintStringSmallest("1. Messenger", 0, 19, false, true);
#endif
#else
UI_PrintStringSmallest("0. Info", 0, 28, false, true);
#endif

ST7565_BlitFullScreen();

gUpdateDisplay = true;
Expand Down
21 changes: 19 additions & 2 deletions ui/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
#include "ui/menu.h"
#include "ui/scanner.h"
#include "ui/ui.h"
#ifdef ENABLE_SCANLIST
#include "../apps/scanlist.h"

#endif
GUI_DisplayType_t gScreenToDisplay;
GUI_DisplayType_t gRequestDisplayScreen = DISPLAY_INVALID;

Expand All @@ -51,9 +52,11 @@ void UI_DisplayApp(void) {
case APP_NONE:
// TODO: maybe more vfo info
break;
#ifdef ENABLE_SCANLIST
case APP_SCANLIST:
SCANLIST_render();
break;
#endif
#ifdef ENABLE_MESSENGER
case APP_MESSENGER:
UI_DisplayMSG();
Expand All @@ -67,10 +70,24 @@ void UI_DisplayApp(void) {
void GUI_DisplayScreen(void) {
switch (gScreenToDisplay) {
case DISPLAY_MAIN:
#if defined (ENABLE_SCANLIST) && defined (ENABLE_MESSENGER)
if (gAppToDisplay != APP_SCANLIST && gAppToDisplay != APP_MESSENGER) {
UI_DisplayMain();
}

#endif
#if !defined (ENABLE_SCANLIST) && defined (ENABLE_MESSENGER)
if (gAppToDisplay != APP_MESSENGER) {
UI_DisplayMain();
}
#endif
#if defined (ENABLE_SCANLIST) && !defined (ENABLE_MESSENGER)
if (gAppToDisplay != APP_SCANLIST && gAppToDisplay) {
UI_DisplayMain();
}
#else
UI_DisplayMain();

#endif
UI_DisplayApp();
break;
#if defined(ENABLE_FMRADIO)
Expand Down
4 changes: 4 additions & 0 deletions ui/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ typedef enum GUI_DisplayType_t {

typedef enum GUI_AppType_t {
APP_NONE,
#ifdef ENABLE_SCANLIST
APP_SCANLIST,
#endif
#ifdef ENABLE_MESSENGER
APP_MESSENGER
#endif
// APP_SPLIT,
// APP_OOK,

Expand Down
2 changes: 1 addition & 1 deletion ui/welcome.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void UI_DisplayWelcome(void) {
}
UI_PrintString(WelcomeString0, 0, 127, 1, 10, true);
UI_PrintString(WelcomeString1, 0, 127, 3, 10, true);
UI_PrintStringSmall(Version, 0, 140, 5);
UI_PrintStringSmall(Version, 0, 127, 5);
UI_PrintStringSmallest(__DATE__ " " __TIME__, 24, 50, false, true);

ST7565_BlitStatusLine();
Expand Down

0 comments on commit 4af4a8a

Please sign in to comment.