From 7c3706ef635e47275a715fcfca328dd364f3a53f Mon Sep 17 00:00:00 2001 From: spm81 Date: Wed, 10 Jan 2024 00:15:49 +0000 Subject: [PATCH] ADD ENABLE_MESSENGER_MORE_ONE_LINE --- Makefile | 4 ++++ app/messenger.c | 28 +++++++++++++++++++++++++++- app/messenger.h | 4 ++++ ui/messenger.c | 15 +++++++++++++-- 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a7ec296..a7884d9 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,7 @@ ENABLE_CW := 1 #============ EXTRA: MESSENGER ============# ENABLE_MESSENGER := 1 ENABLE_MESSENGER_DELIVERY_NOTIFICATION := 1 +ENABLE_MESSENGER_MORE_ONE_LINE := 1 # 124 bytes ENABLE_MESSENGER_SHOW_RX_FREQ := 1 # 124 (+20) bytes @@ -350,6 +351,9 @@ endif ifeq ($(ENABLE_MESSENGER_DELIVERY_NOTIFICATION),1) CFLAGS += -DENABLE_MESSENGER_DELIVERY_NOTIFICATION endif +ifeq ($(ENABLE_MESSENGER_MORE_ONE_LINE),1) + CFLAGS += -DENABLE_MESSENGER_MORE_ONE_LINE +endif ifeq ($(ENABLE_MESSENGER_SHOW_RX_FREQ),1) CFLAGS += -DENABLE_MESSENGER_SHOW_RX_FREQ endif diff --git a/app/messenger.c b/app/messenger.c index e5c9530..9fc4158 100644 --- a/app/messenger.c +++ b/app/messenger.c @@ -36,7 +36,11 @@ char cMessage[TX_MSG_LENGTH]; char msgFreqInfo[30]; #endif char lastcMessage[TX_MSG_LENGTH]; +#ifdef defined(ENABLE_MESSENGER_MORE_ONE_LINE) char rxMessage[5][TX_MSG_LENGTH + 3]; +#else +char rxMessage[4][TX_MSG_LENGTH + 3]; +#endif unsigned char cIndex = 0; unsigned char prevKey = 0, prevLetter = 0; KeyboardType keyboardType = UPPERCASE; @@ -540,10 +544,16 @@ void moveUP(char (*rxMessages)[TX_MSG_LENGTH + 3]) strcpy(rxMessages[0], rxMessages[1]); strcpy(rxMessages[1], rxMessages[2]); strcpy(rxMessages[2], rxMessages[3]); +#ifdef defined(ENABLE_MESSENGER_MORE_ONE_LINE) strcpy(rxMessages[3], rxMessages[4]); +#endif // Insert the new line at the last position +#ifdef defined(ENABLE_MESSENGER_MORE_ONE_LINE) memset(rxMessages[4], 0, sizeof(rxMessages[4])); +#else + memset(rxMessages[3], 0, sizeof(rxMessages[3])); +#endif } void MSG_Send(const char txMessage[TX_MSG_LENGTH], bool bServiceMessage) @@ -584,7 +594,11 @@ void MSG_Send(const char txMessage[TX_MSG_LENGTH], bool bServiceMessage) if (!bServiceMessage) { moveUP(rxMessage); +#ifdef defined(ENABLE_MESSENGER_MORE_ONE_LINE) sprintf(rxMessage[4], "> %s", txMessage); +#else + sprintf(rxMessage[3], "> %s", txMessage); +#endif memset(lastcMessage, 0, sizeof(lastcMessage)); memcpy(lastcMessage, txMessage, TX_MSG_LENGTH); cIndex = 0; @@ -654,7 +668,11 @@ void MSG_StorePacket(const uint16_t interrupt_bits) if (msgFSKBuffer[5] == 'R' && msgFSKBuffer[6] == 'C' && msgFSKBuffer[7] == 'V' && msgFSKBuffer[8] == 'D') { UART_printf("SVC