mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 06:39:49 +03:00
Tidy ups and makefile update
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef DISABLE_AIRCOPY
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#ifndef UI_AIRCOPY_H
|
||||
#define UI_AIRCOPY_H
|
||||
|
||||
#ifndef DISABLE_AIRCOPY
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
void UI_DisplayAircopy(void);
|
||||
#endif
|
||||
|
||||
|
@ -14,7 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "app/fm.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
@ -104,3 +107,5 @@ void UI_DisplayFM(void)
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -17,7 +17,9 @@
|
||||
#ifndef UI_FM_H
|
||||
#define UI_FM_H
|
||||
|
||||
void UI_DisplayFM(void);
|
||||
#ifdef ENABLE_FMRADIO
|
||||
void UI_DisplayFM(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
14
ui/main.c
14
ui/main.c
@ -28,6 +28,10 @@
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/main.h"
|
||||
|
||||
//#ifndef ARRAY_SIZE
|
||||
// #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
//#endif
|
||||
|
||||
void UI_DisplayMain(void)
|
||||
{
|
||||
const unsigned int display_width = 128;
|
||||
@ -135,7 +139,7 @@ void UI_DisplayMain(void)
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{ // transmitting
|
||||
|
||||
#ifndef DISABLE_ALARM
|
||||
#ifdef ENABLE_ALARM
|
||||
if (gAlarmState == ALARM_STATE_ALARM)
|
||||
{
|
||||
SomeValue = 2;
|
||||
@ -204,7 +208,7 @@ void UI_DisplayMain(void)
|
||||
|
||||
uint8_t State = VfoState[vfo_num];
|
||||
|
||||
#ifndef DISABLE_ALARM
|
||||
#ifdef ENABLE_ALARM
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
|
||||
{
|
||||
Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
||||
@ -282,7 +286,7 @@ void UI_DisplayMain(void)
|
||||
switch (gEeprom.CHANNEL_DISPLAY_MODE)
|
||||
{
|
||||
case MDF_FREQUENCY: // show the channel frequency
|
||||
#ifndef DISABLE_BIG_FREQ
|
||||
#ifdef ENABLE_BIG_FREQ
|
||||
NUMBER_ToDigits(frequency_Hz, String);
|
||||
// show the main large frequency digits
|
||||
UI_DisplayFrequency(String, 31, Line, false, false);
|
||||
@ -313,7 +317,7 @@ void UI_DisplayMain(void)
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef CHAN_NAME_FREQ
|
||||
#ifdef ENABLE_CHAN_NAME_FREQ
|
||||
case MDF_NAME_FREQ: // show the channel name and frequency
|
||||
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
|
||||
{ // no channel name, show channel number instead
|
||||
@ -343,7 +347,7 @@ void UI_DisplayMain(void)
|
||||
else
|
||||
{ // frequency mode
|
||||
|
||||
#ifndef DISABLE_BIG_FREQ
|
||||
#ifdef ENABLE_BIG_FREQ
|
||||
NUMBER_ToDigits(frequency_Hz, String); // 8 digits
|
||||
// show the main large frequency digits
|
||||
UI_DisplayFrequency(String, 31, Line, false, false);
|
||||
|
22
ui/menu.c
22
ui/menu.c
@ -52,7 +52,7 @@ static const char MenuList[][7] =
|
||||
"TxVFO", // was "WX"
|
||||
"Beep",
|
||||
"TxTOut", // was "TOT"
|
||||
#ifndef DISABLE_VOICE
|
||||
#ifdef ENABLE_VOICE
|
||||
"Voice",
|
||||
#endif
|
||||
"SC-Rev",
|
||||
@ -67,7 +67,7 @@ static const char MenuList[][7] =
|
||||
"S-List",
|
||||
"SList1",
|
||||
"SList2",
|
||||
#ifndef DISABLE_ALARM
|
||||
#ifdef ENABLE_ALARM
|
||||
"AL-Mod",
|
||||
#endif
|
||||
"ANI-ID",
|
||||
@ -84,7 +84,7 @@ static const char MenuList[][7] =
|
||||
"Roger",
|
||||
"BatVol", // was "VOL"
|
||||
"Mode", // was "AM"
|
||||
#ifndef DISABLE_NOAA
|
||||
#ifdef ENABLE_NOAA
|
||||
"NOAA_S",
|
||||
#endif
|
||||
"MemDel", // was "Del-CH"
|
||||
@ -167,7 +167,7 @@ static const char gSubMenu_CHAN[3][7] =
|
||||
"CHAN_B",
|
||||
};
|
||||
|
||||
#ifndef DISABLE_VOICE
|
||||
#ifdef ENABLE_VOICE
|
||||
static const char gSubMenu_VOICE[3][4] =
|
||||
{
|
||||
"OFF",
|
||||
@ -183,7 +183,7 @@ static const char gSubMenu_SC_REV[3][3] =
|
||||
"SE",
|
||||
};
|
||||
|
||||
#ifndef CHAN_NAME_FREQ
|
||||
#ifndef ENABLE_CHAN_NAME_FREQ
|
||||
static const char gSubMenu_MDF[3][5] =
|
||||
{
|
||||
"FREQ",
|
||||
@ -200,7 +200,7 @@ static const char gSubMenu_SC_REV[3][3] =
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_ALARM
|
||||
#ifdef ENABLE_ALARM
|
||||
static const char gSubMenu_AL_MOD[2][5] =
|
||||
{
|
||||
"SITE",
|
||||
@ -414,7 +414,7 @@ void UI_DisplayMenu(void)
|
||||
case MENU_STE:
|
||||
case MENU_D_ST:
|
||||
case MENU_D_DCD:
|
||||
#ifndef DISABLE_NOAA
|
||||
#ifdef ENABLE_NOAA
|
||||
case MENU_NOAA_S:
|
||||
#endif
|
||||
case MENU_350TX:
|
||||
@ -450,7 +450,7 @@ void UI_DisplayMenu(void)
|
||||
sprintf(String, "%umin", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
#ifndef DISABLE_VOICE
|
||||
#ifdef ENABLE_VOICE
|
||||
case MENU_VOICE:
|
||||
strcpy(String, gSubMenu_VOICE[gSubMenuSelection]);
|
||||
break;
|
||||
@ -475,7 +475,7 @@ void UI_DisplayMenu(void)
|
||||
sprintf(String, "LIST%u", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
#ifndef DISABLE_ALARM
|
||||
#ifdef ENABLE_ALARM
|
||||
case MENU_AL_MOD:
|
||||
sprintf(String, gSubMenu_AL_MOD[gSubMenuSelection]);
|
||||
break;
|
||||
@ -556,6 +556,10 @@ void UI_DisplayMenu(void)
|
||||
gBatteryVoltageAverage;
|
||||
sprintf(String, "%u%%", (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v));
|
||||
UI_PrintString(String, 50, 127, 3, 8);
|
||||
#if 0
|
||||
sprintf(String, "Curr %u", gBatteryCurrent); // needs scaling into mA
|
||||
UI_PrintString(String, 50, 127, 5, 8);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
if (gMenuCursor == MENU_OFFSET)
|
||||
|
@ -42,7 +42,7 @@ enum
|
||||
MENU_XB,
|
||||
MENU_BEEP,
|
||||
MENU_TOT,
|
||||
#ifndef DISABLE_VOICE
|
||||
#ifdef ENABLE_VOICE
|
||||
MENU_VOICE,
|
||||
#endif
|
||||
MENU_SC_REV,
|
||||
@ -57,7 +57,7 @@ enum
|
||||
MENU_S_LIST,
|
||||
MENU_SLIST1,
|
||||
MENU_SLIST2,
|
||||
#ifndef DISABLE_ALARM
|
||||
#ifdef ENABLE_ALARM
|
||||
MENU_AL_MOD,
|
||||
#endif
|
||||
MENU_ANI_ID,
|
||||
@ -74,7 +74,7 @@ enum
|
||||
MENU_ROGER,
|
||||
MENU_VOL,
|
||||
MENU_AM,
|
||||
#ifndef DISABLE_NOAA
|
||||
#ifdef ENABLE_NOAA
|
||||
MENU_NOAA_S,
|
||||
#endif
|
||||
MENU_DEL_CH,
|
||||
|
90
ui/status.c
90
ui/status.c
@ -16,7 +16,9 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "app/fm.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
#endif
|
||||
#include "bitmaps.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "driver/st7565.h"
|
||||
@ -26,65 +28,63 @@
|
||||
#include "settings.h"
|
||||
#include "ui/status.h"
|
||||
|
||||
void UI_DisplayStatus(void)
|
||||
void UI_DisplayStatus(const bool test_display)
|
||||
{
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
|
||||
memcpy(gStatusLine, BITMAP_PowerSave, sizeof(BITMAP_PowerSave));
|
||||
|
||||
if (gBatteryDisplayLevel < 2)
|
||||
{
|
||||
if (gLowBatteryBlink == 1)
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gBatteryDisplayLevel == 2)
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel2, sizeof(BITMAP_BatteryLevel2));
|
||||
#ifdef ENABLE_NOAA
|
||||
if (gIsNoaaMode || test_display)
|
||||
memcpy(gStatusLine + 7, BITMAP_NOAA, sizeof(BITMAP_NOAA));
|
||||
#endif
|
||||
|
||||
if (gSetting_KILLED || test_display)
|
||||
memset(gStatusLine + 21, 0xFF, 10);
|
||||
#ifdef ENABLE_FMRADIO
|
||||
else
|
||||
if (gBatteryDisplayLevel == 3)
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel3, sizeof(BITMAP_BatteryLevel3));
|
||||
else
|
||||
if (gBatteryDisplayLevel == 4)
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel4, sizeof(BITMAP_BatteryLevel4));
|
||||
else
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel5, sizeof(BITMAP_BatteryLevel5));
|
||||
}
|
||||
if (gFmRadioMode || test_display)
|
||||
memcpy(gStatusLine + 21, BITMAP_FM, sizeof(BITMAP_FM));
|
||||
#endif
|
||||
|
||||
if (gChargingWithTypeC)
|
||||
memcpy(gStatusLine + 100, BITMAP_USB_C, sizeof(BITMAP_USB_C));
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF || test_display)
|
||||
memcpy(gStatusLine + 34, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
||||
#endif
|
||||
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF || test_display)
|
||||
memcpy(gStatusLine + 45, BITMAP_TDR, sizeof(BITMAP_TDR));
|
||||
|
||||
if (gEeprom.KEY_LOCK)
|
||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF || test_display)
|
||||
memcpy(gStatusLine + 58, BITMAP_XB, sizeof(BITMAP_XB));
|
||||
|
||||
if (gEeprom.VOX_SWITCH || test_display)
|
||||
memcpy(gStatusLine + 71, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||
|
||||
if (gEeprom.KEY_LOCK || test_display)
|
||||
memcpy(gStatusLine + 90, BITMAP_KeyLock, sizeof(BITMAP_KeyLock));
|
||||
else
|
||||
if (gWasFKeyPressed)
|
||||
memcpy(gStatusLine + 90, BITMAP_F_Key, sizeof(BITMAP_F_Key));
|
||||
|
||||
if (gEeprom.VOX_SWITCH)
|
||||
memcpy(gStatusLine + 71, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||
if (gChargingWithTypeC || test_display)
|
||||
memcpy(gStatusLine + 100, BITMAP_USB_C, sizeof(BITMAP_USB_C));
|
||||
|
||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
|
||||
memcpy(gStatusLine + 58, BITMAP_XB, sizeof(BITMAP_XB));
|
||||
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
memcpy(gStatusLine + 45, BITMAP_TDR, sizeof(BITMAP_TDR));
|
||||
|
||||
#ifndef DISABLE_VOICE
|
||||
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF)
|
||||
memcpy(gStatusLine + 34, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
||||
#endif
|
||||
|
||||
if (gSetting_KILLED)
|
||||
memset(gStatusLine + 21, 0xFF, 10);
|
||||
if (gBatteryDisplayLevel >= 5 || test_display)
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel5, sizeof(BITMAP_BatteryLevel5));
|
||||
else
|
||||
if (gFmRadioMode)
|
||||
memcpy(gStatusLine + 21, BITMAP_FM, sizeof(BITMAP_FM));
|
||||
if (gBatteryDisplayLevel >= 4)
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel4, sizeof(BITMAP_BatteryLevel4));
|
||||
else
|
||||
if (gBatteryDisplayLevel >= 3)
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel3, sizeof(BITMAP_BatteryLevel3));
|
||||
else
|
||||
if (gBatteryDisplayLevel >= 2)
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel2, sizeof(BITMAP_BatteryLevel2));
|
||||
else
|
||||
if (gLowBatteryBlink == 1)
|
||||
memcpy(gStatusLine + 110, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
|
||||
#ifndef DISABLE_NOAA
|
||||
if (gIsNoaaMode)
|
||||
memcpy(gStatusLine + 7, BITMAP_NOAA, sizeof(BITMAP_NOAA));
|
||||
#endif
|
||||
|
||||
ST7565_BlitStatusLine();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#ifndef UI_STATUS_H
|
||||
#define UI_STATUS_H
|
||||
|
||||
void UI_DisplayStatus(void);
|
||||
void UI_DisplayStatus(const bool test_display);
|
||||
|
||||
#endif
|
||||
|
||||
|
26
ui/ui.c
26
ui/ui.c
@ -17,14 +17,18 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "app/dtmf.h"
|
||||
#include "app/fm.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
#endif
|
||||
#include "app/scanner.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "misc.h"
|
||||
#ifndef DISABLE_AIRCOPY
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
#include "ui/aircopy.h"
|
||||
#endif
|
||||
#include "ui/fmradio.h"
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "ui/fmradio.h"
|
||||
#endif
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/main.h"
|
||||
#include "ui/menu.h"
|
||||
@ -46,10 +50,12 @@ void GUI_DisplayScreen(void)
|
||||
UI_DisplayMain();
|
||||
break;
|
||||
|
||||
case DISPLAY_FM:
|
||||
UI_DisplayFM();
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
case DISPLAY_FM:
|
||||
UI_DisplayFM();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case DISPLAY_MENU:
|
||||
UI_DisplayMenu();
|
||||
break;
|
||||
@ -58,7 +64,7 @@ void GUI_DisplayScreen(void)
|
||||
UI_DisplayScanner();
|
||||
break;
|
||||
|
||||
#ifndef DISABLE_AIRCOPY
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
case DISPLAY_AIRCOPY:
|
||||
UI_DisplayAircopy();
|
||||
break;
|
||||
@ -79,7 +85,9 @@ void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
||||
gIsInSubMenu = false;
|
||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||
gScanState = SCAN_OFF;
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
#ifdef ENABLE_FMRADIO
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
#endif
|
||||
gAskForConfirmation = 0;
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputIndex = 0;
|
||||
|
4
ui/ui.h
4
ui/ui.h
@ -26,9 +26,7 @@ enum GUI_DisplayType_t
|
||||
DISPLAY_FM,
|
||||
DISPLAY_MENU,
|
||||
DISPLAY_SCANNER,
|
||||
#ifndef DISABLE_AIRCOPY
|
||||
DISPLAY_AIRCOPY,
|
||||
#endif
|
||||
DISPLAY_AIRCOPY,
|
||||
DISPLAY_INVALID = 0xFFu
|
||||
};
|
||||
|
||||
|
19
ui/welcome.c
19
ui/welcome.c
@ -24,13 +24,15 @@
|
||||
#include "misc.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/welcome.h"
|
||||
#include "ui/status.h"
|
||||
#include "version.h"
|
||||
|
||||
void UI_DisplayWelcome(void)
|
||||
{
|
||||
char WelcomeString0[16];
|
||||
char WelcomeString1[16];
|
||||
|
||||
char WelcomeString2[16];
|
||||
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
@ -42,6 +44,7 @@ void UI_DisplayWelcome(void)
|
||||
{
|
||||
memset(WelcomeString0, 0, sizeof(WelcomeString0));
|
||||
memset(WelcomeString1, 0, sizeof(WelcomeString1));
|
||||
memset(WelcomeString2, 0, sizeof(WelcomeString2));
|
||||
|
||||
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_VOLTAGE)
|
||||
{
|
||||
@ -54,6 +57,10 @@ void UI_DisplayWelcome(void)
|
||||
gBatteryVoltageAverage / 100,
|
||||
gBatteryVoltageAverage % 100,
|
||||
(100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v));
|
||||
|
||||
#if 0
|
||||
sprintf(WelcomeString2, "Current %u", gBatteryCurrent); // needs scaling into mA
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -63,9 +70,17 @@ void UI_DisplayWelcome(void)
|
||||
|
||||
UI_PrintString(WelcomeString0, 0, 127, 0, 10);
|
||||
UI_PrintString(WelcomeString1, 0, 127, 2, 10);
|
||||
#if 0
|
||||
UI_PrintStringSmall(WelcomeString2, 0, 127, 4);
|
||||
#endif
|
||||
UI_PrintString(Version, 0, 127, 5, 10);
|
||||
|
||||
ST7565_BlitStatusLine();
|
||||
#if 1
|
||||
ST7565_BlitStatusLine(); // blank status line
|
||||
#else
|
||||
UI_DisplayStatus(true); // show all status line symbols (test)
|
||||
#endif
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user