messenger rx, enc, ack menu options

This commit is contained in:
Nunu 2024-02-03 12:12:10 +01:00
parent c77ab4c289
commit 54ca645c20
8 changed files with 103 additions and 1 deletions

View File

@ -245,6 +245,13 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
case MENU_500TX:
case MENU_350EN:
case MENU_SCREN:
#ifdef ENABLE_ENCRYPTION
case MENU_MSG_ENC:
#endif
#ifdef ENABLE_MESSENGER
case MENU_MSG_RX:
case MENU_MSG_ACK:
#endif
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
break;
@ -487,6 +494,20 @@ void MENU_AcceptSetting(void)
memset(edit, 0, sizeof(edit));
gUpdateStatus = true;
break;
case MENU_MSG_ENC:
gEeprom.MESSENGER_CONFIG.data.encrypt = gSubMenuSelection;
break;
#endif
#ifdef ENABLE_MESSENGER
case MENU_MSG_RX:
gEeprom.MESSENGER_CONFIG.data.receive = gSubMenuSelection;
break;
case MENU_MSG_ACK:
gEeprom.MESSENGER_CONFIG.data.ack = gSubMenuSelection;
break;
#endif
case MENU_W_N:
@ -916,6 +937,22 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gEeprom.RX_OFFSET;
break;
#ifdef ENABLE_ENCRYPTION
case MENU_MSG_ENC:
gSubMenuSelection = gEeprom.MESSENGER_CONFIG.data.encrypt;
break;
#endif
#ifdef ENABLE_MESSENGER
case MENU_MSG_RX:
gSubMenuSelection = gEeprom.MESSENGER_CONFIG.data.receive;
break;
case MENU_MSG_ACK:
gSubMenuSelection = gEeprom.MESSENGER_CONFIG.data.ack;
break;
#endif
#ifdef ENABLE_PWRON_PASSWORD
case MENU_PASSWORD:
gSubMenuSelection = gEeprom.POWER_ON_PASSWORD;

View File

@ -40,6 +40,22 @@ typedef enum PacketType {
INVALID_PACKET
} PacketType;
// Modem Modulation // 2024 kamilsss655
typedef enum ModemModulation {
MOD_FSK,
MOD_AFSK,
MOD_NOAA_SAME
} ModemModulation;
// Modem Baud Rate // 2024 kamilsss655
// lower baud provides better reliability in bad conditions
typedef enum ModemBaudRate {
MOD_BAUD_1200,
MOD_BAUD_300,
MOD_BAUD_200,
MOD_BAUD_100
} ModemBaudRate;
// Data Packet definition // 2024 kamilsss655
union DataPacket
{
@ -53,6 +69,19 @@ union DataPacket
uint8_t serializedArray[1+PAYLOAD_LENGTH+NONCE_LENGTH];
};
// MessengerConfig // 2024 kamilsss655
typedef union {
struct {
uint8_t
receive :1, // determines whether fsk modem will listen for new messages
ack :1, // determines whether the radio will automatically respond to messages with ACK
encrypt :1, // determines whether outgoing messages will be encrypted
unused :1,
modulation :2, // determines FSK modulation type
baud :2; // determines FSK baud rate
} data;
uint8_t __val;
} MessengerConfig;
void MSG_EnableRX(const bool enable);
void MSG_StorePacket(const uint16_t interrupt_bits);

View File

@ -593,6 +593,9 @@ void BOARD_EEPROM_Init(void)
#ifdef ENABLE_PWRON_PASSWORD
gEeprom.PASSWORD_WRONG_ATTEMPTS = (Data[2] > PASSWORD_MAX_RETRIES) ? PASSWORD_MAX_RETRIES : Data[2];
#endif
#ifdef ENABLE_MESSENGER
gEeprom.MESSENGER_CONFIG.__val = Data[3];
#endif
// 0EA8..0EAF
EEPROM_ReadBuffer(0x0EA8, Data, 8);

Binary file not shown.

View File

@ -112,6 +112,9 @@ void SETTINGS_SaveSettings(void)
#endif
State[1] = gEeprom.RX_AGC;
State[2] = gEeprom.PASSWORD_WRONG_ATTEMPTS;
#ifdef ENABLE_MESSENGER
State[3] = gEeprom.MESSENGER_CONFIG.__val;
#endif
EEPROM_WriteBuffer(0x0EA0, State, true);
memset(State, 0xFF, sizeof(State));

View File

@ -24,6 +24,9 @@
#include <helper/battery.h>
#include "radio.h"
#include <driver/backlight.h>
#ifdef ENABLE_MESSENGER
#include "app/messenger.h"
#endif
enum POWER_OnDisplayMode_t {
POWER_ON_DISPLAY_MODE_FULL_SCREEN = 0,
@ -242,6 +245,9 @@ typedef struct {
#endif
#ifdef ENABLE_ENCRYPTION
char ENC_KEY[16];
#endif
#ifdef ENABLE_MESSENGER
MessengerConfig MESSENGER_CONFIG;
#endif
uint16_t VOX1_THRESHOLD;
uint16_t VOX0_THRESHOLD;

View File

@ -116,6 +116,11 @@ const t_menu_item MenuList[] =
#endif
#ifdef ENABLE_ENCRYPTION
{"EncKey", VOICE_ID_INVALID, MENU_ENC_KEY }, // encryption key
{"MsgEnc", VOICE_ID_INVALID, MENU_MSG_ENC }, // messenger encrypt outgoing messages
#endif
#ifdef ENABLE_MESSENGER
{"MsgRx", VOICE_ID_INVALID, MENU_MSG_RX }, // messenger rx
{"MsgAck", VOICE_ID_INVALID, MENU_MSG_ACK }, // messenger respond ACK
#endif
{"Sql", VOICE_ID_SQUELCH, MENU_SQL },
// hidden menu items from here on
@ -753,6 +758,20 @@ void UI_DisplayMenu(void)
already_printed = true;
break;
}
case MENU_MSG_ENC:
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
break;
#endif
#ifdef ENABLE_MESSENGER
case MENU_MSG_RX:
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
break;
case MENU_MSG_ACK:
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
break;
#endif
case MENU_SAVE:

View File

@ -64,6 +64,11 @@ enum
#endif
#ifdef ENABLE_ENCRYPTION
MENU_ENC_KEY,
MENU_MSG_ENC,
#endif
#ifdef ENABLE_MESSENGER
MENU_MSG_RX,
MENU_MSG_ACK,
#endif
MENU_BEEP,
#ifdef ENABLE_VOICE