This commit is contained in:
54
ui/main.c
54
ui/main.c
@@ -167,9 +167,7 @@ void UI_DisplayAudioBar(void) {
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
||||
gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
|
||||
) {
|
||||
return; // screen is in use
|
||||
}
|
||||
@@ -269,9 +267,6 @@ void DisplayRSSIBar(const bool now) {
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT ||
|
||||
gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
return; // display is in use
|
||||
|
||||
@@ -433,6 +428,7 @@ void UI_DisplayMain(void) {
|
||||
// clear the screen
|
||||
UI_DisplayClear();
|
||||
|
||||
|
||||
if (gLowBattery && !gLowBatteryConfirmed) {
|
||||
UI_DisplayPopup("LOW BAT");
|
||||
ST7565_BlitFullScreen();
|
||||
@@ -550,41 +546,9 @@ void UI_DisplayMain(void) {
|
||||
#endif
|
||||
|
||||
if (gDTMF_InputMode
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx
|
||||
#endif
|
||||
) {
|
||||
char *pPrintStr = "";
|
||||
// show DTMF stuff
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
char Contact[16];
|
||||
if (!gDTMF_InputMode) {
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT) {
|
||||
pPrintStr = DTMF_FindContact(gDTMF_String, Contact) ? Contact : gDTMF_String;
|
||||
} else if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY) {
|
||||
pPrintStr = DTMF_FindContact(gDTMF_Callee, Contact) ? Contact : gDTMF_Callee;
|
||||
} else if (gDTMF_IsTx) {
|
||||
pPrintStr = gDTMF_String;
|
||||
}
|
||||
}
|
||||
|
||||
UI_PrintString(pPrintStr, 2, 0, 2 + (vfo_num * 3) /*, 8 */);
|
||||
|
||||
pPrintStr = "";
|
||||
if (!gDTMF_InputMode) {
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT) {
|
||||
pPrintStr = (gDTMF_State == DTMF_STATE_CALL_OUT_RSP) ? "CALL OUT(RSP)" : "CALL OUT";
|
||||
} else if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
||||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY) {
|
||||
sprintf(String, "CALL FRM:%s",
|
||||
(DTMF_FindContact(gDTMF_Caller, Contact)) ? Contact : gDTMF_Caller);
|
||||
pPrintStr = String;
|
||||
} else if (gDTMF_IsTx) {
|
||||
pPrintStr = (gDTMF_State == DTMF_STATE_TX_SUCC) ? "DTMF TX(SUCC)" : "DTMF TX";
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
sprintf(String, ">%s", gDTMF_InputBox);
|
||||
pPrintStr = String;
|
||||
@@ -1032,11 +996,6 @@ void UI_DisplayMain(void) {
|
||||
UI_PrintStringSmallNormal("N", LCD_WIDTH + 70, 0, line + 1);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
// show the DTMF decoding symbol
|
||||
if (vfoInfo->DTMF_DECODING_ENABLE)
|
||||
UI_PrintStringSmallNormal("DTMF", LCD_WIDTH + 78, 0, line + 1);
|
||||
#endif
|
||||
|
||||
// show the audio scramble symbol
|
||||
if (vfoInfo->SCRAMBLING_TYPE > 0) {
|
||||
@@ -1077,9 +1036,6 @@ void UI_DisplayMain(void) {
|
||||
if (rx && gEeprom.VfoInfo[gEeprom.RX_VFO].Modulation == MODULATION_AM && gSetting_AM_fix)
|
||||
{
|
||||
if (gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
return;
|
||||
|
||||
@@ -1103,9 +1059,6 @@ void UI_DisplayMain(void) {
|
||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
return;
|
||||
|
||||
@@ -1144,9 +1097,6 @@ void UI_DisplayMain(void) {
|
||||
else if (gChargingWithTypeC)
|
||||
{ // charging .. show the battery state
|
||||
if (gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
return;
|
||||
|
||||
|
||||
67
ui/menu.c
67
ui/menu.c
@@ -101,23 +101,13 @@ const t_menu_item MenuList[] =
|
||||
{"1 Call", MENU_1_CALL},
|
||||
#ifdef ENABLE_ALARM
|
||||
{"AlarmT", MENU_AL_MOD},
|
||||
#endif
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
{"ANI ID", MENU_ANI_ID },
|
||||
#endif
|
||||
{"UPCode", MENU_UPCODE},
|
||||
{"DNCode", MENU_DWCODE},
|
||||
{"PTT ID", MENU_PTT_ID},
|
||||
{"L DTMF", MENU_D_ST},
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
{"D Resp", MENU_D_RSP },
|
||||
{"D Hold", MENU_D_HOLD },
|
||||
#endif
|
||||
{"D Prel", MENU_D_PRE},
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
{"D Decd", MENU_D_DCD },
|
||||
{"D List", MENU_D_LIST },
|
||||
#endif
|
||||
|
||||
{"D Live", MENU_D_LIVE_DEC}, // live DTMF decoder
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
#ifdef ENABLE_AM_FIX
|
||||
@@ -225,16 +215,6 @@ const char gSubMenu_AL_MOD[][5] =
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
const char gSubMenu_D_RSP[][11] =
|
||||
{
|
||||
"DO\nNOTHING",
|
||||
"RING",
|
||||
"REPLY",
|
||||
"BOTH"
|
||||
};
|
||||
#endif
|
||||
|
||||
const char *const gSubMenu_PTT_ID[] =
|
||||
{
|
||||
"OFF",
|
||||
@@ -244,13 +224,14 @@ const char *const gSubMenu_PTT_ID[] =
|
||||
"APOLLO"
|
||||
};
|
||||
|
||||
const char gSubMenu_FSKMod[][8] =
|
||||
const char gSubMenu_FSKMod[][6] =
|
||||
{
|
||||
"450",
|
||||
"700",
|
||||
"1200",
|
||||
"2400",
|
||||
"A1200",
|
||||
"A2400",
|
||||
"2400",
|
||||
"NOAA"
|
||||
};
|
||||
|
||||
@@ -394,9 +375,6 @@ void UI_DisplayMenu(void) {
|
||||
unsigned int i;
|
||||
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
char Contact[16];
|
||||
#endif
|
||||
|
||||
UI_DisplayClear();
|
||||
|
||||
@@ -657,9 +635,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
case MENU_S_ADD3:
|
||||
case MENU_STE:
|
||||
case MENU_D_ST:
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_DCD:
|
||||
#endif
|
||||
case MENU_D_LIVE_DEC:
|
||||
#ifdef ENABLE_NOAA
|
||||
case MENU_NOAA_S:
|
||||
@@ -781,11 +756,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_ANI_ID:
|
||||
strcpy(String, gEeprom.ANI_DTMF_ID);
|
||||
break;
|
||||
#endif
|
||||
case MENU_UPCODE:
|
||||
sprintf(String, "%.8s\n%.8s", gEeprom.DTMF_UP_CODE, gEeprom.DTMF_UP_CODE + 8);
|
||||
break;
|
||||
@@ -794,15 +764,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
sprintf(String, "%.8s\n%.8s", gEeprom.DTMF_DOWN_CODE, gEeprom.DTMF_DOWN_CODE + 8);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_RSP:
|
||||
strcpy(String, gSubMenu_D_RSP[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_D_HOLD:
|
||||
sprintf(String, "%lds", gSubMenuSelection);
|
||||
break;
|
||||
#endif
|
||||
case MENU_D_PRE:
|
||||
sprintf(String, "%ld*10ms", gSubMenuSelection);
|
||||
break;
|
||||
@@ -815,15 +776,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
strcpy(String, gSubMenu_BAT_TXT[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
case MENU_D_LIST:
|
||||
gIsDtmfContactValid = DTMF_GetContact((int)gSubMenuSelection - 1, Contact);
|
||||
if (!gIsDtmfContactValid)
|
||||
strcpy(String, "NULL");
|
||||
else
|
||||
memcpy(String, Contact, 8);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_FSKMOD:
|
||||
strcpy(String, gSubMenu_FSKMod[gSubMenuSelection]);
|
||||
@@ -1030,22 +982,11 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gCssBackgroundScan)
|
||||
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4 /*, 8 */);
|
||||
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid) {
|
||||
Contact[11] = 0;
|
||||
memcpy(&gDTMF_ID, Contact + 8, 4);
|
||||
sprintf(String, "ID:%4s", gDTMF_ID);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 /*, 8 */);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_R_CTCS ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_T_CTCS ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_R_DCS ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_T_DCS
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| UI_MENU_GetCurrentMenuId() == MENU_D_LIST
|
||||
#endif
|
||||
) {
|
||||
sprintf(String, "%2ld", gSubMenuSelection);
|
||||
UI_PrintStringSmallNormal(String, 105, 0, 0);
|
||||
|
||||
16
ui/menu.h
16
ui/menu.h
@@ -74,23 +74,12 @@ enum {
|
||||
MENU_SLIST3,
|
||||
#ifdef ENABLE_ALARM
|
||||
MENU_AL_MOD,
|
||||
#endif
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
MENU_ANI_ID,
|
||||
#endif
|
||||
MENU_UPCODE,
|
||||
MENU_DWCODE,
|
||||
MENU_PTT_ID,
|
||||
MENU_D_ST,
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
MENU_D_RSP,
|
||||
MENU_D_HOLD,
|
||||
#endif
|
||||
MENU_D_PRE,
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
MENU_D_DCD,
|
||||
MENU_D_LIST,
|
||||
#endif
|
||||
MENU_D_LIVE_DEC,
|
||||
MENU_FSKSRC,
|
||||
MENU_FSKMOD,
|
||||
@@ -149,16 +138,13 @@ extern const char *const gSubMenu_MDF[4];
|
||||
#ifdef ENABLE_ALARM
|
||||
extern const char gSubMenu_AL_MOD[2][5];
|
||||
#endif
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
extern const char gSubMenu_D_RSP[4][11];
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
extern const char gSubMenu_SET_PTT[2][4];
|
||||
#endif
|
||||
|
||||
extern const char *const gSubMenu_PTT_ID[5];
|
||||
extern const char gSubMenu_FSKMod[6][8];
|
||||
extern const char gSubMenu_FSKMod[7][6];
|
||||
extern const char gSubMenu_ROGER[3][6];
|
||||
extern const char gSubMenu_RESET[2][4];
|
||||
extern const char *const gSubMenu_F_LOCK[F_LOCK_LEN];
|
||||
|
||||
111
ui/messages.c
111
ui/messages.c
@@ -38,84 +38,47 @@ void UI_DisplayMessages(void) {
|
||||
6);
|
||||
}
|
||||
} else {
|
||||
uint8_t Data[8];
|
||||
EEPROM_ReadBuffer(SEQParameterEEPROM, Data, 8);
|
||||
uint8_t msgIndex = Data[1]; // index of latest written message
|
||||
|
||||
// Determine oldest message index (next to be overwritten)
|
||||
uint8_t startIndex = (msgIndex + 1) % MESSAGES_COUNT;
|
||||
|
||||
String[0] = 'M';
|
||||
String[1] = 'S';
|
||||
String[2] = 'G';
|
||||
String[3] = ' ';
|
||||
// Each bank shows 3 messages
|
||||
uint8_t messagesPerPage = 3;
|
||||
|
||||
for (size_t i = 8; i < 14; i++) {
|
||||
String[i] = ' ';
|
||||
// Compute offset for scrolling (0 = newest, higher = older)
|
||||
uint8_t pageOffset = gActiveMessageBank * messagesPerPage;
|
||||
|
||||
for (uint8_t ixa = 0; ixa < messagesPerPage; ixa++) {
|
||||
// Logical order from oldest to newest
|
||||
uint8_t logicalIndex = (startIndex + pageOffset + ixa) % MESSAGES_COUNT;
|
||||
|
||||
// If out of stored range, stop
|
||||
if (pageOffset + ixa >= MESSAGES_COUNT)
|
||||
break;
|
||||
|
||||
gActiveMessage = logicalIndex;
|
||||
MESSAGES_GET();
|
||||
|
||||
// Build the display string
|
||||
u32_to_str(gActiveMessage == MESSAGES_COUNT ? dataPacket.dest : loadedPacket.src, &String[0]);
|
||||
String[10] = '-';
|
||||
u8_to_str(loadedPacket.seq, &String[11]);
|
||||
String[14] = '-';
|
||||
|
||||
// Display a visual index (0,1,2,3... not EEPROM slot)
|
||||
uint8_t visualIndex = ixa + (gActiveMessageBank * 3);
|
||||
String[15] = (visualIndex < 10) ? ('0' + visualIndex) : ('A' + visualIndex - 10);
|
||||
String[16] = '-';
|
||||
String[17] = (gActiveMessage < 10) ? ('0' + gActiveMessage) : ('A' + gActiveMessage - 10);
|
||||
String[18] = 0;
|
||||
|
||||
// Print both metadata and message
|
||||
UI_PrintString(String, 2, 0, ixa * 2);
|
||||
UI_PrintString((const char *) loadedPacket.data, 2, 0, ixa * 2 + 1);
|
||||
}
|
||||
|
||||
String[4] = 'F';
|
||||
String[5] = 'l';
|
||||
String[6] = 'g';
|
||||
String[7] = 's';
|
||||
String[8] = ':';
|
||||
String[9] = ' ';
|
||||
u8_to_str(loadedPacket.flags, &String[10]); // Write at offset 7
|
||||
|
||||
String[13] = ' ';
|
||||
if (gActiveMessage == MESSAGES_COUNT) {
|
||||
String[14] = 'T';
|
||||
} else {
|
||||
String[14] = '0' + gActiveMessage;
|
||||
}
|
||||
String[15] = '/';
|
||||
String[16] = '0' + MESSAGES_COUNT;
|
||||
String[17] = 0;
|
||||
|
||||
UI_PrintString(String, 2, 0, 0 /*, 8 */);
|
||||
|
||||
String[5] = ' ';
|
||||
if (gActiveMessage == MESSAGES_COUNT) {
|
||||
String[0] = 'T';
|
||||
String[1] = 'o';
|
||||
String[2] = ':';
|
||||
String[3] = ' ';
|
||||
String[4] = ' ';
|
||||
} else {
|
||||
String[0] = 'F';
|
||||
String[1] = 'r';
|
||||
String[2] = 'o';
|
||||
String[3] = 'm';
|
||||
String[4] = ':';
|
||||
}
|
||||
u32_to_str(gActiveMessage == MESSAGES_COUNT ? dataPacket.dest : loadedPacket.src,
|
||||
&String[6]); // Write at offset 6
|
||||
UI_PrintString(String, 2, 0, 1 /*, 8 */);
|
||||
|
||||
String[0] = 'S';
|
||||
String[1] = 'E';
|
||||
String[2] = 'Q';
|
||||
String[3] = ':';
|
||||
String[4] = ' ';
|
||||
u8_to_str(loadedPacket.seq, &String[5]); // Write at offset 5
|
||||
String[8] = ' ';
|
||||
String[9] = 'T';
|
||||
String[10] = 'T';
|
||||
String[11] = 'L';
|
||||
String[12] = ':';
|
||||
String[13] = ' ';
|
||||
String[14] = 0;
|
||||
u8_to_str(loadedPacket.ttl, &String[14]); // Write at new offset
|
||||
UI_PrintString(String, 2, 0, 2 /*, 8 */);
|
||||
|
||||
|
||||
char String2[13] = "Data: ";
|
||||
if (gGotACK) {
|
||||
String2[6] = 'G';
|
||||
String2[7] = 'o';
|
||||
String2[8] = 't';
|
||||
String2[9] = 'A';
|
||||
String2[10] = 'C';
|
||||
String2[11] = 'K';
|
||||
}
|
||||
String2[12] = 0;
|
||||
UI_PrintString(String2, 0, 0, 3 /*, 8 */);
|
||||
UI_PrintString((const char *) loadedPacket.data, 2, 0, 4 /*, 8 */);
|
||||
}
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
Reference in New Issue
Block a user