diff --git a/app/menu.c b/app/menu.c index 7355c51..dab4758 100644 --- a/app/menu.c +++ b/app/menu.c @@ -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; diff --git a/app/messenger.h b/app/messenger.h index 1413481..6855c75 100644 --- a/app/messenger.h +++ b/app/messenger.h @@ -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); diff --git a/board.c b/board.c index 1037dfa..c98906e 100644 --- a/board.c +++ b/board.c @@ -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); diff --git a/docs/UV K5 EEPROM.xlsx b/docs/UV K5 EEPROM.xlsx index 6d6b5da..c9aafa0 100644 Binary files a/docs/UV K5 EEPROM.xlsx and b/docs/UV K5 EEPROM.xlsx differ diff --git a/settings.c b/settings.c index 6ffca73..1e613d8 100644 --- a/settings.c +++ b/settings.c @@ -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)); diff --git a/settings.h b/settings.h index eb605f3..3df9354 100644 --- a/settings.h +++ b/settings.h @@ -24,6 +24,9 @@ #include #include "radio.h" #include +#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; diff --git a/ui/menu.c b/ui/menu.c index c18f1a0..cae3f24 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -115,7 +115,12 @@ const t_menu_item MenuList[] = {"Passwd", VOICE_ID_INVALID, MENU_PASSWORD }, // power on password #endif #ifdef ENABLE_ENCRYPTION - {"EncKey", VOICE_ID_INVALID, MENU_ENC_KEY }, // encryption key + {"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: diff --git a/ui/menu.h b/ui/menu.h index a4df3d6..cb79bea 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -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