mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-08-03 09:36:32 +03:00
Initial commit
This commit is contained in:
65
ui/aircopy.c
Normal file
65
ui/aircopy.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef DISABLE_AIRCOPY
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "app/aircopy.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "misc.h"
|
||||
#include "radio.h"
|
||||
#include "ui/aircopy.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/inputbox.h"
|
||||
|
||||
void UI_DisplayAircopy(void)
|
||||
{
|
||||
char String[16];
|
||||
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
if (gAircopyState == AIRCOPY_READY)
|
||||
strcpy(String, "AIR COPY(RDY)");
|
||||
else
|
||||
if (gAircopyState == AIRCOPY_TRANSFER)
|
||||
strcpy(String, "AIR COPY");
|
||||
else
|
||||
strcpy(String, "AIR COPY(CMP)");
|
||||
UI_PrintString(String, 2, 127, 0, 8, true);
|
||||
|
||||
if (gInputBoxIndex == 0)
|
||||
{
|
||||
NUMBER_ToDigits(gRxVfo->ConfigRX.Frequency, String);
|
||||
UI_DisplayFrequency(String, 16, 2, 0, 0);
|
||||
UI_DisplaySmallDigits(2, String + 6, 97, 3);
|
||||
}
|
||||
else
|
||||
UI_DisplayFrequency(gInputBox, 16, 2, 1, 0);
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
if (gAirCopyIsSendMode == 0)
|
||||
sprintf(String, "RCV:%d E:%d", gAirCopyBlockNumber, gErrorsDuringAirCopy);
|
||||
else
|
||||
if (gAirCopyIsSendMode == 1)
|
||||
sprintf(String, "SND:%d", gAirCopyBlockNumber);
|
||||
UI_PrintString(String, 2, 127, 4, 8, true);
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
||||
#endif
|
25
ui/aircopy.h
Normal file
25
ui/aircopy.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_AIRCOPY_H
|
||||
#define UI_AIRCOPY_H
|
||||
|
||||
#ifndef DISABLE_AIRCOPY
|
||||
void UI_DisplayAircopy(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
54
ui/battery.c
Normal file
54
ui/battery.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "bitmaps.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "functions.h"
|
||||
#include "ui/battery.h"
|
||||
|
||||
void UI_DisplayBattery(uint8_t Level)
|
||||
{
|
||||
const uint8_t *pBitmap;
|
||||
bool bClearMode = false;
|
||||
|
||||
if (gCurrentFunction != 1)
|
||||
{
|
||||
switch (Level)
|
||||
{
|
||||
case 0:
|
||||
pBitmap = NULL;
|
||||
bClearMode = true;
|
||||
break;
|
||||
case 1:
|
||||
pBitmap = BITMAP_BatteryLevel1;
|
||||
break;
|
||||
case 2:
|
||||
pBitmap = BITMAP_BatteryLevel2;
|
||||
break;
|
||||
case 3:
|
||||
pBitmap = BITMAP_BatteryLevel3;
|
||||
break;
|
||||
case 4:
|
||||
pBitmap = BITMAP_BatteryLevel4;
|
||||
break;
|
||||
default:
|
||||
pBitmap = BITMAP_BatteryLevel5;
|
||||
break;
|
||||
}
|
||||
ST7565_DrawLine(110, 0, 18, pBitmap, bClearMode);
|
||||
}
|
||||
}
|
25
ui/battery.h
Normal file
25
ui/battery.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_BATTERY_H
|
||||
#define UI_BATTERY_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void UI_DisplayBattery(uint8_t Level);
|
||||
|
||||
#endif
|
||||
|
90
ui/fmradio.c
Normal file
90
ui/fmradio.c
Normal file
@@ -0,0 +1,90 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "app/fm.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/fmradio.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
void UI_DisplayFM(void)
|
||||
{
|
||||
uint8_t i;
|
||||
char String[16];
|
||||
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
strcpy(String, "FM");
|
||||
|
||||
UI_PrintString(String, 0, 127, 0, 12, true);
|
||||
memset(String, 0, sizeof(String));
|
||||
|
||||
if (gAskToSave) {
|
||||
strcpy(String, "SAVE?");
|
||||
} else if (gAskToDelete) {
|
||||
strcpy(String, "DEL?");
|
||||
} else {
|
||||
if (gFM_ScanState == FM_SCAN_OFF) {
|
||||
if (!gEeprom.FM_IsMrMode) {
|
||||
for (i = 0; i < 20; i++) {
|
||||
if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i]) {
|
||||
sprintf(String, "VFO(CH%02d)", i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 20) {
|
||||
strcpy(String, "VFO");
|
||||
}
|
||||
} else {
|
||||
sprintf(String, "MR(CH%02d)", gEeprom.FM_SelectedChannel + 1);
|
||||
}
|
||||
} else {
|
||||
if (!gFM_AutoScan) {
|
||||
strcpy(String, "M-SCAN");
|
||||
} else {
|
||||
sprintf(String, "A-SCAN(%d)", gFM_ChannelPosition + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UI_PrintString(String, 0, 127, 2, 10, true);
|
||||
memset(String, 0, sizeof(String));
|
||||
|
||||
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex)) {
|
||||
UI_GenerateChannelString(String, gFM_ChannelPosition);
|
||||
} else if (!gAskToDelete) {
|
||||
if (gInputBoxIndex == 0) {
|
||||
NUMBER_ToDigits(gEeprom.FM_FrequencyPlaying * 10000, String);
|
||||
UI_DisplayFrequency(String, 23, 4, false, true);
|
||||
} else {
|
||||
UI_DisplayFrequency(gInputBox, 23, 4, true, false);
|
||||
}
|
||||
ST7565_BlitFullScreen();
|
||||
return;
|
||||
} else {
|
||||
sprintf(String, "CH-%02d", gEeprom.FM_SelectedChannel + 1);
|
||||
}
|
||||
|
||||
UI_PrintString(String, 0, 127, 4, 10, true);
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
23
ui/fmradio.h
Normal file
23
ui/fmradio.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_FM_H
|
||||
#define UI_FM_H
|
||||
|
||||
void UI_DisplayFM(void);
|
||||
|
||||
#endif
|
||||
|
133
ui/helper.c
Normal file
133
ui/helper.c
Normal file
@@ -0,0 +1,133 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "font.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/inputbox.h"
|
||||
|
||||
void UI_GenerateChannelString(char *pString, uint8_t Channel)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if (gInputBoxIndex == 0) {
|
||||
sprintf(pString, "CH-%02d", Channel + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
pString[0] = 'C';
|
||||
pString[1] = 'H';
|
||||
pString[2] = '-';
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (gInputBox[i] == 10) {
|
||||
pString[i + 3] = '-';
|
||||
} else {
|
||||
pString[i + 3] = gInputBox[i] + '0';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void UI_GenerateChannelStringEx(char *pString, bool bShowPrefix, uint8_t ChannelNumber)
|
||||
{
|
||||
if (gInputBoxIndex) {
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (gInputBox[i] == 10) {
|
||||
pString[i] = '-';
|
||||
} else {
|
||||
pString[i] = gInputBox[i] + '0';
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (bShowPrefix) {
|
||||
sprintf(pString, "CH-%03d", ChannelNumber + 1);
|
||||
} else {
|
||||
if (ChannelNumber == 0xFF) {
|
||||
strcpy(pString, "NULL");
|
||||
} else {
|
||||
sprintf(pString, "%03d", ChannelNumber + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width, bool bCentered)
|
||||
{
|
||||
uint32_t i, Length;
|
||||
|
||||
Length = strlen(pString);
|
||||
if (bCentered) {
|
||||
Start += (((End - Start) - (Length * Width)) + 1) / 2;
|
||||
}
|
||||
for (i = 0; i < Length; i++) {
|
||||
if (pString[i] >= ' ' && pString[i] < 0x7F) {
|
||||
uint8_t Index = pString[i] - ' ';
|
||||
memcpy(gFrameBuffer[Line + 0] + (i * Width) + Start, &gFontBig[Index][0], 8);
|
||||
memcpy(gFrameBuffer[Line + 1] + (i * Width) + Start, &gFontBig[Index][8], 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag)
|
||||
{
|
||||
uint8_t *pFb0, *pFb1;
|
||||
bool bCanDisplay;
|
||||
uint8_t i;
|
||||
|
||||
pFb0 = gFrameBuffer[Y] + X;
|
||||
pFb1 = pFb0 + 128;
|
||||
|
||||
bCanDisplay = false;
|
||||
for (i = 0; i < 3; i++) {
|
||||
const uint8_t Digit = pDigits[i];
|
||||
|
||||
if (bDisplayLeadingZero || bCanDisplay || Digit) {
|
||||
bCanDisplay = true;
|
||||
memcpy(pFb0 + (i * 13), gFontBigDigits[Digit] + 0, 13);
|
||||
memcpy(pFb1 + (i * 13), gFontBigDigits[Digit] + 13, 13);
|
||||
} else if (bFlag) {
|
||||
pFb1 -= 6;
|
||||
pFb0 -= 6;
|
||||
}
|
||||
}
|
||||
|
||||
pFb1[0x27] = 0x60;
|
||||
pFb1[0x28] = 0x60;
|
||||
pFb1[0x29] = 0x60;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
const uint8_t Digit = pDigits[i + 3];
|
||||
|
||||
memcpy(pFb0 + (i * 13) + 42, gFontBigDigits[Digit] + 0, 13);
|
||||
memcpy(pFb1 + (i * 13) + 42, gFontBigDigits[Digit] + 13, 13);
|
||||
}
|
||||
}
|
||||
|
||||
void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < Size; i++) {
|
||||
memcpy(gFrameBuffer[Y] + (i * 7) + X, gFontSmallDigits[(uint8_t)pString[i]], 7);
|
||||
}
|
||||
}
|
||||
|
30
ui/helper.h
Normal file
30
ui/helper.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_UI_H
|
||||
#define UI_UI_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void UI_GenerateChannelString(char *pString, uint8_t Channel);
|
||||
void UI_GenerateChannelStringEx(char *pString, bool bShowPrefix, uint8_t ChannelNumber);
|
||||
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width, bool bCentered);
|
||||
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag);
|
||||
void UI_DisplaySmallDigits(uint8_t Size, const char *pString, uint8_t X, uint8_t Y);
|
||||
|
||||
#endif
|
||||
|
32
ui/inputbox.c
Normal file
32
ui/inputbox.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "ui/inputbox.h"
|
||||
|
||||
char gInputBox[8];
|
||||
uint8_t gInputBoxIndex;
|
||||
|
||||
void INPUTBOX_Append(char Digit)
|
||||
{
|
||||
if (gInputBoxIndex == 0) {
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
} else if (gInputBoxIndex >= sizeof(gInputBox)) {
|
||||
return;
|
||||
}
|
||||
gInputBox[gInputBoxIndex++] = Digit;
|
||||
}
|
||||
|
28
ui/inputbox.h
Normal file
28
ui/inputbox.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_INPUTBOX_H
|
||||
#define UI_INPUTBOX_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern char gInputBox[8];
|
||||
extern uint8_t gInputBoxIndex;
|
||||
|
||||
void INPUTBOX_Append(char Digit);
|
||||
|
||||
#endif
|
||||
|
156
ui/lock.c
Normal file
156
ui/lock.c
Normal file
@@ -0,0 +1,156 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "ARMCM0.h"
|
||||
#include "app/uart.h"
|
||||
#include "audio.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/lock.h"
|
||||
|
||||
static void Render(void)
|
||||
{
|
||||
char String[7];
|
||||
unsigned int i;
|
||||
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
strcpy(String, "LOCK");
|
||||
UI_PrintString(String, 0, 127, 1, 10, true);
|
||||
for (i = 0; i < 6; i++)
|
||||
String[i] = (gInputBox[i] == 10) ? '-' : '*';
|
||||
String[6] = 0;
|
||||
|
||||
UI_PrintString(String, 0, 127, 3, 12, true);
|
||||
|
||||
ST7565_BlitStatusLine();
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
||||
void UI_DisplayLock(void)
|
||||
{
|
||||
KEY_Code_t Key;
|
||||
BEEP_Type_t Beep;
|
||||
|
||||
gUpdateDisplay = true;
|
||||
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (!gNextTimeslice) {}
|
||||
|
||||
// TODO: Original code doesn't do the below, but is needed for proper key debounce
|
||||
|
||||
gNextTimeslice = false;
|
||||
Key = KEYBOARD_Poll();
|
||||
|
||||
if (gKeyReading0 == Key)
|
||||
{
|
||||
if (++gDebounceCounter == 2)
|
||||
{
|
||||
if (Key == KEY_INVALID)
|
||||
{
|
||||
gKeyReading1 = KEY_INVALID;
|
||||
}
|
||||
else
|
||||
{
|
||||
gKeyReading1 = Key;
|
||||
|
||||
switch (Key)
|
||||
{
|
||||
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:
|
||||
INPUTBOX_Append(Key - KEY_0);
|
||||
if (gInputBoxIndex < 6)
|
||||
{
|
||||
Beep = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t Password;
|
||||
|
||||
gInputBoxIndex = 0;
|
||||
|
||||
NUMBER_Get(gInputBox, &Password);
|
||||
|
||||
if ((gEeprom.POWER_ON_PASSWORD * 100) == Password)
|
||||
{
|
||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(gInputBox, 10, sizeof(gInputBox));
|
||||
|
||||
Beep = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
}
|
||||
|
||||
AUDIO_PlayBeep(Beep);
|
||||
|
||||
gUpdateDisplay = true;
|
||||
break;
|
||||
|
||||
case KEY_EXIT:
|
||||
if (gInputBoxIndex)
|
||||
{
|
||||
gInputBox[--gInputBoxIndex] = 10;
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
|
||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gKeyBeingHeld = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gDebounceCounter = 0;
|
||||
gKeyReading0 = Key;
|
||||
}
|
||||
|
||||
if (UART_IsCommandAvailable())
|
||||
{
|
||||
__disable_irq();
|
||||
UART_HandleCommand();
|
||||
__enable_irq();
|
||||
}
|
||||
|
||||
if (gUpdateDisplay)
|
||||
{
|
||||
Render();
|
||||
gUpdateDisplay = false;
|
||||
}
|
||||
}
|
||||
}
|
23
ui/lock.h
Normal file
23
ui/lock.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_LOCK_H
|
||||
#define UI_LOCK_H
|
||||
|
||||
void UI_DisplayLock(void);
|
||||
|
||||
#endif
|
||||
|
454
ui/main.c
Normal file
454
ui/main.c
Normal file
@@ -0,0 +1,454 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "app/dtmf.h"
|
||||
#include "bitmaps.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "functions.h"
|
||||
#include "misc.h"
|
||||
#include "radio.h"
|
||||
#include "settings.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/main.h"
|
||||
|
||||
void UI_DisplayMain(void)
|
||||
{
|
||||
char String[16];
|
||||
uint8_t i;
|
||||
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
if (gEeprom.KEY_LOCK && gKeypadLocked)
|
||||
{
|
||||
UI_PrintString("Long Press #", 0, 127, 1, 8, true);
|
||||
UI_PrintString("To Unlock", 0, 127, 3, 8, true);
|
||||
ST7565_BlitFullScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
uint8_t *pLine0;
|
||||
uint8_t *pLine1;
|
||||
uint8_t Line;
|
||||
uint8_t Channel;
|
||||
bool bIsSameVfo;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
pLine0 = gFrameBuffer[0];
|
||||
pLine1 = gFrameBuffer[1];
|
||||
Line = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pLine0 = gFrameBuffer[4];
|
||||
pLine1 = gFrameBuffer[5];
|
||||
Line = 4;
|
||||
}
|
||||
|
||||
Channel = gEeprom.TX_CHANNEL;
|
||||
bIsSameVfo = !!(Channel == i);
|
||||
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive)
|
||||
Channel = gEeprom.RX_CHANNEL;
|
||||
|
||||
if (Channel != i)
|
||||
{
|
||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_InputMode)
|
||||
{
|
||||
char Contact[16];
|
||||
|
||||
if (!gDTMF_InputMode)
|
||||
{
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT)
|
||||
{
|
||||
if (gDTMF_State == DTMF_STATE_CALL_OUT_RSP)
|
||||
strcpy(String, "CALL OUT(RSP)");
|
||||
else
|
||||
strcpy(String, "CALL OUT");
|
||||
}
|
||||
else
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
|
||||
{
|
||||
if (DTMF_FindContact(gDTMF_Caller, Contact))
|
||||
sprintf(String, "CALL:%s", Contact);
|
||||
else
|
||||
sprintf(String, "CALL:%s", gDTMF_Caller);
|
||||
}
|
||||
else
|
||||
if (gDTMF_IsTx)
|
||||
{
|
||||
if (gDTMF_State == DTMF_STATE_TX_SUCC)
|
||||
strcpy(String, "DTMF TX(SUCC)");
|
||||
else
|
||||
strcpy(String, "DTMF TX");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(String, ">%s", gDTMF_InputBox);
|
||||
}
|
||||
|
||||
UI_PrintString(String, 2, 127, i * 3, 8, false);
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
memset(Contact, 0, sizeof(Contact));
|
||||
|
||||
if (!gDTMF_InputMode)
|
||||
{
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT)
|
||||
{
|
||||
if (DTMF_FindContact(gDTMF_String, Contact))
|
||||
sprintf(String, ">%s", Contact);
|
||||
else
|
||||
sprintf(String, ">%s", gDTMF_String);
|
||||
}
|
||||
else
|
||||
if (gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
|
||||
{
|
||||
if (DTMF_FindContact(gDTMF_Callee, Contact))
|
||||
sprintf(String, ">%s", Contact);
|
||||
else
|
||||
sprintf(String, ">%s", gDTMF_Callee);
|
||||
}
|
||||
else
|
||||
if (gDTMF_IsTx)
|
||||
sprintf(String, ">%s", gDTMF_String);
|
||||
}
|
||||
UI_PrintString(String, 2, 127, 2 + (i * 3), 8, false);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bIsSameVfo)
|
||||
memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bIsSameVfo)
|
||||
memcpy(pLine0 + 2, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
|
||||
else
|
||||
memcpy(pLine0 + 2, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
|
||||
}
|
||||
|
||||
// 0x8EE2
|
||||
uint32_t SomeValue = 0;
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{
|
||||
if (gAlarmState == ALARM_STATE_ALARM)
|
||||
{
|
||||
SomeValue = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||
Channel = gEeprom.RX_CHANNEL;
|
||||
else
|
||||
Channel = gEeprom.TX_CHANNEL;
|
||||
|
||||
if (Channel == i)
|
||||
{
|
||||
SomeValue = 1;
|
||||
memcpy(pLine0 + 14, BITMAP_TX, sizeof(BITMAP_TX));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SomeValue = 2;
|
||||
if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == i)
|
||||
memcpy(pLine0 + 14, BITMAP_RX, sizeof(BITMAP_RX));
|
||||
}
|
||||
|
||||
// 0x8F3C
|
||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i]))
|
||||
{
|
||||
memcpy(pLine1 + 2, BITMAP_M, sizeof(BITMAP_M));
|
||||
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != i)
|
||||
NUMBER_ToDigits(gEeprom.ScreenChannel[i] + 1, String);
|
||||
else
|
||||
memcpy(String + 5, gInputBox, 3);
|
||||
UI_DisplaySmallDigits(3, String + 5, 10, Line + 1);
|
||||
}
|
||||
else
|
||||
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[i]))
|
||||
{
|
||||
char c;
|
||||
memcpy(pLine1 + 14, BITMAP_F, sizeof(BITMAP_F));
|
||||
c = (gEeprom.ScreenChannel[i] - FREQ_CHANNEL_FIRST) + 1;
|
||||
UI_DisplaySmallDigits(1, &c, 22, Line + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(pLine1 + 7, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand));
|
||||
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != i)
|
||||
{
|
||||
NUMBER_ToDigits((gEeprom.ScreenChannel[i] - NOAA_CHANNEL_FIRST) + 1, String);
|
||||
}
|
||||
else
|
||||
{
|
||||
String[6] = gInputBox[0];
|
||||
String[7] = gInputBox[1];
|
||||
}
|
||||
UI_DisplaySmallDigits(2, String + 6, 15, Line + 1);
|
||||
}
|
||||
|
||||
// 0x8FEC
|
||||
|
||||
uint8_t State = VfoState[i];
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
|
||||
{
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||
Channel = gEeprom.RX_CHANNEL;
|
||||
else
|
||||
Channel = gEeprom.TX_CHANNEL;
|
||||
if (Channel == i)
|
||||
State = VFO_STATE_ALARM;
|
||||
}
|
||||
|
||||
if (State)
|
||||
{
|
||||
uint8_t Width = 10;
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
switch (State)
|
||||
{
|
||||
case 1:
|
||||
strcpy(String, "BUSY");
|
||||
Width = 15;
|
||||
break;
|
||||
case 2:
|
||||
strcpy(String, "BAT LOW");
|
||||
break;
|
||||
case 3:
|
||||
strcpy(String, "DISABLE");
|
||||
break;
|
||||
case 4:
|
||||
strcpy(String, "TIMEOUT");
|
||||
break;
|
||||
case 5:
|
||||
strcpy(String, "ALARM");
|
||||
break;
|
||||
case 6:
|
||||
sprintf(String, "VOL HIGH");
|
||||
Width = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
UI_PrintString(String, 31, 111, i * 4, Width, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gInputBoxIndex && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[i]) && gEeprom.TX_CHANNEL == i)
|
||||
{
|
||||
UI_DisplayFrequency(gInputBox, 31, i * 4, true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i]))
|
||||
{
|
||||
switch (gEeprom.CHANNEL_DISPLAY_MODE)
|
||||
{
|
||||
case MDF_FREQUENCY:
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT) {
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) {
|
||||
Channel = gEeprom.RX_CHANNEL;
|
||||
} else {
|
||||
Channel = gEeprom.TX_CHANNEL;
|
||||
}
|
||||
if (Channel == i) {
|
||||
NUMBER_ToDigits(gEeprom.VfoInfo[i].pTX->Frequency, String);
|
||||
} else {
|
||||
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
|
||||
}
|
||||
} else {
|
||||
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
|
||||
}
|
||||
UI_DisplayFrequency(String, 31, i * 4, false, false);
|
||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i])) {
|
||||
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[i]];
|
||||
if (Attributes & MR_CH_SCANLIST1) {
|
||||
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
|
||||
}
|
||||
if (Attributes & MR_CH_SCANLIST2) {
|
||||
memcpy(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList));
|
||||
}
|
||||
}
|
||||
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
|
||||
break;
|
||||
case MDF_CHANNEL:
|
||||
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
|
||||
UI_PrintString(String, 31, 112, i * 4, 8, true);
|
||||
break;
|
||||
case MDF_NAME:
|
||||
if(gEeprom.VfoInfo[i].Name[0] == 0 || gEeprom.VfoInfo[i].Name[0] == 0xFF) {
|
||||
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
|
||||
UI_PrintString(String, 31, 112, i * 4, 8, true);
|
||||
} else {
|
||||
UI_PrintString(gEeprom.VfoInfo[i].Name, 31, 112, i * 4, 8, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||
{
|
||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||
Channel = gEeprom.RX_CHANNEL;
|
||||
else
|
||||
Channel = gEeprom.TX_CHANNEL;
|
||||
|
||||
if (Channel == i)
|
||||
NUMBER_ToDigits(gEeprom.VfoInfo[i].pTX->Frequency, String);
|
||||
else
|
||||
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
|
||||
}
|
||||
else
|
||||
NUMBER_ToDigits(gEeprom.VfoInfo[i].pRX->Frequency, String);
|
||||
|
||||
UI_DisplayFrequency(String, 31, i * 4, false, false);
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i]))
|
||||
{
|
||||
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[i]];
|
||||
if (Attributes & MR_CH_SCANLIST1)
|
||||
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
|
||||
if (Attributes & MR_CH_SCANLIST2)
|
||||
memcpy(pLine0 + 120, BITMAP_ScanList, sizeof(BITMAP_ScanList));
|
||||
}
|
||||
|
||||
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 0x926E
|
||||
uint8_t Level = 0;
|
||||
|
||||
if (SomeValue == 1)
|
||||
{
|
||||
if (gRxVfo->OUTPUT_POWER == OUTPUT_POWER_LOW)
|
||||
Level = 2;
|
||||
else
|
||||
if (gRxVfo->OUTPUT_POWER == OUTPUT_POWER_MID)
|
||||
Level = 4;
|
||||
else
|
||||
Level = 6;
|
||||
}
|
||||
else
|
||||
if (SomeValue == 2)
|
||||
{
|
||||
if (gVFO_RSSI_Level[i])
|
||||
Level = gVFO_RSSI_Level[i];
|
||||
}
|
||||
|
||||
// TODO: not quite how the original does it, but it's quite entangled in Ghidra
|
||||
if (Level)
|
||||
{
|
||||
memcpy(pLine1 + 128 + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
|
||||
memcpy(pLine1 + 128 + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||
if (Level >= 2)
|
||||
{
|
||||
memcpy(pLine1 + 128 + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
||||
if (Level >= 3)
|
||||
{
|
||||
memcpy(pLine1 + 128 + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
||||
if (Level >= 4)
|
||||
{
|
||||
memcpy(pLine1 + 128 + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
||||
if (Level >= 5)
|
||||
{
|
||||
memcpy(pLine1 + 128 + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
||||
if (Level >= 6)
|
||||
memcpy(pLine1 + 128 + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 0x931E
|
||||
if (gEeprom.VfoInfo[i].IsAM)
|
||||
{
|
||||
memcpy(pLine1 + 128 + 27, BITMAP_AM, sizeof(BITMAP_AM));
|
||||
}
|
||||
else
|
||||
{
|
||||
const FREQ_Config_t *pConfig;
|
||||
|
||||
if (SomeValue == 1)
|
||||
pConfig = gEeprom.VfoInfo[i].pTX;
|
||||
else
|
||||
pConfig = gEeprom.VfoInfo[i].pRX;
|
||||
|
||||
switch (pConfig->CodeType)
|
||||
{
|
||||
case CODE_TYPE_CONTINUOUS_TONE:
|
||||
memcpy(pLine1 + 128 + 27, BITMAP_CT, sizeof(BITMAP_CT));
|
||||
break;
|
||||
case CODE_TYPE_DIGITAL:
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
memcpy(pLine1 + 128 + 24, BITMAP_DCS, sizeof(BITMAP_DCS));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 0x936C
|
||||
switch (gEeprom.VfoInfo[i].OUTPUT_POWER)
|
||||
{
|
||||
case OUTPUT_POWER_LOW:
|
||||
memcpy(pLine1 + 128 + 44, BITMAP_PowerLow, sizeof(BITMAP_PowerLow));
|
||||
break;
|
||||
case OUTPUT_POWER_MID:
|
||||
memcpy(pLine1 + 128 + 44, BITMAP_PowerMid, sizeof(BITMAP_PowerMid));
|
||||
break;
|
||||
case OUTPUT_POWER_HIGH:
|
||||
memcpy(pLine1 + 128 + 44, BITMAP_PowerHigh, sizeof(BITMAP_PowerHigh));
|
||||
break;
|
||||
}
|
||||
|
||||
if (gEeprom.VfoInfo[i].ConfigRX.Frequency != gEeprom.VfoInfo[i].ConfigTX.Frequency)
|
||||
{
|
||||
if (gEeprom.VfoInfo[i].FREQUENCY_DEVIATION_SETTING == FREQUENCY_DEVIATION_ADD)
|
||||
memcpy(pLine1 + 128 + 54, BITMAP_Add, sizeof(BITMAP_Add));
|
||||
if (gEeprom.VfoInfo[i].FREQUENCY_DEVIATION_SETTING == FREQUENCY_DEVIATION_SUB)
|
||||
memcpy(pLine1 + 128 + 54, BITMAP_Sub, sizeof(BITMAP_Sub));
|
||||
}
|
||||
|
||||
if (gEeprom.VfoInfo[i].FrequencyReverse)
|
||||
memcpy(pLine1 + 128 + 64, BITMAP_ReverseMode, sizeof(BITMAP_ReverseMode));
|
||||
|
||||
if (gEeprom.VfoInfo[i].CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
|
||||
memcpy(pLine1 + 128 + 74, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand));
|
||||
|
||||
if (gEeprom.VfoInfo[i].DTMF_DECODING_ENABLE || gSetting_KILLED)
|
||||
memcpy(pLine1 + 128 + 84, BITMAP_DTMF, sizeof(BITMAP_DTMF));
|
||||
|
||||
if (gEeprom.VfoInfo[i].SCRAMBLING_TYPE && gSetting_ScrambleEnable)
|
||||
memcpy(pLine1 + 128 + 110, BITMAP_Scramble, sizeof(BITMAP_Scramble));
|
||||
}
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
23
ui/main.h
Normal file
23
ui/main.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_MAIN_H
|
||||
#define UI_MAIN_H
|
||||
|
||||
void UI_DisplayMain(void);
|
||||
|
||||
#endif
|
||||
|
581
ui/menu.c
Normal file
581
ui/menu.c
Normal file
@@ -0,0 +1,581 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "app/dtmf.h"
|
||||
#include "bitmaps.h"
|
||||
#include "dcs.h"
|
||||
#include "driver/eeprom.h" // EEPROM_ReadBuffer()
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
static const char MenuList[][7] =
|
||||
{
|
||||
// 0
|
||||
"SQL",
|
||||
"STEP",
|
||||
"TXP",
|
||||
"R_DCS",
|
||||
"R_CTCS",
|
||||
"T_DCS",
|
||||
"T_CTCS",
|
||||
"SFT-D",
|
||||
// 8
|
||||
"OFFSET",
|
||||
"W/N",
|
||||
"SCR",
|
||||
"BCL",
|
||||
"MEM-CH",
|
||||
"SAVE",
|
||||
"VOX",
|
||||
"ABR",
|
||||
// 16
|
||||
"TDR",
|
||||
"WX",
|
||||
"BEEP",
|
||||
"TOT",
|
||||
#ifndef DISABLE_VOICE
|
||||
"VOICE",
|
||||
#endif
|
||||
"SC-REV",
|
||||
"MDF",
|
||||
"AUTOLK",
|
||||
// 24
|
||||
"S-ADD1",
|
||||
"S-ADD2",
|
||||
"STE",
|
||||
"RP-STE",
|
||||
"MIC",
|
||||
"1-CALL",
|
||||
"S-LIST",
|
||||
"SLIST1",
|
||||
// 32
|
||||
"SLIST2",
|
||||
"AL-MOD",
|
||||
"ANI-ID",
|
||||
"UPCODE",
|
||||
"DWCODE",
|
||||
"D-ST",
|
||||
"D-RSP",
|
||||
"D-HOLD",
|
||||
// 40
|
||||
"D-PRE",
|
||||
"PTT-ID",
|
||||
"D-DCD",
|
||||
"D-LIST",
|
||||
"PONMSG",
|
||||
"ROGER",
|
||||
"BATVOL",
|
||||
"AM",
|
||||
// 48
|
||||
#ifndef DISABLE_NOAA
|
||||
"NOAA_S",
|
||||
#endif
|
||||
"DEL-CH",
|
||||
"RESET",
|
||||
|
||||
// normally hidden menu items from here on ..
|
||||
|
||||
"350TX",
|
||||
"F-LOCK",
|
||||
"200TX",
|
||||
"500TX",
|
||||
"350EN",
|
||||
// 56 (55 if NOAA is not used)
|
||||
"SCREN"
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const uint16_t gSubMenu_Step[] =
|
||||
{
|
||||
250,
|
||||
500,
|
||||
625,
|
||||
1000,
|
||||
1250,
|
||||
2500,
|
||||
833
|
||||
};
|
||||
#else
|
||||
static const uint16_t gSubMenu_Step[] =
|
||||
{
|
||||
125,
|
||||
250,
|
||||
625,
|
||||
1000,
|
||||
1250,
|
||||
2500,
|
||||
833
|
||||
};
|
||||
#endif
|
||||
|
||||
static const char gSubMenu_TXP[3][5] =
|
||||
{
|
||||
"LOW",
|
||||
"MID",
|
||||
"HIGH",
|
||||
};
|
||||
|
||||
static const char gSubMenu_SFT_D[3][4] =
|
||||
{
|
||||
"OFF",
|
||||
"+",
|
||||
"-",
|
||||
};
|
||||
|
||||
static const char gSubMenu_W_N[2][7] =
|
||||
{
|
||||
"WIDE",
|
||||
"NARROW",
|
||||
};
|
||||
|
||||
static const char gSubMenu_OFF_ON[2][4] =
|
||||
{
|
||||
"OFF",
|
||||
"ON",
|
||||
};
|
||||
|
||||
static const char gSubMenu_SAVE[5][4] =
|
||||
{
|
||||
"OFF",
|
||||
"1:1",
|
||||
"1:2",
|
||||
"1:3",
|
||||
"1:4",
|
||||
};
|
||||
|
||||
static const char gSubMenu_CHAN[3][7] =
|
||||
{
|
||||
"OFF",
|
||||
"CHAN_A",
|
||||
"CHAN_B",
|
||||
};
|
||||
|
||||
#ifndef DISABLE_VOICE
|
||||
static const char gSubMenu_VOICE[3][4] =
|
||||
{
|
||||
"OFF",
|
||||
"CHI",
|
||||
"ENG",
|
||||
};
|
||||
#endif
|
||||
|
||||
static const char gSubMenu_SC_REV[3][3] =
|
||||
{
|
||||
"TO",
|
||||
"CO",
|
||||
"SE",
|
||||
};
|
||||
|
||||
static const char gSubMenu_MDF[3][5] =
|
||||
{
|
||||
"FREQ",
|
||||
"CHAN",
|
||||
"NAME",
|
||||
};
|
||||
|
||||
static const char gSubMenu_AL_MOD[2][5] =
|
||||
{
|
||||
"SITE",
|
||||
"TONE",
|
||||
};
|
||||
|
||||
static const char gSubMenu_D_RSP[4][6] =
|
||||
{
|
||||
"NULL",
|
||||
"RING",
|
||||
"REPLY",
|
||||
"BOTH",
|
||||
};
|
||||
|
||||
static const char gSubMenu_PTT_ID[4][5] =
|
||||
{
|
||||
"OFF",
|
||||
"BOT",
|
||||
"EOT",
|
||||
"BOTH",
|
||||
};
|
||||
|
||||
static const char gSubMenu_PONMSG[3][5] =
|
||||
{
|
||||
"FULL",
|
||||
"MSG",
|
||||
"VOL",
|
||||
};
|
||||
|
||||
static const char gSubMenu_ROGER[3][6] =
|
||||
{
|
||||
"OFF",
|
||||
"ROGER",
|
||||
"MDC",
|
||||
};
|
||||
|
||||
static const char gSubMenu_RESET[2][4] =
|
||||
{
|
||||
"VFO",
|
||||
"ALL",
|
||||
};
|
||||
|
||||
static const char gSubMenu_F_LOCK[6][4] =
|
||||
{
|
||||
"OFF",
|
||||
"FCC",
|
||||
"CE",
|
||||
"GB",
|
||||
"430",
|
||||
"438",
|
||||
};
|
||||
|
||||
bool gIsInSubMenu;
|
||||
uint8_t gMenuCursor;
|
||||
int8_t gMenuScrollDirection;
|
||||
uint32_t gSubMenuSelection;
|
||||
|
||||
void UI_DisplayMenu(void)
|
||||
{
|
||||
unsigned int i;
|
||||
char String[16];
|
||||
char Contact[16];
|
||||
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (gMenuCursor || i)
|
||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||
UI_PrintString(MenuList[gMenuCursor + i - 1], 0, 127, i * 2, 8, false);
|
||||
|
||||
for (i = 0; i < 48; i++)
|
||||
{
|
||||
gFrameBuffer[2][i] ^= 0xFF;
|
||||
gFrameBuffer[3][i] ^= 0xFF;
|
||||
}
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
{
|
||||
gFrameBuffer[i][48] = 0xFF;
|
||||
gFrameBuffer[i][49] = 0xFF;
|
||||
}
|
||||
|
||||
NUMBER_ToDigits(gMenuCursor + 1, String);
|
||||
|
||||
UI_DisplaySmallDigits(2, String + 6, 33, 6);
|
||||
|
||||
if (gIsInSubMenu)
|
||||
memcpy(gFrameBuffer[0] + 50, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
||||
|
||||
memset(String, 0, sizeof(String));
|
||||
|
||||
switch (gMenuCursor)
|
||||
{
|
||||
case MENU_SQL:
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_MIC:
|
||||
{ // display the mic gain in actual dB rather than just an index number
|
||||
const uint8_t mic = gMicGain_dB2[gSubMenuSelection];
|
||||
//EEPROM_ReadBuffer(0x1F80 + gSubMenuSelection, &mic, 1);
|
||||
//sprintf(String, "%d %.1fdB", gSubMenuSelection, mic * 0.5);
|
||||
sprintf(String, "%+.1fdB", mic * 0.5);
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_STEP:
|
||||
sprintf(String, "%.2fKHz", gSubMenu_Step[gSubMenuSelection] * 0.01);
|
||||
break;
|
||||
|
||||
case MENU_TXP:
|
||||
strcpy(String, gSubMenu_TXP[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_R_DCS:
|
||||
case MENU_T_DCS:
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
if (gSubMenuSelection < 105)
|
||||
sprintf(String, "D%03oN", DCS_Options[gSubMenuSelection - 1]);
|
||||
else
|
||||
sprintf(String, "D%03oI", DCS_Options[gSubMenuSelection - 105]);
|
||||
break;
|
||||
|
||||
case MENU_R_CTCS:
|
||||
case MENU_T_CTCS:
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%.1fHz", CTCSS_Options[gSubMenuSelection - 1] * 0.1);
|
||||
break;
|
||||
|
||||
case MENU_SFT_D:
|
||||
strcpy(String, gSubMenu_SFT_D[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_OFFSET:
|
||||
if (!gIsInSubMenu || gInputBoxIndex == 0)
|
||||
{
|
||||
sprintf(String, "%.5f", gSubMenuSelection * 1e-05);
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
String[i ] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
|
||||
String[3] = '.';
|
||||
for (i = 3; i < 6; i++)
|
||||
String[i + 1] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
|
||||
String[ 7] = '-';
|
||||
String[ 8] = '-';
|
||||
String[ 9] = 0;
|
||||
String[10] = 0;
|
||||
String[11] = 0;
|
||||
|
||||
break;
|
||||
|
||||
case MENU_W_N:
|
||||
strcpy(String, gSubMenu_W_N[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_SCR:
|
||||
case MENU_VOX:
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%d", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_ABR:
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%d sec", gSubMenuSelection * 10);
|
||||
break;
|
||||
|
||||
case MENU_BCL:
|
||||
case MENU_BEEP:
|
||||
case MENU_AUTOLK:
|
||||
case MENU_S_ADD1:
|
||||
case MENU_S_ADD2:
|
||||
case MENU_STE:
|
||||
case MENU_D_ST:
|
||||
case MENU_D_DCD:
|
||||
case MENU_AM:
|
||||
#ifndef DISABLE_NOAA
|
||||
case MENU_NOAA_S:
|
||||
#endif
|
||||
case MENU_350TX:
|
||||
case MENU_200TX:
|
||||
case MENU_500TX:
|
||||
case MENU_350EN:
|
||||
case MENU_SCREN:
|
||||
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_MEM_CH:
|
||||
case MENU_1_CALL:
|
||||
case MENU_DEL_CH:
|
||||
UI_GenerateChannelStringEx(
|
||||
String,
|
||||
RADIO_CheckValidChannel((uint16_t)gSubMenuSelection, false, 0),
|
||||
(uint8_t)gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_SAVE:
|
||||
strcpy(String, gSubMenu_SAVE[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_TDR:
|
||||
case MENU_WX:
|
||||
strcpy(String, gSubMenu_CHAN[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_TOT:
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%dmin", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
#ifndef DISABLE_VOICE
|
||||
case MENU_VOICE:
|
||||
strcpy(String, gSubMenu_VOICE[gSubMenuSelection]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_SC_REV:
|
||||
strcpy(String, gSubMenu_SC_REV[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_MDF:
|
||||
strcpy(String, gSubMenu_MDF[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_RP_STE:
|
||||
if (gSubMenuSelection == 0)
|
||||
strcpy(String, "OFF");
|
||||
else
|
||||
sprintf(String, "%d*100ms", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_S_LIST:
|
||||
sprintf(String, "LIST%d", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_AL_MOD:
|
||||
sprintf(String, gSubMenu_AL_MOD[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_ANI_ID:
|
||||
strcpy(String, gEeprom.ANI_DTMF_ID);
|
||||
break;
|
||||
|
||||
case MENU_UPCODE:
|
||||
strcpy(String, gEeprom.DTMF_UP_CODE);
|
||||
break;
|
||||
|
||||
case MENU_DWCODE:
|
||||
strcpy(String, gEeprom.DTMF_DOWN_CODE);
|
||||
break;
|
||||
|
||||
case MENU_D_RSP:
|
||||
strcpy(String, gSubMenu_D_RSP[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_D_HOLD:
|
||||
sprintf(String, "%ds", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_D_PRE:
|
||||
sprintf(String, "%d*10ms", gSubMenuSelection);
|
||||
break;
|
||||
|
||||
case MENU_PTT_ID:
|
||||
strcpy(String, gSubMenu_PTT_ID[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_D_LIST:
|
||||
gIsDtmfContactValid = DTMF_GetContact((uint8_t)gSubMenuSelection - 1, Contact);
|
||||
if (!gIsDtmfContactValid)
|
||||
// Ghidra being weird again...
|
||||
memcpy(String, "NULL\0\0\0", 8);
|
||||
else
|
||||
memcpy(String, Contact, 8);
|
||||
break;
|
||||
|
||||
case MENU_PONMSG:
|
||||
strcpy(String, gSubMenu_PONMSG[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_ROGER:
|
||||
strcpy(String, gSubMenu_ROGER[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_VOL:
|
||||
sprintf(String, "%.3fV", gBatteryVoltageAverage * 0.01); // argh, floating point :(
|
||||
break;
|
||||
|
||||
case MENU_RESET:
|
||||
strcpy(String, gSubMenu_RESET[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_F_LOCK:
|
||||
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
|
||||
break;
|
||||
}
|
||||
|
||||
UI_PrintString(String, 50, 127, 2, 8, true);
|
||||
|
||||
if (gMenuCursor == MENU_OFFSET)
|
||||
UI_PrintString("MHz", 50, 127, 4, 8, true);
|
||||
|
||||
if ((gMenuCursor == MENU_RESET || gMenuCursor == MENU_MEM_CH || gMenuCursor == MENU_DEL_CH) && gAskForConfirmation)
|
||||
{
|
||||
strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!");
|
||||
UI_PrintString(String, 50, 127, 4, 8, true);
|
||||
}
|
||||
|
||||
if ((gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||
UI_PrintString("SCAN", 50, 127, 4, 8, true);
|
||||
|
||||
if (gMenuCursor == MENU_UPCODE)
|
||||
if (strlen(gEeprom.DTMF_UP_CODE) > 8)
|
||||
UI_PrintString(gEeprom.DTMF_UP_CODE + 8, 50, 127, 4, 8, true);
|
||||
|
||||
if (gMenuCursor == MENU_DWCODE)
|
||||
if (strlen(gEeprom.DTMF_DOWN_CODE) > 8)
|
||||
UI_PrintString(gEeprom.DTMF_DOWN_CODE + 8, 50, 127, 4, 8, true);
|
||||
|
||||
if (gMenuCursor == MENU_D_LIST && gIsDtmfContactValid)
|
||||
{
|
||||
Contact[11] = 0;
|
||||
memcpy(&gDTMF_ID, Contact + 8, 4);
|
||||
sprintf(String, "ID:%s", Contact + 8);
|
||||
UI_PrintString(String, 50, 127, 4, 8, true);
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_R_CTCS ||
|
||||
gMenuCursor == MENU_T_CTCS ||
|
||||
gMenuCursor == MENU_R_DCS ||
|
||||
gMenuCursor == MENU_T_DCS ||
|
||||
gMenuCursor == MENU_D_LIST)
|
||||
{
|
||||
uint8_t Offset;
|
||||
NUMBER_ToDigits((uint8_t)gSubMenuSelection, String);
|
||||
Offset = (gMenuCursor == MENU_D_LIST) ? 2 : 3;
|
||||
UI_DisplaySmallDigits(Offset, String + (8 - Offset), 105, 0);
|
||||
}
|
||||
|
||||
if (gMenuCursor == MENU_SLIST1 || gMenuCursor == MENU_SLIST2)
|
||||
{
|
||||
i = gMenuCursor - MENU_SLIST1;
|
||||
|
||||
if (gSubMenuSelection == 0xFF)
|
||||
sprintf(String, "NULL");
|
||||
else
|
||||
UI_GenerateChannelStringEx(String, true, (uint8_t)gSubMenuSelection);
|
||||
|
||||
if (gSubMenuSelection == 0xFF || !gEeprom.SCAN_LIST_ENABLED[i])
|
||||
{
|
||||
UI_PrintString(String, 50, 127, 2, 8, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
UI_PrintString(String, 50, 127, 0, 8, 1);
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i]))
|
||||
{
|
||||
sprintf(String, "PRI1:%d", gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
|
||||
UI_PrintString(String, 50, 127, 2, 8, 1);
|
||||
}
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i]))
|
||||
{
|
||||
sprintf(String, "PRI2:%d", gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
|
||||
UI_PrintString(String, 50, 127, 4, 8, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
97
ui/menu.h
Normal file
97
ui/menu.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_MENU_H
|
||||
#define UI_MENU_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
enum
|
||||
{
|
||||
MENU_SQL = 0,
|
||||
MENU_STEP,
|
||||
MENU_TXP,
|
||||
MENU_R_DCS,
|
||||
MENU_R_CTCS,
|
||||
MENU_T_DCS,
|
||||
MENU_T_CTCS,
|
||||
MENU_SFT_D,
|
||||
MENU_OFFSET,
|
||||
MENU_W_N,
|
||||
MENU_SCR,
|
||||
MENU_BCL,
|
||||
MENU_MEM_CH,
|
||||
MENU_SAVE,
|
||||
MENU_VOX,
|
||||
MENU_ABR,
|
||||
MENU_TDR,
|
||||
MENU_WX,
|
||||
MENU_BEEP,
|
||||
MENU_TOT,
|
||||
#ifndef DISABLE_VOICE
|
||||
MENU_VOICE,
|
||||
#endif
|
||||
MENU_SC_REV,
|
||||
MENU_MDF,
|
||||
MENU_AUTOLK,
|
||||
MENU_S_ADD1,
|
||||
MENU_S_ADD2,
|
||||
MENU_STE,
|
||||
MENU_RP_STE,
|
||||
MENU_MIC,
|
||||
MENU_1_CALL,
|
||||
MENU_S_LIST,
|
||||
MENU_SLIST1,
|
||||
MENU_SLIST2,
|
||||
MENU_AL_MOD,
|
||||
MENU_ANI_ID,
|
||||
MENU_UPCODE,
|
||||
MENU_DWCODE,
|
||||
MENU_D_ST,
|
||||
MENU_D_RSP,
|
||||
MENU_D_HOLD,
|
||||
MENU_D_PRE,
|
||||
MENU_PTT_ID,
|
||||
MENU_D_DCD,
|
||||
MENU_D_LIST,
|
||||
MENU_PONMSG,
|
||||
MENU_ROGER,
|
||||
MENU_VOL,
|
||||
MENU_AM,
|
||||
#ifndef DISABLE_NOAA
|
||||
MENU_NOAA_S,
|
||||
#endif
|
||||
MENU_DEL_CH,
|
||||
MENU_RESET,
|
||||
MENU_350TX,
|
||||
MENU_F_LOCK,
|
||||
MENU_200TX,
|
||||
MENU_500TX,
|
||||
MENU_350EN,
|
||||
MENU_SCREN
|
||||
};
|
||||
|
||||
extern bool gIsInSubMenu;
|
||||
|
||||
extern uint8_t gMenuCursor;
|
||||
extern int8_t gMenuScrollDirection;
|
||||
extern uint32_t gSubMenuSelection;
|
||||
|
||||
void UI_DisplayMenu(void);
|
||||
|
||||
#endif
|
||||
|
93
ui/rssi.c
Normal file
93
ui/rssi.c
Normal file
@@ -0,0 +1,93 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "bitmaps.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "functions.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/rssi.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
static void Render(uint8_t RssiLevel, uint8_t VFO)
|
||||
{
|
||||
uint8_t *pLine;
|
||||
uint8_t Line;
|
||||
bool bIsClearMode;
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (VFO == 0) {
|
||||
pLine = gFrameBuffer[2];
|
||||
Line = 3;
|
||||
} else {
|
||||
pLine = gFrameBuffer[6];
|
||||
Line = 7;
|
||||
}
|
||||
|
||||
memset(pLine, 0, 23);
|
||||
if (RssiLevel == 0) {
|
||||
pLine = NULL;
|
||||
bIsClearMode = true;
|
||||
} else {
|
||||
memcpy(pLine, BITMAP_Antenna, 5);
|
||||
memcpy(pLine + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
|
||||
if (RssiLevel >= 2) {
|
||||
memcpy(pLine + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
|
||||
}
|
||||
if (RssiLevel >= 3) {
|
||||
memcpy(pLine + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
|
||||
}
|
||||
if (RssiLevel >= 4) {
|
||||
memcpy(pLine + 14, BITMAP_AntennaLevel4, sizeof(BITMAP_AntennaLevel4));
|
||||
}
|
||||
if (RssiLevel >= 5) {
|
||||
memcpy(pLine + 17, BITMAP_AntennaLevel5, sizeof(BITMAP_AntennaLevel5));
|
||||
}
|
||||
if (RssiLevel >= 6) {
|
||||
memcpy(pLine + 20, BITMAP_AntennaLevel6, sizeof(BITMAP_AntennaLevel6));
|
||||
}
|
||||
bIsClearMode = false;
|
||||
}
|
||||
|
||||
ST7565_DrawLine(0, Line, 23 , pLine, bIsClearMode);
|
||||
}
|
||||
|
||||
void UI_UpdateRSSI(uint16_t RSSI)
|
||||
{
|
||||
uint8_t Level;
|
||||
|
||||
if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][3]) {
|
||||
Level = 6;
|
||||
} else if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][2]) {
|
||||
Level = 4;
|
||||
} else if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][1]) {
|
||||
Level = 2;
|
||||
} else if (RSSI >= gEEPROM_RSSI_CALIB[gRxVfo->Band][0]) {
|
||||
Level = 1;
|
||||
} else {
|
||||
Level = 0;
|
||||
}
|
||||
|
||||
if (gVFO_RSSI_Level[gEeprom.RX_CHANNEL] != Level) {
|
||||
gVFO_RSSI_Level[gEeprom.RX_CHANNEL] = Level;
|
||||
Render(Level, gEeprom.RX_CHANNEL);
|
||||
}
|
||||
}
|
||||
|
23
ui/rssi.h
Normal file
23
ui/rssi.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_RSSI_H
|
||||
#define UI_RSSI_H
|
||||
|
||||
void UI_UpdateRSSI(uint16_t RSSI);
|
||||
|
||||
#endif
|
||||
|
80
ui/scanner.c
Normal file
80
ui/scanner.c
Normal file
@@ -0,0 +1,80 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include "app/scanner.h"
|
||||
#include "dcs.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "misc.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/scanner.h"
|
||||
|
||||
void UI_DisplayScanner(void)
|
||||
{
|
||||
char String[16];
|
||||
bool bCentered;
|
||||
uint8_t Start;
|
||||
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
memset(String, 0, sizeof(String));
|
||||
|
||||
if (gScanSingleFrequency || (gScanCssState != SCAN_CSS_STATE_OFF && gScanCssState != SCAN_CSS_STATE_FAILED)) {
|
||||
sprintf(String, "FREQ:%.5f", gScanFrequency * 1e-05);
|
||||
} else {
|
||||
sprintf(String, "FREQ:**.*****");
|
||||
}
|
||||
UI_PrintString(String, 2, 127, 1, 8, 0);
|
||||
memset(String, 0, sizeof(String));
|
||||
|
||||
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) {
|
||||
sprintf(String, "CTC:******");
|
||||
} else if (gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) {
|
||||
sprintf(String, "CTC:%.1fHz", CTCSS_Options[gScanCssResultCode] * 0.1);
|
||||
} else {
|
||||
sprintf(String, "DCS:D%03oN", DCS_Options[gScanCssResultCode]);
|
||||
}
|
||||
|
||||
UI_PrintString(String, 2, 127, 3, 8, 0);
|
||||
memset(String, 0, sizeof(String));
|
||||
|
||||
if (gScannerEditState == 2) {
|
||||
strcpy(String, "SAVE?");
|
||||
Start = 0;
|
||||
bCentered = 1;
|
||||
} else {
|
||||
if (gScannerEditState == 1) {
|
||||
strcpy(String, "SAVE:");
|
||||
UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel);
|
||||
} else if (gScanCssState < SCAN_CSS_STATE_FOUND) {
|
||||
strcpy(String, "SCAN");
|
||||
memset(String + 4, '.', (gScanProgressIndicator & 7) + 1);
|
||||
} else {
|
||||
if (gScanCssState == SCAN_CSS_STATE_FOUND) {
|
||||
strcpy(String, "SCAN CMP.");
|
||||
} else {
|
||||
strcpy(String, "SCAN FAIL.");
|
||||
}
|
||||
}
|
||||
Start = 2;
|
||||
bCentered = 0;
|
||||
}
|
||||
|
||||
UI_PrintString(String, Start, 127, 5, 8, bCentered);
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
23
ui/scanner.h
Normal file
23
ui/scanner.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_SCANNER_H
|
||||
#define UI_SCANNER_H
|
||||
|
||||
void UI_DisplayScanner(void);
|
||||
|
||||
#endif
|
||||
|
90
ui/status.c
Normal file
90
ui/status.c
Normal file
@@ -0,0 +1,90 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "app/fm.h"
|
||||
#include "bitmaps.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "functions.h"
|
||||
#include "helper/battery.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
#include "ui/status.h"
|
||||
|
||||
void UI_DisplayStatus(void)
|
||||
{
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
|
||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||
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));
|
||||
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 (gChargingWithTypeC)
|
||||
memcpy(gStatusLine + 100, BITMAP_USB_C, sizeof(BITMAP_USB_C));
|
||||
|
||||
if (gEeprom.KEY_LOCK)
|
||||
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 (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
|
||||
memcpy(gStatusLine + 58, BITMAP_WX, sizeof(BITMAP_WX));
|
||||
|
||||
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);
|
||||
else
|
||||
if (gFmRadioMode)
|
||||
memcpy(gStatusLine + 21, BITMAP_FM, sizeof(BITMAP_FM));
|
||||
|
||||
#ifndef DISABLE_NOAA
|
||||
if (gIsNoaaMode)
|
||||
memcpy(gStatusLine + 7, BITMAP_NOAA, sizeof(BITMAP_NOAA));
|
||||
#endif
|
||||
|
||||
ST7565_BlitStatusLine();
|
||||
}
|
23
ui/status.h
Normal file
23
ui/status.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_STATUS_H
|
||||
#define UI_STATUS_H
|
||||
|
||||
void UI_DisplayStatus(void);
|
||||
|
||||
#endif
|
||||
|
100
ui/ui.c
Normal file
100
ui/ui.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "app/dtmf.h"
|
||||
#include "app/fm.h"
|
||||
#include "app/scanner.h"
|
||||
#include "driver/keyboard.h"
|
||||
#include "misc.h"
|
||||
#ifndef DISABLE_AIRCOPY
|
||||
#include "ui/aircopy.h"
|
||||
#endif
|
||||
#include "ui/fmradio.h"
|
||||
#include "ui/inputbox.h"
|
||||
#include "ui/main.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/scanner.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
GUI_DisplayType_t gScreenToDisplay;
|
||||
GUI_DisplayType_t gRequestDisplayScreen = DISPLAY_INVALID;
|
||||
|
||||
uint8_t gAskForConfirmation;
|
||||
bool gAskToSave;
|
||||
bool gAskToDelete;
|
||||
|
||||
void GUI_DisplayScreen(void)
|
||||
{
|
||||
switch (gScreenToDisplay)
|
||||
{
|
||||
case DISPLAY_MAIN:
|
||||
UI_DisplayMain();
|
||||
break;
|
||||
|
||||
case DISPLAY_FM:
|
||||
UI_DisplayFM();
|
||||
break;
|
||||
|
||||
case DISPLAY_MENU:
|
||||
UI_DisplayMenu();
|
||||
break;
|
||||
|
||||
case DISPLAY_SCANNER:
|
||||
UI_DisplayScanner();
|
||||
break;
|
||||
|
||||
#ifndef DISABLE_AIRCOPY
|
||||
case DISPLAY_AIRCOPY:
|
||||
UI_DisplayAircopy();
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
||||
{
|
||||
if (Display != DISPLAY_INVALID)
|
||||
{
|
||||
if (gScreenToDisplay != Display)
|
||||
{
|
||||
gInputBoxIndex = 0;
|
||||
gIsInSubMenu = false;
|
||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||
gScanState = SCAN_OFF;
|
||||
gFM_ScanState = FM_SCAN_OFF;
|
||||
gAskForConfirmation = 0;
|
||||
gDTMF_InputMode = false;
|
||||
gDTMF_InputIndex = 0;
|
||||
gF_LOCK = false;
|
||||
gAskToSave = false;
|
||||
gAskToDelete = false;
|
||||
|
||||
if (gWasFKeyPressed)
|
||||
{
|
||||
gWasFKeyPressed = false;
|
||||
gUpdateStatus = true;
|
||||
}
|
||||
}
|
||||
|
||||
gUpdateDisplay = true;
|
||||
gScreenToDisplay = Display;
|
||||
}
|
||||
}
|
48
ui/ui.h
Normal file
48
ui/ui.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef GUI_H
|
||||
#define GUI_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
enum GUI_DisplayType_t
|
||||
{
|
||||
DISPLAY_MAIN = 0,
|
||||
DISPLAY_FM,
|
||||
DISPLAY_MENU,
|
||||
DISPLAY_SCANNER,
|
||||
#ifndef DISABLE_AIRCOPY
|
||||
DISPLAY_AIRCOPY,
|
||||
#endif
|
||||
DISPLAY_INVALID = 0xFFu
|
||||
};
|
||||
|
||||
typedef enum GUI_DisplayType_t GUI_DisplayType_t;
|
||||
|
||||
extern GUI_DisplayType_t gScreenToDisplay;
|
||||
extern GUI_DisplayType_t gRequestDisplayScreen;
|
||||
|
||||
extern uint8_t gAskForConfirmation;
|
||||
extern bool gAskToSave;
|
||||
extern bool gAskToDelete;
|
||||
|
||||
void GUI_DisplayScreen(void);
|
||||
void GUI_SelectNextDisplay(GUI_DisplayType_t Display);
|
||||
|
||||
#endif
|
||||
|
65
ui/welcome.c
Normal file
65
ui/welcome.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "driver/eeprom.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "external/printf/printf.h"
|
||||
#include "helper/battery.h"
|
||||
#include "settings.h"
|
||||
#include "ui/helper.h"
|
||||
#include "ui/welcome.h"
|
||||
#include "version.h"
|
||||
|
||||
void UI_DisplayWelcome(void)
|
||||
{
|
||||
char WelcomeString0[16];
|
||||
char WelcomeString1[16];
|
||||
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
|
||||
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_FULL_SCREEN)
|
||||
{
|
||||
ST7565_FillScreen(0xFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(WelcomeString0, 0, sizeof(WelcomeString0));
|
||||
memset(WelcomeString1, 0, sizeof(WelcomeString1));
|
||||
|
||||
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_VOLTAGE)
|
||||
{
|
||||
sprintf(WelcomeString0, "VOLTAGE");
|
||||
sprintf(WelcomeString1, "%.2fV", gBatteryVoltageAverage * 0.01); // argh, floating point :(
|
||||
}
|
||||
else
|
||||
{
|
||||
EEPROM_ReadBuffer(0x0EB0, WelcomeString0, 16);
|
||||
EEPROM_ReadBuffer(0x0EC0, WelcomeString1, 16);
|
||||
}
|
||||
|
||||
// UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width, bool bCentered);
|
||||
UI_PrintString(WelcomeString0, 0, 127, 0, 10, true);
|
||||
UI_PrintString(WelcomeString1, 0, 127, 2, 10, true);
|
||||
UI_PrintString(Version, 0, 127, 5, 10, true);
|
||||
|
||||
ST7565_BlitStatusLine();
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
}
|
||||
|
23
ui/welcome.h
Normal file
23
ui/welcome.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* Copyright 2023 Dual Tachyon
|
||||
* https://github.com/DualTachyon
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef UI_WELCOME_H
|
||||
#define UI_WELCOME_H
|
||||
|
||||
void UI_DisplayWelcome(void);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user