Merge remote-tracking branch 'remotes/OneOfEleven/main'

This commit is contained in:
Krzysiek Egzmont
2023-10-02 23:15:34 +02:00
28 changed files with 584 additions and 576 deletions

View File

@@ -36,7 +36,18 @@
#include "ui/main.h"
#include "ui/ui.h"
bool center_line_is_free = true;
enum center_line_t {
CENTER_LINE_NONE = 0,
CENTER_LINE_IN_USE,
CENTER_LINE_AUDIO_BAR,
CENTER_LINE_RSSI,
CENTER_LINE_AM_FIX_DATA,
CENTER_LINE_DTMF_DEC,
CENTER_LINE_CHARGE_DATA
};
typedef enum center_line_t center_line_t;
center_line_t center_line = CENTER_LINE_NONE;
// ***************************************************************************
@@ -154,14 +165,14 @@ bool center_line_is_free = true;
if (rssi_dBm >= (s9_dBm + 6))
{ // S9+XXdB, 1dB increment
const char *fmt[] = {"%-4d +%u ", "%-4d +%2u "};
const unsigned int dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99;
sprintf(s, (dB < 10) ? fmt[0] : fmt[1], rssi_dBm, dB);
const char *fmt[] = {"%3d 9+%u ", "%3d 9+%2u "};
const unsigned int s9_dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99;
sprintf(s, (s9_dB < 10) ? fmt[0] : fmt[1], rssi_dBm, s9_dB);
}
else
{ // S0 ~ S9, 6dB per S-point
const unsigned int s_level = (rssi_dBm >= s0_dBm) ? (rssi_dBm - s0_dBm) / 6 : 0;
sprintf(s, "%-4d S%u ", rssi_dBm, s_level);
sprintf(s, "%4d S%u ", rssi_dBm, s_level);
}
UI_PrintStringSmall(s, 2, 0, line);
@@ -184,7 +195,9 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
{
#ifdef ENABLE_RSSI_BAR
if (!center_line_is_free)
// optional larger RSSI dBm, S-point and bar level
if (center_line != CENTER_LINE_RSSI)
return;
if (gCurrentFunction == FUNCTION_RECEIVE ||
@@ -193,9 +206,11 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
{
UI_DisplayRSSIBar(rssi, true);
}
#else
// original little RS bars
// const int16_t dBm = (rssi / 2) - 160;
const uint8_t Line = (vfo == 0) ? 3 : 7;
uint8_t *p_line = gFrameBuffer[Line - 1];
@@ -290,8 +305,7 @@ void UI_DisplayMain(void)
char String[16];
unsigned int vfo_num;
// true if the center screen line is available to use
center_line_is_free = true;
center_line = CENTER_LINE_NONE;
// #ifdef SINGLE_VFO_CHAN
// const bool single_vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? true : false;
@@ -356,7 +370,7 @@ void UI_DisplayMain(void)
{
sprintf(String, ">%s", gDTMF_InputBox);
center_line_is_free = false;
center_line = CENTER_LINE_IN_USE;
}
UI_PrintString(String, 2, 0, vfo_num * 3, 8);
@@ -375,11 +389,11 @@ void UI_DisplayMain(void)
}
else
{
center_line_is_free = false;
center_line = CENTER_LINE_IN_USE;
}
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
center_line_is_free = false;
center_line = CENTER_LINE_IN_USE;
continue;
}
@@ -483,7 +497,7 @@ void UI_DisplayMain(void)
{ // user entering a frequency
UI_DisplayFrequency(gInputBox, 32, line, true, false);
center_line_is_free = false;
// center_line = CENTER_LINE_IN_USE;
}
else
{
@@ -689,7 +703,7 @@ void UI_DisplayMain(void)
UI_PrintStringSmall("SCR", LCD_WIDTH + 106, 0, line + 1);
}
if (center_line_is_free)
if (center_line == CENTER_LINE_NONE)
{ // we're free to use the middle line
const bool rx = (gCurrentFunction == FUNCTION_RECEIVE ||
@@ -700,7 +714,7 @@ void UI_DisplayMain(void)
if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT)
{
UI_DisplayAudioBar();
center_line_is_free = false;
center_line = CENTER_LINE_AUDIO_BAR;
}
else
#endif
@@ -710,7 +724,7 @@ void UI_DisplayMain(void)
{
AM_fix_print_data(gEeprom.RX_CHANNEL, String);
UI_PrintStringSmall(String, 2, 0, 3);
center_line_is_free = false;
center_line = CENTER_LINE_AM_FIX_DATA;
}
else
#endif
@@ -719,11 +733,11 @@ void UI_DisplayMain(void)
if (rx)
{
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false);
center_line_is_free = false;
center_line = CENTER_LINE_RSSI;
}
else
#endif
if (rx || gCurrentFunction == FUNCTION_FOREGROUND || gCurrentFunction == FUNCTION_POWER_SAVE)
{
#if 1
@@ -734,7 +748,7 @@ void UI_DisplayMain(void)
strcpy(String, "DTMF ");
strcat(String, gDTMF_RX_live + idx);
UI_PrintStringSmall(String, 2, 0, 3);
center_line_is_free = false;
center_line = CENTER_LINE_DTMF_DEC;
}
#else
if (gSetting_live_DTMF_decoder && gDTMF_RX_index > 0)
@@ -744,7 +758,7 @@ void UI_DisplayMain(void)
strcpy(String, "DTMF ");
strcat(String, gDTMF_RX + idx);
UI_PrintStringSmall(String, 2, 0, 3);
center_line_is_free = false;
center_line = CENTER_LINE_DTMF_DEC;
}
#endif
@@ -756,7 +770,7 @@ void UI_DisplayMain(void)
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
UI_PrintStringSmall(String, 2, 0, 3);
center_line_is_free = false;
center_line = CENTER_LINE_CHARGE_DATA;
}
#endif
}

