Skip to content

Commit

Permalink
ADD ENABLE_MESSENGER_MORE_ONE_LINE
Browse files Browse the repository at this point in the history
  • Loading branch information
spm81 committed Jan 10, 2024
1 parent ba14538 commit 7c3706e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
4 changes: 4 additions & 0 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_MORE_ONE_LINE := 1
# 124 bytes
ENABLE_MESSENGER_SHOW_RX_FREQ := 1
# 124 (+20) bytes
Expand Down Expand Up @@ -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
Expand Down
28 changes: 27 additions & 1 deletion app/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<RCPT\r\n");
#ifdef defined(ENABLE_MESSENGER_MORE_ONE_LINE)
rxMessage[4][0] = '+';
#else
rxMessage[3][0] = '+';
#endif
gUpdateStatus = true;
gUpdateDisplay = true;
}
Expand All @@ -665,13 +683,21 @@ void MSG_StorePacket(const uint16_t interrupt_bits)
moveUP(rxMessage);
if (msgFSKBuffer[0] != 'M' || msgFSKBuffer[1] != 'S')
{
#ifdef defined(ENABLE_MESSENGER_MORE_ONE_LINE)
snprintf(rxMessage[4], TX_MSG_LENGTH + 2, "? unknown msg format!");
}
else
{
snprintf(rxMessage[4], TX_MSG_LENGTH + 2, "< %s", &msgFSKBuffer[2]);
}

#else
snprintf(rxMessage[3], TX_MSG_LENGTH + 2, "? unknown msg format!");
}
else
{
snprintf(rxMessage[3], TX_MSG_LENGTH + 2, "< %s", &msgFSKBuffer[2]);
}
#endif
#ifdef ENABLE_MESSENGER_UART
UART_printf("SMS<%s\r\n", &msgFSKBuffer[2]);
#endif
Expand Down
4 changes: 4 additions & 0 deletions app/messenger.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ typedef enum MsgStatus

extern KeyboardType keyboardType;
extern char cMessage[TX_MSG_LENGTH];
#ifdef defined(ENABLE_MESSENGER_MORE_ONE_LINE)
extern char rxMessage[5][TX_MSG_LENGTH + 3];
#else
extern char rxMessage[4][TX_MSG_LENGTH + 3];
#endif
#if defined(ENABLE_MESSENGER_SHOW_RX_FREQ) || defined(ENABLE_MESSENGER_SHOW_RX_TX_FREQ)
extern char msgFreqInfo[30];
#endif
Expand Down
15 changes: 13 additions & 2 deletions ui/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ void UI_DisplayMSG(void) {

memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
memset(String, 0, sizeof(String));

#ifdef defined(ENABLE_MESSENGER_MORE_ONE_LINE)
//UI_PrintStringSmallBold("MESSENGER", 0, 127, 0);
//UI_PrintStringSmall("Messenger", 1, 127, 0);

//UI_DrawDottedLineBuffer(gFrameBuffer, 2, 3, 26, 3, true, 2);
//UI_DrawDottedLineBuffer(gFrameBuffer, 100, 3, 126, 3, true, 2);
#else
UI_PrintStringSmallBold("MESSENGER", 0, 127, 0);
//UI_PrintStringSmall("Messenger", 1, 127, 0);

UI_DrawDottedLineBuffer(gFrameBuffer, 2, 3, 26, 3, true, 2);
UI_DrawDottedLineBuffer(gFrameBuffer, 100, 3, 126, 3, true, 2);
#endif
/*if ( msgStatus == SENDING ) {
GUI_DisplaySmallest("SENDING", 100, 6, false, true);
} else if ( msgStatus == RECEIVING ) {
Expand All @@ -40,10 +46,15 @@ void UI_DisplayMSG(void) {
//GUI_DisplaySmallest("RX", 4, 34, false, true);

memset(String, 0, sizeof(String));
#ifdef defined(ENABLE_MESSENGER_MORE_ONE_LINE)
uint8_t mPos = 1;//8;
const uint8_t mLine = 7;
for (int i = 0; i < 5; ++i) {
#else
uint8_t mPos = 8;
const uint8_t mLine = 7;
for (int i = 0; i < 4; ++i) {
#endif
sprintf(String, "%s", rxMessage[i]);
GUI_DisplaySmallest(String, 2, mPos, false, true);
mPos += mLine;
Expand Down

0 comments on commit 7c3706e

Please sign in to comment.