mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-22 01:32:43 +00:00
Bargraph level resolution fix
This commit is contained in:
parent
628f00a939
commit
71375f31b2
@ -452,7 +452,7 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
||||
|
||||
// help improve AM RX audio by reducing the PGA gain
|
||||
//
|
||||
// I think the solution is to set the RX AGC to limit the front end gain
|
||||
// I think the solution is to set the RX AGC to limit the front end/I.F gain
|
||||
//
|
||||
// LNA_SHORT .. 0dB
|
||||
// LNA ........ 14dB
|
||||
|
@ -24,30 +24,39 @@
|
||||
|
||||
enum BK4819_AF_Type_t
|
||||
{
|
||||
BK4819_AF_MUTE = 0U,
|
||||
BK4819_AF_OPEN = 1U,
|
||||
BK4819_AF_ALAM = 2U,
|
||||
BK4819_AF_BEEP = 3U,
|
||||
BK4819_AF_CTCO = 6U,
|
||||
BK4819_AF_AM = 7U,
|
||||
BK4819_AF_FSKO = 8U,
|
||||
BK4819_AF_MUTE = 0u,
|
||||
BK4819_AF_OPEN = 1u,
|
||||
BK4819_AF_ALAM = 2u,
|
||||
BK4819_AF_BEEP = 3u,
|
||||
BK4819_AF_UNKNOWN1 = 4u,
|
||||
BK4819_AF_UNKNOWN2 = 5u,
|
||||
BK4819_AF_CTCO = 6u,
|
||||
BK4819_AF_AM = 7u,
|
||||
BK4819_AF_FSKO = 8u,
|
||||
BK4819_AF_UNKNOWN3 = 9u,
|
||||
BK4819_AF_UNKNOWN4 = 10u,
|
||||
BK4819_AF_UNKNOWN5 = 11u,
|
||||
BK4819_AF_UNKNOWN6 = 12u,
|
||||
BK4819_AF_UNKNOWN7 = 13u,
|
||||
BK4819_AF_UNKNOWN8 = 14u,
|
||||
BK4819_AF_UNKNOWN9 = 15u
|
||||
};
|
||||
|
||||
typedef enum BK4819_AF_Type_t BK4819_AF_Type_t;
|
||||
|
||||
enum BK4819_FilterBandwidth_t
|
||||
{
|
||||
BK4819_FILTER_BW_WIDE = 0U,
|
||||
BK4819_FILTER_BW_NARROW = 1U,
|
||||
BK4819_FILTER_BW_WIDE = 0,
|
||||
BK4819_FILTER_BW_NARROW
|
||||
};
|
||||
|
||||
typedef enum BK4819_FilterBandwidth_t BK4819_FilterBandwidth_t;
|
||||
|
||||
enum BK4819_CssScanResult_t
|
||||
{
|
||||
BK4819_CSS_RESULT_NOT_FOUND = 0U,
|
||||
BK4819_CSS_RESULT_CTCSS = 1U,
|
||||
BK4819_CSS_RESULT_CDCSS = 2U,
|
||||
BK4819_CSS_RESULT_NOT_FOUND = 0,
|
||||
BK4819_CSS_RESULT_CTCSS,
|
||||
BK4819_CSS_RESULT_CDCSS
|
||||
};
|
||||
|
||||
typedef enum BK4819_CssScanResult_t BK4819_CssScanResult_t;
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
3
misc.c
3
misc.c
@ -99,7 +99,10 @@ uint8_t gUpdateStatus;
|
||||
uint8_t gFoundCTCSS;
|
||||
uint8_t gFoundCDCSS;
|
||||
bool gEndOfRxDetectedMaybe;
|
||||
|
||||
uint16_t gVFO_RSSI[2];
|
||||
uint8_t gVFO_RSSI_Level[2];
|
||||
|
||||
uint8_t gReducedService;
|
||||
uint8_t gBatteryVoltageIndex;
|
||||
CssScanMode_t gCssScanMode;
|
||||
|
3
misc.h
3
misc.h
@ -159,7 +159,10 @@ extern uint8_t gUpdateStatus;
|
||||
extern uint8_t gFoundCTCSS;
|
||||
extern uint8_t gFoundCDCSS;
|
||||
extern bool gEndOfRxDetectedMaybe;
|
||||
|
||||
extern uint16_t gVFO_RSSI[2];
|
||||
extern uint8_t gVFO_RSSI_Level[2];
|
||||
|
||||
extern uint8_t gReducedService;
|
||||
extern uint8_t gBatteryVoltageIndex;
|
||||
extern CssScanMode_t gCssScanMode;
|
||||
|
40
ui/main.c
40
ui/main.c
@ -354,32 +354,49 @@ void UI_DisplayMain(void)
|
||||
else
|
||||
if (SomeValue == 2)
|
||||
{ // RX signal level
|
||||
if (gVFO_RSSI_Level[vfo_num])
|
||||
#ifdef ENABLE_DBM
|
||||
// dBm
|
||||
//
|
||||
// this doesn't yet quite fit into the available screen space
|
||||
const uint16_t rssi = gVFO_RSSI[vfo_num];
|
||||
if (rssi > 0)
|
||||
{
|
||||
const int16_t dBm = (int16_t)(rssi / 2) - 160;
|
||||
sprintf(String, "%-3d", dBm);
|
||||
UI_PrintStringSmall(String, 2, 0, Line + 2);
|
||||
}
|
||||
#else
|
||||
// bar graph
|
||||
if (gVFO_RSSI_Level[vfo_num] > 0)
|
||||
Level = gVFO_RSSI_Level[vfo_num];
|
||||
#endif
|
||||
}
|
||||
|
||||
if (Level >= 1)
|
||||
{
|
||||
memmove(pLine1 + display_width + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
|
||||
memmove(pLine1 + display_width + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||
uint8_t *pLine = pLine1 + display_width;
|
||||
memmove(pLine + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
|
||||
if (Level >= 2)
|
||||
memmove(pLine1 + display_width + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
||||
memmove(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||
if (Level >= 3)
|
||||
memmove(pLine1 + display_width + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
||||
memmove(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
||||
if (Level >= 4)
|
||||
memmove(pLine1 + display_width + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
||||
memmove(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
||||
if (Level >= 5)
|
||||
memmove(pLine1 + display_width + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
||||
memmove(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
||||
if (Level >= 6)
|
||||
memmove(pLine1 + display_width + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
||||
memmove(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
||||
if (Level >= 7)
|
||||
memmove(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
||||
}
|
||||
}
|
||||
|
||||
// ************
|
||||
|
||||
String[0] = '\0';
|
||||
if (gEeprom.VfoInfo[vfo_num].IsAM)
|
||||
{ // show the AM symbol
|
||||
UI_PrintStringSmall("AM", display_width + 27, 0, Line + 1);
|
||||
strcpy(String, "AM");
|
||||
}
|
||||
else
|
||||
{ // show the CTCSS/DCS symbol
|
||||
@ -387,8 +404,9 @@ void UI_DisplayMain(void)
|
||||
const unsigned int code_type = pConfig->CodeType;
|
||||
const char *code_list[] = {"", "CT", "DCS", "DCR"};
|
||||
if (code_type >= 0 && code_type < ARRAY_SIZE(code_list))
|
||||
UI_PrintStringSmall(code_list[code_type], display_width + 24, 0, Line + 1);
|
||||
strcpy(String, code_list[code_type]);
|
||||
}
|
||||
UI_PrintStringSmall(String, display_width + 24, 0, Line + 1);
|
||||
|
||||
{ // show the TX power
|
||||
const char pwr_list[] = "LMH";
|
||||
@ -423,7 +441,7 @@ void UI_DisplayMain(void)
|
||||
UI_PrintStringSmall("DTMF", display_width + 78, 0, Line + 1);
|
||||
|
||||
// show the audio scramble symbol
|
||||
if (gEeprom.VfoInfo[vfo_num].SCRAMBLING_TYPE && gSetting_ScrambleEnable)
|
||||
if (gEeprom.VfoInfo[vfo_num].SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
|
||||
UI_PrintStringSmall("SCR", display_width + 106, 0, Line + 1);
|
||||
}
|
||||
|
||||
|
50
ui/rssi.c
50
ui/rssi.c
@ -15,19 +15,48 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "bitmaps.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "functions.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/rssi.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
static void Render(uint8_t RssiLevel, uint8_t VFO)
|
||||
{
|
||||
#ifdef ENABLE_DBM
|
||||
|
||||
void UI_UpdateRSSI(uint16_t RSSI)
|
||||
{ // dBm
|
||||
//
|
||||
// this doesn't yet quite fit into the available screen space
|
||||
|
||||
char s[8];
|
||||
const uint8_t line = (gEeprom.RX_CHANNEL == 0) ? 3 : 7;
|
||||
|
||||
gVFO_RSSI[gEeprom.RX_CHANNEL] = RSSI;
|
||||
gVFO_RSSI_Level[gEeprom.RX_CHANNEL] = 0;
|
||||
|
||||
if (RSSI > 0)
|
||||
{ // drop the '.5'
|
||||
const int16_t dBm = (int16_t)(RSSI / 2) - 160;
|
||||
sprintf(s, "%-3d", dBm);
|
||||
}
|
||||
else
|
||||
strcpy(s, " ");
|
||||
|
||||
UI_PrintStringSmall(s, 2, 0, line);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void Render(const uint8_t rssi, const uint8_t RssiLevel, const uint8_t VFO)
|
||||
{ // bar graph
|
||||
|
||||
uint8_t *pLine;
|
||||
uint8_t Line;
|
||||
bool bIsClearMode = false;
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN)
|
||||
return;
|
||||
@ -36,7 +65,6 @@ static void Render(uint8_t RssiLevel, uint8_t VFO)
|
||||
{
|
||||
pLine = gFrameBuffer[2];
|
||||
Line = 3;
|
||||
// Line = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -49,10 +77,10 @@ static void Render(uint8_t RssiLevel, uint8_t VFO)
|
||||
if (RssiLevel == 0)
|
||||
{
|
||||
pLine = NULL;
|
||||
bIsClearMode = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (RssiLevel >= 1)
|
||||
memmove(pLine, BITMAP_Antenna, 5);
|
||||
if (RssiLevel >= 2)
|
||||
memmove(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||
@ -68,14 +96,16 @@ static void Render(uint8_t RssiLevel, uint8_t VFO)
|
||||
memmove(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
||||
}
|
||||
|
||||
ST7565_DrawLine(0, Line, 23 , pLine, bIsClearMode);
|
||||
ST7565_DrawLine(0, Line, 23, pLine, (pLine == NULL) ? true : false);
|
||||
}
|
||||
|
||||
void UI_UpdateRSSI(uint16_t RSSI)
|
||||
{
|
||||
//const int16_t dB = (int16_t)(RSSI / 2) - 160;
|
||||
gVFO_RSSI[gEeprom.RX_CHANNEL] = RSSI;
|
||||
|
||||
// const unsigned int band = gRxVfo->Band;
|
||||
//const int16_t dBm = (int16_t)(RSSI / 2) - 160;
|
||||
|
||||
//const unsigned int band = gRxVfo->Band;
|
||||
const unsigned int band = 0;
|
||||
|
||||
const uint16_t level0 = gEEPROM_RSSI_CALIB[band][0];
|
||||
@ -105,6 +135,8 @@ void UI_UpdateRSSI(uint16_t RSSI)
|
||||
if (gVFO_RSSI_Level[gEeprom.RX_CHANNEL] != Level)
|
||||
{
|
||||
gVFO_RSSI_Level[gEeprom.RX_CHANNEL] = Level;
|
||||
Render(Level, gEeprom.RX_CHANNEL);
|
||||
Render(RSSI, Level, gEeprom.RX_CHANNEL);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user