169
ui/menu.c
View File

@@ -44,22 +44,22 @@ const t_menu_item MenuList[] =
{"SQL", VOICE_ID_SQUELCH, MENU_SQL },
{"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
{"T-PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
{"R-DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
{"R-CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
{"T-DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
{"T-CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
{"T-DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
{"T-OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
{"T-VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
{"T-TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
{"T PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
{"R DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
{"R CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
{"T DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
{"T CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
{"T DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
{"T OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
{"T VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
{"T TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
{"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
{"CH-SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
{"CH-DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
{"CH-NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
{"CH-DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
{"CH SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
{"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
{"CH NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
{"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
{"VOX", VOICE_ID_VOX, MENU_VOX },
{"BACKLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
@@ -68,12 +68,12 @@ const t_menu_item MenuList[] =
#ifdef ENABLE_VOICE
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
#endif
{"SC-REV", VOICE_ID_INVALID, MENU_SC_REV },
{"SC REV", VOICE_ID_INVALID, MENU_SC_REV },
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
{"S-ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
{"S-ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
{"S ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
{"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
{"STE", VOICE_ID_INVALID, MENU_STE },
{"RP-STE", VOICE_ID_INVALID, MENU_RP_STE },
{"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
{"MIC", VOICE_ID_INVALID, MENU_MIC },
#ifdef ENABLE_AUDIO_BAR
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR },
@@ -81,34 +81,34 @@ const t_menu_item MenuList[] =
#ifdef ENABLE_COMPANDER
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
#endif
{"1-CALL", VOICE_ID_INVALID, MENU_1_CALL },
{"1 CALL", VOICE_ID_INVALID, MENU_1_CALL },
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 },
{"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 },
#ifdef ENABLE_ALARM
{"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD },
#endif
{"ANI-ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
{"PTT-ID", VOICE_ID_INVALID, MENU_PTT_ID },
{"D-ST", VOICE_ID_INVALID, MENU_D_ST },
{"D-RSP", VOICE_ID_INVALID, MENU_D_RSP },
{"D-HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
{"D-PRE", VOICE_ID_INVALID, MENU_D_PRE },
{"D-DCD", VOICE_ID_INVALID, MENU_D_DCD },
{"D-LIST", VOICE_ID_INVALID, MENU_D_LIST },
{"D-LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
{"D ST", VOICE_ID_INVALID, MENU_D_ST },
{"D RSP", VOICE_ID_INVALID, MENU_D_RSP },
{"D HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
{"D PRE", VOICE_ID_INVALID, MENU_D_PRE },
{"D DCD", VOICE_ID_INVALID, MENU_D_DCD },
{"D LIST", VOICE_ID_INVALID, MENU_D_LIST },
{"D LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG },
{"ROGER", VOICE_ID_INVALID, MENU_ROGER },
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
#ifdef ENABLE_AM_FIX
{"AM-FIX", VOICE_ID_INVALID, MENU_AM_FIX },
{"AM FIX", VOICE_ID_INVALID, MENU_AM_FIX },
#endif
#ifdef ENABLE_AM_FIX_TEST1
{"AM-FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1},
{"AM FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1},
#endif
#ifdef ENABLE_NOAA
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
@@ -118,15 +118,17 @@ const t_menu_item MenuList[] =
// hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on
{"F-LOCK", VOICE_ID_INVALID, MENU_F_LOCK },
{"TX-200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
{"TX-350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
{"TX-500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
{"350-EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
{"SCR-EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
{"F LOCK", VOICE_ID_INVALID, MENU_F_LOCK },
{"TX 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
{"TX 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
{"TX 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
{"350 EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
{"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
{"TX-EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
{"F-CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
{"TX EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
#ifdef ENABLE_F_CAL_MENU
{"F CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
#endif
{"BATCAL", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
@@ -207,9 +209,6 @@ const char gSubMenu_XB[3][10] =
const char gSubMenu_SC_REV[3][13] =
{
// "TIME\nOPER",
// "CARRIER\nOPER",
// "SEARCH\nOPER"
"TIME",
"CARRIER",
"SEARCH"
@@ -231,9 +230,9 @@ const char gSubMenu_MDF[4][15] =
};
#endif
const char gSubMenu_D_RSP[4][6] =
const char gSubMenu_D_RSP[4][11] =
{
"NULL",
"DO\nNOTHING",
"RING",
"REPLY",
"BOTH"
@@ -255,11 +254,11 @@ const char gSubMenu_PONMSG[4][8] =
"NONE"
};
const char gSubMenu_ROGER[3][6] =
const char gSubMenu_ROGER[3][9] =
{
"OFF",
"ROGER",
"MDC"
"MDC\n1200"
};
const char gSubMenu_RESET[2][4] =
@@ -336,10 +335,9 @@ bool gIsInSubMenu;
uint8_t gMenuCursor;
int8_t gMenuScrollDirection;
int32_t gSubMenuSelection;
int32_t gSubMenuSelection_original = 0; // copy of the original value
// edit box
char edit_original[17] = {0}; // a copy of the text before editing so that we can easily test for changes/difference
char edit_original[17]; // a copy of the text before editing so that we can easily test for changes/difference
char edit[17];
int edit_index;
@@ -349,21 +347,21 @@ void UI_DisplayMenu(void)
const unsigned int menu_item_x1 = (8 * menu_list_width) + 2;
const unsigned int menu_item_x2 = LCD_WIDTH - 1;
unsigned int i;
char String[64];
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
char Contact[16];
// clear the screen
// clear the screen buffer
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
// draw the left menu list
#if 0
// original menu layout
for (i = 0; i < 3; i++)
if (gMenuCursor > 0 || i > 0)
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
// invert the current menu list item text pixels
// invert the current menu list item pixels
for (i = 0; i < (8 * menu_list_width); i++)
{
gFrameBuffer[2][i] ^= 0xFF;
@@ -374,7 +372,7 @@ void UI_DisplayMenu(void)
for (i = 0; i < 7; i++)
gFrameBuffer[i][(8 * menu_list_width) + 1] = 0xAA;
// draw the little triangle marker if we're in the sub-menu
// draw the little sub-menu triangle marker
if (gIsInSubMenu)
memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
@@ -383,14 +381,15 @@ void UI_DisplayMenu(void)
UI_PrintStringSmall(String, 2, 0, 6);
#else
{
{ // new menu layout .. experimental & unfinished
const int menu_index = gMenuCursor; // current selected menu item
i = 1;
if (!gIsInSubMenu)
{
while (i < 2)
{ // leading menu items
{ // leading menu items - small text
const int k = menu_index + i - 2;
if (k < 0)
UI_PrintStringSmall(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round
@@ -400,13 +399,13 @@ void UI_DisplayMenu(void)
i++;
}
// current menu item
// current menu item - keep big n fat
if (menu_index >= 0 && menu_index < (int)gMenuListCount)
UI_PrintString(MenuList[menu_index].name, 0, 0, 2, 8);
i++;
while (i < 4)
{ // trailing menu item
{ // trailing menu item - small text
const int k = menu_index + i - 2;
if (k >= 0 && k < (int)gMenuListCount)
UI_PrintStringSmall(MenuList[k].name, 0, 0, 1 + i);
@@ -457,7 +456,7 @@ void UI_DisplayMenu(void)
#endif
case MENU_STEP:
sprintf(String, "%d.%02uKHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100);
sprintf(String, "%d.%02ukHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100);
break;
case MENU_TXP:
@@ -589,7 +588,6 @@ void UI_DisplayMenu(void)
const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection);
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
}
already_printed = true;
@@ -619,7 +617,6 @@ void UI_DisplayMenu(void)
UI_PrintString(edit, menu_item_x1, 0, 2, 8);
if (edit_index < 10)
UI_PrintString( "^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor
// UI_PrintStringSmall("^", menu_item_x1 + (8 * edit_index), 0, 4);
}
if (!gAskForConfirmation)
@@ -629,7 +626,6 @@ void UI_DisplayMenu(void)
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
else
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
}
}
@@ -746,19 +742,21 @@ void UI_DisplayMenu(void)
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
break;
case MENU_F_CALI:
{
const uint32_t value = 22656 + gSubMenuSelection;
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
//gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection; // already set when the user was adjusting the value
BK4819_WriteRegister(BK4819_REG_3B, value);
sprintf(String, "%d\n%u.%06u\nMHz",
gSubMenuSelection,
xtal_Hz / 1000000, xtal_Hz % 1000000);
}
break;
#ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI:
{
const uint32_t value = 22656 + gSubMenuSelection;
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
//gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection; // already set when the user was adjusting the value
BK4819_WriteRegister(BK4819_REG_3B, value);
sprintf(String, "%d\n%u.%06u\nMHz",
gSubMenuSelection,
xtal_Hz / 1000000, xtal_Hz % 1000000);
}
break;
#endif
case MENU_BATCAL:
{
@@ -769,9 +767,9 @@ void UI_DisplayMenu(void)
}
if (!already_printed)
{
{ // we now do multi-line text in a single string
unsigned int y;
unsigned int k = 0;
unsigned int lines = 1;
unsigned int len = strlen(String);
bool small = false;
@@ -782,9 +780,9 @@ void UI_DisplayMenu(void)
for (i = 0; i < len; i++)
{
if (String[i] == '\n' && i < (len - 1))
{
{ // found new line char
lines++;
String[i] = 0;
String[i] = 0; // null terminate the line
}
}
@@ -795,21 +793,28 @@ void UI_DisplayMenu(void)
lines = 7;
}
// move the 1st line up
// center vertically'ish
if (small)
y = 3 - ((lines + 0) / 2);
y = 3 - ((lines + 0) / 2); // untested
else
y = 2 - ((lines + 0) / 2);
// draw the text lines
for (i = 0; i < len && lines > 0; lines--)
{
if (small)
UI_PrintStringSmall(String + k, menu_item_x1, menu_item_x2, y);
UI_PrintStringSmall(String + i, menu_item_x1, menu_item_x2, y);
else
UI_PrintString(String + k, menu_item_x1, menu_item_x2, y, 8);
UI_PrintString(String + i, menu_item_x1, menu_item_x2, y, 8);
// look for start of next line
while (i < len && String[i] >= 32)
i++;
k = ++i;
// hop over the null term char(s)
while (i < len && String[i] < 32)
i++;
y += small ? 1 : 2;
}
}

View File

@@ -53,9 +53,9 @@ enum
MENU_ABR,
MENU_TDR,
MENU_BEEP,
#ifdef ENABLE_VOICE
MENU_VOICE,
#endif
#ifdef ENABLE_VOICE
MENU_VOICE,
#endif
MENU_SC_REV,
MENU_AUTOLK,
MENU_S_ADD1,
@@ -63,19 +63,19 @@ enum
MENU_STE,
MENU_RP_STE,
MENU_MIC,
#ifdef ENABLE_AUDIO_BAR
MENU_MIC_BAR,
#endif
#ifdef ENABLE_COMPANDER
MENU_COMPAND,
#endif
#ifdef ENABLE_AUDIO_BAR
MENU_MIC_BAR,
#endif
#ifdef ENABLE_COMPANDER
MENU_COMPAND,
#endif
MENU_1_CALL,
MENU_S_LIST,
MENU_SLIST1,
MENU_SLIST2,
#ifdef ENABLE_ALARM
MENU_AL_MOD,
#endif
#ifdef ENABLE_ALARM
MENU_AL_MOD,
#endif
MENU_ANI_ID,
MENU_UPCODE,
MENU_DWCODE,
@@ -92,15 +92,15 @@ enum
MENU_VOL,
MENU_BAT_TXT,
MENU_AM,
#ifdef ENABLE_AM_FIX
MENU_AM_FIX,
#endif
#ifdef ENABLE_AM_FIX_TEST1
MENU_AM_FIX_TEST1,
#endif
#ifdef ENABLE_NOAA
MENU_NOAA_S,
#endif
#ifdef ENABLE_AM_FIX
MENU_AM_FIX,
#endif
#ifdef ENABLE_AM_FIX_TEST1
MENU_AM_FIX_TEST1,
#endif
#ifdef ENABLE_NOAA
MENU_NOAA_S,
#endif
MENU_RESET,
// items after here are normally hidden
@@ -113,7 +113,9 @@ enum
MENU_SCREN,
MENU_TX_EN, // enable TX
#ifdef ENABLE_F_CAL_MENU
MENU_F_CALI, // reference xtal calibration
#endif
MENU_BATCAL // battery voltage calibration
};
@@ -135,10 +137,10 @@ extern const char gSubMenu_MDF[4][15];
#ifdef ENABLE_ALARM
extern const char gSubMenu_AL_MOD[2][5];
#endif
extern const char gSubMenu_D_RSP[4][6];
extern const char gSubMenu_D_RSP[4][11];
extern const char gSubMenu_PTT_ID[4][7];
extern const char gSubMenu_PONMSG[4][8];
extern const char gSubMenu_ROGER[3][6];
extern const char gSubMenu_ROGER[3][9];
extern const char gSubMenu_RESET[2][4];
extern const char gSubMenu_F_LOCK[6][4];
extern const char gSubMenu_BACKLIGHT[8][7];
@@ -157,7 +159,6 @@ extern bool gIsInSubMenu;
extern uint8_t gMenuCursor;
extern int8_t gMenuScrollDirection;
extern int32_t gSubMenuSelection;
extern int32_t gSubMenuSelection_original;
extern char edit_original[17];
extern char edit[17];

View File

@@ -187,54 +187,35 @@ void UI_DisplayStatus(const bool test_display)
x += sizeof(BITMAP_USB_C);
// BATTERY LEVEL indicator
#if 1
if (gBatteryDisplayLevel >= 2 && !gLowBattery)
{
line += x;
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
#ifndef ENABLE_REVERSE_BAT_SYMBOL
line += sizeof(BITMAP_BatteryLevel1);
if (gBatteryDisplayLevel >= 2)
memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
if (gBatteryDisplayLevel >= 5)
if (gBatteryDisplayLevel >= 3)
memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
if (gBatteryDisplayLevel >= 7)
if (gBatteryDisplayLevel >= 4)
memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
if (gBatteryDisplayLevel >= 9)
if (gBatteryDisplayLevel >= 5)
memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
#else
if (gBatteryDisplayLevel >= 2)
memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
if (gBatteryDisplayLevel >= 5)
if (gBatteryDisplayLevel >= 3)
memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
if (gBatteryDisplayLevel >= 7)
if (gBatteryDisplayLevel >= 4)
memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
if (gBatteryDisplayLevel >= 9)
if (gBatteryDisplayLevel >= 5)
memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
#endif
}
else
if (gLowBatteryBlink == 1)
memmove(line + x, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
#else
// UI_DisplayBattery(gBatteryDisplayLevel);
line += x;
if (gBatteryDisplayLevel > 0)
{
const uint8_t level = (gBatteryDisplayLevel <= 11) ? gBatteryDisplayLevel : 11;
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
#ifdef ENABLE_REVERSE_BAT_SYMBOL
for (uint8_t i = 0; i < level; i++)
line[3 + i] = (i & 1u) ? 0b01011101 : 0b01011101;
#else
for (uint8_t i = 0; i < level; i++)
line[sizeof(BITMAP_BatteryLevel1) - 3 - i] = (i & 1u) ? 0b01011101 : 0b01011101;
#endif
}
else
memset(line, 0, sizeof(BITMAP_BatteryLevel1));
#endif
// **************