diff --git a/Makefile b/Makefile index fcf1573..bf42b6a 100644 --- a/Makefile +++ b/Makefile @@ -211,7 +211,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1) VERSION_STRING_1 ?= v0.22 AUTHOR_STRING_2 ?= F4HWN - VERSION_STRING_2 ?= v2.5 + VERSION_STRING_2 ?= v2.6 AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2) VERSION_STRING ?= $(VERSION_STRING_2) diff --git a/README.md b/README.md index af92569..e5f7e7e 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,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, Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB and Jean-Claude 14FRS3306 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, Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306 and Thierry F4GVO for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻 ## Table of Contents @@ -42,8 +42,8 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC * improve default power settings level (Low ~125mW, Mid ~2W and High ~5W), * improve s-meter (IARU recommandations), * improve UI: - * menu index, - * s-meter design, + * menu index is always visible, even if a menu is selected, + * s-meter new design (Classic or Tiny), * MAIN ONLY screen mode, * DUAL and CROSS screen mode, * RX blink on VFO RX, @@ -53,6 +53,9 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC * CTCSS or DCS value, * KeyLock message, * last RX, + * move BatTxt menu from 34/63 to 30/63 (just after BatSave menu 29/63), + * rename BackLt to BLTime, + * rename BltTRX to BLTxRx, * and more... * new menu entries: * add SetLow menu to set low power (<20mW, 125mW, 250mW, 500mW and 1W), @@ -71,12 +74,14 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC * improve status bar, * add SetPtt mode in status bar, * change font and bitmaps, + * move USB icon to left of battery information, + * add RX and TX timers, * new actions: * SWITCH RxMode, * SWITCH PTT, * SWITCH WIDE NARROW, * 1750Hz, - * BlMin Tmp Pff, + * BlMin Tmp Off, * new key combinations: * add the F + UP or F + DOWN key combination to dynamically change the Squelch level, * add the F + F1 or F + F2 key combination to dynamically change the Step, diff --git a/app/main.c b/app/main.c index 807c0b7..704613d 100644 --- a/app/main.c +++ b/app/main.c @@ -125,6 +125,8 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) //SETTINGS_SaveChannel(channel, gEeprom.RX_VFO, gRxVfo, 1); + gRequestSaveChannel = 1; + gUpdateDisplay = true; } #endif diff --git a/archive/f4hwn.packed.v2.6.bin b/archive/f4hwn.packed.v2.6.bin new file mode 100644 index 0000000..8289c3f Binary files /dev/null and b/archive/f4hwn.packed.v2.6.bin differ diff --git a/archive/f4hwn.packed.v2.6.fixed.bin b/archive/f4hwn.packed.v2.6.fixed.bin new file mode 100644 index 0000000..0e38c56 Binary files /dev/null and b/archive/f4hwn.packed.v2.6.fixed.bin differ diff --git a/bitmaps.c b/bitmaps.c index e9f9e17..91cefd2 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -11,16 +11,6 @@ const uint8_t gFontPowerSave[2][6] = {0x00, 0x26, 0x49, 0x49, 0x49, 0x32}, }; -const uint8_t gFontTx[1][5] = -{ - {0x3, 0x1, 0x7f, 0x1, 0x3}, -}; - -const uint8_t gFontRx[1][5] = -{ - {0x7f, 0x9, 0x19, 0x29, 0x46}, -}; - const uint8_t gFontPttOnePush[2][6] = { {0x00, 0x3e, 0x41, 0x41, 0x41, 0x3e}, @@ -39,9 +29,9 @@ const uint8_t gFontFM[2][6] = {0x00, 0x7f, 0x2, 0x1c, 0x2, 0x7f}, }; -const uint8_t gFontKeyLock[1][8] = +const uint8_t gFontKeyLock[1][9] = { - {0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c} + {0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c} }; const uint8_t gFontScanAll[9] = diff --git a/bitmaps.h b/bitmaps.h index 667823a..69a437a 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -5,12 +5,10 @@ #include extern const uint8_t gFontPowerSave[2][6]; -extern const uint8_t gFontTx[1][5]; -extern const uint8_t gFontRx[1][5]; extern const uint8_t gFontPttOnePush[2][6]; extern const uint8_t gFontPttClassic[2][6]; extern const uint8_t gFontFM[2][6]; -extern const uint8_t gFontKeyLock[1][8]; +extern const uint8_t gFontKeyLock[1][9]; extern const uint8_t gFontScanAll[9]; extern const uint8_t gFontLight[9]; diff --git a/functions.c b/functions.c index 088fe67..3a98566 100644 --- a/functions.c +++ b/functions.c @@ -210,6 +210,7 @@ void FUNCTION_Transmit() AUDIO_AudioPathOn(); gEnableSpeaker = true; + gVfoConfigureMode = VFO_CONFIGURE; return; } #endif diff --git a/misc.c b/misc.c index c6fc797..f8a2d4a 100644 --- a/misc.c +++ b/misc.c @@ -159,6 +159,7 @@ volatile bool gTxTimeoutReached; volatile uint16_t gTxTimerCountdownAlert_500ms; volatile bool gTxTimeoutReachedAlert; volatile uint16_t gTxTimeoutToneAlert = 800; + volatile uint16_t gRxTimerCountdown_500ms; #endif volatile uint16_t gTailNoteEliminationCountdown_10ms; diff --git a/misc.h b/misc.h index 2d72357..84b6cae 100644 --- a/misc.h +++ b/misc.h @@ -222,6 +222,7 @@ extern volatile bool gTxTimeoutReached; extern volatile uint16_t gTxTimerCountdownAlert_500ms; extern volatile bool gTxTimeoutReachedAlert; extern volatile uint16_t gTxTimeoutToneAlert; + extern volatile uint16_t gRxTimerCountdown_500ms; #endif extern volatile uint16_t gTailNoteEliminationCountdown_10ms; diff --git a/scheduler.c b/scheduler.c index 8ed2b89..47d07ec 100644 --- a/scheduler.c +++ b/scheduler.c @@ -58,6 +58,7 @@ void SystickHandler(void) #ifdef ENABLE_FEAT_F4HWN DECREMENT_AND_TRIGGER(gTxTimerCountdownAlert_500ms - ALERT_TOT * 2, gTxTimeoutReachedAlert); + DECREMENT(gRxTimerCountdown_500ms); #endif DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached); diff --git a/ui/main.c b/ui/main.c index fd77268..7166f10 100644 --- a/ui/main.c +++ b/ui/main.c @@ -53,6 +53,10 @@ 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(bool checkGui) { if(checkGui) @@ -252,12 +256,6 @@ void UI_DisplayAudioBar(void) } #endif -#ifdef ENABLE_FEAT_F4HWN - 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; - } -#endif - void DisplayRSSIBar(const bool now) { #if defined(ENABLE_RSSI_BAR) @@ -800,6 +798,8 @@ void UI_DisplayMain(void) #ifdef ENABLE_FEAT_F4HWN else { + gRxTimerCountdown_500ms = 7200; + if(RxOnVfofrequency == frequency && !isMainOnly(false)) { UI_PrintStringSmallNormal(">>", 14, 0, line); diff --git a/ui/menu.c b/ui/menu.c index 191af19..1acbec4 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -77,17 +77,17 @@ const t_menu_item MenuList[] = {"KeyLck", MENU_AUTOLK }, // was "AUTOLk" {"TxTOut", MENU_TOT }, // was "TOT" {"BatSav", MENU_SAVE }, // was "SAVE" + {"BatTxt", MENU_BAT_TXT }, {"Mic", MENU_MIC }, #ifdef ENABLE_AUDIO_BAR {"MicBar", MENU_MIC_BAR }, #endif {"ChDisp", MENU_MDF }, // was "MDF" {"POnMsg", MENU_PONMSG }, - {"BatTxt", MENU_BAT_TXT }, - {"BackLt", MENU_ABR }, // was "ABR" + {"BLTime", MENU_ABR }, // was "ABR" {"BLMin", MENU_ABR_MIN }, {"BLMax", MENU_ABR_MAX }, - {"BltTRX", MENU_ABR_ON_TX_RX }, + {"BLTxRx", MENU_ABR_ON_TX_RX }, {"Beep", MENU_BEEP }, #ifdef ENABLE_VOICE {"Voice", MENU_VOICE }, @@ -516,10 +516,7 @@ void UI_DisplayMenu(void) } // draw the menu index number/count -#ifdef ENABLE_FEAT_F4HWN - sprintf(String, "%02u/%u", 1 + gMenuCursor, gMenuListCount); - UI_PrintStringSmallNormal(String, 6, 0, 6); -#else +#ifndef ENABLE_FEAT_F4HWN sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount); UI_PrintStringSmallNormal(String, 2, 0, 6); #endif @@ -530,6 +527,11 @@ void UI_DisplayMenu(void) UI_PrintString(MenuList[menu_index].name, 0, 0, 0, 8); // UI_PrintStringSmallNormal(String, 0, 0, 0); } + +#ifdef ENABLE_FEAT_F4HWN + sprintf(String, "%02u/%u", 1 + gMenuCursor, gMenuListCount); + UI_PrintStringSmallNormal(String, 6, 0, 6); +#endif } #endif diff --git a/ui/status.c b/ui/status.c index 6e1b8aa..425ed1a 100644 --- a/ui/status.c +++ b/ui/status.c @@ -34,8 +34,33 @@ #include "ui/ui.h" #include "ui/status.h" + +static void convertTime(uint8_t *line, uint8_t type) +{ + char str[8] = ""; + + uint8_t m, s; // Declare variables for seconds, hours, minutes, and seconds + uint16_t t; + + if(type == 0) // Tx timer + t = (gTxTimerCountdown_500ms / 2); + //t = ((gEeprom.TX_TIMEOUT_TIMER + 1) * 5) - (gTxTimerCountdown_500ms / 2); + else // Rx timer + t = 3600 - (gRxTimerCountdown_500ms / 2); + + m = t / 60; + s = t - (m * 60); + + sprintf(str, "%02d:%02d", m, s); + UI_PrintStringSmallBufferNormal(str, line + 0); + + gUpdateStatus = true; +} + void UI_DisplayStatus() { + char str[8] = ""; + gUpdateStatus = false; memset(gStatusLine, 0, sizeof(gStatusLine)); @@ -44,13 +69,7 @@ void UI_DisplayStatus() // ************** // POWER-SAVE indicator - if (gCurrentFunction == FUNCTION_TRANSMIT) { - memcpy(line + x, gFontTx, sizeof(gFontTx)); - } - else if (FUNCTION_IsRx()) { - memcpy(line + x, gFontRx, sizeof(gFontRx)); - } - else if (gCurrentFunction == FUNCTION_POWER_SAVE) { + if (gCurrentFunction == FUNCTION_POWER_SAVE) { memcpy(line + x, gFontPowerSave, sizeof(gFontPowerSave)); } x += 8; @@ -108,9 +127,8 @@ void UI_DisplayStatus() bool debug = false; if(debug) { - char sDebug[8] = ""; - sprintf(sDebug, "%d", gDebug); - UI_PrintStringSmallBufferNormal(sDebug, line + x + 1); + sprintf(str, "%d", gDebug); + UI_PrintStringSmallBufferNormal(str, line + x + 1); x += 16; } else @@ -126,19 +144,30 @@ void UI_DisplayStatus() #endif if(!SCANNER_IsScanning()) { - uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2; - if(dw == 1 || dw == 3) { // DWR - dual watch + respond - if(gDualWatchActive) - memcpy(line + x + (dw==1?0:2), gFontDWR, sizeof(gFontDWR) - (dw==1?0:5)); - else - memcpy(line + x + 3, gFontHold, sizeof(gFontHold)); + if(gCurrentFunction == FUNCTION_TRANSMIT) + { + convertTime(line, 0); } - else if(dw == 2) { // XB - crossband - memcpy(line + x + 2, gFontXB, sizeof(gFontXB)); + else if(FUNCTION_IsRx()) + { + convertTime(line, 1); } else { - memcpy(line + x + 2, gFontMO, sizeof(gFontMO)); + uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2; + if(dw == 1 || dw == 3) { // DWR - dual watch + respond + if(gDualWatchActive) + memcpy(line + x + (dw==1?0:2), gFontDWR, sizeof(gFontDWR) - (dw==1?0:5)); + else + memcpy(line + x + 3, gFontHold, sizeof(gFontHold)); + } + else if(dw == 2) { // XB - crossband + memcpy(line + x + 2, gFontXB, sizeof(gFontXB)); + } + else + { + memcpy(line + x + 2, gFontMO, sizeof(gFontMO)); + } } } x += sizeof(gFontDWR) + 3; @@ -172,67 +201,51 @@ void UI_DisplayStatus() // KEY-LOCK indicator if (gEeprom.KEY_LOCK) { memcpy(line + x + 1, gFontKeyLock, sizeof(gFontKeyLock)); - x += sizeof(gFontKeyLock); - x1 = x; } else if (gWasFKeyPressed) { UI_PrintStringSmallBufferNormal("F", line + x + 1); - x += sizeof(gFontKeyLock); for (uint8_t i = 71; i < 79; i++) { gStatusLine[i] ^= 0x7F; } - x1 = x; } - else if(gBackLight) + else if (gBackLight) { memcpy(line + x + 1, gFontLight, sizeof(gFontLight)); - x += sizeof(gFontLight); - x1 = x; + } + else if (gChargingWithTypeC) + { + memcpy(line + x + 1, BITMAP_USB_C, sizeof(BITMAP_USB_C)); } - { // battery voltage or percentage - char s[8] = ""; - unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 0; - if (gChargingWithTypeC) - x2 -= sizeof(BITMAP_USB_C); // the radio is on charge + // Battery + unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 0; - switch (gSetting_battery_text) { - default: - case 0: - break; + UI_DrawBattery(line + x2, gBatteryDisplayLevel, gLowBatteryBlink); - case 1: { // voltage - const uint16_t voltage = (gBatteryVoltageAverage <= 999) ? gBatteryVoltageAverage : 999; // limit to 9.99V + switch (gSetting_battery_text) { + default: + case 0: + break; + + case 1: { // voltage + const uint16_t voltage = (gBatteryVoltageAverage <= 999) ? gBatteryVoltageAverage : 999; // limit to 9.99V #ifdef ENABLE_FEAT_F4HWN - sprintf(s, "%u.%02u", voltage / 100, voltage % 100); + sprintf(str, "%u.%02u", voltage / 100, voltage % 100); #else - sprintf(s, "%u.%02uV", voltage / 100, voltage % 100); + sprintf(str, "%u.%02uV", voltage / 100, voltage % 100); #endif - break; - } - - case 2: // percentage - sprintf(s, "%u%%", BATTERY_VoltsToPercent(gBatteryVoltageAverage)); - break; + break; } - unsigned int space_needed = (7 * strlen(s)); - if (x2 >= (x1 + space_needed)) - UI_PrintStringSmallBufferNormal(s, line + x2 - space_needed); + case 2: // percentage + sprintf(str, "%u%%", BATTERY_VoltsToPercent(gBatteryVoltageAverage)); + break; } - // move to right side of the screen - x = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - sizeof(BITMAP_USB_C); - - // USB-C charge indicator - if (gChargingWithTypeC) - memcpy(line + x, BITMAP_USB_C, sizeof(BITMAP_USB_C)); - x += sizeof(BITMAP_USB_C); - - // BATTERY LEVEL indicator - UI_DrawBattery(line + x, gBatteryDisplayLevel, gLowBatteryBlink); + x2 -= (7 * strlen(str)); + UI_PrintStringSmallBufferNormal(str, line + x2); // **************