mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 06:39:49 +03:00
clean ups
This commit is contained in:
13
README.md
13
README.md
@ -17,18 +17,19 @@ You can edit those changes by (currently) editing the MakeFile, look for these l
|
|||||||
* CFLAGS += -DKEEP_MEM_NAME .. maintain the memory channel's name when re-saving the memory channel
|
* CFLAGS += -DKEEP_MEM_NAME .. maintain the memory channel's name when re-saving the memory channel
|
||||||
* CFLAGS += -DDISABLE_ALARM .. remove the ALARM transmit option from the firmware
|
* CFLAGS += -DDISABLE_ALARM .. remove the ALARM transmit option from the firmware
|
||||||
* CFLAGS += -DCHAN_NAME_FREQ .. show the channel frequency (as well as channel number/name)
|
* CFLAGS += -DCHAN_NAME_FREQ .. show the channel frequency (as well as channel number/name)
|
||||||
* CFLAGS += -DSINGLE_VFO_CHAN .. only show a single VFO/CHANNEL if dual watch is disabled
|
* CFLAGS += -DSINGLE_VFO_CHAN .. not yet implemented .. only show a single VFO/CHANNEL if dual watch is disabled
|
||||||
* #CFLAGS += -DBAND_SCOPE .. not yet implemented
|
* #CFLAGS += -DBAND_SCOPE .. not yet implemented
|
||||||
|
|
||||||
To enable the custom option just uncomment the line by removing the starting '#'.
|
To enable the custom option just uncomment the line by removing the starting '#'.
|
||||||
|
|
||||||
# Other changes made
|
# Other changes made
|
||||||
|
|
||||||
* Battery voltage boot screen now includes the percentage (as well as voltage).
|
* Various bugs fixed that the QS firmware had (TX tail, Menu confimation etc)
|
||||||
* Slightly less intense menu style.
|
* Battery voltage boot screen now includes the percentage (as well as voltage)
|
||||||
* AM RX allowed everywhere. Although the radio really doesn't do AM, the adverts are a con !
|
* Slightly less intense menu style
|
||||||
|
* AM RX now allowed everywhere, although the radio really doesn't do AM, the adverts are a con !
|
||||||
* Finer RSSI bar steps
|
* Finer RSSI bar steps
|
||||||
|
*
|
||||||
* "MEM-CH" and "DEL-CH" menus now include channel name
|
* "MEM-CH" and "DEL-CH" menus now include channel name
|
||||||
* "STEP" menu, added 1.25kHz option, removed 5kHz option
|
* "STEP" menu, added 1.25kHz option, removed 5kHz option
|
||||||
* "TXP" menu, renamed to "TX-PWR"
|
* "TXP" menu, renamed to "TX-PWR"
|
||||||
@ -37,7 +38,7 @@ To enable the custom option just uncomment the line by removing the starting '#'
|
|||||||
* "ABR" menu, renamed to "BAK-LT", shows extended backlight times, now has always ON option
|
* "ABR" menu, renamed to "BAK-LT", shows extended backlight times, now has always ON option
|
||||||
* "SCR" menu, renamed to "SCRAM"
|
* "SCR" menu, renamed to "SCRAM"
|
||||||
* "MIC" menu, shows mic gain in dB's, now includes the max mic gain possible (+15.5dB)
|
* "MIC" menu, shows mic gain in dB's, now includes the max mic gain possible (+15.5dB)
|
||||||
* "VOL" menu, renamed to "BATVOL", shows voltage and percentage
|
* "VOL" menu, renamed to "BATVOL", shows voltage and percentage
|
||||||
* "AM" menu, renamed to "MODE", shows modulation mode
|
* "AM" menu, renamed to "MODE", shows modulation mode
|
||||||
|
|
||||||
Menu renames are to try and reduce 'WTF does that do/mean ?'
|
Menu renames are to try and reduce 'WTF does that do/mean ?'
|
||||||
|
100
app/app.c
100
app/app.c
@ -129,7 +129,7 @@ static void APP_HandleIncoming(void)
|
|||||||
gSystickCountdown2 = 0;
|
gSystickCountdown2 = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g_CTCSS_Lost && gCurrentCodeType == CODE_TYPE_CONTINUOUS_TONE)
|
if (g_CTCSS_Lost && gCurrentCodeType == CODE_TYPE_CONTINUOUS_TONE)
|
||||||
{
|
{
|
||||||
bFlag = true;
|
bFlag = true;
|
||||||
@ -234,7 +234,7 @@ static void APP_HandleReceive(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CODE_TYPE_CONTINUOUS_TONE:
|
case CODE_TYPE_CONTINUOUS_TONE:
|
||||||
if (g_CTCSS_Lost)
|
if (g_CTCSS_Lost)
|
||||||
{
|
{
|
||||||
@ -253,7 +253,7 @@ static void APP_HandleReceive(void)
|
|||||||
g_CxCSS_TAIL_Found = false;
|
g_CxCSS_TAIL_Found = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CODE_TYPE_DIGITAL:
|
case CODE_TYPE_DIGITAL:
|
||||||
case CODE_TYPE_REVERSE_DIGITAL:
|
case CODE_TYPE_REVERSE_DIGITAL:
|
||||||
if (g_CDCSS_Lost && gCDCSSCodeType == CDCSS_POSITIVE_CODE)
|
if (g_CDCSS_Lost && gCDCSSCodeType == CDCSS_POSITIVE_CODE)
|
||||||
@ -273,7 +273,7 @@ static void APP_HandleReceive(void)
|
|||||||
g_CxCSS_TAIL_Found = false;
|
g_CxCSS_TAIL_Found = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -292,14 +292,14 @@ Skip:
|
|||||||
{
|
{
|
||||||
case END_OF_RX_MODE_END:
|
case END_OF_RX_MODE_END:
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
#ifndef DISABLE_NOAA
|
#ifndef DISABLE_NOAA
|
||||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||||
gSystickCountdown2 = 300;
|
gSystickCountdown2 = 300;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF)
|
if (gScanState != SCAN_OFF)
|
||||||
{
|
{
|
||||||
switch (gEeprom.SCAN_RESUME_MODE)
|
switch (gEeprom.SCAN_RESUME_MODE)
|
||||||
@ -314,7 +314,7 @@ Skip:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case END_OF_RX_MODE_TTE:
|
case END_OF_RX_MODE_TTE:
|
||||||
if (gEeprom.TAIL_NOTE_ELIMINATION)
|
if (gEeprom.TAIL_NOTE_ELIMINATION)
|
||||||
{
|
{
|
||||||
@ -419,7 +419,7 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
|||||||
if (gVoiceWriteIndex == 0)
|
if (gVoiceWriteIndex == 0)
|
||||||
#endif
|
#endif
|
||||||
BK4819_SetAF(gRxVfo->IsAM ? BK4819_AF_AM : BK4819_AF_OPEN);
|
BK4819_SetAF(gRxVfo->IsAM ? BK4819_AF_AM : BK4819_AF_OPEN);
|
||||||
|
|
||||||
FUNCTION_Select(Function);
|
FUNCTION_Select(Function);
|
||||||
|
|
||||||
if (Function == FUNCTION_MONITOR || gFmRadioMode)
|
if (Function == FUNCTION_MONITOR || gFmRadioMode)
|
||||||
@ -532,9 +532,9 @@ static void DUALWATCH_Alternate(void)
|
|||||||
gEeprom.RX_CHANNEL = gEeprom.RX_CHANNEL == 0;
|
gEeprom.RX_CHANNEL = gEeprom.RX_CHANNEL == 0;
|
||||||
else
|
else
|
||||||
gEeprom.RX_CHANNEL = 0;
|
gEeprom.RX_CHANNEL = 0;
|
||||||
|
|
||||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
||||||
|
|
||||||
if (gEeprom.VfoInfo[0].CHANNEL_SAVE >= NOAA_CHANNEL_FIRST)
|
if (gEeprom.VfoInfo[0].CHANNEL_SAVE >= NOAA_CHANNEL_FIRST)
|
||||||
NOAA_IncreaseChannel();
|
NOAA_IncreaseChannel();
|
||||||
}
|
}
|
||||||
@ -732,7 +732,7 @@ void APP_Update(void)
|
|||||||
gFlagPlayQueuedVoice = false;
|
gFlagPlayQueuedVoice = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gTxTimeoutReached)
|
if (gCurrentFunction == FUNCTION_TRANSMIT && gTxTimeoutReached)
|
||||||
{
|
{
|
||||||
gTxTimeoutReached = false;
|
gTxTimeoutReached = false;
|
||||||
@ -801,7 +801,7 @@ void APP_Update(void)
|
|||||||
gNOAA_Countdown = 7;
|
gNOAA_Countdown = 7;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
if (gScreenToDisplay != DISPLAY_SCANNER && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_VOICE
|
#ifndef DISABLE_VOICE
|
||||||
@ -853,7 +853,7 @@ void APP_Update(void)
|
|||||||
else
|
else
|
||||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gSchedulePowerSave = false;
|
gSchedulePowerSave = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -905,11 +905,11 @@ void APP_Update(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// called every 10ms
|
||||||
void APP_CheckKeys(void)
|
void APP_CheckKeys(void)
|
||||||
{
|
{
|
||||||
const uint16_t key_repeat_delay = 70; // 700ms
|
const uint16_t key_repeat_delay = 70; // 700ms
|
||||||
|
KEY_Code_t Key;
|
||||||
KEY_Code_t Key;
|
|
||||||
|
|
||||||
#ifndef DISABLE_AIRCOPY
|
#ifndef DISABLE_AIRCOPY
|
||||||
if (gSetting_KILLED || (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState != AIRCOPY_READY))
|
if (gSetting_KILLED || (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState != AIRCOPY_READY))
|
||||||
@ -918,27 +918,27 @@ void APP_CheckKeys(void)
|
|||||||
if (gSetting_KILLED)
|
if (gSetting_KILLED)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gPttIsPressed)
|
if (gPttIsPressed)
|
||||||
{
|
{
|
||||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||||
{ // PTT released
|
{ // PTT released
|
||||||
|
|
||||||
// denoise the PTT
|
// denoise the PTT
|
||||||
unsigned int i = 4; // loop for 4ms
|
unsigned int i = 6; // test the PTT button for 6ms
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
{
|
{
|
||||||
SYSTEM_DelayMs(1);
|
SYSTEM_DelayMs(1);
|
||||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||||
count++;
|
count++; // PTT still released
|
||||||
else
|
else
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
count--;
|
count--; // no it's not
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count >= 2)
|
if (count >= 3)
|
||||||
{
|
{ // good enough to end transmission
|
||||||
APP_ProcessKey(KEY_PTT, false, false);
|
APP_ProcessKey(KEY_PTT, false, false);
|
||||||
gPttIsPressed = false;
|
gPttIsPressed = false;
|
||||||
if (gKeyReading1 != KEY_INVALID)
|
if (gKeyReading1 != KEY_INVALID)
|
||||||
@ -947,18 +947,16 @@ void APP_CheckKeys(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
{ // PTT pressed
|
||||||
{
|
if (++gPttDebounceCounter >= 4) // 40ms
|
||||||
if (++gPttDebounceCounter >= 4) // 40ms
|
{ // lets start transmitting
|
||||||
{
|
gPttIsPressed = true;
|
||||||
gPttIsPressed = true;
|
APP_ProcessKey(KEY_PTT, true, false);
|
||||||
APP_ProcessKey(KEY_PTT, true, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
gPttDebounceCounter = 0;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
gPttDebounceCounter = 0;
|
||||||
|
|
||||||
Key = KEYBOARD_Poll();
|
Key = KEYBOARD_Poll();
|
||||||
|
|
||||||
@ -1022,7 +1020,7 @@ void APP_CheckKeys(void)
|
|||||||
void APP_TimeSlice10ms(void)
|
void APP_TimeSlice10ms(void)
|
||||||
{
|
{
|
||||||
gFlashLightBlinkCounter++;
|
gFlashLightBlinkCounter++;
|
||||||
|
|
||||||
if (UART_IsCommandAvailable())
|
if (UART_IsCommandAvailable())
|
||||||
{
|
{
|
||||||
__disable_irq();
|
__disable_irq();
|
||||||
@ -1071,23 +1069,23 @@ void APP_TimeSlice10ms(void)
|
|||||||
if (gAlarmState == ALARM_STATE_TXALARM || gAlarmState == ALARM_STATE_ALARM)
|
if (gAlarmState == ALARM_STATE_TXALARM || gAlarmState == ALARM_STATE_ALARM)
|
||||||
{
|
{
|
||||||
uint16_t Tone;
|
uint16_t Tone;
|
||||||
|
|
||||||
gAlarmRunningCounter++;
|
gAlarmRunningCounter++;
|
||||||
gAlarmToneCounter++;
|
gAlarmToneCounter++;
|
||||||
|
|
||||||
Tone = 500 + (gAlarmToneCounter * 25);
|
Tone = 500 + (gAlarmToneCounter * 25);
|
||||||
if (Tone > 1500)
|
if (Tone > 1500)
|
||||||
{
|
{
|
||||||
Tone = 500;
|
Tone = 500;
|
||||||
gAlarmToneCounter = 0;
|
gAlarmToneCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BK4819_SetScrambleFrequencyControlWord(Tone);
|
BK4819_SetScrambleFrequencyControlWord(Tone);
|
||||||
|
|
||||||
if (gEeprom.ALARM_MODE == ALARM_MODE_TONE && gAlarmRunningCounter == 512)
|
if (gEeprom.ALARM_MODE == ALARM_MODE_TONE && gAlarmRunningCounter == 512)
|
||||||
{
|
{
|
||||||
gAlarmRunningCounter = 0;
|
gAlarmRunningCounter = 0;
|
||||||
|
|
||||||
if (gAlarmState == ALARM_STATE_TXALARM)
|
if (gAlarmState == ALARM_STATE_TXALARM)
|
||||||
{
|
{
|
||||||
gAlarmState = ALARM_STATE_ALARM;
|
gAlarmState = ALARM_STATE_ALARM;
|
||||||
@ -1113,7 +1111,7 @@ void APP_TimeSlice10ms(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// repeater tail tone elimination
|
// repeater tail tone elimination
|
||||||
if (gRTTECountdown)
|
if (gRTTECountdown)
|
||||||
{
|
{
|
||||||
@ -1259,7 +1257,7 @@ void APP_TimeSlice10ms(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
APP_CheckKeys();
|
APP_CheckKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1397,17 +1395,17 @@ void APP_TimeSlice500ms(void)
|
|||||||
if (!gChargingWithTypeC)
|
if (!gChargingWithTypeC)
|
||||||
{
|
{
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP);
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP);
|
||||||
|
|
||||||
#ifndef DISABLE_VOICE
|
#ifndef DISABLE_VOICE
|
||||||
AUDIO_SetVoiceID(0, VOICE_ID_LOW_VOLTAGE);
|
AUDIO_SetVoiceID(0, VOICE_ID_LOW_VOLTAGE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gBatteryDisplayLevel == 0)
|
if (gBatteryDisplayLevel == 0)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_VOICE
|
#ifndef DISABLE_VOICE
|
||||||
AUDIO_PlaySingleVoice(true);
|
AUDIO_PlaySingleVoice(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gReducedService = true;
|
gReducedService = true;
|
||||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||||
ST7565_Configure_GPIO_B11();
|
ST7565_Configure_GPIO_B11();
|
||||||
@ -1481,17 +1479,17 @@ void APP_TimeSlice500ms(void)
|
|||||||
gAlarmState = ALARM_STATE_OFF;
|
gAlarmState = ALARM_STATE_OFF;
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
gEnableSpeaker = false;
|
gEnableSpeaker = false;
|
||||||
|
|
||||||
if (gEeprom.ALARM_MODE == ALARM_MODE_TONE)
|
if (gEeprom.ALARM_MODE == ALARM_MODE_TONE)
|
||||||
{
|
{
|
||||||
RADIO_SendEndOfTransmission();
|
RADIO_SendEndOfTransmission();
|
||||||
RADIO_EnableCxCSS();
|
RADIO_EnableCxCSS();
|
||||||
}
|
}
|
||||||
|
|
||||||
gVoxResumeCountdown = 80;
|
gVoxResumeCountdown = 80;
|
||||||
|
|
||||||
SYSTEM_DelayMs(5);
|
SYSTEM_DelayMs(5);
|
||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
}
|
}
|
||||||
@ -1742,12 +1740,12 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (!bKeyHeld && bKeyPressed)
|
if (!bKeyHeld && bKeyPressed)
|
||||||
{
|
{
|
||||||
ALARM_Off();
|
ALARM_Off();
|
||||||
|
|
||||||
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
else
|
else
|
||||||
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
||||||
|
|
||||||
if (Key == KEY_PTT)
|
if (Key == KEY_PTT)
|
||||||
gPttWasPressed = true;
|
gPttWasPressed = true;
|
||||||
else
|
else
|
||||||
@ -1913,7 +1911,7 @@ Skip:
|
|||||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||||
AUDIO_PlaySingleVoice(true);
|
AUDIO_PlaySingleVoice(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SCANNER_Start();
|
SCANNER_Start();
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||||
@ -1935,7 +1933,7 @@ Skip:
|
|||||||
gAnotherVoiceID = VOICE_ID_INVALID;
|
gAnotherVoiceID = VOICE_ID_INVALID;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GUI_SelectNextDisplay(gRequestDisplayScreen);
|
GUI_SelectNextDisplay(gRequestDisplayScreen);
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_INVALID;
|
gRequestDisplayScreen = DISPLAY_INVALID;
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user