Add Rx/Tx timer

This commit is contained in:
Armel FAUVEAU
2024-04-16 19:46:17 +02:00
parent 576deb8e2f
commit 27bfe1f4ac
7 changed files with 58 additions and 34 deletions

View File

@@ -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},

View File

@@ -5,8 +5,6 @@
#include <stdint.h>
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];

1
misc.c
View File

@@ -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;

1
misc.h
View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;