mirror of
https://github.com/kamilsss655/uv-k5-firmware-custom
synced 2024-11-21 17:57:59 +00:00
Tidy ups, speedier channel scanning, RSSI meter updating fix
This commit is contained in:
parent
e0aa1a83be
commit
3c7f496f3e
6
Makefile
6
Makefile
@ -21,15 +21,15 @@ ENABLE_TX_WHEN_AM := 0
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
||||
ENABLE_MAIN_KEY_HOLD := 1
|
||||
ENABLE_BOOT_BEEPS := 0
|
||||
ENABLE_COMPANDER := 0
|
||||
ENABLE_SHOW_CHARGE_LEVEL := 0
|
||||
ENABLE_COMPANDER := 1
|
||||
ENABLE_SHOW_CHARGE_LEVEL := 1
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 1
|
||||
ENABLE_CODE_SCAN_TIMEOUT := 0
|
||||
ENABLE_AM_FIX := 1
|
||||
ENABLE_AM_FIX_SHOW_DATA := 1
|
||||
ENABLE_SQUELCH_LOWER := 1
|
||||
ENABLE_RSSI_BAR := 1
|
||||
ENABLE_AUDIO_BAR := 0
|
||||
ENABLE_AUDIO_BAR := 1
|
||||
#ENABLE_COPY_CHAN_TO_VFO := 1
|
||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||
#ENABLE_BAND_SCOPE := 1
|
||||
|
117
app/app.c
117
app/app.c
@ -95,7 +95,7 @@ static void APP_CheckForIncoming(void)
|
||||
if (gCssScanMode != CSS_SCAN_MODE_OFF && gRxReceptionMode == RX_MODE_NONE)
|
||||
{ // CTCSS/DTS scanning
|
||||
|
||||
ScanPauseDelayIn_10ms = 100; // 1 second
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_5_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gRxReceptionMode = RX_MODE_DETECTED;
|
||||
}
|
||||
@ -160,7 +160,7 @@ static void APP_CheckForIncoming(void)
|
||||
return;
|
||||
}
|
||||
|
||||
ScanPauseDelayIn_10ms = 20; // 200ms
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||
gScheduleScanListen = false;
|
||||
}
|
||||
|
||||
@ -401,7 +401,7 @@ Skip:
|
||||
break;
|
||||
|
||||
case SCAN_RESUME_CO:
|
||||
ScanPauseDelayIn_10ms = 360;
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_7_10ms;
|
||||
gScheduleScanListen = false;
|
||||
break;
|
||||
|
||||
@ -490,7 +490,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
|
||||
case SCAN_RESUME_TO:
|
||||
if (!gScanPauseMode)
|
||||
{
|
||||
ScanPauseDelayIn_10ms = 500;
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
||||
gScheduleScanListen = false;
|
||||
gScanPauseMode = true;
|
||||
}
|
||||
@ -642,57 +642,76 @@ static void FREQ_NextChannel(void)
|
||||
RADIO_SetupRegisters(true);
|
||||
|
||||
gUpdateDisplay = true;
|
||||
ScanPauseDelayIn_10ms = 10;
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
|
||||
bScanKeepFrequency = false;
|
||||
}
|
||||
|
||||
static void MR_NextChannel(void)
|
||||
{
|
||||
const uint8_t Ch1 = gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT];
|
||||
const uint8_t Ch2 = gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT];
|
||||
const bool bEnabled = gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT];
|
||||
uint8_t PreviousCh = gNextMrChannel;
|
||||
uint8_t Ch;
|
||||
static unsigned int prev_mr_chan = 0;
|
||||
const bool enabled = gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT];
|
||||
const unsigned int chan1 = gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT];
|
||||
const unsigned int chan2 = gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT];
|
||||
const unsigned int prev_chan = gNextMrChannel;
|
||||
unsigned int chan = 0;
|
||||
|
||||
if (bEnabled)
|
||||
if (enabled)
|
||||
{
|
||||
if (gCurrentScanList == 0)
|
||||
switch (gCurrentScanList)
|
||||
{
|
||||
gPreviousMrChannel = gNextMrChannel;
|
||||
if (RADIO_CheckValidChannel(Ch1, false, 0))
|
||||
gNextMrChannel = Ch1;
|
||||
else
|
||||
gCurrentScanList = 1;
|
||||
}
|
||||
case SCAN_NEXT_CHAN_SCANLIST1:
|
||||
prev_mr_chan = gNextMrChannel;
|
||||
if (RADIO_CheckValidChannel(chan1, false, 0))
|
||||
{
|
||||
//gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gNextMrChannel = chan1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (gCurrentScanList == 1)
|
||||
{
|
||||
if (RADIO_CheckValidChannel(Ch2, false, 0))
|
||||
gNextMrChannel = Ch2;
|
||||
else
|
||||
gCurrentScanList = 2;
|
||||
}
|
||||
case SCAN_NEXT_CHAN_SCANLIST2:
|
||||
if (RADIO_CheckValidChannel(chan2, false, 0))
|
||||
{
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST2;
|
||||
gNextMrChannel = chan2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (gCurrentScanList == 2)
|
||||
{
|
||||
gNextMrChannel = gPreviousMrChannel;
|
||||
Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
|
||||
if (Ch == 0xFF)
|
||||
return;
|
||||
// this bit doesn't work at all :(
|
||||
case SCAN_NEXT_CHAN_DUAL_WATCH:
|
||||
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
// chan = (gEeprom.RX_CHANNEL + 1) & 1u;
|
||||
// chan = gEeprom.MrChannel[chan];
|
||||
// chan = gEeprom.ScreenChannel[chan];
|
||||
// chan = gEeprom.VfoInfo[chan].CHANNEL_SAVE;
|
||||
// chan = 14;
|
||||
// if (RADIO_CheckValidChannel(chan, false, 0))
|
||||
// {
|
||||
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
||||
// gNextMrChannel = chan;
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
gNextMrChannel = Ch;
|
||||
default:
|
||||
case SCAN_NEXT_CHAN_MR:
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_MR;
|
||||
gNextMrChannel = prev_mr_chan;
|
||||
chan = 0xffffffff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (!enabled || chan == 0xffffffff)
|
||||
{
|
||||
Ch = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
|
||||
if (Ch == 0xFF)
|
||||
chan = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT);
|
||||
if (chan == 0xFF)
|
||||
return;
|
||||
|
||||
gNextMrChannel = Ch;
|
||||
gNextMrChannel = chan;
|
||||
}
|
||||
|
||||
if (PreviousCh != gNextMrChannel)
|
||||
if (prev_chan != gNextMrChannel)
|
||||
{
|
||||
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
|
||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
|
||||
@ -703,12 +722,14 @@ static void MR_NextChannel(void)
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||
bScanKeepFrequency = false;
|
||||
// ScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||
ScanPauseDelayIn_10ms = 8; // 100ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
|
||||
|
||||
if (bEnabled)
|
||||
if (++gCurrentScanList > 2)
|
||||
gCurrentScanList = 0;
|
||||
bScanKeepFrequency = false;
|
||||
|
||||
if (enabled)
|
||||
if (++gCurrentScanList >= SCAN_NEXT_NUM)
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; // back round we go
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
@ -1450,7 +1471,6 @@ void APP_TimeSlice10ms(void)
|
||||
// Skipping authentic device checks
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
// if (gFmRadioCountdown_500ms > 0)
|
||||
if (gFmRadioMode && gFmRadioCountdown_500ms > 0) // 1of11
|
||||
return;
|
||||
#endif
|
||||
@ -1561,6 +1581,9 @@ void APP_TimeSlice10ms(void)
|
||||
switch (gScanCssState)
|
||||
{
|
||||
case SCAN_CSS_STATE_OFF:
|
||||
|
||||
// must be RF frequency scanning if we're here ?
|
||||
|
||||
if (!BK4819_GetFrequencyScanResult(&Result))
|
||||
break;
|
||||
|
||||
@ -1593,8 +1616,8 @@ void APP_TimeSlice10ms(void)
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
|
||||
//gScanDelay_10ms = scan_delay_10ms;
|
||||
gScanDelay_10ms = 20 / 10; // 20ms
|
||||
gScanDelay_10ms = scan_delay_10ms;
|
||||
//gScanDelay_10ms = 1; // 10ms
|
||||
break;
|
||||
|
||||
case SCAN_CSS_STATE_SCANNING:
|
||||
@ -1943,7 +1966,7 @@ void APP_TimeSlice500ms(void)
|
||||
}
|
||||
else
|
||||
gDTMF_DecodeRingCountdown_500ms = 0;
|
||||
|
||||
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE &&
|
||||
gCurrentFunction != FUNCTION_TRANSMIT &&
|
||||
gCurrentFunction != FUNCTION_RECEIVE)
|
||||
@ -1996,7 +2019,7 @@ void CHANNEL_Next(bool bFlag, int8_t Direction)
|
||||
RADIO_SelectVfos();
|
||||
|
||||
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
|
||||
gCurrentScanList = 0;
|
||||
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||
gScanState = Direction;
|
||||
|
||||
if (IS_MR_CHANNEL(gNextMrChannel))
|
||||
|
@ -717,14 +717,14 @@ void BK4819_SetupSquelch(
|
||||
//
|
||||
BK4819_WriteRegister(BK4819_REG_4E, // 01 101 11 1 00000000
|
||||
#if 0
|
||||
// original
|
||||
(1u << 14) // 1 ???
|
||||
| (5u << 11) // 5 squelch = 1 delay .. 0 ~ 7
|
||||
| (3u << 9) // 3 squelch = 0 delay .. 0 ~ 3
|
||||
| SquelchOpenGlitchThresh); // 0 ~ 255
|
||||
#else
|
||||
// supposedly fast
|
||||
(1u << 14) // 1 ???
|
||||
| (2u << 11) // squelch = 1 delay .. 0 ~ 7
|
||||
| (1u << 9) // squelch = 0 delay .. 0 ~ 3
|
||||
| SquelchOpenGlitchThresh); // 0 ~ 255
|
||||
#endif
|
||||
|
||||
@ -1487,10 +1487,15 @@ void BK4819_PlayRogerMDC(void)
|
||||
unsigned int i;
|
||||
|
||||
BK4819_SetAF(BK4819_AF_MUTE);
|
||||
BK4819_WriteRegister(BK4819_REG_58, 0x37C3); // FSK Enable, RX Bandwidth FFSK1200/1800, 0xAA or 0x55 Preamble, 11 RX Gain,
|
||||
// 101 RX Mode, FFSK1200/1800 TX
|
||||
BK4819_WriteRegister(BK4819_REG_72, 0x3065); // Set Tone2 to 1200Hz
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0x00E0); // Enable Tone2 and Set Tone2 Gain
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_58, 0x37C3); // FSK Enable,
|
||||
// RX Bandwidth FFSK 1200/1800
|
||||
// 0xAA or 0x55 Preamble
|
||||
// 11 RX Gain,
|
||||
// 101 RX Mode
|
||||
// TX FFSK 1200/1800
|
||||
BK4819_WriteRegister(BK4819_REG_72, 0x3065); // Set Tone-2 to 1200Hz
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0x00E0); // Enable Tone-2 and Set Tone2 Gain
|
||||
BK4819_WriteRegister(BK4819_REG_5D, 0x0D00); // Set FSK data length to 13 bytes
|
||||
BK4819_WriteRegister(BK4819_REG_59, 0x8068); // 4 byte sync length, 6 byte preamble, clear TX FIFO
|
||||
BK4819_WriteRegister(BK4819_REG_59, 0x0068); // Same, but clear TX FIFO is now unset (clearing done)
|
||||
@ -1509,7 +1514,7 @@ void BK4819_PlayRogerMDC(void)
|
||||
|
||||
SYSTEM_DelayMs(180);
|
||||
|
||||
// Stop FSK TX, reset Tone2, disable FSK
|
||||
// Stop FSK TX, reset Tone-2, disable FSK
|
||||
BK4819_WriteRegister(BK4819_REG_59, 0x0068);
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0x0000);
|
||||
BK4819_WriteRegister(BK4819_REG_58, 0x0000);
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -156,26 +156,16 @@ uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower)
|
||||
|
||||
return Lower + (Step * Index);
|
||||
}
|
||||
/*
|
||||
int TX_freq_check(VFO_Info_t *pInfo)
|
||||
{ // return '0' if TX frequency is allowed
|
||||
// otherwise return '-1'
|
||||
|
||||
const uint32_t Frequency = pInfo->pTX->Frequency;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (pInfo->CHANNEL_SAVE > FREQ_CHANNEL_LAST)
|
||||
return -1;
|
||||
#endif
|
||||
*/
|
||||
int TX_freq_check(const uint32_t Frequency)
|
||||
{ // return '0' if TX frequency is allowed
|
||||
// otherwise return '-1'
|
||||
|
||||
if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6])
|
||||
return -1;
|
||||
return -1; // not allowed outside this range
|
||||
|
||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
||||
return -1;
|
||||
return -1; // BX chip does not work in this range
|
||||
|
||||
switch (gSetting_F_LOCK)
|
||||
{
|
||||
|
12
misc.c
12
misc.c
@ -51,6 +51,9 @@ const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
||||
const uint16_t scan_pause_delay_in_2_10ms = 500 / 10; // 500ms
|
||||
const uint16_t scan_pause_delay_in_3_10ms = 200 / 10; // 200ms
|
||||
const uint16_t scan_pause_delay_in_4_10ms = 300 / 10; // 300ms
|
||||
const uint16_t scan_pause_delay_in_5_10ms = 1000 / 10; // 1 sec
|
||||
const uint16_t scan_pause_delay_in_6_10ms = 100 / 10; // 100ms
|
||||
const uint16_t scan_pause_delay_in_7_10ms = 3600 / 10; // 3.6 seconds
|
||||
|
||||
const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
|
||||
|
||||
@ -192,10 +195,11 @@ bool gFlagEndTransmission;
|
||||
uint16_t gLowBatteryCountdown;
|
||||
uint8_t gNextMrChannel;
|
||||
ReceptionMode_t gRxReceptionMode;
|
||||
uint8_t gRestoreMrChannel;
|
||||
uint8_t gCurrentScanList;
|
||||
uint8_t gPreviousMrChannel;
|
||||
uint32_t gRestoreFrequency;
|
||||
|
||||
uint8_t gRestoreMrChannel;
|
||||
enum scan_next_chan_t gCurrentScanList;
|
||||
uint32_t gRestoreFrequency;
|
||||
|
||||
bool gRxVfoIsActive;
|
||||
#ifdef ENABLE_ALARM
|
||||
uint8_t gAlarmToneCounter;
|
||||
|
18
misc.h
18
misc.h
@ -63,7 +63,6 @@ enum AlarmState_t {
|
||||
ALARM_STATE_ALARM,
|
||||
ALARM_STATE_TX1750
|
||||
};
|
||||
|
||||
typedef enum AlarmState_t AlarmState_t;
|
||||
|
||||
enum ReceptionMode_t {
|
||||
@ -71,7 +70,6 @@ enum ReceptionMode_t {
|
||||
RX_MODE_DETECTED, // signal detected
|
||||
RX_MODE_LISTENING //
|
||||
};
|
||||
|
||||
typedef enum ReceptionMode_t ReceptionMode_t;
|
||||
|
||||
enum CssScanMode_t
|
||||
@ -80,9 +78,17 @@ enum CssScanMode_t
|
||||
CSS_SCAN_MODE_SCANNING,
|
||||
CSS_SCAN_MODE_FOUND,
|
||||
};
|
||||
|
||||
typedef enum CssScanMode_t CssScanMode_t;
|
||||
|
||||
enum scan_next_chan_t {
|
||||
SCAN_NEXT_CHAN_SCANLIST1 = 0,
|
||||
SCAN_NEXT_CHAN_SCANLIST2,
|
||||
SCAN_NEXT_CHAN_DUAL_WATCH,
|
||||
SCAN_NEXT_CHAN_MR,
|
||||
SCAN_NEXT_NUM
|
||||
};
|
||||
typedef enum scan_next_chan_t scan_next_chan_t;
|
||||
|
||||
extern const uint8_t fm_resume_countdown_500ms;
|
||||
extern const uint8_t fm_radio_countdown_500ms;
|
||||
extern const uint16_t fm_play_countdown_scan_10ms;
|
||||
@ -127,6 +133,9 @@ extern const uint16_t scan_pause_delay_in_1_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_2_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_3_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_4_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_5_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_6_10ms;
|
||||
extern const uint16_t scan_pause_delay_in_7_10ms;
|
||||
|
||||
//extern const uint16_t gMax_bat_v;
|
||||
//extern const uint16_t gMin_bat_v;
|
||||
@ -256,10 +265,11 @@ extern bool gFlagEndTransmission;
|
||||
extern uint16_t gLowBatteryCountdown;
|
||||
extern uint8_t gNextMrChannel;
|
||||
extern ReceptionMode_t gRxReceptionMode;
|
||||
|
||||
extern uint8_t gRestoreMrChannel;
|
||||
extern uint8_t gCurrentScanList;
|
||||
extern uint8_t gPreviousMrChannel;
|
||||
extern uint32_t gRestoreFrequency;
|
||||
|
||||
extern bool gRxVfoIsActive;
|
||||
extern uint8_t gAlarmToneCounter;
|
||||
extern uint16_t gAlarmRunningCounter;
|
||||
|
56
ui/main.c
56
ui/main.c
@ -36,7 +36,18 @@
|
||||
#include "ui/main.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
bool center_line_is_free = true;
|
||||
enum center_line_t {
|
||||
CENTER_LINE_NONE = 0,
|
||||
CENTER_LINE_IN_USE,
|
||||
CENTER_LINE_AUDIO_BAR,
|
||||
CENTER_LINE_RSSI,
|
||||
CENTER_LINE_AM_FIX_DATA,
|
||||
CENTER_LINE_DTMF_DEC,
|
||||
CENTER_LINE_CHARGE_DATA
|
||||
};
|
||||
typedef enum center_line_t center_line_t;
|
||||
|
||||
center_line_t center_line = CENTER_LINE_NONE;
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
@ -154,14 +165,14 @@ bool center_line_is_free = true;
|
||||
|
||||
if (rssi_dBm >= (s9_dBm + 6))
|
||||
{ // S9+XXdB, 1dB increment
|
||||
const char *fmt[] = {"%-4d +%u ", "%-4d +%2u "};
|
||||
const unsigned int dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99;
|
||||
sprintf(s, (dB < 10) ? fmt[0] : fmt[1], rssi_dBm, dB);
|
||||
const char *fmt[] = {"%3d 9+%u ", "%3d 9+%2u "};
|
||||
const unsigned int s9_dB = ((rssi_dBm - s9_dBm) <= 99) ? rssi_dBm - s9_dBm : 99;
|
||||
sprintf(s, (s9_dB < 10) ? fmt[0] : fmt[1], rssi_dBm, s9_dB);
|
||||
}
|
||||
else
|
||||
{ // S0 ~ S9, 6dB per S-point
|
||||
const unsigned int s_level = (rssi_dBm >= s0_dBm) ? (rssi_dBm - s0_dBm) / 6 : 0;
|
||||
sprintf(s, "%-4d S%u ", rssi_dBm, s_level);
|
||||
sprintf(s, "%4d S%u ", rssi_dBm, s_level);
|
||||
}
|
||||
UI_PrintStringSmall(s, 2, 0, line);
|
||||
|
||||
@ -184,7 +195,9 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
{
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
|
||||
if (!center_line_is_free)
|
||||
// optional larger RSSI dBm, S-point and bar level
|
||||
|
||||
if (center_line != CENTER_LINE_RSSI)
|
||||
return;
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
@ -193,9 +206,11 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
|
||||
{
|
||||
UI_DisplayRSSIBar(rssi, true);
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
// original little RS bars
|
||||
|
||||
// const int16_t dBm = (rssi / 2) - 160;
|
||||
const uint8_t Line = (vfo == 0) ? 3 : 7;
|
||||
uint8_t *p_line = gFrameBuffer[Line - 1];
|
||||
@ -290,8 +305,7 @@ void UI_DisplayMain(void)
|
||||
char String[16];
|
||||
unsigned int vfo_num;
|
||||
|
||||
// true if the center screen line is available to use
|
||||
center_line_is_free = true;
|
||||
center_line = CENTER_LINE_NONE;
|
||||
|
||||
// #ifdef SINGLE_VFO_CHAN
|
||||
// const bool single_vfo = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF && gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? true : false;
|
||||
@ -356,7 +370,7 @@ void UI_DisplayMain(void)
|
||||
{
|
||||
sprintf(String, ">%s", gDTMF_InputBox);
|
||||
|
||||
center_line_is_free = false;
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
}
|
||||
UI_PrintString(String, 2, 0, vfo_num * 3, 8);
|
||||
|
||||
@ -375,11 +389,11 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
center_line_is_free = false;
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
}
|
||||
UI_PrintString(String, 2, 0, 2 + (vfo_num * 3), 8);
|
||||
|
||||
center_line_is_free = false;
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -483,7 +497,7 @@ void UI_DisplayMain(void)
|
||||
{ // user entering a frequency
|
||||
UI_DisplayFrequency(gInputBox, 32, line, true, false);
|
||||
|
||||
center_line_is_free = false;
|
||||
// center_line = CENTER_LINE_IN_USE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -689,7 +703,7 @@ void UI_DisplayMain(void)
|
||||
UI_PrintStringSmall("SCR", LCD_WIDTH + 106, 0, line + 1);
|
||||
}
|
||||
|
||||
if (center_line_is_free)
|
||||
if (center_line == CENTER_LINE_NONE)
|
||||
{ // we're free to use the middle line
|
||||
|
||||
const bool rx = (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||
@ -700,7 +714,7 @@ void UI_DisplayMain(void)
|
||||
if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{
|
||||
UI_DisplayAudioBar();
|
||||
center_line_is_free = false;
|
||||
center_line = CENTER_LINE_AUDIO_BAR;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -710,7 +724,7 @@ void UI_DisplayMain(void)
|
||||
{
|
||||
AM_fix_print_data(gEeprom.RX_CHANNEL, String);
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
center_line_is_free = false;
|
||||
center_line = CENTER_LINE_AM_FIX_DATA;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -719,11 +733,11 @@ void UI_DisplayMain(void)
|
||||
if (rx)
|
||||
{
|
||||
UI_DisplayRSSIBar(gCurrentRSSI[gEeprom.RX_CHANNEL], false);
|
||||
center_line_is_free = false;
|
||||
center_line = CENTER_LINE_RSSI;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
|
||||
if (rx || gCurrentFunction == FUNCTION_FOREGROUND || gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
{
|
||||
#if 1
|
||||
@ -734,7 +748,7 @@ void UI_DisplayMain(void)
|
||||
strcpy(String, "DTMF ");
|
||||
strcat(String, gDTMF_RX_live + idx);
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
center_line_is_free = false;
|
||||
center_line = CENTER_LINE_DTMF_DEC;
|
||||
}
|
||||
#else
|
||||
if (gSetting_live_DTMF_decoder && gDTMF_RX_index > 0)
|
||||
@ -744,7 +758,7 @@ void UI_DisplayMain(void)
|
||||
strcpy(String, "DTMF ");
|
||||
strcat(String, gDTMF_RX + idx);
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
center_line_is_free = false;
|
||||
center_line = CENTER_LINE_DTMF_DEC;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -756,7 +770,7 @@ void UI_DisplayMain(void)
|
||||
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
|
||||
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||
UI_PrintStringSmall(String, 2, 0, 3);
|
||||
center_line_is_free = false;
|
||||
center_line = CENTER_LINE_CHARGE_DATA;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
62
ui/menu.c
62
ui/menu.c
@ -207,9 +207,6 @@ const char gSubMenu_XB[3][10] =
|
||||
|
||||
const char gSubMenu_SC_REV[3][13] =
|
||||
{
|
||||
// "TIME\nOPER",
|
||||
// "CARRIER\nOPER",
|
||||
// "SEARCH\nOPER"
|
||||
"TIME",
|
||||
"CARRIER",
|
||||
"SEARCH"
|
||||
@ -231,9 +228,9 @@ const char gSubMenu_MDF[4][15] =
|
||||
};
|
||||
#endif
|
||||
|
||||
const char gSubMenu_D_RSP[4][6] =
|
||||
const char gSubMenu_D_RSP[4][11] =
|
||||
{
|
||||
"NULL",
|
||||
"DO\nNOTHING",
|
||||
"RING",
|
||||
"REPLY",
|
||||
"BOTH"
|
||||
@ -255,11 +252,11 @@ const char gSubMenu_PONMSG[4][8] =
|
||||
"NONE"
|
||||
};
|
||||
|
||||
const char gSubMenu_ROGER[3][6] =
|
||||
const char gSubMenu_ROGER[3][9] =
|
||||
{
|
||||
"OFF",
|
||||
"ROGER",
|
||||
"MDC"
|
||||
"MDC\n1200"
|
||||
};
|
||||
|
||||
const char gSubMenu_RESET[2][4] =
|
||||
@ -339,7 +336,7 @@ int32_t gSubMenuSelection;
|
||||
int32_t gSubMenuSelection_original = 0; // copy of the original value
|
||||
|
||||
// edit box
|
||||
char edit_original[17] = {0}; // a copy of the text before editing so that we can easily test for changes/difference
|
||||
char edit_original[17]; // a copy of the text before editing so that we can easily test for changes/difference
|
||||
char edit[17];
|
||||
int edit_index;
|
||||
|
||||
@ -349,21 +346,21 @@ void UI_DisplayMenu(void)
|
||||
const unsigned int menu_item_x1 = (8 * menu_list_width) + 2;
|
||||
const unsigned int menu_item_x2 = LCD_WIDTH - 1;
|
||||
unsigned int i;
|
||||
char String[64];
|
||||
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
||||
char Contact[16];
|
||||
|
||||
// clear the screen
|
||||
// clear the screen buffer
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
// draw the left menu list
|
||||
#if 0
|
||||
|
||||
// original menu layout
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (gMenuCursor > 0 || i > 0)
|
||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
|
||||
|
||||
// invert the current menu list item text pixels
|
||||
// invert the current menu list item pixels
|
||||
for (i = 0; i < (8 * menu_list_width); i++)
|
||||
{
|
||||
gFrameBuffer[2][i] ^= 0xFF;
|
||||
@ -374,7 +371,7 @@ void UI_DisplayMenu(void)
|
||||
for (i = 0; i < 7; i++)
|
||||
gFrameBuffer[i][(8 * menu_list_width) + 1] = 0xAA;
|
||||
|
||||
// draw the little triangle marker if we're in the sub-menu
|
||||
// draw the little sub-menu triangle marker
|
||||
if (gIsInSubMenu)
|
||||
memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
||||
|
||||
@ -383,14 +380,15 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintStringSmall(String, 2, 0, 6);
|
||||
|
||||
#else
|
||||
{
|
||||
{ // new menu layout .. experimental & unfinished
|
||||
|
||||
const int menu_index = gMenuCursor; // current selected menu item
|
||||
i = 1;
|
||||
|
||||
if (!gIsInSubMenu)
|
||||
{
|
||||
while (i < 2)
|
||||
{ // leading menu items
|
||||
{ // leading menu items - small text
|
||||
const int k = menu_index + i - 2;
|
||||
if (k < 0)
|
||||
UI_PrintStringSmall(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round
|
||||
@ -400,13 +398,13 @@ void UI_DisplayMenu(void)
|
||||
i++;
|
||||
}
|
||||
|
||||
// current menu item
|
||||
// current menu item - keep big n fat
|
||||
if (menu_index >= 0 && menu_index < (int)gMenuListCount)
|
||||
UI_PrintString(MenuList[menu_index].name, 0, 0, 2, 8);
|
||||
i++;
|
||||
|
||||
while (i < 4)
|
||||
{ // trailing menu item
|
||||
{ // trailing menu item - small text
|
||||
const int k = menu_index + i - 2;
|
||||
if (k >= 0 && k < (int)gMenuListCount)
|
||||
UI_PrintStringSmall(MenuList[k].name, 0, 0, 1 + i);
|
||||
@ -589,7 +587,6 @@ void UI_DisplayMenu(void)
|
||||
const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection);
|
||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
|
||||
}
|
||||
|
||||
already_printed = true;
|
||||
@ -619,7 +616,6 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(edit, menu_item_x1, 0, 2, 8);
|
||||
if (edit_index < 10)
|
||||
UI_PrintString( "^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor
|
||||
// UI_PrintStringSmall("^", menu_item_x1 + (8 * edit_index), 0, 4);
|
||||
}
|
||||
|
||||
if (!gAskForConfirmation)
|
||||
@ -629,7 +625,6 @@ void UI_DisplayMenu(void)
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||
else
|
||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@ -769,9 +764,9 @@ void UI_DisplayMenu(void)
|
||||
}
|
||||
|
||||
if (!already_printed)
|
||||
{
|
||||
{ // we now do multi-line text in a single string
|
||||
|
||||
unsigned int y;
|
||||
unsigned int k = 0;
|
||||
unsigned int lines = 1;
|
||||
unsigned int len = strlen(String);
|
||||
bool small = false;
|
||||
@ -782,9 +777,9 @@ void UI_DisplayMenu(void)
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (String[i] == '\n' && i < (len - 1))
|
||||
{
|
||||
{ // found new line char
|
||||
lines++;
|
||||
String[i] = 0;
|
||||
String[i] = 0; // null terminate the line
|
||||
}
|
||||
}
|
||||
|
||||
@ -795,21 +790,28 @@ void UI_DisplayMenu(void)
|
||||
lines = 7;
|
||||
}
|
||||
|
||||
// move the 1st line up
|
||||
// center vertically'ish
|
||||
if (small)
|
||||
y = 3 - ((lines + 0) / 2);
|
||||
y = 3 - ((lines + 0) / 2); // untested
|
||||
else
|
||||
y = 2 - ((lines + 0) / 2);
|
||||
|
||||
// draw the text lines
|
||||
for (i = 0; i < len && lines > 0; lines--)
|
||||
{
|
||||
if (small)
|
||||
UI_PrintStringSmall(String + k, menu_item_x1, menu_item_x2, y);
|
||||
UI_PrintStringSmall(String + i, menu_item_x1, menu_item_x2, y);
|
||||
else
|
||||
UI_PrintString(String + k, menu_item_x1, menu_item_x2, y, 8);
|
||||
UI_PrintString(String + i, menu_item_x1, menu_item_x2, y, 8);
|
||||
|
||||
// look for start of next line
|
||||
while (i < len && String[i] >= 32)
|
||||
i++;
|
||||
k = ++i;
|
||||
|
||||
// hop over the null term char(s)
|
||||
while (i < len && String[i] < 32)
|
||||
i++;
|
||||
|
||||
y += small ? 1 : 2;
|
||||
}
|
||||
}
|
||||
|
@ -135,10 +135,10 @@ extern const char gSubMenu_MDF[4][15];
|
||||
#ifdef ENABLE_ALARM
|
||||
extern const char gSubMenu_AL_MOD[2][5];
|
||||
#endif
|
||||
extern const char gSubMenu_D_RSP[4][6];
|
||||
extern const char gSubMenu_D_RSP[4][11];
|
||||
extern const char gSubMenu_PTT_ID[4][7];
|
||||
extern const char gSubMenu_PONMSG[4][8];
|
||||
extern const char gSubMenu_ROGER[3][6];
|
||||
extern const char gSubMenu_ROGER[3][9];
|
||||
extern const char gSubMenu_RESET[2][4];
|
||||
extern const char gSubMenu_F_LOCK[6][4];
|
||||
extern const char gSubMenu_BACKLIGHT[8][7];
|
||||
|
Loading…
Reference in New Issue
Block a user