From 8ec757dbfedbb07c4aa5c1a2a2f250ba2fb30a83 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 25 Mar 2024 01:28:49 +0100 Subject: [PATCH] Add debug helper in status --- misc.c | 1 + misc.h | 2 ++ radio.c | 24 +++++++++++++++++----- ui/status.c | 58 ++++++++++++++++++++++++++++++++++------------------- 4 files changed, 59 insertions(+), 26 deletions(-) diff --git a/misc.c b/misc.c index 6640a34..c6fc797 100644 --- a/misc.c +++ b/misc.c @@ -115,6 +115,7 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; bool gSetting_set_met = 0; bool gSetting_set_gui = 0; bool gSetting_set_ptt_session; + uint8_t gDebug; #endif #ifdef ENABLE_AUDIO_BAR diff --git a/misc.h b/misc.h index fa22619..f3828d7 100644 --- a/misc.h +++ b/misc.h @@ -349,6 +349,8 @@ extern volatile uint8_t boot_counter_10ms; extern uint8_t gBacklightBrightnessOld; extern uint8_t gPttOnePushCounter; extern uint32_t gBlinkCounter; + extern uint8_t gDebug; + #endif int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit); diff --git a/radio.c b/radio.c index 4d363eb..7174e6f 100644 --- a/radio.c +++ b/radio.c @@ -474,24 +474,38 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) #ifdef ENABLE_FEAT_F4HWN // make low and mid even lower + + uint8_t shift[] = {0, 0, 0, 0, 0}; + + /* + if(Band == 5) + { + shift[0] = 3; + shift[1] = 3; + shift[2] = 4; + shift[3] = 7; + shift[4] = 8; + } + */ + if (pInfo->OUTPUT_POWER == OUTPUT_POWER_LOW) { for(uint8_t p = 0; p < 3; p++ ) { switch (gSetting_set_low) { case 0: - Txp[p] = (Txp[p] * 4) / 25; + Txp[p] = (Txp[p] * 4) / 25 - shift[gSetting_set_low]; break; case 1: - Txp[p] = (Txp[p] * 4) / 19; + Txp[p] = (Txp[p] * 4) / 19 + shift[gSetting_set_low]; break; case 2: - Txp[p] = (Txp[p] * 4) / 13; + Txp[p] = (Txp[p] * 4) / 13 + shift[gSetting_set_low]; break; case 3: - Txp[p] = (Txp[p] * 4) / 10; + Txp[p] = (Txp[p] * 4) / 10 + shift[gSetting_set_low]; break; case 4: - Txp[p] = (Txp[p] * 4) / 7; + Txp[p] = (Txp[p] * 4) / 7 + shift[gSetting_set_low]; break; } diff --git a/ui/status.c b/ui/status.c index 6c4ea3f..10f6d4f 100644 --- a/ui/status.c +++ b/ui/status.c @@ -101,32 +101,48 @@ void UI_DisplayStatus() } x += 10; // font character width -#ifdef ENABLE_VOICE - // VOICE indicator - if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF){ - memcpy(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt)); - x1 = x + sizeof(BITMAP_VoicePrompt); + // Only for debug + // Only for debug + // Only for debug + + bool debug = false; + if(debug) + { + char sDebug[8] = ""; + sprintf(sDebug, "%d", gDebug); + UI_PrintStringSmallBufferNormal(sDebug, line + x + 1); + x += 16; } - x += sizeof(BITMAP_VoicePrompt); -#endif + else + { - 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)); + #ifdef ENABLE_VOICE + // VOICE indicator + if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF){ + memcpy(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt)); + x1 = x + sizeof(BITMAP_VoicePrompt); + } + x += sizeof(BITMAP_VoicePrompt); + #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)); + } + else if(dw == 2) { // XB - crossband + memcpy(line + x + 2, gFontXB, sizeof(gFontXB)); + } 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)); + { + memcpy(line + x + 2, gFontMO, sizeof(gFontMO)); + } } + x += sizeof(gFontDWR) + 3; } - x += sizeof(gFontDWR) + 3; #ifdef ENABLE_VOX // VOX indicator