Skip to content

Commit

Permalink
Update menu, fix delivery sound but ack is broken?
Browse files Browse the repository at this point in the history
  • Loading branch information
LolloDev5123 committed Jan 10, 2024
1 parent f52479b commit ea3efef
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 22 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ENABLE_CW := 1
#============ EXTRA: MESSENGER ============#
ENABLE_MESSENGER := 1
ENABLE_MESSENGER_DELIVERY_NOTIFICATION := 1
ENABLE_MESSENGER_DELIVERY_SOUND := 0
ENABLE_MESSENGER_MORE_ONE_LINE := 1
ENABLE_MESSENGER_SHOW_INVALID_FSK := 0
# 124 bytes
Expand Down Expand Up @@ -351,8 +352,8 @@ endif
ifeq ($(ENABLE_MESSENGER_DELIVERY_ACK_NOTIFICATION),1)
CFLAGS += -DENABLE_MESSENGER_DELIVERY_ACK_NOTIFICATION
endif
ifeq ($(ENABLE_MESSENGER_DELIVERY_SOUND_NOTIFICATION),1)
CFLAGS += -DENABLE_MESSENGER_DELIVERY_SOUND_NOTIFICATION
ifeq ($(ENABLE_MESSENGER_DELIVERY_SOUND),1)
CFLAGS += -DENABLE_MESSENGER_DELIVERY_SOUND
endif
ifeq ($(ENABLE_MESSENGER_MORE_ONE_LINE),1)
CFLAGS += -DENABLE_MESSENGER_MORE_ONE_LINE
Expand Down
17 changes: 4 additions & 13 deletions apps/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ void MSG_StorePacket(const uint16_t interrupt_bits)
// This delivery roger sound is supposed to play when an ACK is received,
// but it currently refuses to work?? when placed under the '+' ACK indicator code
// So, for now, it'll serve as a notification when receiving a message.
#ifdef ENABLE_MESSENGER_DELIVERY_NOTIFICATION
#ifdef ENABLE_MESSENGER_DELIVERY_SOUND
BK4819_DisableDTMF();
RADIO_SetTxParameters();
SYSTEM_DelayMs(500);
Expand All @@ -724,22 +724,13 @@ void MSG_StorePacket(const uint16_t interrupt_bits)
}


}
}

if (gAppToDisplay != APP_MESSENGER)
{
hasNewMessage = true;
gUpdateStatus = true;
gUpdateDisplay = true;
UI_DisplayStatus();
}
else
{
gUpdateDisplay = true;
}

}

gFSKWriteIndex = 0;

// Transmit a message to the sender that we have received the message (Unless it's a service message)
if (msgFSKBuffer[0] == 'M' && msgFSKBuffer[1] == 'S' && msgFSKBuffer[2] != 0x1b)
{
Expand Down
4 changes: 2 additions & 2 deletions driver/bk4819.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ void BK4819_PlayBeep(const uint16_t freq, const int delay)
BK4819_EnterTxMute();
}

#if defined(ENABLE_ROGERBEEP) || defined(ENABLE_MESSENGER_DELIVERY_SOUND_NOTIFICATION)
#if defined(ENABLE_ROGERBEEP) || defined(ENABLE_MESSENGER_DELIVERY_SOUND)
void BK4819_PlayRoger(int t)
{
BK4819_EnterTxMute();
Expand Down Expand Up @@ -1022,7 +1022,7 @@ void BK4819_PlayRoger(int t)

#endif

#ifdef ENABLE_MESSENGER_DELIVERY_SOUND_NOTIFICATION
#ifdef ENABLE_MESSENGER_DELIVERY_SOUND
case 99: // NOKIA SMS Tone2
BK4819_PlayBeep(800, 200); // Frequency and duration can be adjusted
BK4819_PlayBeep(600, 200);
Expand Down
46 changes: 41 additions & 5 deletions ui/appmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,25 @@
#include "settings.h"
#endif

#if defined(ENABLE_SPECTRUM)
#include "main/spectrum.h"
#include "functions.h"
#endif

#include "ui/scanner.h"

uint16_t APPMENU_cursor;

void APPMENU_move(bool down) {
if (down) {
if (APPMENU_cursor == 3) {
if (APPMENU_cursor == 7) {
APPMENU_cursor = 0;
} else {
APPMENU_cursor++;
}
} else {
if (APPMENU_cursor == 0) {
APPMENU_cursor = 3;
APPMENU_cursor = 7;
} else {
APPMENU_cursor--;
}
Expand All @@ -40,8 +47,8 @@ void UI_DisplayAppMenu() {
char itemName[16];
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));

const uint8_t count = 4;
const uint8_t perScreen = 4;
const uint8_t count = 8;
const uint8_t perScreen = 7;;
const uint8_t offset = Clamp(APPMENU_cursor - 2, 0, count - perScreen);
for (uint8_t i = 0; i < perScreen; ++i) {
uint8_t itemIndex = i + offset;
Expand All @@ -56,7 +63,7 @@ void UI_DisplayAppMenu() {

switch (itemIndex) {
case 0:
sprintf(itemName, "SETTINGS");
sprintf(itemName, "Settings");
break;
case 1:
sprintf(itemName, "Edit Scanlist");
Expand All @@ -65,6 +72,18 @@ void UI_DisplayAppMenu() {
sprintf(itemName, "Messenger");
break;
case 3:
sprintf(itemName, "Spectrum");
break;
case 4:
sprintf(itemName, "FM Radio");
break;
case 5:
sprintf(itemName, "Air Copy");
break;
case 6:
sprintf(itemName, "Scanner");
break;
case 7:
sprintf(itemName, "Info");
break;
default:
Expand Down Expand Up @@ -149,6 +168,23 @@ void APPMENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
#endif
#endif
case 3:
gCurrentFunction = 0;
APP_RunSpectrum();
break;
case 4:
#if defined(ENABLE_FMRADIO)
UI_DisplayFM();
#endif
break;
case 5:
#if defined(ENABLE_AIRCOPY)
UI_DisplayAircopy();
#endif
break;
case 6:
UI_DisplayScanner();
break;
case 7:
UI_DisplayWelcome();
break;
default:
Expand Down

0 comments on commit ea3efef

Please sign in to comment.