diff --git a/Makefile b/Makefile index 227c627..f8045dd 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ ENABLE_SWD := 0 ENABLE_OVERLAY := 1 ENABLE_UART := 1 ENABLE_AIRCOPY := 0 -ENABLE_FMRADIO := 1 +ENABLE_FMRADIO := 0 ENABLE_NOAA := 0 ENABLE_VOICE := 0 ENABLE_ALARM := 0 diff --git a/README.md b/README.md index 88584f7..498b5ce 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,18 @@ https://github.com/DualTachyon/uv-k5-firmware A cool achievement +# Radio performance + +Please note that the Quansheng uv-k radios are not professional quality transceivers, their +performance is strictly limited, somewhat below that of a decent transceiver. The RX front +end has no track-tuned band pass filtering at all, and so are wide band/wide open to any +and all signals over a wide frequency range. Using the radio in high intensity RF environments +will nearly always destroy your reception, the receiver simply doesn't have a great dynamic +range, though are quite sensitive (weak signal wise). + +Saying that, they are nice toys for the price, fun to play with, though limited due to +absolute minimal cost hardware design (£13 all in china to UK). + # User customization You can customize the firmware by enabling/disabling various compile options. diff --git a/app/aircopy.c b/app/aircopy.c index 8818c8a..d2d3f46 100644 --- a/app/aircopy.c +++ b/app/aircopy.c @@ -144,8 +144,8 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) gRxVfo->Band = i; Frequency += 75; Frequency = FREQUENCY_FloorToStep(Frequency, gRxVfo->StepFrequency, 0); - gRxVfo->ConfigRX.Frequency = Frequency; - gRxVfo->ConfigTX.Frequency = Frequency; + gRxVfo->freq_config_RX.Frequency = Frequency; + gRxVfo->freq_config_TX.Frequency = Frequency; RADIO_ConfigureSquelchAndOutputPower(gRxVfo); gCurrentVfo = gRxVfo; RADIO_SetupRegisters(true); diff --git a/app/app.c b/app/app.c index a49d1ca..b2c747a 100644 --- a/app/app.c +++ b/app/app.c @@ -563,7 +563,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix) void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step) { - uint32_t Frequency = pInfo->ConfigRX.Frequency + (Step * pInfo->StepFrequency); + uint32_t Frequency = pInfo->freq_config_RX.Frequency + (Step * pInfo->StepFrequency); if (pInfo->StepFrequency == 833) { @@ -584,7 +584,7 @@ void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step) if (Frequency < LowerLimitFrequencyBandTable[pInfo->Band]) Frequency = FREQUENCY_FloorToStep(UpperLimitFrequencyBandTable[pInfo->Band], pInfo->StepFrequency, LowerLimitFrequencyBandTable[pInfo->Band]); - pInfo->ConfigRX.Frequency = Frequency; + pInfo->freq_config_RX.Frequency = Frequency; } static void FREQ_NextChannel(void) @@ -1912,7 +1912,7 @@ void CHANNEL_Next(bool bFlag, int8_t Direction) else { if (bFlag) - gRestoreFrequency = gRxVfo->ConfigRX.Frequency; + gRestoreFrequency = gRxVfo->freq_config_RX.Frequency; FREQ_NextChannel(); } diff --git a/app/main.c b/app/main.c index 75954a6..c191757 100644 --- a/app/main.c +++ b/app/main.c @@ -56,6 +56,43 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) // TODO: do something useful with the key + #ifdef ENABLE_COPY_CHAN_VFO + { // copy channel to VFO + int channel = -1; + int vfo = -1; + if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) + { // VFO mode + if (IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE)) + { // other vfo is in channel mode + channel = gRxVfo->CHANNEL_SAVE; + vfo = gTxVfo->CHANNEL_SAVE; + } + } + else + if (IS_FREQ_CHANNEL((gRxVfo->CHANNEL_SAVE + 1) & 1)) + { // VFO mode + if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) + { // other vfo is in channel mode + channel = gTxVfo->CHANNEL_SAVE; + vfo = gRxVfo->CHANNEL_SAVE; + } + } + + if (channel >= 0 && vfo >= 0) + { // copy the channel into the VFO + + gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; + + +// gRequestSaveVFO = true; +// gVfoConfigureMode = VFO_CONFIGURE_RELOAD; +// gRequestDisplayScreen = DISPLAY_MAIN; + } + } + #endif + + + #endif break; @@ -71,7 +108,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) Band = gTxVfo->Band + 1; if (gSetting_350EN || Band != BAND5_350MHz) { - if (BAND7_470MHz < Band) + if (Band > BAND7_470MHz) Band = BAND1_50MHz; } else @@ -80,6 +117,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) gEeprom.ScreenChannel[Vfo] = FREQ_CHANNEL_FIRST + Band; gEeprom.FreqChannel[Vfo] = FREQ_CHANNEL_FIRST + Band; + gRequestSaveVFO = true; gVfoConfigureMode = VFO_CONFIGURE_RELOAD; gRequestDisplayScreen = DISPLAY_MAIN; @@ -361,7 +399,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) Frequency += 75; - gTxVfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, LowerLimitFrequencyBandTable[gTxVfo->Band]); + gTxVfo->freq_config_RX.Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, LowerLimitFrequencyBandTable[gTxVfo->Band]); gRequestSaveChannel = 1; return; diff --git a/app/menu.c b/app/menu.c index ef54966..6139add 100644 --- a/app/menu.c +++ b/app/menu.c @@ -293,7 +293,7 @@ void MENU_AcceptSetting(void) int32_t Min; int32_t Max; uint8_t Code; - FREQ_Config_t *pConfig = &gTxVfo->ConfigRX; + FREQ_Config_t *pConfig = &gTxVfo->freq_config_RX; if (!MENU_GetLimits(gMenuCursor, &Min, &Max)) { @@ -328,7 +328,7 @@ void MENU_AcceptSetting(void) return; case MENU_T_DCS: - pConfig = &gTxVfo->ConfigTX; + pConfig = &gTxVfo->freq_config_TX; // Fallthrough @@ -360,7 +360,7 @@ void MENU_AcceptSetting(void) return; case MENU_T_CTCS: - pConfig = &gTxVfo->ConfigTX; + pConfig = &gTxVfo->freq_config_TX; // Fallthrough @@ -778,13 +778,13 @@ void MENU_ShowCurrentSetting(void) break; case MENU_R_DCS: - switch (gTxVfo->ConfigRX.CodeType) + switch (gTxVfo->freq_config_RX.CodeType) { case CODE_TYPE_DIGITAL: - gSubMenuSelection = gTxVfo->ConfigRX.Code + 1; + gSubMenuSelection = gTxVfo->freq_config_RX.Code + 1; break; case CODE_TYPE_REVERSE_DIGITAL: - gSubMenuSelection = gTxVfo->ConfigRX.Code + 105; + gSubMenuSelection = gTxVfo->freq_config_RX.Code + 105; break; default: gSubMenuSelection = 0; @@ -797,17 +797,17 @@ void MENU_ShowCurrentSetting(void) break; case MENU_R_CTCS: - gSubMenuSelection = (gTxVfo->ConfigRX.CodeType == CODE_TYPE_CONTINUOUS_TONE) ? gTxVfo->ConfigRX.Code + 1 : 0; + gSubMenuSelection = (gTxVfo->freq_config_RX.CodeType == CODE_TYPE_CONTINUOUS_TONE) ? gTxVfo->freq_config_RX.Code + 1 : 0; break; case MENU_T_DCS: - switch (gTxVfo->ConfigTX.CodeType) + switch (gTxVfo->freq_config_TX.CodeType) { case CODE_TYPE_DIGITAL: - gSubMenuSelection = gTxVfo->ConfigTX.Code + 1; + gSubMenuSelection = gTxVfo->freq_config_TX.Code + 1; break; case CODE_TYPE_REVERSE_DIGITAL: - gSubMenuSelection = gTxVfo->ConfigTX.Code + 105; + gSubMenuSelection = gTxVfo->freq_config_TX.Code + 105; break; default: gSubMenuSelection = 0; @@ -816,7 +816,7 @@ void MENU_ShowCurrentSetting(void) break; case MENU_T_CTCS: - gSubMenuSelection = (gTxVfo->ConfigTX.CodeType == CODE_TYPE_CONTINUOUS_TONE) ? gTxVfo->ConfigTX.Code + 1 : 0; + gSubMenuSelection = (gTxVfo->freq_config_TX.CodeType == CODE_TYPE_CONTINUOUS_TONE) ? gTxVfo->freq_config_TX.Code + 1 : 0; break; case MENU_SFT_D: diff --git a/app/scanner.c b/app/scanner.c index 17a925b..f57bcab 100644 --- a/app/scanner.c +++ b/app/scanner.c @@ -227,11 +227,11 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld) if (gScanUseCssResult) { - gTxVfo->ConfigRX.CodeType = gScanCssResultType; - gTxVfo->ConfigRX.Code = gScanCssResultCode; + gTxVfo->freq_config_RX.CodeType = gScanCssResultType; + gTxVfo->freq_config_RX.Code = gScanCssResultCode; } - gTxVfo->ConfigTX = gTxVfo->ConfigRX; + gTxVfo->freq_config_TX = gTxVfo->freq_config_RX; gTxVfo->STEP_SETTING = gStepSetting; } else @@ -239,10 +239,10 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld) RADIO_ConfigureChannel(0, 2); RADIO_ConfigureChannel(1, 2); - gTxVfo->ConfigRX.CodeType = gScanCssResultType; - gTxVfo->ConfigRX.Code = gScanCssResultCode; - gTxVfo->ConfigTX.CodeType = gScanCssResultType; - gTxVfo->ConfigTX.Code = gScanCssResultCode; + gTxVfo->freq_config_RX.CodeType = gScanCssResultType; + gTxVfo->freq_config_RX.Code = gScanCssResultCode; + gTxVfo->freq_config_TX.CodeType = gScanCssResultType; + gTxVfo->freq_config_TX.Code = gScanCssResultCode; } if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) @@ -431,7 +431,7 @@ void SCANNER_Stop(void) } else { - gRxVfo->ConfigRX.Frequency = gRestoreFrequency; + gRxVfo->freq_config_RX.Frequency = gRestoreFrequency; RADIO_ApplyOffset(gRxVfo); RADIO_ConfigureSquelchAndOutputPower(gRxVfo); } diff --git a/app/uart.c b/app/uart.c index 343f458..0a64d1e 100644 --- a/app/uart.c +++ b/app/uart.c @@ -376,8 +376,8 @@ static void CMD_052F(const uint8_t *pBuffer) gEeprom.RX_CHANNEL = 0; gEeprom.DTMF_SIDE_TONE = false; gEeprom.VfoInfo[0].FrequencyReverse = false; - gEeprom.VfoInfo[0].pRX = &gEeprom.VfoInfo[0].ConfigRX; - gEeprom.VfoInfo[0].pTX = &gEeprom.VfoInfo[0].ConfigTX; + gEeprom.VfoInfo[0].pRX = &gEeprom.VfoInfo[0].freq_config_RX; + gEeprom.VfoInfo[0].pTX = &gEeprom.VfoInfo[0].freq_config_TX; gEeprom.VfoInfo[0].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF; gEeprom.VfoInfo[0].DTMF_PTT_ID_TX_MODE = PTT_ID_OFF; gEeprom.VfoInfo[0].DTMF_DECODING_ENABLE = false; diff --git a/board.c b/board.c index f70982a..6f43e28 100644 --- a/board.c +++ b/board.c @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #include @@ -871,8 +870,8 @@ void BOARD_FactoryReset(bool bIsAll) for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++) { const uint32_t Frequency = gDefaultFrequencyTable[i]; - gRxVfo->ConfigRX.Frequency = Frequency; - gRxVfo->ConfigTX.Frequency = Frequency; + gRxVfo->freq_config_RX.Frequency = Frequency; + gRxVfo->freq_config_TX.Frequency = Frequency; gRxVfo->Band = FREQUENCY_GetBand(Frequency); SETTINGS_SaveChannel(MR_CHANNEL_FIRST + i, 0, gRxVfo, 2); } diff --git a/firmware.bin b/firmware.bin index 67d4978..e7621d0 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index 4f2c9b4..bfa9a1d 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/main.c b/main.c index 0a68a42..87b71da 100644 --- a/main.c +++ b/main.c @@ -39,10 +39,6 @@ #include "ui/menu.h" #include "version.h" -#ifndef ARRAY_SIZE - #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - void _putchar(char c) { UART_Send((uint8_t *)&c, 1); diff --git a/radio.c b/radio.c index 3e65610..8c3a71a 100644 --- a/radio.c +++ b/radio.c @@ -34,10 +34,6 @@ #include "radio.h" #include "settings.h" -#ifndef ARRAY_SIZE - #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - VFO_Info_t *gTxVfo; VFO_Info_t *gRxVfo; VFO_Info_t *gCurrentVfo; @@ -129,10 +125,10 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t Band, uint32 pInfo->CHANNEL_SAVE = ChannelSave; pInfo->FrequencyReverse = false; pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW; - pInfo->ConfigRX.Frequency = Frequency; - pInfo->ConfigTX.Frequency = Frequency; - pInfo->pRX = &pInfo->ConfigRX; - pInfo->pTX = &pInfo->ConfigTX; + pInfo->freq_config_RX.Frequency = Frequency; + pInfo->freq_config_TX.Frequency = Frequency; + pInfo->pRX = &pInfo->freq_config_RX; + pInfo->pTX = &pInfo->freq_config_TX; pInfo->TX_OFFSET_FREQUENCY = 1000000; #ifdef ENABLE_COMPANDER pInfo->Compander = 0; // off @@ -274,15 +270,15 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg) Tmp = 0; gEeprom.VfoInfo[VFO].SCRAMBLING_TYPE = Tmp; - gEeprom.VfoInfo[VFO].ConfigRX.CodeType = (Data[2] >> 0) & 0x0F; - gEeprom.VfoInfo[VFO].ConfigTX.CodeType = (Data[2] >> 4) & 0x0F; + gEeprom.VfoInfo[VFO].freq_config_RX.CodeType = (Data[2] >> 0) & 0x0F; + gEeprom.VfoInfo[VFO].freq_config_TX.CodeType = (Data[2] >> 4) & 0x0F; Tmp = Data[0]; - switch (gEeprom.VfoInfo[VFO].ConfigRX.CodeType) + switch (gEeprom.VfoInfo[VFO].freq_config_RX.CodeType) { default: case CODE_TYPE_OFF: - gEeprom.VfoInfo[VFO].ConfigRX.CodeType = CODE_TYPE_OFF; + gEeprom.VfoInfo[VFO].freq_config_RX.CodeType = CODE_TYPE_OFF; Tmp = 0; break; @@ -297,14 +293,14 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg) Tmp = 0; break; } - gEeprom.VfoInfo[VFO].ConfigRX.Code = Tmp; + gEeprom.VfoInfo[VFO].freq_config_RX.Code = Tmp; Tmp = Data[1]; - switch (gEeprom.VfoInfo[VFO].ConfigTX.CodeType) + switch (gEeprom.VfoInfo[VFO].freq_config_TX.CodeType) { default: case CODE_TYPE_OFF: - gEeprom.VfoInfo[VFO].ConfigTX.CodeType = CODE_TYPE_OFF; + gEeprom.VfoInfo[VFO].freq_config_TX.CodeType = CODE_TYPE_OFF; Tmp = 0; break; @@ -319,7 +315,7 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg) Tmp = 0; break; } - gEeprom.VfoInfo[VFO].ConfigTX.Code = Tmp; + gEeprom.VfoInfo[VFO].freq_config_TX.Code = Tmp; if (Data[4] == 0xFF) { @@ -356,14 +352,14 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg) EEPROM_ReadBuffer(Base, &Info, sizeof(Info)); - pRadio->ConfigRX.Frequency = Info.Frequency; + pRadio->freq_config_RX.Frequency = Info.Frequency; if (Info.Offset >= 100000000) Info.Offset = 1000000; gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = Info.Offset; } - Frequency = pRadio->ConfigRX.Frequency; + Frequency = pRadio->freq_config_RX.Frequency; #if 1 // fix previously set incorrect band @@ -379,7 +375,7 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg) if (Channel >= FREQ_CHANNEL_FIRST) Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, LowerLimitFrequencyBandTable[Band]); - pRadio->ConfigRX.Frequency = Frequency; + pRadio->freq_config_RX.Frequency = Frequency; if (Frequency >= 10800000 && Frequency < 13600000) gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF; @@ -398,13 +394,13 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg) if (!gEeprom.VfoInfo[VFO].FrequencyReverse) { - gEeprom.VfoInfo[VFO].pRX = &gEeprom.VfoInfo[VFO].ConfigRX; - gEeprom.VfoInfo[VFO].pTX = &gEeprom.VfoInfo[VFO].ConfigTX; + gEeprom.VfoInfo[VFO].pRX = &gEeprom.VfoInfo[VFO].freq_config_RX; + gEeprom.VfoInfo[VFO].pTX = &gEeprom.VfoInfo[VFO].freq_config_TX; } else { - gEeprom.VfoInfo[VFO].pRX = &gEeprom.VfoInfo[VFO].ConfigTX; - gEeprom.VfoInfo[VFO].pTX = &gEeprom.VfoInfo[VFO].ConfigRX; + gEeprom.VfoInfo[VFO].pRX = &gEeprom.VfoInfo[VFO].freq_config_TX; + gEeprom.VfoInfo[VFO].pTX = &gEeprom.VfoInfo[VFO].freq_config_RX; } if (!gSetting_350EN) @@ -419,8 +415,8 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg) gEeprom.VfoInfo[VFO].IsAM = true; gEeprom.VfoInfo[VFO].SCRAMBLING_TYPE = 0; gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = false; - gEeprom.VfoInfo[VFO].ConfigRX.CodeType = CODE_TYPE_OFF; - gEeprom.VfoInfo[VFO].ConfigTX.CodeType = CODE_TYPE_OFF; + gEeprom.VfoInfo[VFO].freq_config_RX.CodeType = CODE_TYPE_OFF; + gEeprom.VfoInfo[VFO].freq_config_TX.CodeType = CODE_TYPE_OFF; } else gEeprom.VfoInfo[VFO].IsAM = false; @@ -513,7 +509,7 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) void RADIO_ApplyOffset(VFO_Info_t *pInfo) { - uint32_t Frequency = pInfo->ConfigRX.Frequency; + uint32_t Frequency = pInfo->freq_config_RX.Frequency; switch (pInfo->TX_OFFSET_FREQUENCY_DIRECTION) { @@ -542,7 +538,7 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo) Frequency = UpperLimitFrequencyBandTable[ARRAY_SIZE(UpperLimitFrequencyBandTable) - 1]; #endif - pInfo->ConfigTX.Frequency = Frequency; + pInfo->freq_config_TX.Frequency = Frequency; } static void RADIO_SelectCurrentVfo(void) diff --git a/radio.h b/radio.h index d2ac398..99246fa 100644 --- a/radio.h +++ b/radio.h @@ -99,38 +99,51 @@ typedef struct typedef struct VFO_Info_t { - FREQ_Config_t ConfigRX; - FREQ_Config_t ConfigTX; + FREQ_Config_t freq_config_RX; + FREQ_Config_t freq_config_TX; FREQ_Config_t *pRX; FREQ_Config_t *pTX; + uint32_t TX_OFFSET_FREQUENCY; uint16_t StepFrequency; + uint8_t CHANNEL_SAVE; + uint8_t TX_OFFSET_FREQUENCY_DIRECTION; + uint8_t SquelchOpenRSSIThresh; uint8_t SquelchOpenNoiseThresh; uint8_t SquelchCloseGlitchThresh; uint8_t SquelchCloseRSSIThresh; uint8_t SquelchCloseNoiseThresh; uint8_t SquelchOpenGlitchThresh; + STEP_Setting_t STEP_SETTING; uint8_t OUTPUT_POWER; uint8_t TXP_CalculatedSetting; bool FrequencyReverse; + uint8_t SCRAMBLING_TYPE; uint8_t CHANNEL_BANDWIDTH; + uint8_t SCANLIST1_PARTICIPATION; uint8_t SCANLIST2_PARTICIPATION; + uint8_t Band; + uint8_t DTMF_DECODING_ENABLE; PTT_ID_t DTMF_PTT_ID_TX_MODE; + uint8_t BUSY_CHANNEL_LOCK; + uint8_t AM_CHANNEL_MODE; bool IsAM; + #ifdef ENABLE_COMPANDER uint8_t Compander; #endif - char Name[10 + 1]; + + char Name[16]; } VFO_Info_t; extern VFO_Info_t *gTxVfo; diff --git a/settings.c b/settings.c index 4953c3a..a2a9830 100644 --- a/settings.c +++ b/settings.c @@ -177,6 +177,10 @@ void SETTINGS_SaveSettings(void) EEPROM_WriteBuffer(0x0F40, State); } +void SETTINGS_LoadChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO) +{ +} + void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode) { #ifdef ENABLE_NOAA @@ -187,23 +191,24 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint16_t OffsetVFO = OffsetMR; if (!IS_MR_CHANNEL(Channel)) - { + { // it's a VFO, not a channel OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C90; OffsetVFO += (Channel - FREQ_CHANNEL_FIRST) * 32; } if (Mode >= 2 || !IS_MR_CHANNEL(Channel)) - { + { // copy VFO to a channel + uint32_t State32[2]; uint8_t State8[8]; - State32[0] = pVFO->ConfigRX.Frequency; + State32[0] = pVFO->freq_config_RX.Frequency; State32[1] = pVFO->TX_OFFSET_FREQUENCY; EEPROM_WriteBuffer(OffsetVFO + 0, State32); - State8[0] = pVFO->ConfigRX.Code; - State8[1] = pVFO->ConfigTX.Code; - State8[2] = (pVFO->ConfigTX.CodeType << 4) | pVFO->ConfigRX.CodeType; + State8[0] = pVFO->freq_config_RX.Code; + State8[1] = pVFO->freq_config_TX.Code; + State8[2] = (pVFO->freq_config_TX.CodeType << 4) | pVFO->freq_config_RX.CodeType; State8[3] = (pVFO->AM_CHANNEL_MODE << 4) | pVFO->TX_OFFSET_FREQUENCY_DIRECTION; State8[4] = 0 | (pVFO->BUSY_CHANNEL_LOCK << 4) diff --git a/ui/aircopy.c b/ui/aircopy.c index 85be7b4..1163275 100644 --- a/ui/aircopy.c +++ b/ui/aircopy.c @@ -44,7 +44,7 @@ void UI_DisplayAircopy(void) if (gInputBoxIndex == 0) { - NUMBER_ToDigits(gRxVfo->ConfigRX.Frequency, String); + NUMBER_ToDigits(gRxVfo->freq_config_RX.Frequency, String); UI_DisplayFrequency(String, 16, 2, 0, 0); UI_DisplaySmallDigits(2, String + 6, 97, 3, true); } diff --git a/ui/main.c b/ui/main.c index 99fcbbb..c88a0e5 100644 --- a/ui/main.c +++ b/ui/main.c @@ -35,10 +35,6 @@ #include "ui/main.h" #include "ui/ui.h" -#ifndef ARRAY_SIZE - #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - #ifdef ENABLE_AUDIO_BAR void UI_DisplayAudioBar(void) { @@ -463,7 +459,7 @@ void UI_DisplayMain(void) UI_PrintStringSmall(String, LCD_WIDTH + 46, 0, Line + 1); } - if (gEeprom.VfoInfo[vfo_num].ConfigRX.Frequency != gEeprom.VfoInfo[vfo_num].ConfigTX.Frequency) + if (gEeprom.VfoInfo[vfo_num].freq_config_RX.Frequency != gEeprom.VfoInfo[vfo_num].freq_config_TX.Frequency) { // show the TX offset symbol const char dir_list[] = "\0+-"; const unsigned int i = gEeprom.VfoInfo[vfo_num].TX_OFFSET_FREQUENCY_DIRECTION; diff --git a/ui/menu.c b/ui/menu.c index 39859f6..421e8a0 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -35,6 +35,9 @@ #include "ui/menu.h" #include "ui/ui.h" +// NOTE. this menu list is half way through a change, what might seem +// pointless at this time is for there for a reason. +// const t_menu_item MenuList[] = { // name, voice ID, menu ID @@ -112,7 +115,7 @@ const t_menu_item MenuList[] = #endif {"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ? - // hidden menu items from here on (center param set to '1') + // hidden menu items from here on // enabled if pressing both the PTT and upper side button at power-on {"F-LOCK", VOICE_ID_INVALID, MENU_F_LOCK },