forked from mirror/uv-k5-firmware
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1e2a86755e | ||
|
b75d59a283 | ||
|
9b7ee2ffff |
@ -115,7 +115,7 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gInputBoxIndex = 0;
|
||||
NUMBER_Get(gInputBox, &Frequency);
|
||||
for (i = 0; i < 7; i++) {
|
||||
if (Frequency >= gLowerLimitFrequencyBandTable[i] && Frequency <= gUpperLimitFrequencyBandTable[i]) {
|
||||
if (Frequency >= LowerLimitFrequencyBandTable[i] && Frequency <= UpperLimitFrequencyBandTable[i]) {
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
gRxVfo->Band = i;
|
||||
Frequency += 75;
|
||||
|
16
app/app.c
16
app/app.c
@ -381,10 +381,10 @@ void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
|
||||
uint32_t Frequency;
|
||||
|
||||
Frequency = pInfo->ConfigRX.Frequency + (Step * pInfo->StepFrequency);
|
||||
if (Frequency > gUpperLimitFrequencyBandTable[pInfo->Band]) {
|
||||
pInfo->ConfigRX.Frequency = gLowerLimitFrequencyBandTable[pInfo->Band];
|
||||
} else if (Frequency < gLowerLimitFrequencyBandTable[pInfo->Band]) {
|
||||
pInfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(gUpperLimitFrequencyBandTable[pInfo->Band], pInfo->StepFrequency, gLowerLimitFrequencyBandTable[pInfo->Band]);
|
||||
if (Frequency > UpperLimitFrequencyBandTable[pInfo->Band]) {
|
||||
pInfo->ConfigRX.Frequency = LowerLimitFrequencyBandTable[pInfo->Band];
|
||||
} else if (Frequency < LowerLimitFrequencyBandTable[pInfo->Band]) {
|
||||
pInfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(UpperLimitFrequencyBandTable[pInfo->Band], pInfo->StepFrequency, LowerLimitFrequencyBandTable[pInfo->Band]);
|
||||
} else {
|
||||
pInfo->ConfigRX.Frequency = Frequency;
|
||||
}
|
||||
@ -1126,18 +1126,18 @@ void APP_TimeSlice500ms(void)
|
||||
#if defined(ENABLE_FMRADIO)
|
||||
(gFM_ScanState == FM_SCAN_OFF || gAskToSave) &&
|
||||
#endif
|
||||
gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF) {
|
||||
gCssScanMode == CSS_SCAN_MODE_OFF) {
|
||||
if (gBacklightCountdown) {
|
||||
gBacklightCountdown--;
|
||||
if (gBacklightCountdown == 0) {
|
||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
||||
}
|
||||
}
|
||||
if (
|
||||
if (gScanState == SCAN_OFF
|
||||
#if defined(ENABLE_AIRCOPY)
|
||||
gScreenToDisplay != DISPLAY_AIRCOPY &&
|
||||
&& gScreenToDisplay != DISPLAY_AIRCOPY
|
||||
#endif
|
||||
(gScreenToDisplay != DISPLAY_SCANNER || (gScanCssState >= SCAN_CSS_STATE_FOUND))) {
|
||||
&& (gScreenToDisplay != DISPLAY_SCANNER || (gScanCssState >= SCAN_CSS_STATE_FOUND))) {
|
||||
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown && !gDTMF_InputMode) {
|
||||
gKeyLockCountdown--;
|
||||
if (gKeyLockCountdown == 0) {
|
||||
|
@ -85,7 +85,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < 7; i++) {
|
||||
if (Frequency <= gUpperLimitFrequencyBandTable[i] && (gLowerLimitFrequencyBandTable[i] <= Frequency)) {
|
||||
if (Frequency <= UpperLimitFrequencyBandTable[i] && (LowerLimitFrequencyBandTable[i] <= Frequency)) {
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
if (gTxVfo->Band != i) {
|
||||
gTxVfo->Band = i;
|
||||
@ -98,7 +98,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gTxVfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(
|
||||
Frequency,
|
||||
gTxVfo->StepFrequency,
|
||||
gLowerLimitFrequencyBandTable[gTxVfo->Band]
|
||||
LowerLimitFrequencyBandTable[gTxVfo->Band]
|
||||
);
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
|
5
audio.c
5
audio.c
@ -164,7 +164,7 @@ void AUDIO_PlayVoice(uint8_t VoiceID)
|
||||
uint8_t i;
|
||||
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
|
||||
SYSTEM_DelayMs(7);
|
||||
SYSTEM_DelayMs(20);
|
||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
|
||||
for (i = 0; i < 8; i++) {
|
||||
if ((VoiceID & 0x80U) == 0) {
|
||||
@ -172,11 +172,12 @@ void AUDIO_PlayVoice(uint8_t VoiceID)
|
||||
} else {
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_VOICE_1);
|
||||
}
|
||||
SYSTICK_DelayUs(1200);
|
||||
SYSTICK_DelayUs(1000);
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
|
||||
SYSTICK_DelayUs(1200);
|
||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
|
||||
VoiceID <<= 1;
|
||||
SYSTICK_DelayUs(200);
|
||||
}
|
||||
}
|
||||
|
||||
|
24
board.c
24
board.c
@ -44,6 +44,14 @@
|
||||
#include "sram-overlay.h"
|
||||
#endif
|
||||
|
||||
static const uint32_t gDefaultFrequencyTable[5] = {
|
||||
14502500,
|
||||
14552500,
|
||||
43477500,
|
||||
43502500,
|
||||
43697500,
|
||||
};
|
||||
|
||||
#if defined(ENABLE_OVERLAY)
|
||||
void BOARD_FLASH_Init(void)
|
||||
{
|
||||
@ -582,7 +590,7 @@ void BOARD_EEPROM_Init(void)
|
||||
gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < 9) ? Data[4] : 6;
|
||||
gEeprom.SCAN_RESUME_MODE = (Data[5] < 3) ? Data[5] : SCAN_RESUME_CO;
|
||||
gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 2) ? Data[6] : true;
|
||||
gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 3) ? Data[7] : POWER_ON_DISPLAY_MODE_MESSAGE;
|
||||
gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 3) ? Data[7] : POWER_ON_DISPLAY_MODE_VOLTAGE;
|
||||
|
||||
// 0E98..0E9F
|
||||
EEPROM_ReadBuffer(0x0E98, Data, 8);
|
||||
@ -675,9 +683,6 @@ void BOARD_EEPROM_Init(void)
|
||||
EEPROM_ReadBuffer(0x0F40, Data, 8);
|
||||
gSetting_F_LOCK = (Data[0] < 6) ? Data[0] : F_LOCK_OFF;
|
||||
|
||||
gUpperLimitFrequencyBandTable = UpperLimitFrequencyBandTable;
|
||||
gLowerLimitFrequencyBandTable = LowerLimitFrequencyBandTable;
|
||||
|
||||
gSetting_350TX = (Data[1] < 2) ? Data[1] : true;
|
||||
gSetting_KILLED = (Data[2] < 2) ? Data[2] : false;
|
||||
gSetting_200TX = (Data[3] < 2) ? Data[3] : false;
|
||||
@ -775,5 +780,16 @@ void BOARD_FactoryReset(bool bIsAll)
|
||||
EEPROM_WriteBuffer(i, Template);
|
||||
}
|
||||
}
|
||||
if (bIsAll) {
|
||||
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + 5, 5, 41002500);
|
||||
for (i = 0; i < 5; i++) {
|
||||
const uint32_t Frequency = gDefaultFrequencyTable[i];
|
||||
|
||||
gRxVfo->ConfigRX.Frequency = Frequency;
|
||||
gRxVfo->ConfigTX.Frequency = Frequency;
|
||||
gRxVfo->Band = FREQUENCY_GetBand(Frequency);
|
||||
SETTINGS_SaveChannel(MR_CHANNEL_FIRST + i, 0, gRxVfo, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
3
misc.h
3
misc.h
@ -79,9 +79,6 @@ enum CssScanMode_t {
|
||||
|
||||
typedef enum CssScanMode_t CssScanMode_t;
|
||||
|
||||
extern const uint32_t *gUpperLimitFrequencyBandTable;
|
||||
extern const uint32_t *gLowerLimitFrequencyBandTable;
|
||||
|
||||
extern bool gSetting_350TX;
|
||||
extern bool gSetting_KILLED;
|
||||
extern bool gSetting_200TX;
|
||||
|
18
radio.c
18
radio.c
@ -126,6 +126,12 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t Band, uint32
|
||||
pInfo->pRX = &pInfo->ConfigRX;
|
||||
pInfo->pTX = &pInfo->ConfigTX;
|
||||
pInfo->FREQUENCY_OF_DEVIATION = 1000000;
|
||||
|
||||
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz)) {
|
||||
pInfo->AM_CHANNEL_MODE = true;
|
||||
pInfo->IsAM = true;
|
||||
}
|
||||
|
||||
RADIO_ConfigureSquelchAndOutputPower(pInfo);
|
||||
}
|
||||
|
||||
@ -188,7 +194,7 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Configure)
|
||||
gEeprom.ScreenChannel[VFO] = gEeprom.FreqChannel[VFO];
|
||||
}
|
||||
Index = Channel - FREQ_CHANNEL_FIRST;
|
||||
RADIO_InitInfo(pRadio, Channel, Index, gLowerLimitFrequencyBandTable[Index]);
|
||||
RADIO_InitInfo(pRadio, Channel, Index, LowerLimitFrequencyBandTable[Index]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -315,12 +321,12 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Configure)
|
||||
}
|
||||
|
||||
Frequency = pRadio->ConfigRX.Frequency;
|
||||
if (Frequency < gLowerLimitFrequencyBandTable[Band]) {
|
||||
pRadio->ConfigRX.Frequency = gLowerLimitFrequencyBandTable[Band];
|
||||
} else if (Frequency > gUpperLimitFrequencyBandTable[Band]) {
|
||||
pRadio->ConfigRX.Frequency = gUpperLimitFrequencyBandTable[Band];
|
||||
if (Frequency < LowerLimitFrequencyBandTable[Band]) {
|
||||
pRadio->ConfigRX.Frequency = LowerLimitFrequencyBandTable[Band];
|
||||
} else if (Frequency > UpperLimitFrequencyBandTable[Band]) {
|
||||
pRadio->ConfigRX.Frequency = UpperLimitFrequencyBandTable[Band];
|
||||
} else if (Channel >= FREQ_CHANNEL_FIRST) {
|
||||
pRadio->ConfigRX.Frequency = FREQUENCY_FloorToStep(pRadio->ConfigRX.Frequency, gEeprom.VfoInfo[VFO].StepFrequency, gLowerLimitFrequencyBandTable[Band]);
|
||||
pRadio->ConfigRX.Frequency = FREQUENCY_FloorToStep(pRadio->ConfigRX.Frequency, gEeprom.VfoInfo[VFO].StepFrequency, LowerLimitFrequencyBandTable[Band]);
|
||||
}
|
||||
|
||||
if (Frequency >= 10800000 && Frequency <= 13599990) {
|
||||
|
Loading…
Reference in New Issue
Block a user