forked from mirror/uv-k5-firmware
Renamed gNumberForPrintf to gInputBox.
This commit is contained in:
parent
1959d13642
commit
285ae00d6b
1
Makefile
1
Makefile
@ -55,6 +55,7 @@ OBJS += misc.o
|
||||
OBJS += radio.o
|
||||
OBJS += scheduler.o
|
||||
OBJS += settings.o
|
||||
OBJS += ui/inputbox.o
|
||||
|
||||
OBJS += main.o
|
||||
|
||||
|
11
app/app.c
11
app/app.c
@ -42,6 +42,7 @@
|
||||
#include "radio.h"
|
||||
#include "settings.h"
|
||||
#include "sram-overlay.h"
|
||||
#include "ui/inputbox.h"
|
||||
|
||||
static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||
void FUN_000069f8(FUNCTION_Type_t Function);
|
||||
@ -1247,7 +1248,7 @@ void APP_TimeSlice500ms(void)
|
||||
if (g_20000393 != 0) {
|
||||
g_20000393--;
|
||||
if (g_20000393 == 0) {
|
||||
if (gNumberOffset != 0 || g_200003BA == 1 || gScreenToDisplay == DISPLAY_MENU) {
|
||||
if (gInputBoxIndex || g_200003BA == 1 || gScreenToDisplay == DISPLAY_MENU) {
|
||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||
}
|
||||
if (gScreenToDisplay == DISPLAY_SCANNER) {
|
||||
@ -1258,7 +1259,7 @@ void APP_TimeSlice500ms(void)
|
||||
}
|
||||
gWasFKeyPressed = false;
|
||||
g_2000036F = 1;
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
g_200003BA = 0;
|
||||
g_200003BB = 0;
|
||||
gAskToSave = false;
|
||||
@ -1556,7 +1557,7 @@ void APP_SwitchToFM(void)
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_2) {
|
||||
if (gFmRadioMode) {
|
||||
FM_TurnOff();
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
g_200003B6 = 0x50;
|
||||
g_20000398 = 1;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
@ -1565,14 +1566,14 @@ void APP_SwitchToFM(void)
|
||||
RADIO_ConfigureTX();
|
||||
RADIO_SetupRegisters(true);
|
||||
APP_StartFM();
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
gRequestDisplayScreen = DISPLAY_FM;
|
||||
}
|
||||
}
|
||||
|
||||
void FUN_000056a0(bool bFlag)
|
||||
{
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
if (bFlag) {
|
||||
g_20000383 = 3;
|
||||
} else {
|
||||
|
@ -7,13 +7,14 @@
|
||||
#include "gui.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/inputbox.h"
|
||||
|
||||
extern void FUN_0000773c(void);
|
||||
extern void PlayFMRadio(void);
|
||||
|
||||
void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (gNumberOffset != 0) {
|
||||
if (gInputBoxIndex) {
|
||||
if (!bKeyHeld && bKeyPressed) {
|
||||
g_20000396 = 2;
|
||||
}
|
||||
@ -60,7 +61,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
{
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
if (!bKeyPressed) {
|
||||
if (gScreenToDisplay == DISPLAY_MAIN) {
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT) {
|
||||
@ -79,7 +80,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -95,21 +96,21 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
if (g_20000381 == 0) {
|
||||
if (gScreenToDisplay == DISPLAY_MENU) {
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
gPttIsPressed = false;
|
||||
gPttDebounceCounter = 0;
|
||||
return;
|
||||
}
|
||||
if (gScreenToDisplay == DISPLAY_FM) {
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
gPttIsPressed = false;
|
||||
gPttDebounceCounter = 0;
|
||||
return;
|
||||
}
|
||||
if (gScreenToDisplay != DISPLAY_SCANNER) {
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gRTTECountdown == 0) {
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
return;
|
||||
}
|
||||
g_200003A0 = 1;
|
||||
@ -136,7 +137,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
||||
}
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
g_200003A0 = 1;
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
return;
|
||||
}
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
|
39
app/main.c
39
app/main.c
@ -8,6 +8,7 @@
|
||||
#include "misc.h"
|
||||
#include "radio.h"
|
||||
#include "settings.h"
|
||||
#include "ui/inputbox.h"
|
||||
|
||||
extern void APP_SwitchToFM(void);
|
||||
extern void FUN_0000773c(void);
|
||||
@ -34,18 +35,18 @@ void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
if (!gWasFKeyPressed) {
|
||||
NUMBER_Append(Key);
|
||||
INPUTBOX_Append(Key);
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
if (gTxRadioInfo->CHANNEL_SAVE < 200) {
|
||||
uint16_t Channel;
|
||||
|
||||
if (gNumberOffset != 3) {
|
||||
if (gInputBoxIndex != 3) {
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
gNumberOffset = 0;
|
||||
Channel = ((gNumberForPrintf[0] * 100) + (gNumberForPrintf[1] * 10) + gNumberForPrintf[2]) - 1;
|
||||
gInputBoxIndex = 0;
|
||||
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||
if (!RADIO_CheckValidChannel(Channel, false, 0)) {
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
@ -60,12 +61,12 @@ void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
if (gTxRadioInfo->CHANNEL_SAVE < 207) {
|
||||
uint32_t Frequency;
|
||||
|
||||
if (gNumberOffset < 6) {
|
||||
if (gInputBoxIndex < 6) {
|
||||
gAnotherVoiceID = Key;
|
||||
return;
|
||||
}
|
||||
gNumberOffset = 0;
|
||||
NUMBER_Get(gNumberForPrintf, &Frequency);
|
||||
gInputBoxIndex = 0;
|
||||
NUMBER_Get(gInputBox, &Frequency);
|
||||
if (gSetting_350EN || (4999990 < (Frequency - 35000000))) {
|
||||
uint8_t i;
|
||||
|
||||
@ -96,13 +97,13 @@ void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
} else {
|
||||
uint8_t Channel;
|
||||
|
||||
if (gNumberOffset != 2) {
|
||||
if (gInputBoxIndex != 2) {
|
||||
gAnotherVoiceID = Key;
|
||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||
return;
|
||||
}
|
||||
gNumberOffset = 0;
|
||||
Channel = (gNumberForPrintf[0] * 10) + gNumberForPrintf[1];
|
||||
gInputBoxIndex = 0;
|
||||
Channel = (gInputBox[0] * 10) + gInputBox[1];
|
||||
if ((Channel - 1) < 10) {
|
||||
Channel += 207;
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
@ -253,12 +254,12 @@ void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
if (!gFmRadioMode) {
|
||||
if (gStepDirection == 0) {
|
||||
if (gNumberOffset == 0) {
|
||||
if (gInputBoxIndex == 0) {
|
||||
return;
|
||||
}
|
||||
gNumberOffset--;
|
||||
gNumberForPrintf[gNumberOffset] = 10;
|
||||
if (gNumberOffset == 0) {
|
||||
gInputBoxIndex--;
|
||||
gInputBox[gInputBoxIndex] = 10;
|
||||
if (gInputBoxIndex == 0) {
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
}
|
||||
} else {
|
||||
@ -278,8 +279,8 @@ void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
bool bFlag;
|
||||
|
||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
bFlag = gNumberOffset == 0;
|
||||
gNumberOffset = 0;
|
||||
bFlag = gInputBoxIndex == 0;
|
||||
gInputBoxIndex = 0;
|
||||
if (bFlag) {
|
||||
gFlagRefreshSetting = true;
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
@ -292,7 +293,7 @@ void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
|
||||
void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||
{
|
||||
if (gNumberOffset) {
|
||||
if (gInputBoxIndex) {
|
||||
if (!bKeyHeld && bKeyPressed) {
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
}
|
||||
@ -342,7 +343,7 @@ void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
|
||||
Channel = gEeprom.ScreenChannel[gEeprom.TX_CHANNEL];
|
||||
if (bKeyHeld || !bKeyPressed) {
|
||||
if (gNumberOffset) {
|
||||
if (gInputBoxIndex) {
|
||||
return;
|
||||
}
|
||||
if (!bKeyPressed) {
|
||||
@ -357,7 +358,7 @@ void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (gNumberOffset) {
|
||||
if (gInputBoxIndex) {
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
return;
|
||||
}
|
||||
|
51
app/menu.c
51
app/menu.c
@ -11,6 +11,7 @@
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "sram-overlay.h"
|
||||
#include "ui/inputbox.h"
|
||||
|
||||
static const VOICE_ID_t MenuVoices[] = {
|
||||
VOICE_ID_SQUELCH,
|
||||
@ -810,12 +811,12 @@ void MENU_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
g_20000396 = 1;
|
||||
NUMBER_Append(Key);
|
||||
INPUTBOX_Append(Key);
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
if (!gIsInSubMenu) {
|
||||
switch (gNumberOffset) {
|
||||
switch (gInputBoxIndex) {
|
||||
case 1:
|
||||
Value = gNumberForPrintf[0];
|
||||
Value = gInputBox[0];
|
||||
if (Value && Value <= gMenuListCount) {
|
||||
gMenuCursor = Value - 1;
|
||||
gFlagRefreshSetting = true;
|
||||
@ -823,8 +824,8 @@ void MENU_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
gNumberOffset = 0;
|
||||
Value = (gNumberForPrintf[0] * 10) + gNumberForPrintf[1];
|
||||
gInputBoxIndex = 0;
|
||||
Value = (gInputBox[0] * 10) + gInputBox[1];
|
||||
if (Value && Value <= gMenuListCount) {
|
||||
gMenuCursor = Value - 1;
|
||||
gFlagRefreshSetting = true;
|
||||
@ -832,30 +833,30 @@ void MENU_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
break;
|
||||
}
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
} else {
|
||||
if (gMenuCursor == MENU_OFFSET) {
|
||||
uint32_t Frequency;
|
||||
|
||||
if (gNumberOffset < 6) {
|
||||
if (gInputBoxIndex < 6) {
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
return;
|
||||
}
|
||||
gNumberOffset = 0;
|
||||
NUMBER_Get(gNumberForPrintf, &Frequency);
|
||||
gInputBoxIndex = 0;
|
||||
NUMBER_Get(gInputBox, &Frequency);
|
||||
Frequency += 75;
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
gSubMenuSelection = FREQUENCY_FloorToStep(Frequency, gTxRadioInfo->StepFrequency, 0);
|
||||
return;
|
||||
}
|
||||
if (gMenuCursor == MENU_MEM_CH || gMenuCursor == MENU_DEL_CH || gMenuCursor == MENU_1_CALL) {
|
||||
if (gNumberOffset < 3) {
|
||||
if (gInputBoxIndex < 3) {
|
||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
return;
|
||||
}
|
||||
gNumberOffset = 0;
|
||||
Value = ((gNumberForPrintf[0] * 100) + (gNumberForPrintf[1] * 10) + gNumberForPrintf[2]) - 1;
|
||||
gInputBoxIndex = 0;
|
||||
Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||
if (Value < 200) {
|
||||
gAnotherVoiceID = Key;
|
||||
gSubMenuSelection = Value;
|
||||
@ -876,26 +877,26 @@ void MENU_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
} else {
|
||||
Offset = 3;
|
||||
}
|
||||
switch (gNumberOffset) {
|
||||
switch (gInputBoxIndex) {
|
||||
case 1:
|
||||
Value = gNumberForPrintf[0];
|
||||
Value = gInputBox[0];
|
||||
break;
|
||||
case 2:
|
||||
Value = (gNumberForPrintf[0] * 10) + gNumberForPrintf[1];
|
||||
Value = (gInputBox[0] * 10) + gInputBox[1];
|
||||
break;
|
||||
case 3:
|
||||
Value = (gNumberForPrintf[0] * 100) + (gNumberForPrintf[1] * 10) + gNumberForPrintf[2];
|
||||
Value = (gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2];
|
||||
break;
|
||||
}
|
||||
if (Offset == gNumberOffset) {
|
||||
gNumberOffset = 0;
|
||||
if (Offset == gInputBoxIndex) {
|
||||
gInputBoxIndex = 0;
|
||||
}
|
||||
if (Value <= Max) {
|
||||
gSubMenuSelection = Value;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -908,14 +909,14 @@ void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
||||
g_20000396 = 1;
|
||||
if (g_20000381 == 0) {
|
||||
if (gIsInSubMenu) {
|
||||
if (gNumberOffset == 0 || gMenuCursor != MENU_OFFSET) {
|
||||
if (gInputBoxIndex == 0 || gMenuCursor != MENU_OFFSET) {
|
||||
gIsInSubMenu = false;
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
gFlagRefreshSetting = true;
|
||||
gAnotherVoiceID = VOICE_ID_CANCEL;
|
||||
} else {
|
||||
gNumberOffset--;
|
||||
gNumberForPrintf[gNumberOffset] = 10;
|
||||
gInputBoxIndex--;
|
||||
gInputBox[gInputBoxIndex] = 10;
|
||||
}
|
||||
gRequestDisplayScreen = DISPLAY_MENU;
|
||||
return;
|
||||
@ -976,7 +977,7 @@ void MENU_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||
}
|
||||
}
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1016,7 +1017,7 @@ void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||
return;
|
||||
}
|
||||
g_20000396 = 1;
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
} else if (!bKeyPressed) {
|
||||
return;
|
||||
}
|
||||
|
69
gui.c
69
gui.c
@ -32,6 +32,7 @@
|
||||
#include "helper.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/inputbox.h"
|
||||
|
||||
static const char MenuList[][7] = {
|
||||
// 0x00
|
||||
@ -265,7 +266,7 @@ void GUI_PasswordScreen(void)
|
||||
BEEP_Type_t Beep;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
memset(gNumberForPrintf, 10, sizeof(gNumberForPrintf));
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
|
||||
while (1) {
|
||||
while (!gNextTimeslice) {
|
||||
@ -284,28 +285,28 @@ void GUI_PasswordScreen(void)
|
||||
case KEY_0: case KEY_1: case KEY_2: case KEY_3:
|
||||
case KEY_4: case KEY_5: case KEY_6: case KEY_7:
|
||||
case KEY_8: case KEY_9:
|
||||
NUMBER_Append(Key - KEY_0);
|
||||
if (gNumberOffset < 6) {
|
||||
INPUTBOX_Append(Key - KEY_0);
|
||||
if (gInputBoxIndex < 6) {
|
||||
Beep = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
} else {
|
||||
uint32_t Password;
|
||||
|
||||
gNumberOffset = 0;
|
||||
NUMBER_Get(gNumberForPrintf, &Password);
|
||||
gInputBoxIndex = 0;
|
||||
NUMBER_Get(gInputBox, &Password);
|
||||
if ((gEeprom.POWER_ON_PASSWORD * 100) == Password) {
|
||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||
return;
|
||||
}
|
||||
memset(gNumberForPrintf, 10, sizeof(gNumberForPrintf));
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
Beep = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
}
|
||||
AUDIO_PlayBeep(Beep);
|
||||
gUpdateDisplay = true;
|
||||
break;
|
||||
case KEY_EXIT: // Delete digit
|
||||
if (gNumberOffset != 0) {
|
||||
gNumberOffset -= 1;
|
||||
gNumberForPrintf[gNumberOffset] = 10;
|
||||
if (gInputBoxIndex) {
|
||||
gInputBoxIndex -= 1;
|
||||
gInputBox[gInputBoxIndex] = 10;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||
@ -343,7 +344,7 @@ void GUI_LockScreen(void)
|
||||
strcpy(String, "LOCK");
|
||||
GUI_PrintString(String, 0, 127, 1, 10, true);
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (gNumberForPrintf[i] == 10) {
|
||||
if (gInputBox[i] == 10) {
|
||||
String[i] = '-';
|
||||
} else {
|
||||
String[i] = '*';
|
||||
@ -415,7 +416,7 @@ static void GenerateChannelString(char *pString, uint8_t Channel)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if (gNumberOffset == 0) {
|
||||
if (gInputBoxIndex == 0) {
|
||||
sprintf(pString, "CH-%02d", Channel + 1);
|
||||
return;
|
||||
}
|
||||
@ -425,10 +426,10 @@ static void GenerateChannelString(char *pString, uint8_t Channel)
|
||||
pString[2] = '-';
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (gNumberForPrintf[i] == 10) {
|
||||
if (gInputBox[i] == 10) {
|
||||
pString[i + 3] = '-';
|
||||
} else {
|
||||
pString[i + 3] = gNumberForPrintf[i] + '0';
|
||||
pString[i + 3] = gInputBox[i] + '0';
|
||||
}
|
||||
}
|
||||
|
||||
@ -436,14 +437,14 @@ static void GenerateChannelString(char *pString, uint8_t Channel)
|
||||
|
||||
static void GenerateChannelStringEx(char *pString, bool bShowPrefix, uint8_t ChannelNumber)
|
||||
{
|
||||
if (gNumberOffset) {
|
||||
if (gInputBoxIndex) {
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (gNumberForPrintf[i] == 10) {
|
||||
if (gInputBox[i] == 10) {
|
||||
pString[i] = '-';
|
||||
} else {
|
||||
pString[i] = gNumberForPrintf[i] + '0';
|
||||
pString[i] = gInputBox[i] + '0';
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -628,10 +629,10 @@ static void DisplayMain(void)
|
||||
// 0x8F3C
|
||||
if (gEeprom.ScreenChannel[i] < 200) {
|
||||
memcpy(pLine1 + 2, BITMAP_M, sizeof(BITMAP_M));
|
||||
if (gNumberOffset == 0 || gEeprom.TX_CHANNEL != i) {
|
||||
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != i) {
|
||||
NUMBER_ToDigits(gEeprom.ScreenChannel[i] + 1, String);
|
||||
} else {
|
||||
memcpy(String + 5, gNumberForPrintf, 3);
|
||||
memcpy(String + 5, gInputBox, 3);
|
||||
}
|
||||
GUI_DisplaySmallDigits(3, String + 5, 10, Line + 1);
|
||||
} else if (gEeprom.ScreenChannel[i] < 207) {
|
||||
@ -642,11 +643,11 @@ static void DisplayMain(void)
|
||||
GUI_DisplaySmallDigits(1, &c, 22, Line + 1);
|
||||
} else {
|
||||
memcpy(pLine1 + 7, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand));
|
||||
if (gNumberOffset == 0 || gEeprom.TX_CHANNEL != i) {
|
||||
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != i) {
|
||||
NUMBER_ToDigits(gEeprom.ScreenChannel[i] - 206, String);
|
||||
} else {
|
||||
String[6] = gNumberForPrintf[0];
|
||||
String[7] = gNumberForPrintf[1];
|
||||
String[6] = gInputBox[0];
|
||||
String[7] = gInputBox[1];
|
||||
}
|
||||
GUI_DisplaySmallDigits(2, String + 6, 15, Line + 1);
|
||||
}
|
||||
@ -692,8 +693,8 @@ static void DisplayMain(void)
|
||||
}
|
||||
GUI_PrintString(String, 31, 111, i * 4, Width, true);
|
||||
} else {
|
||||
if (gNumberOffset != 0 && (gEeprom.ScreenChannel[i] - 200) < 7 && gEeprom.TX_CHANNEL == i) {
|
||||
GUI_DisplayFrequency(gNumberForPrintf, 31, i * 4, true, false);
|
||||
if (gInputBoxIndex && (gEeprom.ScreenChannel[i] - 200) < 7 && gEeprom.TX_CHANNEL == i) {
|
||||
GUI_DisplayFrequency(gInputBox, 31, i * 4, true, false);
|
||||
} else {
|
||||
if (gEeprom.ScreenChannel[i] < 200) {
|
||||
if (gEeprom.CHANNEL_DISPLAY_MODE == 2 && (gEeprom.VfoInfo[i].Name[0] == 0 || gEeprom.VfoInfo[i].Name[0] == 0xFF)) {
|
||||
@ -913,14 +914,14 @@ static void DisplayFM(void)
|
||||
GUI_PrintString(String, 0, 127, 2, 10, true);
|
||||
memset(String, 0, sizeof(String));
|
||||
|
||||
if (gAskToSave || (gEeprom.FM_IsChannelSelected && gNumberOffset)) {
|
||||
if (gAskToSave || (gEeprom.FM_IsChannelSelected && gInputBoxIndex)) {
|
||||
GenerateChannelString(String, gA_Scan_Channel);
|
||||
} else if (gAskToDelete) {
|
||||
if (gNumberOffset == 0) {
|
||||
if (gInputBoxIndex == 0) {
|
||||
NUMBER_ToDigits(gEeprom.FM_FrequencyToPlay * 10000, String);
|
||||
GUI_DisplayFrequency(String, 23, 4, false, true);
|
||||
} else {
|
||||
GUI_DisplayFrequency(gNumberForPrintf, 23, 4, true, false);
|
||||
GUI_DisplayFrequency(gInputBox, 23, 4, true, false);
|
||||
}
|
||||
ST7565_BlitFullScreen();
|
||||
return;
|
||||
@ -1002,23 +1003,23 @@ void GUI_DisplayMenu(void)
|
||||
break;
|
||||
|
||||
case MENU_OFFSET:
|
||||
if (!gIsInSubMenu || gNumberOffset == 0) {
|
||||
if (!gIsInSubMenu || gInputBoxIndex == 0) {
|
||||
sprintf(String, "%.5f", gSubMenuSelection * 1e-05);
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (gNumberForPrintf[i] == 10) {
|
||||
if (gInputBox[i] == 10) {
|
||||
String[i] = '-';
|
||||
} else {
|
||||
String[i] = gNumberForPrintf[i] + '0';
|
||||
String[i] = gInputBox[i] + '0';
|
||||
}
|
||||
}
|
||||
String[3] = '.';
|
||||
for (i = 3; i < 6; i++) {
|
||||
if (gNumberForPrintf[i] == 10) {
|
||||
if (gInputBox[i] == 10) {
|
||||
String[i + 1] = '-';
|
||||
} else {
|
||||
String[i + 1] = gNumberForPrintf[i] + '0';
|
||||
String[i + 1] = gInputBox[i] + '0';
|
||||
}
|
||||
}
|
||||
String[7] = 0x2d;
|
||||
@ -1317,12 +1318,12 @@ static void DisplayAircopy(void)
|
||||
}
|
||||
GUI_PrintString(String, 2, 127, 0, 8, true);
|
||||
|
||||
if (gNumberOffset == 0) {
|
||||
if (gInputBoxIndex == 0) {
|
||||
NUMBER_ToDigits(gInfoCHAN_A->DCS[0].Frequency, String);
|
||||
GUI_DisplayFrequency(String, 16, 2, 0, 0);
|
||||
GUI_DisplaySmallDigits(2, String + 6, 97, 3);
|
||||
} else {
|
||||
GUI_DisplayFrequency(gNumberForPrintf, 16, 2, 1, 0);
|
||||
GUI_DisplayFrequency(gInputBox, 16, 2, 1, 0);
|
||||
}
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
@ -1363,7 +1364,7 @@ void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
||||
{
|
||||
if (Display != DISPLAY_INVALID) {
|
||||
if (gScreenToDisplay != Display) {
|
||||
gNumberOffset = 0;
|
||||
gInputBoxIndex = 0;
|
||||
gIsInSubMenu = false;
|
||||
g_20000381 = 0;
|
||||
gStepDirection = 0;
|
||||
|
12
misc.c
12
misc.c
@ -167,8 +167,6 @@ uint8_t gA_Scan_Channel;
|
||||
uint8_t gDebounceCounter;
|
||||
uint8_t gDTMF_AUTO_RESET_TIME;
|
||||
bool gF_LOCK;
|
||||
char gNumberForPrintf[8];
|
||||
uint8_t gNumberOffset;
|
||||
uint8_t gScanChannel;
|
||||
uint32_t gScanFrequency;
|
||||
uint8_t gScanPauseMode;
|
||||
@ -197,16 +195,6 @@ uint16_t gCurrentRSSI;
|
||||
|
||||
// --------
|
||||
|
||||
void NUMBER_Append(char Digit)
|
||||
{
|
||||
if (gNumberOffset == 0) {
|
||||
memset(gNumberForPrintf, 10, sizeof(gNumberForPrintf));
|
||||
} else if (gNumberOffset >= sizeof(gNumberForPrintf)) {
|
||||
return;
|
||||
}
|
||||
gNumberForPrintf[gNumberOffset++] = Digit;
|
||||
}
|
||||
|
||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger)
|
||||
{
|
||||
uint32_t Value;
|
||||
|
3
misc.h
3
misc.h
@ -176,8 +176,6 @@ extern uint8_t gA_Scan_Channel;
|
||||
extern uint8_t gDebounceCounter;
|
||||
extern uint8_t gDTMF_AUTO_RESET_TIME;
|
||||
extern bool gF_LOCK;
|
||||
extern char gNumberForPrintf[8];
|
||||
extern uint8_t gNumberOffset;
|
||||
extern uint8_t gScanChannel;
|
||||
extern uint32_t gScanFrequency;
|
||||
extern uint8_t gScanPauseMode;
|
||||
@ -205,7 +203,6 @@ extern uint16_t gCurrentRSSI;
|
||||
|
||||
// --------
|
||||
|
||||
void NUMBER_Append(char Digit);
|
||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger);
|
||||
void NUMBER_ToDigits(uint32_t Value, char *pDigits);
|
||||
uint8_t NUMBER_AddWithWraparound(uint8_t Base, int8_t Add, uint8_t LowerLimit, uint8_t UpperLimit);
|
||||
|
Loading…
Reference in New Issue
Block a user