0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-29 06:41:25 +03:00

Let copy-chan-to-vfo work when dual-watch enabled

This commit is contained in:
OneOfEleven 2023-10-05 00:01:13 +01:00
parent a6324ffcf8
commit 56fc929921
5 changed files with 135 additions and 133 deletions

View File

@ -639,12 +639,12 @@ static void FREQ_NextChannel(void)
static void MR_NextChannel(void)
{
static int prev_mr_chan = 0;
static unsigned int prev_mr_chan = 0;
const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true;
const int chan1 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT] : -1;
const int chan2 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT] : -1;
const int prev_chan = gNextMrChannel;
int chan = 0;
const unsigned int prev_chan = gNextMrChannel;
unsigned int chan = 0;
if (enabled)
{
@ -657,7 +657,7 @@ static void MR_NextChannel(void)
{
if (RADIO_CheckValidChannel(chan1, false, 0))
{
//gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
gNextMrChannel = chan1;
break;
}
@ -674,31 +674,31 @@ static void MR_NextChannel(void)
}
}
// this bit doesn't work at all - yet :(
// this bit doesn't yet work if the other VFO is a frequency
case SCAN_NEXT_CHAN_DUAL_WATCH:
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
// dual watch is enabled - include the other VFO in the scan
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
{
// chan = (gEeprom.RX_CHANNEL + 1) & 1u;
// chan = gEeprom.ScreenChannel[chan];
// chan = 14;
// if (RADIO_CheckValidChannel(chan, false, 0))
// {
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
// gNextMrChannel = chan;
// break;
// }
chan = (gEeprom.RX_CHANNEL + 1) & 1u;
chan = gEeprom.ScreenChannel[chan];
if (IS_MR_CHANNEL(chan))
{
gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
gNextMrChannel = chan;
break;
}
}
default:
case SCAN_NEXT_CHAN_MR:
gCurrentScanList = SCAN_NEXT_CHAN_MR;
gNextMrChannel = prev_mr_chan;
chan = 0xffffffff;
chan = 0xff;
break;
}
}
if (!enabled || chan == 0xffffffff)
if (!enabled || chan == 0xff)
{
chan = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
if (chan == 0xFF)
@ -711,9 +711,9 @@ static void MR_NextChannel(void)
gNextMrChannel = chan;
}
if (prev_chan != gNextMrChannel)
if (gNextMrChannel != prev_chan)
{
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
gEeprom.MrChannel[ gEeprom.RX_CHANNEL] = gNextMrChannel;
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, VFO_CONFIGURE_RELOAD);

View File

@ -554,8 +554,8 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
gUpdateStatus = true;
#ifdef ENABLE_COPY_CHAN_TO_VFO
if (gEeprom.VFO_OPEN &&
gEeprom.DUAL_WATCH == DUAL_WATCH_OFF &&
gScanState == SCAN_OFF &&
gCssScanMode == CSS_SCAN_MODE_OFF)
{ // copy channel to VFO
@ -580,10 +580,11 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
}
#else
// copy channel to same VFO
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[gEeprom.RX_CHANNEL]))
const unsigned int chan = (gEeprom.DUAL_WATCH == DUAL_WATCH_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[chan]))
{
channel = gEeprom.ScreenChannel[gEeprom.RX_CHANNEL];
vfo = gEeprom.RX_CHANNEL;
channel = gEeprom.ScreenChannel[chan];
vfo = chan;
}
#endif
@ -611,14 +612,14 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
RADIO_SetupRegisters(true);
// SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gRxVfo, 1);
//SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gRxVfo, 1);
gUpdateStatus = true;
gUpdateDisplay = true;
}
}
#endif
#endif
}
}

Binary file not shown.

Binary file not shown.

View File

@ -85,22 +85,22 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
const unsigned int bar_width = LCD_WIDTH - 2 - bar_x;
unsigned int i;
if (gScreenToDisplay != DISPLAY_MAIN)
return;
#if 1
// TX audio level
if (gCurrentFunction != FUNCTION_TRANSMIT ||
gScreenToDisplay != DISPLAY_MAIN ||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
{
return; // screen is in use
}
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
if (gAlarmState != ALARM_STATE_OFF)
return;
#endif
{
#if 1
// TX audio level
const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0
// const unsigned int max = 65535;
@ -140,6 +140,7 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
ST7565_BlitFullScreen();
}
}
}
#endif
#if defined(ENABLE_RSSI_BAR)