0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-29 23:01:26 +03:00

clean ups

This commit is contained in:
OneOfEleven 2023-09-10 18:11:25 +01:00
parent 50a55e34ab
commit 7dc3512a50
5 changed files with 56 additions and 57 deletions

View File

@ -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 += -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 += -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
To enable the custom option just uncomment the line by removing the starting '#'.
# Other changes made
* Battery voltage boot screen now includes the percentage (as well as voltage).
* Slightly less intense menu style.
* AM RX allowed everywhere. Although the radio really doesn't do AM, the adverts are a con !
* Various bugs fixed that the QS firmware had (TX tail, Menu confimation etc)
* Battery voltage boot screen now includes the percentage (as well as voltage)
* 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
*
* "MEM-CH" and "DEL-CH" menus now include channel name
* "STEP" menu, added 1.25kHz option, removed 5kHz option
* "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
* "SCR" menu, renamed to "SCRAM"
* "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
Menu renames are to try and reduce 'WTF does that do/mean ?'

100
app/app.c
View File

@ -129,7 +129,7 @@ static void APP_HandleIncoming(void)
gSystickCountdown2 = 0;
}
#endif
if (g_CTCSS_Lost && gCurrentCodeType == CODE_TYPE_CONTINUOUS_TONE)
{
bFlag = true;
@ -234,7 +234,7 @@ static void APP_HandleReceive(void)
}
}
break;
case CODE_TYPE_CONTINUOUS_TONE:
if (g_CTCSS_Lost)
{
@ -253,7 +253,7 @@ static void APP_HandleReceive(void)
g_CxCSS_TAIL_Found = false;
}
break;
case CODE_TYPE_DIGITAL:
case CODE_TYPE_REVERSE_DIGITAL:
if (g_CDCSS_Lost && gCDCSSCodeType == CDCSS_POSITIVE_CODE)
@ -273,7 +273,7 @@ static void APP_HandleReceive(void)
g_CxCSS_TAIL_Found = false;
}
break;
default:
break;
}
@ -292,14 +292,14 @@ Skip:
{
case END_OF_RX_MODE_END:
RADIO_SetupRegisters(true);
#ifndef DISABLE_NOAA
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
gSystickCountdown2 = 300;
#endif
gUpdateDisplay = true;
if (gScanState != SCAN_OFF)
{
switch (gEeprom.SCAN_RESUME_MODE)
@ -314,7 +314,7 @@ Skip:
}
}
break;
case END_OF_RX_MODE_TTE:
if (gEeprom.TAIL_NOTE_ELIMINATION)
{
@ -419,7 +419,7 @@ void APP_StartListening(FUNCTION_Type_t Function)
if (gVoiceWriteIndex == 0)
#endif
BK4819_SetAF(gRxVfo->IsAM ? BK4819_AF_AM : BK4819_AF_OPEN);
FUNCTION_Select(Function);
if (Function == FUNCTION_MONITOR || gFmRadioMode)
@ -532,9 +532,9 @@ static void DUALWATCH_Alternate(void)
gEeprom.RX_CHANNEL = gEeprom.RX_CHANNEL == 0;
else
gEeprom.RX_CHANNEL = 0;
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
if (gEeprom.VfoInfo[0].CHANNEL_SAVE >= NOAA_CHANNEL_FIRST)
NOAA_IncreaseChannel();
}
@ -732,7 +732,7 @@ void APP_Update(void)
gFlagPlayQueuedVoice = false;
}
#endif
if (gCurrentFunction == FUNCTION_TRANSMIT && gTxTimeoutReached)
{
gTxTimeoutReached = false;
@ -801,7 +801,7 @@ void APP_Update(void)
gNOAA_Countdown = 7;
}
#endif
if (gScreenToDisplay != DISPLAY_SCANNER && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
{
#ifndef DISABLE_VOICE
@ -853,7 +853,7 @@ void APP_Update(void)
else
FUNCTION_Select(FUNCTION_POWER_SAVE);
#endif
gSchedulePowerSave = false;
}
@ -905,11 +905,11 @@ void APP_Update(void)
}
}
// called every 10ms
void APP_CheckKeys(void)
{
const uint16_t key_repeat_delay = 70; // 700ms
KEY_Code_t Key;
KEY_Code_t Key;
#ifndef DISABLE_AIRCOPY
if (gSetting_KILLED || (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState != AIRCOPY_READY))
@ -918,27 +918,27 @@ void APP_CheckKeys(void)
if (gSetting_KILLED)
return;
#endif
if (gPttIsPressed)
{
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
{ // PTT released
// denoise the PTT
unsigned int i = 4; // loop for 4ms
unsigned int i = 6; // test the PTT button for 6ms
unsigned int count = 0;
while (i-- > 0)
{
SYSTEM_DelayMs(1);
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
count++;
count++; // PTT still released
else
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);
gPttIsPressed = false;
if (gKeyReading1 != KEY_INVALID)
@ -947,18 +947,16 @@ void APP_CheckKeys(void)
}
}
else
{
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
{
if (++gPttDebounceCounter >= 4) // 40ms
{
gPttIsPressed = true;
APP_ProcessKey(KEY_PTT, true, false);
}
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
{ // PTT pressed
if (++gPttDebounceCounter >= 4) // 40ms
{ // lets start transmitting
gPttIsPressed = true;
APP_ProcessKey(KEY_PTT, true, false);
}
else
gPttDebounceCounter = 0;
}
else
gPttDebounceCounter = 0;
Key = KEYBOARD_Poll();
@ -1022,7 +1020,7 @@ void APP_CheckKeys(void)
void APP_TimeSlice10ms(void)
{
gFlashLightBlinkCounter++;
if (UART_IsCommandAvailable())
{
__disable_irq();
@ -1071,23 +1069,23 @@ void APP_TimeSlice10ms(void)
if (gAlarmState == ALARM_STATE_TXALARM || gAlarmState == ALARM_STATE_ALARM)
{
uint16_t Tone;
gAlarmRunningCounter++;
gAlarmToneCounter++;
Tone = 500 + (gAlarmToneCounter * 25);
if (Tone > 1500)
{
Tone = 500;
gAlarmToneCounter = 0;
}
BK4819_SetScrambleFrequencyControlWord(Tone);
if (gEeprom.ALARM_MODE == ALARM_MODE_TONE && gAlarmRunningCounter == 512)
{
gAlarmRunningCounter = 0;
if (gAlarmState == ALARM_STATE_TXALARM)
{
gAlarmState = ALARM_STATE_ALARM;
@ -1113,7 +1111,7 @@ void APP_TimeSlice10ms(void)
}
}
#endif
// repeater tail tone elimination
if (gRTTECountdown)
{
@ -1259,7 +1257,7 @@ void APP_TimeSlice10ms(void)
}
}
#endif
APP_CheckKeys();
}
@ -1397,17 +1395,17 @@ void APP_TimeSlice500ms(void)
if (!gChargingWithTypeC)
{
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP);
#ifndef DISABLE_VOICE
AUDIO_SetVoiceID(0, VOICE_ID_LOW_VOLTAGE);
#endif
if (gBatteryDisplayLevel == 0)
{
#ifndef DISABLE_VOICE
AUDIO_PlaySingleVoice(true);
#endif
gReducedService = true;
FUNCTION_Select(FUNCTION_POWER_SAVE);
ST7565_Configure_GPIO_B11();
@ -1481,17 +1479,17 @@ void APP_TimeSlice500ms(void)
gAlarmState = ALARM_STATE_OFF;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
gEnableSpeaker = false;
if (gEeprom.ALARM_MODE == ALARM_MODE_TONE)
{
RADIO_SendEndOfTransmission();
RADIO_EnableCxCSS();
}
gVoxResumeCountdown = 80;
SYSTEM_DelayMs(5);
RADIO_SetupRegisters(true);
gRequestDisplayScreen = DISPLAY_MAIN;
}
@ -1742,12 +1740,12 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (!bKeyHeld && bKeyPressed)
{
ALARM_Off();
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
FUNCTION_Select(FUNCTION_FOREGROUND);
else
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
if (Key == KEY_PTT)
gPttWasPressed = true;
else
@ -1913,7 +1911,7 @@ Skip:
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
AUDIO_PlaySingleVoice(true);
#endif
SCANNER_Start();
gRequestDisplayScreen = DISPLAY_SCANNER;
@ -1935,7 +1933,7 @@ Skip:
gAnotherVoiceID = VOICE_ID_INVALID;
}
#endif
GUI_SelectNextDisplay(gRequestDisplayScreen);
gRequestDisplayScreen = DISPLAY_INVALID;

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.