mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-21 17:19:57 +00:00
Compander setting now saved into each channel
This commit is contained in:
parent
30d6f3b371
commit
737e5ac8e2
@ -27,7 +27,7 @@ ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
|
||||
ENABLE_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead hold down keys 0-9 to access the functions
|
||||
ENABLE_BOOT_BEEPS := 0 give user audio feedback on volume knob position at boot-up
|
||||
ENABLE_COMPANDER := 1 compander option - setting not yet saved (per channel)
|
||||
ENABLE_COMPANDER := 1 compander option (per channel)
|
||||
ENABLE_SHOW_CHARGE_LEVEL := 1 show the charge level when the radio is on charge
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right)
|
||||
ENABLE_STATUSBAR_VOLTAGE := 0 show the battery voltage on the top status bar - when possible
|
||||
|
@ -578,7 +578,7 @@ void MENU_AcceptSetting(void)
|
||||
#ifdef ENABLE_COMPANDER
|
||||
case MENU_COMPAND:
|
||||
gTxVfo->Compander = gSubMenuSelection;
|
||||
//gRequestSaveChannel = 2;
|
||||
gRequestSaveChannel = 2;
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
16
bitmaps.c
16
bitmaps.c
@ -539,7 +539,7 @@ const uint8_t BITMAP_ScanList[6] =
|
||||
};
|
||||
*/
|
||||
const uint8_t BITMAP_ScanList1[6] =
|
||||
{ // 1 symbol
|
||||
{ // 'I' symbol
|
||||
0b00000000,
|
||||
0b00000000,
|
||||
0b01000010,
|
||||
@ -549,7 +549,7 @@ const uint8_t BITMAP_ScanList1[6] =
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_ScanList2[6] =
|
||||
{ // 2 symbol
|
||||
{ // 'II' symbol
|
||||
0b00000000,
|
||||
0b01000010,
|
||||
0b01111110,
|
||||
@ -557,3 +557,15 @@ const uint8_t BITMAP_ScanList2[6] =
|
||||
0b01111110,
|
||||
0b01000010
|
||||
};
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
const uint8_t BITMAP_compand[6] =
|
||||
{
|
||||
0b00000000,
|
||||
0b00111100,
|
||||
0b01000010,
|
||||
0b01000010,
|
||||
0b01000010,
|
||||
0b00100100
|
||||
};
|
||||
#endif
|
||||
|
@ -60,5 +60,9 @@ extern const uint8_t BITMAP_VFO_NotDefault[8];
|
||||
extern const uint8_t BITMAP_ScanList1[6];
|
||||
extern const uint8_t BITMAP_ScanList2[6];
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
extern const uint8_t BITMAP_compand[6];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
24
radio.c
24
radio.c
@ -48,7 +48,8 @@ STEP_Setting_t gStepSetting;
|
||||
VfoState_t VfoState[2];
|
||||
|
||||
bool RADIO_CheckValidChannel(uint16_t Channel, bool bCheckScanList, uint8_t VFO)
|
||||
{
|
||||
{ // return true if the channel appears valid
|
||||
|
||||
uint8_t Attributes;
|
||||
uint8_t PriorityCh1;
|
||||
uint8_t PriorityCh2;
|
||||
@ -56,8 +57,8 @@ bool RADIO_CheckValidChannel(uint16_t Channel, bool bCheckScanList, uint8_t VFO)
|
||||
if (!IS_MR_CHANNEL(Channel))
|
||||
return false;
|
||||
|
||||
// Check channel is valid
|
||||
Attributes = gMR_ChannelAttributes[Channel];
|
||||
|
||||
if ((Attributes & MR_CH_BAND_MASK) > BAND7_470MHz)
|
||||
return false;
|
||||
|
||||
@ -177,8 +178,9 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg)
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||
return;
|
||||
|
||||
gUpdateStatus = true;
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
|
||||
gUpdateStatus = true;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -203,7 +205,8 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg)
|
||||
|
||||
Attributes = gMR_ChannelAttributes[Channel];
|
||||
if (Attributes == 0xFF)
|
||||
{
|
||||
{ // invalid/unused channel
|
||||
|
||||
uint8_t Index;
|
||||
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
@ -220,8 +223,11 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg)
|
||||
|
||||
Band = Attributes & MR_CH_BAND_MASK;
|
||||
if (Band > BAND7_470MHz)
|
||||
Band = BAND6_400MHz;
|
||||
|
||||
{
|
||||
// Band = BAND6_400MHz;
|
||||
Band = FREQUENCY_GetBand(gEeprom.ScreenChannel[VFO]); // 111 bug fix, or have I broke it ?
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
{
|
||||
gEeprom.VfoInfo[VFO].Band = Band;
|
||||
@ -349,7 +355,9 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg)
|
||||
} __attribute__((packed)) Info;
|
||||
|
||||
EEPROM_ReadBuffer(Base, &Info, sizeof(Info));
|
||||
|
||||
pRadio->ConfigRX.Frequency = Info.Frequency;
|
||||
|
||||
if (Info.Offset >= 100000000)
|
||||
Info.Offset = 1000000;
|
||||
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = Info.Offset;
|
||||
@ -418,7 +426,7 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg)
|
||||
gEeprom.VfoInfo[VFO].IsAM = false;
|
||||
|
||||
#ifdef ENABLE_COMPANDER
|
||||
gEeprom.VfoInfo[VFO].Compander = 0; // off
|
||||
gEeprom.VfoInfo[VFO].Compander = (Attributes & MR_CH_COMPAND) >> 4;
|
||||
#endif
|
||||
|
||||
RADIO_ConfigureSquelchAndOutputPower(pRadio);
|
||||
@ -465,7 +473,7 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
Txp[1],
|
||||
Txp[2],
|
||||
LowerLimitFrequencyBandTable[Band],
|
||||
MiddleFrequencyBandTable[Band],
|
||||
MiddleFrequencyBandTable[Band],
|
||||
UpperLimitFrequencyBandTable[Band],
|
||||
pInfo->pTX->Frequency);
|
||||
}
|
||||
|
9
radio.h
9
radio.h
@ -23,9 +23,12 @@
|
||||
#include "dcs.h"
|
||||
|
||||
enum {
|
||||
MR_CH_SCANLIST1 = (1u << 7),
|
||||
MR_CH_SCANLIST2 = (1u << 6),
|
||||
MR_CH_BAND_MASK = 0x0Fu
|
||||
MR_CH_BAND_MASK = 0x0F << 0,
|
||||
#ifdef ENABLE_COMPANDER
|
||||
MR_CH_COMPAND = 3u << 4, // new
|
||||
#endif
|
||||
MR_CH_SCANLIST2 = 1u << 6,
|
||||
MR_CH_SCANLIST1 = 1u << 7
|
||||
};
|
||||
|
||||
enum {
|
||||
|
29
settings.c
29
settings.c
@ -229,7 +229,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
||||
}
|
||||
}
|
||||
|
||||
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool bUpdate)
|
||||
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
|
||||
{
|
||||
UART_LogSend("svalid\r\n", 8);
|
||||
|
||||
@ -238,32 +238,39 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool bUpdat
|
||||
#endif
|
||||
{
|
||||
uint8_t State[8];
|
||||
uint8_t Attributes = 0xFF;
|
||||
uint16_t Offset = 0x0D60 + (Channel & ~7U);
|
||||
uint8_t Attributes = 0xFF; // default attributes
|
||||
#ifdef ENABLE_COMPANDER
|
||||
Attributes &= ~MR_CH_COMPAND; // default to '0' = compander disabled
|
||||
#endif
|
||||
uint16_t Offset = 0x0D60 + (Channel & ~7u);
|
||||
|
||||
EEPROM_ReadBuffer(Offset, State, sizeof(State));
|
||||
|
||||
if (bUpdate)
|
||||
if (keep)
|
||||
{
|
||||
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Band << 0);
|
||||
if (State[Channel & 7U] == Attributes)
|
||||
return;
|
||||
#ifdef ENABLE_COMPANDER
|
||||
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Compander << 4) | (pVFO->Band << 0);
|
||||
#else
|
||||
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Band << 0);
|
||||
#endif
|
||||
if (State[Channel & 7u] == Attributes)
|
||||
return; // no change in the attributes
|
||||
}
|
||||
|
||||
State[Channel & 7U] = Attributes;
|
||||
State[Channel & 7u] = Attributes;
|
||||
|
||||
EEPROM_WriteBuffer(Offset, State);
|
||||
|
||||
gMR_ChannelAttributes[Channel] = Attributes;
|
||||
|
||||
#ifndef KEEP_MEM_NAME
|
||||
if (IS_MR_CHANNEL(Channel))
|
||||
// #ifndef KEEP_MEM_NAME
|
||||
if (IS_MR_CHANNEL(Channel) && !keep)
|
||||
{ // clear/reset the channel name
|
||||
const uint16_t OffsetMR = Channel * 16;
|
||||
memset(&State, 0xFF, sizeof(State));
|
||||
EEPROM_WriteBuffer(0x0F50 + OffsetMR, State);
|
||||
EEPROM_WriteBuffer(0x0F58 + OffsetMR, State);
|
||||
}
|
||||
#endif
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
|
@ -235,6 +235,6 @@ extern EEPROM_Config_t gEeprom;
|
||||
void SETTINGS_SaveVfoIndices(void);
|
||||
void SETTINGS_SaveSettings(void);
|
||||
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode);
|
||||
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool bUpdate);
|
||||
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep);
|
||||
|
||||
#endif
|
||||
|
44
ui/main.c
44
ui/main.c
@ -244,22 +244,19 @@ void UI_DisplayMain(void)
|
||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
|
||||
{ // channel mode
|
||||
|
||||
// show the scanlist symbols
|
||||
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
||||
// #ifdef ENABLE_BIG_FREQ
|
||||
// side-by-side
|
||||
if (Attributes & MR_CH_SCANLIST1)
|
||||
memmove(pLine0 + 113, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
|
||||
if (Attributes & MR_CH_SCANLIST2)
|
||||
memmove(pLine0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
|
||||
// #else
|
||||
// // top-bottom .. makes room for full 10 characters of channel name
|
||||
// if (Attributes & MR_CH_SCANLIST1)
|
||||
// memmove(pLine0 + 120, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
|
||||
// if (Attributes & MR_CH_SCANLIST2)
|
||||
// memmove(pLine0 + 120 + LCD_WIDTH, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
|
||||
// #endif
|
||||
|
||||
// show the channel symbols
|
||||
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
||||
if (attributes & MR_CH_SCANLIST1)
|
||||
memmove(pLine0 + 113, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
|
||||
if (attributes & MR_CH_SCANLIST2)
|
||||
memmove(pLine0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
|
||||
#ifndef ENABLE_BIG_FREQ
|
||||
#ifdef ENABLE_COMPANDER
|
||||
if ((attributes & MR_CH_COMPAND) > 0)
|
||||
memmove(pLine0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
switch (gEeprom.CHANNEL_DISPLAY_MODE)
|
||||
{
|
||||
case MDF_FREQUENCY: // show the channel frequency
|
||||
@ -327,6 +324,21 @@ void UI_DisplayMain(void)
|
||||
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
|
||||
UI_PrintString(String, 32, 0, Line, 8);
|
||||
#endif
|
||||
|
||||
// show the channel symbols
|
||||
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
|
||||
(void)attributes; // stop compiler warning/error
|
||||
#ifdef ENABLE_BIG_FREQ
|
||||
#ifdef ENABLE_COMPANDER
|
||||
if ((attributes & MR_CH_COMPAND) > 0)
|
||||
memmove(pLine0 + 120, BITMAP_compand, sizeof(BITMAP_compand));
|
||||
#endif
|
||||
#else
|
||||
#ifdef ENABLE_COMPANDER
|
||||
if ((attributes & MR_CH_COMPAND) > 0)
|
||||
memmove(pLine0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user