diff --git a/Makefile b/Makefile index c5b755f..0c3e3ed 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ ENABLE_FEAT_F4HWN ?= 1 ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0 ENABLE_FEAT_F4HWN_SPECTRUM ?= 1 ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 1 -ENABLE_FEAT_F4HWN_CHARGING_C ?= 1 +ENABLE_FEAT_F4HWN_CHARGING_C ?= 0 ENABLE_FEAT_F4HWN_SLEEP ?= 1 ENABLE_FEAT_F4HWN_RESTORE_SCAN ?= 1 ENABLE_FEAT_F4HWN_NARROWER ?= 1 @@ -224,12 +224,14 @@ ifeq ($(ENABLE_FEAT_F4HWN),1) VERSION_STRING_1 ?= v0.22 AUTHOR_STRING_2 ?= F4HWN - VERSION_STRING_2 ?= v3.8 + VERSION_STRING_2 ?= v3.9 EDITION_STRING ?= Custom AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2) VERSION_STRING ?= $(VERSION_STRING_2) + + SQL_TONE ?= 550 # For SA818, use 600 and python3 sa818.py --port /dev/ttyS2 radio --frequency 434.975 --ctcss 71.9 --tail Open else AUTHOR_STRING ?= EGZUMER # the user might not have/want git installed @@ -412,7 +414,7 @@ endif ifeq ($(ENABLE_FEAT_F4HWN),1) CFLAGS += -DENABLE_FEAT_F4HWN CFLAGS += -DALERT_TOT=10 - CFLAGS += -DSQL_TONE=550 # For SA818, use 600 and python3 sa818.py --port /dev/ttyS2 radio --frequency 434.975 --ctcss 71.9 --tail Open + CFLAGS += -DSQL_TONE=$(SQL_TONE) CFLAGS += -DAUTHOR_STRING_1=\"$(AUTHOR_STRING_1)\" -DVERSION_STRING_1=\"$(VERSION_STRING_1)\" CFLAGS += -DAUTHOR_STRING_2=\"$(AUTHOR_STRING_2)\" -DVERSION_STRING_2=\"$(VERSION_STRING_2)\" CFLAGS += -DEDITION_STRING=\"$(EDITION_STRING)\" diff --git a/README.md b/README.md index 362d2ca..d4faa1c 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Anyway, have fun. # Donations -Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas (4 times), Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern, Joseph Roth, Pierre-Yves Colin, Frank DJ7FG, Marcel Testaz, Brian Frobisher, Yannick F4JFO, Paolo Bussola, Dirk DL8DF, Levente Szőke (2 times), Bernard-Michel Herrera, Jérôme Saintespes, Paul Davies, RS, Johan F4WAT, Robert Wörle, Rafael Sundorf, Paul Harker, Peter Fintl, Pascal F4ICR (2 times), Mike DL2MF, Eric KI1C (2 times) and Phil G0ELM for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻 +Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas (4 times), Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern, Joseph Roth, Pierre-Yves Colin, Frank DJ7FG, Marcel Testaz, Brian Frobisher, Yannick F4JFO, Paolo Bussola, Dirk DL8DF, Levente Szőke (2 times), Bernard-Michel Herrera, Jérôme Saintespes, Paul Davies, RS, Johan F4WAT, Robert Wörle, Rafael Sundorf, Paul Harker, Peter Fintl, Pascal F4ICR (2 times), Mike DL2MF, Eric KI1C (2 times), Phil G0ELM, Jérôme Lambert, Meinhard Frank Günther and Eliot Vedel for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻 ## Table of Contents diff --git a/app/action.c b/app/action.c index 7521355..08a3540 100644 --- a/app/action.c +++ b/app/action.c @@ -234,7 +234,14 @@ void ACTION_Scan(bool bRestart) gScheduleScanListen = false; } else { #ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN - gEeprom.CURRENT_STATE = 1; + if(gScanRangeStart == 0) // No ScanRange + { + gEeprom.CURRENT_STATE = 1; + } + else // ScanRange + { + gEeprom.CURRENT_STATE = 2; + } SETTINGS_WriteCurrentState(); #endif // start scanning diff --git a/app/main.c b/app/main.c index 8fd25bb..3e4a115 100644 --- a/app/main.c +++ b/app/main.c @@ -349,6 +349,11 @@ void channelMove(uint16_t Channel) //gRequestSaveVFO = true; gVfoConfigureMode = VFO_CONFIGURE_RELOAD; +#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS + gRemoveOffset = false; + gPowerHigh = false; +#endif + RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode); return; @@ -735,6 +740,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) if (!bKeyPressed) // released return; + /* #ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN if(gScanRangeStart == 0) // No ScanRange { @@ -746,6 +752,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) } SETTINGS_WriteCurrentState(); #endif + */ ACTION_Scan(false);// toggle scanning gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; @@ -821,6 +828,11 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) } #endif +#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS + gRemoveOffset = false; + gPowerHigh = false; +#endif + uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO]; if (bKeyHeld || !bKeyPressed) { // key held or released diff --git a/app/menu.c b/app/menu.c index fed8bf5..07b07b8 100644 --- a/app/menu.c +++ b/app/menu.c @@ -840,6 +840,12 @@ void MENU_AcceptSetting(void) gUnlockAllTxConfCnt = 0; gSetting_F_LOCK = gSubMenuSelection; + + #ifdef ENABLE_FEAT_F4HWN + if(gSetting_F_LOCK == F_LOCK_ALL) { + SETTINGS_ResetTxLock(); + } + #endif break; } #ifndef ENABLE_FEAT_F4HWN diff --git a/app/spectrum.c b/app/spectrum.c index d09491d..57a7647 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -952,12 +952,23 @@ static void ShowChannelName(uint32_t f) if (SETTINGS_FetchChannelFrequency(i) == f) { SETTINGS_FetchChannelName(String, i); - UI_PrintStringSmallBold(String[0] ? String : "--", 8, 127, 1); + if (String[0] != 0) { + UI_PrintStringSmallBufferNormal(String, gStatusLine + 36); + //GUI_DisplaySmallest(String, 127, 1, true, true); + } break; } } } } + else + { + for (int i = 36; i < 100; i++) + { + gStatusLine[i] = 0b00000000; + } + } + ST7565_BlitStatusLine(); } #endif @@ -1281,6 +1292,9 @@ static void RenderStatus() { memset(gStatusLine, 0, sizeof(gStatusLine)); DrawStatus(); +#ifdef ENABLE_FEAT_F4HWN_SPECTRUM + ShowChannelName(peak.f); +#endif ST7565_BlitStatusLine(); } diff --git a/archive/f4hwn.bandscope.packed.v3.9.bin b/archive/f4hwn.bandscope.packed.v3.9.bin new file mode 100644 index 0000000..8403690 Binary files /dev/null and b/archive/f4hwn.bandscope.packed.v3.9.bin differ diff --git a/archive/f4hwn.bandscope.packed.v3.9.sa818.bin b/archive/f4hwn.bandscope.packed.v3.9.sa818.bin new file mode 100644 index 0000000..90457f4 Binary files /dev/null and b/archive/f4hwn.bandscope.packed.v3.9.sa818.bin differ diff --git a/archive/f4hwn.broadcast.packed.v3.9.bin b/archive/f4hwn.broadcast.packed.v3.9.bin new file mode 100644 index 0000000..e01ecf9 Binary files /dev/null and b/archive/f4hwn.broadcast.packed.v3.9.bin differ diff --git a/archive/f4hwn.broadcast.packed.v3.9.sa818.bin b/archive/f4hwn.broadcast.packed.v3.9.sa818.bin new file mode 100644 index 0000000..8f5e7f3 Binary files /dev/null and b/archive/f4hwn.broadcast.packed.v3.9.sa818.bin differ diff --git a/archive/f4hwn.rescueops.packed.v3.9.bin b/archive/f4hwn.rescueops.packed.v3.9.bin new file mode 100644 index 0000000..85221b6 Binary files /dev/null and b/archive/f4hwn.rescueops.packed.v3.9.bin differ diff --git a/archive/f4hwn.rescueops.packed.v3.9.sa818.bin b/archive/f4hwn.rescueops.packed.v3.9.sa818.bin new file mode 100644 index 0000000..96d5ba7 Binary files /dev/null and b/archive/f4hwn.rescueops.packed.v3.9.sa818.bin differ diff --git a/driver/st7565.c b/driver/st7565.c index fc3723d..5e49e49 100644 --- a/driver/st7565.c +++ b/driver/st7565.c @@ -219,6 +219,25 @@ uint8_t cmds[] = { ST7565_Cmd(i); } } + + int16_t map(int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max) { + return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; + } + + void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value) + { + gFrameBuffer[line][54] = 0x0c; + gFrameBuffer[line][55] = 0x12; + + gFrameBuffer[line][121] = 0x12; + gFrameBuffer[line][122] = 0x0c; + + uint8_t filled = map(value, min, max, 56, 120); + + for (uint8_t i = 56; i <= 120; i++) { + gFrameBuffer[line][i] = (i <= filled) ? 0x2d : 0x21; + } + } #endif void ST7565_Init(void) diff --git a/driver/st7565.h b/driver/st7565.h index d7e9e17..42c69e4 100644 --- a/driver/st7565.h +++ b/driver/st7565.h @@ -43,6 +43,8 @@ void ST7565_WriteByte(uint8_t Value); #ifdef ENABLE_FEAT_F4HWN void ST7565_ContrastAndInv(void); + void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value); + int16_t map(int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max); #endif #endif diff --git a/radio.c b/radio.c index cb559f3..170083e 100644 --- a/radio.c +++ b/radio.c @@ -427,21 +427,19 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure pVfo->Compander = att.compander; - RADIO_ConfigureSquelchAndOutputPower(pVfo); - #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS if(gRemoveOffset) { pVfo->pTX = &pVfo->freq_config_RX; - gRequestSaveChannel = 1; } if(gPowerHigh) { pVfo->OUTPUT_POWER = OUTPUT_POWER_HIGH; - gRequestSaveChannel = 1; } #endif + + RADIO_ConfigureSquelchAndOutputPower(pVfo); } void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) diff --git a/settings.c b/settings.c index d140979..efd78af 100644 --- a/settings.c +++ b/settings.c @@ -1026,3 +1026,17 @@ State[1] = 0 EEPROM_WriteBuffer(0x1F88, State); } #endif + +#ifdef ENABLE_FEAT_F4HWN +void SETTINGS_ResetTxLock(void) +{ + uint8_t State[8]; + for(uint8_t channel = 0; channel < 200; channel++) + { + uint16_t OffsetVFO = channel * 16; + EEPROM_ReadBuffer(OffsetVFO + 8, State, sizeof(State)); + State[4] |= (1 << 6); + EEPROM_WriteBuffer(OffsetVFO + 8, State); + } +} +#endif diff --git a/settings.h b/settings.h index 0a0ac01..8947379 100644 --- a/settings.h +++ b/settings.h @@ -319,4 +319,7 @@ void SETTINGS_WriteBuildOptions(void); #ifdef ENABLE_FEAT_F4HWN_VOL void SETTINGS_WriteCurrentVol(void); #endif +#ifdef ENABLE_FEAT_F4HWN + void SETTINGS_ResetTxLock(void); +#endif #endif diff --git a/ui/main.c b/ui/main.c index 6a69368..ea8fc91 100644 --- a/ui/main.c +++ b/ui/main.c @@ -53,16 +53,9 @@ center_line_t center_line = CENTER_LINE_NONE; bool isMainOnlyInputDTMF = false; - static int16_t map(int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max) { - return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; - } - static bool isMainOnly() { - if((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0) - return true; - else - return false; + return (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) && (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF); } #endif @@ -281,22 +274,15 @@ void DisplayRSSIBar(const bool now) if(RxLine >= 0 && center_line != CENTER_LINE_IN_USE) { - switch(RxBlink) - { - case 0: - UI_PrintStringSmallBold("RX", 8, 0, RxLine); - break; - case 1: - UI_PrintStringSmallBold("RX", 8, 0, RxLine); - RxBlink = 2; - break; - case 2: - for (uint8_t i = 8; i < 24; i++) - { - gFrameBuffer[RxLine][i] = 0x00; - } - RxBlink = 1; - break; + if (RxBlink == 0 || RxBlink == 1) { + UI_PrintStringSmallBold("RX", 8, 0, RxLine); + if (RxBlink == 1) RxBlink = 2; + } else { + for (uint8_t i = 8; i < 24; i++) + { + gFrameBuffer[RxLine][i] = 0x00; + } + RxBlink = 1; } ST7565_BlitLine(RxLine); } @@ -1070,10 +1056,11 @@ void UI_DisplayMain(void) // ************ { // show the TX/RX level - uint8_t Level = 0; + int8_t Level = -1; if (mode == VFO_MODE_TX) { // TX power level + /* switch (gRxVfo->OUTPUT_POWER) { case OUTPUT_POWER_LOW1: Level = 2; break; @@ -1084,6 +1071,16 @@ void UI_DisplayMain(void) case OUTPUT_POWER_MID: Level = 4; break; case OUTPUT_POWER_HIGH: Level = 6; break; } + + if (gRxVfo->OUTPUT_POWER == OUTPUT_POWER_MID) { + Level = 4; + } else if (gRxVfo->OUTPUT_POWER == OUTPUT_POWER_HIGH) { + Level = 6; + } else { + Level = 2; + } + */ + Level = gRxVfo->OUTPUT_POWER - 1; } else if (mode == VFO_MODE_RX) @@ -1094,7 +1091,7 @@ void UI_DisplayMain(void) Level = gVFO_RSSI_bar_level[vfo_num]; #endif } - if(Level) + if(Level >= 0) DrawSmallAntennaAndBars(p_line1 + LCD_WIDTH, Level); } @@ -1339,6 +1336,7 @@ void UI_DisplayMain(void) #endif #ifdef ENABLE_FEAT_F4HWN + /* if(isMainVFO) { if(gMonitor) @@ -1363,6 +1361,20 @@ void UI_DisplayMain(void) GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true); } } + */ + if (isMainVFO) { + if (gMonitor) { + sprintf(String, "MONI"); + } else { + sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL); + } + + if (gSetting_set_gui) { + UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1); + } else { + GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true); + } + } #endif } diff --git a/ui/menu.c b/ui/menu.c index 0ea3138..f78a007 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -70,8 +70,10 @@ const t_menu_item MenuList[] = {"SList2", MENU_SLIST2 }, {"SList3", MENU_SLIST3 }, {"ScnRev", MENU_SC_REV }, -#ifdef ENABLE_NOAA - {"NOAA-S", MENU_NOAA_S }, +#ifndef ENABLE_FEAT_F4HWN + #ifdef ENABLE_NOAA + {"NOAA-S", MENU_NOAA_S }, + #endif #endif {"F1Shrt", MENU_F1SHRT }, {"F1Long", MENU_F1LONG }, @@ -161,6 +163,9 @@ const t_menu_item MenuList[] = #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS {"SetKey", MENU_SET_KEY }, #endif +#ifdef ENABLE_NOAA + {"SetNWR", MENU_NOAA_S }, +#endif #endif // hidden menu items from here on // enabled if pressing both the PTT and upper side button at power-on @@ -701,6 +706,7 @@ void UI_DisplayMenu(void) else if(gSubMenuSelection < 61) { sprintf(String, "%02dm:%02ds", (((gSubMenuSelection) * 5) / 60), (((gSubMenuSelection) * 5) % 60)); + ST7565_Gauge(4, 1, 60, gSubMenuSelection); } else { @@ -730,7 +736,10 @@ void UI_DisplayMenu(void) if (gSubMenuSelection == 0) strcpy(String, "OFF"); else + { sprintf(String, "%02dm:%02ds", ((gSubMenuSelection * 15) / 60), ((gSubMenuSelection * 15) % 60)); + ST7565_Gauge(4, 1, 40, gSubMenuSelection); + } break; case MENU_COMPAND: @@ -844,6 +853,7 @@ void UI_DisplayMenu(void) case MENU_TOT: sprintf(String, "%02dm:%02ds", (((gSubMenuSelection + 1) * 5) / 60), (((gSubMenuSelection + 1) * 5) % 60)); + ST7565_Gauge(4, 5, 179, gSubMenuSelection); break; #ifdef ENABLE_VOICE @@ -860,10 +870,12 @@ void UI_DisplayMenu(void) else if(gSubMenuSelection < 81) { sprintf(String, "CARRIER\n%02ds:%03dms", ((gSubMenuSelection * 250) / 1000), ((gSubMenuSelection * 250) % 1000)); + ST7565_Gauge(5, 1, 80, gSubMenuSelection); } else { sprintf(String, "TIMEOUT\n%02dm:%02ds", (((gSubMenuSelection - 80) * 5) / 60), (((gSubMenuSelection - 80) * 5) % 60)); + ST7565_Gauge(5, 80, 104, gSubMenuSelection); } break; @@ -1015,6 +1027,7 @@ void UI_DisplayMenu(void) else if(gSubMenuSelection < 121) { sprintf(String, "%dh:%02dm", (gSubMenuSelection / 60), (gSubMenuSelection % 60)); + ST7565_Gauge(4, 1, 120, gSubMenuSelection); } break; #endif diff --git a/ui/menu.h b/ui/menu.h index abe6e90..4b106aa 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -110,8 +110,10 @@ enum #ifdef ENABLE_AM_FIX MENU_AM_FIX, #endif -#ifdef ENABLE_NOAA - MENU_NOAA_S, +#ifndef ENABLE_FEAT_F4HWN + #ifdef ENABLE_NOAA + MENU_NOAA_S, + #endif #endif MENU_RESET, MENU_F_LOCK, @@ -150,6 +152,9 @@ enum #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS MENU_SET_KEY, #endif + #ifdef ENABLE_NOAA + MENU_NOAA_S, + #endif #endif MENU_BATCAL, // battery voltage calibration MENU_F1SHRT, diff --git a/ui/status.c b/ui/status.c index d55bef0..6ba6747 100644 --- a/ui/status.c +++ b/ui/status.c @@ -40,12 +40,12 @@ static void convertTime(uint8_t *line, uint8_t type) uint16_t t = (type == 0) ? (gTxTimerCountdown_500ms / 2) : (3600 - gRxTimerCountdown_500ms / 2); uint8_t m = t / 60; - uint8_t s = t % 60; // Utilisation de l'opérateur modulo pour simplifier le calcul des secondes + uint8_t s = t - (m * 60); // Replace modulo with subtraction for efficiency gStatusLine[0] = gStatusLine[7] = gStatusLine[14] = 0x00; // Quick fix on display (on scanning I, II, etc.) - char str[8]; - sprintf(str, "%02d:%02d", m, s); + char str[6]; + sprintf(str, "%02u:%02u", m, s); UI_PrintStringSmallBufferNormal(str, line); gUpdateStatus = true; @@ -61,23 +61,27 @@ void UI_DisplayStatus() uint8_t *line = gStatusLine; unsigned int x = 0; - // ************** - // POWER-SAVE indicator +#ifdef ENABLE_NOAA + // NOAA indicator + if (!(gScanStateDir != SCAN_OFF || SCANNER_IsScanning()) && gIsNoaaMode) { // NOASS SCAN indicator + memcpy(line + x, BITMAP_NOAA, sizeof(BITMAP_NOAA)); + } + // Power Save indicator + else if (gCurrentFunction == FUNCTION_POWER_SAVE) { + memcpy(line + x, gFontPowerSave, sizeof(gFontPowerSave)); + } + x += 8; +#else + // Power Save indicator if (gCurrentFunction == FUNCTION_POWER_SAVE) { memcpy(line + x, gFontPowerSave, sizeof(gFontPowerSave)); } x += 8; - unsigned int x1 = x; - -#ifdef ENABLE_NOAA - if (gIsNoaaMode) { // NOASS SCAN indicator - memcpy(line + x, BITMAP_NOAA, sizeof(BITMAP_NOAA)); - x1 = x + sizeof(BITMAP_NOAA); - } - x += sizeof(BITMAP_NOAA); #endif + unsigned int x1 = x; + #ifdef ENABLE_DTMF_CALLING if (gSetting_KILLED) { memset(line + x, 0xFF, 10); @@ -206,7 +210,7 @@ void UI_DisplayStatus() x += sizeof(gFontPttClassic) + 3; #endif - x = MAX(x1, 70u); + x = MAX(x1, 69u); // KEY-LOCK indicator if (gEeprom.KEY_LOCK) { @@ -237,28 +241,37 @@ void UI_DisplayStatus() UI_DrawBattery(line + x2, gBatteryDisplayLevel, gLowBatteryBlink); + bool BatTxt = true; + switch (gSetting_battery_text) { default: case 0: + BatTxt = false; break; - case 1: { // voltage + case 1: // voltage const uint16_t voltage = (gBatteryVoltageAverage <= 999) ? gBatteryVoltageAverage : 999; // limit to 9.99V -#ifdef ENABLE_FEAT_F4HWN sprintf(str, "%u.%02u", voltage / 100, voltage % 100); -#else - sprintf(str, "%u.%02uV", voltage / 100, voltage % 100); -#endif break; - } case 2: // percentage - sprintf(str, "%u%%", BATTERY_VoltsToPercent(gBatteryVoltageAverage)); + //gBatteryVoltageAverage = 999; + sprintf(str, "%02u%%", BATTERY_VoltsToPercent(gBatteryVoltageAverage)); break; } - x2 -= (7 * strlen(str)); - UI_PrintStringSmallBufferNormal(str, line + x2); + if (BatTxt) { + x2 -= (7 * strlen(str)); + UI_PrintStringSmallBufferNormal(str, line + x2); + /* + uint8_t shift = (strlen(str) < 5) ? 92 : 88; + GUI_DisplaySmallest(str, shift, 1, true, true); + + for (uint8_t i = shift - 2; i < 110; i++) { + gStatusLine[i] ^= 0x7F; // invert + } + */ + } // ************** diff --git a/ui/ui.c b/ui/ui.c index a64adc7..aaa7961 100644 --- a/ui/ui.c +++ b/ui/ui.c @@ -79,7 +79,7 @@ void GUI_SelectNextDisplay(GUI_DisplayType_t Display) gInputBoxIndex = 0; gIsInSubMenu = false; - gCssBackgroundScan = false; + gCssBackgroundScan = false; gScanStateDir = SCAN_OFF; #ifdef ENABLE_FMRADIO gFM_ScanState = FM_SCAN_OFF; diff --git a/ui/welcome.c b/ui/welcome.c index 85ebcbf..6a5d79e 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -119,17 +119,13 @@ void UI_DisplayWelcome(void) #ifdef ENABLE_FEAT_F4HWN UI_PrintStringSmallNormal(Version, 0, 128, 4); - for (uint8_t i = 0; i < 128; i++) - { - gFrameBuffer[3][i] ^= 0x80; - } + UI_DrawLineBuffer(gFrameBuffer, 0, 31, 127, 31, 1); // Be ware, status zone = 8 lines, the rest = 56 ->total 64 for (uint8_t i = 18; i < 110; i++) { gFrameBuffer[4][i] ^= 0xFF; } - sprintf(WelcomeString3, "%s Edition", Edition); UI_PrintStringSmallNormal(WelcomeString3, 0, 127, 6);