mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-29 14:51:26 +03:00
Tidy up
This commit is contained in:
parent
d65a39da56
commit
a452646da9
95
app/app.c
95
app/app.c
@ -1281,14 +1281,6 @@ void APP_TimeSlice500ms(void)
|
|||||||
{
|
{
|
||||||
// Skipped authentic device check
|
// Skipped authentic device check
|
||||||
|
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
|
||||||
{
|
|
||||||
if (gBacklightCountdown > 0)
|
|
||||||
if (--gBacklightCountdown == 0)
|
|
||||||
if (gEeprom.BACKLIGHT < 5)
|
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gKeypadLocked > 0)
|
if (gKeypadLocked > 0)
|
||||||
if (--gKeypadLocked == 0)
|
if (--gKeypadLocked == 0)
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
@ -1330,57 +1322,62 @@ void APP_TimeSlice500ms(void)
|
|||||||
gCurrentRSSI = BK4819_GetRSSI();
|
gCurrentRSSI = BK4819_GetRSSI();
|
||||||
UI_UpdateRSSI(gCurrentRSSI);
|
UI_UpdateRSSI(gCurrentRSSI);
|
||||||
}
|
}
|
||||||
// else
|
|
||||||
|
if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
{
|
{
|
||||||
if ((gFM_ScanState == FM_SCAN_OFF || gAskToSave) && gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF)
|
|
||||||
|
if (gBacklightCountdown > 0)
|
||||||
|
if (--gBacklightCountdown == 0)
|
||||||
|
if (gEeprom.BACKLIGHT < 5)
|
||||||
|
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn backlight off
|
||||||
|
|
||||||
|
#ifndef DISABLE_AIRCOPY
|
||||||
|
if (gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
||||||
|
#else
|
||||||
|
if (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_AIRCOPY
|
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode)
|
||||||
if (gScreenToDisplay != DISPLAY_AIRCOPY && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
|
|
||||||
#else
|
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode)
|
if (--gKeyLockCountdown == 0)
|
||||||
|
gEeprom.KEY_LOCK = true;
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gVoltageMenuCountdown > 0)
|
||||||
|
{
|
||||||
|
if (--gVoltageMenuCountdown == 0)
|
||||||
{
|
{
|
||||||
if (--gKeyLockCountdown == 0)
|
if (gInputBoxIndex || gDTMF_InputMode || gScreenToDisplay == DISPLAY_MENU)
|
||||||
gEeprom.KEY_LOCK = true;
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
|
|
||||||
gUpdateStatus = true;
|
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||||
}
|
|
||||||
|
|
||||||
if (gVoltageMenuCountdown > 0)
|
|
||||||
{
|
|
||||||
if (--gVoltageMenuCountdown == 0)
|
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex || gDTMF_InputMode || gScreenToDisplay == DISPLAY_MENU)
|
BK4819_StopScan();
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
|
||||||
|
RADIO_ConfigureChannel(0, 2);
|
||||||
if (gScreenToDisplay == DISPLAY_SCANNER)
|
RADIO_ConfigureChannel(1, 2);
|
||||||
{
|
RADIO_SetupRegisters(true);
|
||||||
BK4819_StopScan();
|
|
||||||
|
|
||||||
RADIO_ConfigureChannel(0, 2);
|
|
||||||
RADIO_ConfigureChannel(1, 2);
|
|
||||||
RADIO_SetupRegisters(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
gWasFKeyPressed = false;
|
|
||||||
gUpdateStatus = true;
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
gDTMF_InputMode = false;
|
|
||||||
gDTMF_InputIndex = 0;
|
|
||||||
gAskToSave = false;
|
|
||||||
gAskToDelete = false;
|
|
||||||
|
|
||||||
if (gFmRadioMode && gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
|
||||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
|
||||||
else
|
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gWasFKeyPressed = false;
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
gDTMF_InputMode = false;
|
||||||
|
gDTMF_InputIndex = 0;
|
||||||
|
gAskToSave = false;
|
||||||
|
gAskToDelete = false;
|
||||||
|
|
||||||
|
if (gFmRadioMode && gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
|
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||||
|
else
|
||||||
|
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gPttIsPressed && gFM_ResumeCountdown)
|
if (!gPttIsPressed && gFM_ResumeCountdown)
|
||||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
28
ui/main.c
28
ui/main.c
@ -121,7 +121,7 @@ void UI_DisplayMain(void)
|
|||||||
if (!single_vfo)
|
if (!single_vfo)
|
||||||
{ // highlight the selected/used VFO with a marker
|
{ // highlight the selected/used VFO with a marker
|
||||||
if (bIsSameVfo)
|
if (bIsSameVfo)
|
||||||
memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
||||||
//else
|
//else
|
||||||
//memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
|
//memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
|
||||||
}
|
}
|
||||||
@ -234,14 +234,14 @@ void UI_DisplayMain(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_PrintString(String, 31, 111, vfo_num * 4, Width, true);
|
UI_PrintString(String, 31, 111, Line, Width, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // normal state
|
{ // normal state
|
||||||
|
|
||||||
if (gInputBoxIndex && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num)
|
if (gInputBoxIndex && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num)
|
||||||
{ // user is entering a new frequency
|
{ // user is entering a new frequency
|
||||||
UI_DisplayFrequency(gInputBox, 31, vfo_num * 4, true, false);
|
UI_DisplayFrequency(gInputBox, 31, Line, true, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -270,13 +270,13 @@ void UI_DisplayMain(void)
|
|||||||
#ifndef DISABLE_BIG_FREQ
|
#ifndef DISABLE_BIG_FREQ
|
||||||
NUMBER_ToDigits(frequency_Hz, String);
|
NUMBER_ToDigits(frequency_Hz, String);
|
||||||
// show the main large frequency digits
|
// show the main large frequency digits
|
||||||
UI_DisplayFrequency(String, 31, vfo_num * 4, false, false);
|
UI_DisplayFrequency(String, 31, Line, false, false);
|
||||||
// show the remaining 2 small frequency digits
|
// show the remaining 2 small frequency digits
|
||||||
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
|
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
|
||||||
#else
|
#else
|
||||||
// show the frequency in the main font
|
// show the frequency in the main font
|
||||||
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
|
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
|
||||||
UI_PrintString(String, 31, 112, vfo_num * 4, 8, true);
|
UI_PrintString(String, 31, 112, Line, 8, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
frequency_Hz = 0;
|
frequency_Hz = 0;
|
||||||
@ -284,7 +284,7 @@ void UI_DisplayMain(void)
|
|||||||
|
|
||||||
case MDF_CHANNEL: // show the channel number
|
case MDF_CHANNEL: // show the channel number
|
||||||
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
|
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||||
UI_PrintString(String, 31, 112, vfo_num * 4, 8, true);
|
UI_PrintString(String, 31, 112, Line, 8, true);
|
||||||
frequency_Hz = 0;
|
frequency_Hz = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -292,11 +292,11 @@ void UI_DisplayMain(void)
|
|||||||
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
|
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
|
||||||
{ // no channel name, show the channel number instead
|
{ // no channel name, show the channel number instead
|
||||||
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
|
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||||
UI_PrintString(String, 31, 112, vfo_num * 4, 8, true);
|
UI_PrintString(String, 31, 112, Line, 8, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // channel name
|
{ // channel name
|
||||||
UI_PrintString(gEeprom.VfoInfo[vfo_num].Name, 31, 112, vfo_num * 4, 8, true);
|
UI_PrintString(gEeprom.VfoInfo[vfo_num].Name, 31, 112, Line, 8, true);
|
||||||
}
|
}
|
||||||
frequency_Hz = 0;
|
frequency_Hz = 0;
|
||||||
break;
|
break;
|
||||||
@ -306,13 +306,13 @@ void UI_DisplayMain(void)
|
|||||||
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
|
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
|
||||||
{ // no channel name, show channel number instead
|
{ // no channel name, show channel number instead
|
||||||
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
|
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||||
UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, (vfo_num * 4) + 0, false);
|
UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, Line, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // channel name
|
{ // channel name
|
||||||
memset(String, 0, sizeof(String));
|
memset(String, 0, sizeof(String));
|
||||||
memcpy(String, gEeprom.VfoInfo[vfo_num].Name, 8);
|
memcpy(String, gEeprom.VfoInfo[vfo_num].Name, 8);
|
||||||
UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, (vfo_num * 4) + 0, false);
|
UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, Line, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@ -332,13 +332,13 @@ void UI_DisplayMain(void)
|
|||||||
#ifndef DISABLE_BIG_FREQ
|
#ifndef DISABLE_BIG_FREQ
|
||||||
NUMBER_ToDigits(frequency_Hz, String); // 8 digits
|
NUMBER_ToDigits(frequency_Hz, String); // 8 digits
|
||||||
// show the main large frequency digits
|
// show the main large frequency digits
|
||||||
UI_DisplayFrequency(String, 31, vfo_num * 4, false, false);
|
UI_DisplayFrequency(String, 31, Line, false, false);
|
||||||
// show the remaining 2 small frequency digits
|
// show the remaining 2 small frequency digits
|
||||||
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
|
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
|
||||||
#else
|
#else
|
||||||
// show the frequency in the main font
|
// show the frequency in the main font
|
||||||
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
|
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
|
||||||
UI_PrintString(String, 31, 112, vfo_num * 4, 8, true);
|
UI_PrintString(String, 31, 112, Line, 8, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
frequency_Hz = 0;
|
frequency_Hz = 0;
|
||||||
@ -452,10 +452,10 @@ void UI_DisplayMain(void)
|
|||||||
{ // show the channel frequency below the channel number/name
|
{ // show the channel frequency below the channel number/name
|
||||||
#if 1
|
#if 1
|
||||||
NUMBER_ToDigits(frequency_Hz, String); // 8 digits
|
NUMBER_ToDigits(frequency_Hz, String); // 8 digits
|
||||||
UI_DisplayFrequencySmall(String, 31 + 8, (vfo_num * 4) + 1, false);
|
UI_DisplayFrequencySmall(String, 31 + 8, Line + 1, false);
|
||||||
#else
|
#else
|
||||||
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
|
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
|
||||||
UI_PrintStringSmall(String, 31 + 8, 0, (vfo_num * 4) + 1, false);
|
UI_PrintStringSmall(String, 31 + 8, 0, Line + 1, false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user