mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-05-19 08:21:18 +03:00
Fix RSSI bar bug
This commit is contained in:
parent
99ef859a52
commit
fd0e166315
17
app/main.c
17
app/main.c
@ -177,10 +177,23 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||
gRequestSaveVFO = true;
|
||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||
#else
|
||||
// toggle scanlist-1
|
||||
// toggle scanlist-1 and scanlist 2
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||
{
|
||||
gTxVfo->SCANLIST1_PARTICIPATION = gTxVfo->SCANLIST1_PARTICIPATION ? 0 : 1;
|
||||
if (gTxVfo->SCANLIST1_PARTICIPATION)
|
||||
{
|
||||
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
||||
gTxVfo->SCANLIST1_PARTICIPATION = 0;
|
||||
else
|
||||
gTxVfo->SCANLIST2_PARTICIPATION = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
||||
gTxVfo->SCANLIST2_PARTICIPATION = 0;
|
||||
else
|
||||
gTxVfo->SCANLIST1_PARTICIPATION = 1;
|
||||
}
|
||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
gFlagResetVfos = true;
|
||||
|
9
board.c
9
board.c
@ -744,12 +744,9 @@ void BOARD_EEPROM_LoadMoreSettings(void)
|
||||
memmove(gEEPROM_1EC0_2, gEEPROM_1EC0_0, 8);
|
||||
memmove(gEEPROM_1EC0_3, gEEPROM_1EC0_0, 8);
|
||||
|
||||
// 3 bands, 4 * 16-bit values per band
|
||||
// both my radios are -70dBm, -65dBm, -60dBm, -55dBm (0xB4, 0xBE, 0xC8, 0xD2)
|
||||
// -93, -75, -57, -39 seems to be a better choice (0x86, 0xAA, 0xCE, 0xF2)
|
||||
EEPROM_ReadBuffer(0x1EC8, gEEPROM_RSSI_CALIB[0], 8);
|
||||
memmove(gEEPROM_RSSI_CALIB[1], gEEPROM_RSSI_CALIB[0], 8);
|
||||
memmove(gEEPROM_RSSI_CALIB[2], gEEPROM_RSSI_CALIB[0], 8);
|
||||
// 8 * 16-bit values
|
||||
EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[0], 8);
|
||||
EEPROM_ReadBuffer(0x1EC8, gEEPROM_RSSI_CALIB[1], 8);
|
||||
|
||||
EEPROM_ReadBuffer(0x1F40, gBatteryCalibration, 12);
|
||||
if (gBatteryCalibration[0] >= 5000)
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
2
misc.c
2
misc.c
@ -103,7 +103,7 @@ uint8_t gEEPROM_1EC0_1[8];
|
||||
uint8_t gEEPROM_1EC0_2[8];
|
||||
uint8_t gEEPROM_1EC0_3[8];
|
||||
|
||||
uint16_t gEEPROM_RSSI_CALIB[3][4];
|
||||
uint16_t gEEPROM_RSSI_CALIB[2][4];
|
||||
|
||||
uint16_t gEEPROM_1F8A;
|
||||
uint16_t gEEPROM_1F8C;
|
||||
|
2
misc.h
2
misc.h
@ -167,7 +167,7 @@ extern uint8_t gEEPROM_1EC0_1[8];
|
||||
extern uint8_t gEEPROM_1EC0_2[8];
|
||||
extern uint8_t gEEPROM_1EC0_3[8];
|
||||
|
||||
extern uint16_t gEEPROM_RSSI_CALIB[3][4];
|
||||
extern uint16_t gEEPROM_RSSI_CALIB[2][4];
|
||||
|
||||
extern uint16_t gEEPROM_1F8A;
|
||||
extern uint16_t gEEPROM_1F8C;
|
||||
|
5
radio.c
5
radio.c
@ -417,7 +417,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
if (gEeprom.VfoInfo[VFO].AM_mode)
|
||||
{ // freq/chan is in AM mode
|
||||
gEeprom.VfoInfo[VFO].SCRAMBLING_TYPE = 0;
|
||||
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = false; // no reason to disable DTMF decoding, aircraft use it on SSB
|
||||
// gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = false; // no reason to disable DTMF decoding, aircraft use it on SSB
|
||||
gEeprom.VfoInfo[VFO].freq_config_RX.CodeType = CODE_TYPE_OFF;
|
||||
gEeprom.VfoInfo[VFO].freq_config_TX.CodeType = CODE_TYPE_OFF;
|
||||
}
|
||||
@ -749,7 +749,8 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
#if 0
|
||||
// there's no reason the DTMF decoder can't be used in AM RX mode too
|
||||
// aircraft comms use it on HF (AM and SSB)
|
||||
if (gRxVfo->AM_mode || (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED))
|
||||
// if (gRxVfo->AM_mode || (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED))
|
||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||
{
|
||||
BK4819_DisableDTMF();
|
||||
}
|
||||
|
25
ui/main.c
25
ui/main.c
@ -120,17 +120,17 @@
|
||||
char s[16];
|
||||
unsigned int i;
|
||||
|
||||
const unsigned int max_dB = -33;
|
||||
const unsigned int min_dB = -127;
|
||||
const int16_t max_dB = -33; // S9+40dB
|
||||
const int16_t min_dB = -127; // S0
|
||||
|
||||
const unsigned int txt_width = 7 * 8; // 8 text chars
|
||||
const unsigned int bar_x = txt_width + 4;
|
||||
const unsigned int bar_width = LCD_WIDTH - 1 - bar_x;
|
||||
|
||||
const int16_t dBm = (rssi / 2) - 160;
|
||||
const unsigned int clamped_dBm = (dBm < min_dB) ? min_dB : (dBm > max_dB) ? max_dB : dBm;
|
||||
const unsigned int width = max_dB - min_dB;
|
||||
const unsigned int len = (((clamped_dBm - min_dB) * bar_width) + (width / 2)) / width;
|
||||
const int16_t clamped_dBm = (dBm <= min_dB) ? min_dB : (dBm >= max_dB) ? max_dB : dBm;
|
||||
const unsigned int range_dB = max_dB - min_dB;
|
||||
const unsigned int len = ((clamped_dBm - min_dB) * bar_width) / range_dB;
|
||||
|
||||
const unsigned int line = 3;
|
||||
uint8_t *pLine = gFrameBuffer[line];
|
||||
@ -191,13 +191,18 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
|
||||
#else
|
||||
|
||||
// const int16_t dBm = (rssi / 2) - 160;
|
||||
const uint8_t Line = (vfo == 0) ? 3 : 7;
|
||||
uint8_t *pLine = gFrameBuffer[Line - 1];
|
||||
// const int16_t dBm = (rssi / 2) - 160;
|
||||
|
||||
// TODO: sort out all 8 values from the eeprom
|
||||
|
||||
#if 0
|
||||
//const unsigned int band = gRxVfo->Band;
|
||||
const unsigned int band = 0;
|
||||
// dBm -105 -100 -95 -90 -70 -65 -60 -55
|
||||
// RSSI 110 120 130 140 180 190 200 210
|
||||
// 0000C0 6E 00 78 00 82 00 8C 00 B4 00 BE 00 C8 00 D2 00
|
||||
//
|
||||
const unsigned int band = 1;
|
||||
const int16_t level0 = gEEPROM_RSSI_CALIB[band][0];
|
||||
const int16_t level1 = gEEPROM_RSSI_CALIB[band][1];
|
||||
const int16_t level2 = gEEPROM_RSSI_CALIB[band][2];
|
||||
@ -716,9 +721,7 @@ void UI_DisplayMain(void)
|
||||
if (gSetting_live_DTMF_decoder && gDTMF_ReceivedSaved[0] >= 32)
|
||||
{ // show live DTMF decode
|
||||
const unsigned int len = strlen(gDTMF_ReceivedSaved);
|
||||
unsigned int idx = 0;
|
||||
while ((len - idx) > (17 - 5)) // display the last 'n' on-screen fittable chars
|
||||
idx++;
|
||||
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // just the last 'n' chars
|
||||
strcpy(String, "DTMF ");
|
||||
strcat(String, gDTMF_ReceivedSaved + idx);
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
|
Loading…
x
Reference in New Issue
Block a user