diff --git a/bitmaps.c b/bitmaps.c index e9f9e17..190c89b 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}, diff --git a/bitmaps.h b/bitmaps.h index 667823a..8635bcc 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -5,8 +5,6 @@ #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]; 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..d3da93a 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) @@ -246,18 +250,14 @@ void UI_DisplayAudioBar(void) DrawLevelBar(62, line, bars); + gUpdateStatus = true; + if (gCurrentFunction == FUNCTION_TRANSMIT) ST7565_BlitFullScreen(); } } #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 +800,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/status.c b/ui/status.c index 6e1b8aa..cbb91d0 100644 --- a/ui/status.c +++ b/ui/status.c @@ -34,6 +34,32 @@ #include "ui/ui.h" #include "ui/status.h" +static void convertTime(uint8_t *line, uint8_t type) { + uint8_t m, s; // Declare variables for seconds, hours, minutes, and seconds + uint16_t t; + char str[7]; + + if(type == 0) + t = ((gEeprom.TX_TIMEOUT_TIMER + 1) * 5) - (gTxTimerCountdown_500ms / 2); + else + t = (7200 - gRxTimerCountdown_500ms) / 2; + + m = t / 60; + s = t - (m * 60); + + sprintf(str, "%02d:%02d", m, s); + UI_PrintStringSmallBufferNormal(str, line + 0); + //GUI_DisplaySmallest(str, 2, 26, false, true); + /* + for (uint8_t i = 0; i < 27; i++) + { + gStatusLine[i] ^= 0x7F; + } + */ + + gUpdateStatus = true; +} + void UI_DisplayStatus() { gUpdateStatus = false; @@ -44,13 +70,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; @@ -126,19 +146,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;