mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 22:31:25 +03:00
Let copy-chan-to-vfo work when dual-watch enabled
This commit is contained in:
parent
a6324ffcf8
commit
56fc929921
44
app/app.c
44
app/app.c
@ -639,12 +639,12 @@ static void FREQ_NextChannel(void)
|
|||||||
|
|
||||||
static void MR_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 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 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 chan2 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||||
const int prev_chan = gNextMrChannel;
|
const unsigned int prev_chan = gNextMrChannel;
|
||||||
int chan = 0;
|
unsigned int chan = 0;
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
@ -657,7 +657,7 @@ static void MR_NextChannel(void)
|
|||||||
{
|
{
|
||||||
if (RADIO_CheckValidChannel(chan1, false, 0))
|
if (RADIO_CheckValidChannel(chan1, false, 0))
|
||||||
{
|
{
|
||||||
//gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||||
gNextMrChannel = chan1;
|
gNextMrChannel = chan1;
|
||||||
break;
|
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:
|
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.RX_CHANNEL + 1) & 1u;
|
||||||
// chan = gEeprom.ScreenChannel[chan];
|
chan = gEeprom.ScreenChannel[chan];
|
||||||
// chan = 14;
|
if (IS_MR_CHANNEL(chan))
|
||||||
// if (RADIO_CheckValidChannel(chan, false, 0))
|
{
|
||||||
// {
|
gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
||||||
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
gNextMrChannel = chan;
|
||||||
// gNextMrChannel = chan;
|
break;
|
||||||
// break;
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case SCAN_NEXT_CHAN_MR:
|
case SCAN_NEXT_CHAN_MR:
|
||||||
gCurrentScanList = SCAN_NEXT_CHAN_MR;
|
gCurrentScanList = SCAN_NEXT_CHAN_MR;
|
||||||
gNextMrChannel = prev_mr_chan;
|
gNextMrChannel = prev_mr_chan;
|
||||||
chan = 0xffffffff;
|
chan = 0xff;
|
||||||
break;
|
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);
|
chan = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
|
||||||
if (chan == 0xFF)
|
if (chan == 0xFF)
|
||||||
@ -711,9 +711,9 @@ static void MR_NextChannel(void)
|
|||||||
gNextMrChannel = chan;
|
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;
|
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = gNextMrChannel;
|
||||||
|
|
||||||
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, VFO_CONFIGURE_RELOAD);
|
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, VFO_CONFIGURE_RELOAD);
|
||||||
|
125
app/main.c
125
app/main.c
@ -554,71 +554,72 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
||||||
if (gEeprom.VFO_OPEN &&
|
|
||||||
gEeprom.DUAL_WATCH == DUAL_WATCH_OFF &&
|
if (gEeprom.VFO_OPEN &&
|
||||||
gScanState == SCAN_OFF &&
|
gScanState == SCAN_OFF &&
|
||||||
gCssScanMode == CSS_SCAN_MODE_OFF)
|
gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
{ // copy channel to VFO
|
{ // copy channel to VFO
|
||||||
|
|
||||||
int channel = -1;
|
int channel = -1;
|
||||||
int vfo = -1;
|
int vfo = -1;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// copy channel to opposite VFO
|
// copy channel to opposite VFO
|
||||||
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[0]) &&
|
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[0]) &&
|
||||||
IS_MR_CHANNEL(gEeprom.ScreenChannel[1]))
|
IS_MR_CHANNEL(gEeprom.ScreenChannel[1]))
|
||||||
{
|
{
|
||||||
channel = gEeprom.ScreenChannel[1];
|
channel = gEeprom.ScreenChannel[1];
|
||||||
vfo = 0;
|
vfo = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[1]) &&
|
||||||
|
IS_MR_CHANNEL(gEeprom.ScreenChannel[0]))
|
||||||
|
{
|
||||||
|
channel = gEeprom.ScreenChannel[0];
|
||||||
|
vfo = 1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// copy channel to same VFO
|
||||||
|
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[chan];
|
||||||
|
vfo = chan;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (channel >= 0 && vfo >= 0)
|
||||||
|
{ // copy the channel into the VFO
|
||||||
|
|
||||||
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
|
gEeprom.MrChannel[vfo] = channel;
|
||||||
|
gEeprom.ScreenChannel[vfo] = channel;
|
||||||
|
RADIO_ConfigureChannel(vfo, VFO_CONFIGURE_RELOAD);
|
||||||
|
|
||||||
|
channel = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band;
|
||||||
|
gEeprom.MrChannel[vfo] = channel;
|
||||||
|
gEeprom.ScreenChannel[vfo] = channel;
|
||||||
|
gEeprom.VfoInfo[vfo].CHANNEL_SAVE = channel;
|
||||||
|
|
||||||
|
// swap to the VFO
|
||||||
|
gEeprom.TX_CHANNEL = vfo;
|
||||||
|
gEeprom.RX_CHANNEL = vfo;
|
||||||
|
RADIO_SelectVfos();
|
||||||
|
|
||||||
|
RADIO_ApplyOffset(gRxVfo);
|
||||||
|
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||||
|
|
||||||
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
|
//SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gRxVfo, 1);
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[1]) &&
|
|
||||||
IS_MR_CHANNEL(gEeprom.ScreenChannel[0]))
|
|
||||||
{
|
|
||||||
channel = gEeprom.ScreenChannel[0];
|
|
||||||
vfo = 1;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
// copy channel to same VFO
|
|
||||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[gEeprom.RX_CHANNEL]))
|
|
||||||
{
|
|
||||||
channel = gEeprom.ScreenChannel[gEeprom.RX_CHANNEL];
|
|
||||||
vfo = gEeprom.RX_CHANNEL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (channel >= 0 && vfo >= 0)
|
|
||||||
{ // copy the channel into the VFO
|
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
|
|
||||||
gEeprom.MrChannel[vfo] = channel;
|
|
||||||
gEeprom.ScreenChannel[vfo] = channel;
|
|
||||||
RADIO_ConfigureChannel(vfo, VFO_CONFIGURE_RELOAD);
|
|
||||||
|
|
||||||
channel = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band;
|
|
||||||
gEeprom.MrChannel[vfo] = channel;
|
|
||||||
gEeprom.ScreenChannel[vfo] = channel;
|
|
||||||
gEeprom.VfoInfo[vfo].CHANNEL_SAVE = channel;
|
|
||||||
|
|
||||||
// swap to the VFO
|
|
||||||
gEeprom.TX_CHANNEL = vfo;
|
|
||||||
gEeprom.RX_CHANNEL = vfo;
|
|
||||||
RADIO_SelectVfos();
|
|
||||||
|
|
||||||
RADIO_ApplyOffset(gRxVfo);
|
|
||||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
|
||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
|
||||||
|
|
||||||
// SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gRxVfo, 1);
|
|
||||||
|
|
||||||
gUpdateStatus = true;
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
99
ui/main.c
99
ui/main.c
@ -85,59 +85,60 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
|||||||
const unsigned int bar_width = LCD_WIDTH - 2 - bar_x;
|
const unsigned int bar_width = LCD_WIDTH - 2 - bar_x;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_MAIN)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// TX audio level
|
|
||||||
|
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
||||||
gScreenToDisplay != DISPLAY_MAIN ||
|
gScreenToDisplay != DISPLAY_MAIN ||
|
||||||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
gDTMF_CallState != DTMF_CALL_STATE_NONE)
|
||||||
|
{
|
||||||
return; // screen is in use
|
return; // screen is in use
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
if (gAlarmState != ALARM_STATE_OFF)
|
if (gAlarmState != ALARM_STATE_OFF)
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{
|
||||||
|
#if 1
|
||||||
|
// TX audio level
|
||||||
|
|
||||||
|
const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0
|
||||||
|
|
||||||
|
// const unsigned int max = 65535;
|
||||||
|
// const unsigned int level = ((voice_amp * bar_width) + (max / 2)) / max; // with rounding
|
||||||
|
// const unsigned int len = (level <= bar_width) ? level : bar_width;
|
||||||
|
|
||||||
|
// make non-linear to make more sensitive at low values
|
||||||
|
const unsigned int level = voice_amp * 8;
|
||||||
|
const unsigned int sqrt_level = sqrt16((level < 65535) ? level : 65535);
|
||||||
|
const unsigned int len = (sqrt_level <= bar_width) ? sqrt_level : bar_width;
|
||||||
|
|
||||||
|
#else
|
||||||
|
// TX/RX AF input level (dB)
|
||||||
|
|
||||||
|
const uint8_t af_tx_rx = BK4819_GetAfTxRx(); // 6:0
|
||||||
|
const unsigned int max = 63;
|
||||||
|
const unsigned int level = (((uint16_t)af_tx_rx * bar_width) + (max / 2)) / max; // with rounding
|
||||||
|
const unsigned int len = (level <= bar_width) ? level : bar_width;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0
|
uint8_t *p_line = gFrameBuffer[line];
|
||||||
|
|
||||||
// const unsigned int max = 65535;
|
memset(p_line, 0, LCD_WIDTH);
|
||||||
// const unsigned int level = ((voice_amp * bar_width) + (max / 2)) / max; // with rounding
|
|
||||||
// const unsigned int len = (level <= bar_width) ? level : bar_width;
|
#if 1
|
||||||
|
// solid bar
|
||||||
// make non-linear to make more sensitive at low values
|
for (i = 0; i < bar_width; i++)
|
||||||
const unsigned int level = voice_amp * 8;
|
p_line[bar_x + i] = (i > len) ? ((i & 1) == 0) ? 0x41 : 0x00 : ((i & 1) == 0) ? 0x7f : 0x3e;
|
||||||
const unsigned int sqrt_level = sqrt16((level < 65535) ? level : 65535);
|
#else
|
||||||
const unsigned int len = (sqrt_level <= bar_width) ? sqrt_level : bar_width;
|
// knuled bar
|
||||||
|
for (i = 0; i < bar_width; i += 2)
|
||||||
#else
|
p_line[bar_x + i] = (i <= len) ? 0x7f : 0x41;
|
||||||
// TX/RX AF input level (dB)
|
#endif
|
||||||
|
|
||||||
const uint8_t af_tx_rx = BK4819_GetAfTxRx(); // 6:0
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
const unsigned int max = 63;
|
ST7565_BlitFullScreen();
|
||||||
const unsigned int level = (((uint16_t)af_tx_rx * bar_width) + (max / 2)) / max; // with rounding
|
}
|
||||||
const unsigned int len = (level <= bar_width) ? level : bar_width;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t *p_line = gFrameBuffer[line];
|
|
||||||
|
|
||||||
memset(p_line, 0, LCD_WIDTH);
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// solid bar
|
|
||||||
for (i = 0; i < bar_width; i++)
|
|
||||||
p_line[bar_x + i] = (i > len) ? ((i & 1) == 0) ? 0x41 : 0x00 : ((i & 1) == 0) ? 0x7f : 0x3e;
|
|
||||||
#else
|
|
||||||
// knuled bar
|
|
||||||
for (i = 0; i < bar_width; i += 2)
|
|
||||||
p_line[bar_x + i] = (i <= len) ? 0x7f : 0x41;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
|
||||||
ST7565_BlitFullScreen();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user