Optimize memory
This commit is contained in:
79
ui/main.c
79
ui/main.c
@@ -50,6 +50,14 @@ center_line_t center_line = CENTER_LINE_NONE;
|
|||||||
static int8_t RxBlinkLedCounter;
|
static int8_t RxBlinkLedCounter;
|
||||||
static int8_t RxLine;
|
static int8_t RxLine;
|
||||||
bool isMainOnlyInputDTMF = false;
|
bool isMainOnlyInputDTMF = false;
|
||||||
|
|
||||||
|
static bool isMainOnly(void)
|
||||||
|
{
|
||||||
|
if((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int8_t dBmCorrTable[7] = {
|
const int8_t dBmCorrTable[7] = {
|
||||||
@@ -188,7 +196,7 @@ void UI_DisplayAudioBar(void)
|
|||||||
RxBlinkLedCounter = 0;
|
RxBlinkLedCounter = 0;
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
||||||
unsigned int line;
|
unsigned int line;
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
line = 5;
|
line = 5;
|
||||||
}
|
}
|
||||||
@@ -257,7 +265,7 @@ void DisplayRSSIBar(const bool now)
|
|||||||
};
|
};
|
||||||
|
|
||||||
unsigned int line;
|
unsigned int line;
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
line = 5;
|
line = 5;
|
||||||
}
|
}
|
||||||
@@ -363,7 +371,7 @@ void DisplayRSSIBar(const bool now)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
sprintf(str, "%3d", -rssi_dBm);
|
sprintf(str, "%3d", -rssi_dBm);
|
||||||
UI_PrintStringSmallNormal(str, LCD_WIDTH + 8, 0, line - 1);
|
UI_PrintStringSmallNormal(str, LCD_WIDTH + 8, 0, line - 1);
|
||||||
@@ -567,7 +575,7 @@ void UI_DisplayMain(void)
|
|||||||
const unsigned int line0 = 0; // text screen line
|
const unsigned int line0 = 0; // text screen line
|
||||||
const unsigned int line1 = 4;
|
const unsigned int line1 = 4;
|
||||||
unsigned int line;
|
unsigned int line;
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
line = 0;
|
line = 0;
|
||||||
}
|
}
|
||||||
@@ -590,7 +598,7 @@ void UI_DisplayMain(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
if (activeTxVFO != vfo_num)
|
if (activeTxVFO != vfo_num)
|
||||||
{
|
{
|
||||||
@@ -600,7 +608,7 @@ void UI_DisplayMain(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if (activeTxVFO != vfo_num || ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0))
|
if (activeTxVFO != vfo_num || isMainOnly())
|
||||||
#else
|
#else
|
||||||
if (activeTxVFO != vfo_num) // this is not active TX VFO
|
if (activeTxVFO != vfo_num) // this is not active TX VFO
|
||||||
#endif
|
#endif
|
||||||
@@ -657,7 +665,7 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
UI_PrintString(pPrintStr, 2, 0, 5, 8);
|
UI_PrintString(pPrintStr, 2, 0, 5, 8);
|
||||||
isMainOnlyInputDTMF = true;
|
isMainOnlyInputDTMF = true;
|
||||||
@@ -871,7 +879,7 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
UI_PrintString(String, 32, 0, line, 8);
|
UI_PrintString(String, 32, 0, line, 8);
|
||||||
}
|
}
|
||||||
@@ -890,7 +898,7 @@ void UI_DisplayMain(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
||||||
if(frequency < _1GHz_in_KHz) {
|
if(frequency < _1GHz_in_KHz) {
|
||||||
@@ -1000,7 +1008,7 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
UI_PrintStringSmallNormal(s, LCD_WIDTH + 24, 0, line + 1);
|
UI_PrintStringSmallNormal(s, LCD_WIDTH + 24, 0, line + 1);
|
||||||
}
|
}
|
||||||
@@ -1016,15 +1024,15 @@ void UI_DisplayMain(void)
|
|||||||
{ // show the TX power
|
{ // show the TX power
|
||||||
int i = vfoInfo->OUTPUT_POWER % 3;
|
int i = vfoInfo->OUTPUT_POWER % 3;
|
||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
const char pwr_list[][2] = {"L","M","H"};
|
const char pwr_list[][2] = {"L","M","H"};
|
||||||
UI_PrintStringSmallNormal(pwr_list[i], LCD_WIDTH + 46, 0, line + 1);
|
UI_PrintStringSmallNormal(pwr_list[i], LCD_WIDTH + 46, 0, line + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *powerNames[] = {"LOW", "MID", "HIGH"};
|
const char pwr_names[][5] = {"LOW", "MID", "HIGH"};
|
||||||
GUI_DisplaySmallest(powerNames[i], 37, line == 0 ? 17 : 49, false, true);
|
GUI_DisplaySmallest(pwr_names[i], 37, line == 0 ? 17 : 49, false, true);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
const char pwr_list[][2] = {"L","M","H"};
|
const char pwr_list[][2] = {"L","M","H"};
|
||||||
@@ -1037,7 +1045,7 @@ void UI_DisplayMain(void)
|
|||||||
const char dir_list[][2] = {"", "+", "-"};
|
const char dir_list[][2] = {"", "+", "-"};
|
||||||
int i = vfoInfo->TX_OFFSET_FREQUENCY_DIRECTION % 3;
|
int i = vfoInfo->TX_OFFSET_FREQUENCY_DIRECTION % 3;
|
||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 54, 0, line + 1);
|
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 54, 0, line + 1);
|
||||||
}
|
}
|
||||||
@@ -1054,7 +1062,7 @@ void UI_DisplayMain(void)
|
|||||||
if (vfoInfo->FrequencyReverse)
|
if (vfoInfo->FrequencyReverse)
|
||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
{
|
{
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
UI_PrintStringSmallNormal("R", LCD_WIDTH + 62, 0, line + 1);
|
UI_PrintStringSmallNormal("R", LCD_WIDTH + 62, 0, line + 1);
|
||||||
}
|
}
|
||||||
@@ -1068,7 +1076,7 @@ void UI_DisplayMain(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLE_FEAT_F4HWN
|
#if ENABLE_FEAT_F4HWN
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
|
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
|
||||||
UI_PrintStringSmallNormal("N", LCD_WIDTH + 70, 0, line + 1);
|
UI_PrintStringSmallNormal("N", LCD_WIDTH + 70, 0, line + 1);
|
||||||
@@ -1076,10 +1084,7 @@ void UI_DisplayMain(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *bandWidthNames[] = {"WIDE", "NARROW"};
|
const char *bandWidthNames[] = {"WIDE", "NARROW"};
|
||||||
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
|
GUI_DisplaySmallest(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], 76, line == 0 ? 17 : 49, false, true);
|
||||||
GUI_DisplaySmallest(bandWidthNames[1], 76, line == 0 ? 17 : 49, false, true);
|
|
||||||
else
|
|
||||||
GUI_DisplaySmallest(bandWidthNames[0], 76, line == 0 ? 17 : 49, false, true);
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
|
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
|
||||||
@@ -1101,14 +1106,14 @@ void UI_DisplayMain(void)
|
|||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if(isMainVFO)
|
if(isMainVFO)
|
||||||
{
|
{
|
||||||
|
if(gMonitor)
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
|
||||||
{
|
{
|
||||||
if(gMonitor)
|
sprintf(String, "%s", "MONIT");
|
||||||
{
|
}
|
||||||
sprintf(String, "%s", "MON");
|
|
||||||
}
|
if (isMainOnly())
|
||||||
else
|
{
|
||||||
|
if(!gMonitor)
|
||||||
{
|
{
|
||||||
sprintf(String, "SQL %d", gEeprom.SQUELCH_LEVEL);
|
sprintf(String, "SQL %d", gEeprom.SQUELCH_LEVEL);
|
||||||
}
|
}
|
||||||
@@ -1116,11 +1121,7 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(gMonitor)
|
if(!gMonitor)
|
||||||
{
|
|
||||||
sprintf(String, "%s", "MONIT");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
sprintf(String, "SQL %d", gEeprom.SQUELCH_LEVEL);
|
sprintf(String, "SQL %d", gEeprom.SQUELCH_LEVEL);
|
||||||
}
|
}
|
||||||
@@ -1191,7 +1192,7 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
sprintf(String, "DTMF %s", gDTMF_RX_live + idx);
|
sprintf(String, "DTMF %s", gDTMF_RX_live + idx);
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
UI_PrintStringSmallNormal(String, 2, 0, 5);
|
UI_PrintStringSmallNormal(String, 2, 0, 5);
|
||||||
}
|
}
|
||||||
@@ -1243,17 +1244,9 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
|
if (isMainOnly())
|
||||||
{
|
{
|
||||||
switch(activeTxVFO)
|
sprintf(String, "VFO %s", activeTxVFO ? "B" : "A");
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
sprintf(String, "%s %s", "VFO", "A");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
sprintf(String, "%s %s", "VFO", "B");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
UI_PrintStringSmallBold(String, 49, 0, 6);
|
UI_PrintStringSmallBold(String, 49, 0, 6);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user