Compare commits

...

20 Commits

Author SHA1 Message Date
72558f93f3 Do some stuff
All checks were successful
Build Firmware / build (push) Successful in 3m32s
2025-03-04 16:46:02 +01:00
fabf38f1bc Upload entire dir
All checks were successful
Build Firmware / build (push) Successful in 20s
2025-02-27 17:54:15 +01:00
00786c683d Upload entire dir
All checks were successful
Build Firmware / build (push) Successful in 19s
2025-02-27 17:52:12 +01:00
c5464994ed Upload entire dir
All checks were successful
Build Firmware / build (push) Successful in 24s
2025-02-27 17:47:48 +01:00
f1b2d085d5 Add ls
All checks were successful
Build Firmware / build (push) Successful in 19s
2025-02-27 17:43:30 +01:00
ac6e59044d Yet another test
All checks were successful
Build Firmware / build (push) Successful in 22s
2025-02-27 17:40:40 +01:00
3850025e63 Yet another test
All checks were successful
Build Firmware / build (push) Successful in 20s
2025-02-27 17:36:40 +01:00
dc5919ac6f Another test
All checks were successful
Build Firmware / build (push) Successful in 22s
2025-02-27 17:35:25 +01:00
3e1756697f Forgot important files
All checks were successful
Build Firmware / build (push) Successful in 21s
2025-02-27 17:24:49 +01:00
62f73f8c6c Try to fix the CI
Some checks failed
Build Firmware / build (push) Failing after 18s
2025-02-27 17:23:44 +01:00
f4ff2e6048 Apply my changes v1
Some checks failed
Build Firmware / build (push) Failing after 3m21s
2025-02-27 16:49:04 +01:00
Armel FAUVEAU
ba5257f2f6 Merge pull request #367 from armel/feature_update_v4
Feature update v4
2025-02-22 02:48:10 +01:00
Armel FAUVEAU
aee4406cff Prepare new v4.0 2025-02-22 02:46:47 +01:00
Armel FAUVEAU
448a201308 Update README 2025-02-20 03:59:31 +01:00
Armel FAUVEAU
9a312c3526 Rename Voxless to Basic 2025-02-20 03:56:05 +01:00
Armel FAUVEAU
7f146a5857 Fix bug if BOOT_MODE_F_LOCK 2025-02-19 02:11:39 +01:00
Armel FAUVEAU
710ff8fac1 Fix directive 2025-02-19 01:44:30 +01:00
Armel FAUVEAU
08af06564c Refactoring 2025-02-19 00:43:00 +01:00
Armel FAUVEAU
03f761348b Fix condition 2025-02-18 23:26:58 +01:00
Armel FAUVEAU
96acae8014 Remove comment 2025-02-18 22:14:51 +01:00
69 changed files with 5293 additions and 6055 deletions

View File

@@ -15,10 +15,16 @@ jobs:
- name: Compile firmware - name: Compile firmware
run: | run: |
chmod +x compile-with-docker.sh chmod +x compile-with-docker.sh
./compile-with-docker.sh ./compile-with-docker.sh custom
- name: Debug files
run: ls -lah
- name: Debug compiled firmware
run: ls -lah compiled-firmware
- name: Upload firmware artifact - name: Upload firmware artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: firmware-artifact name: firmware-artifact
path: compiled-firmware/f4hwn.packed.bin path: compiled-firmware/*

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

7
.idea/discord.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
</project>

18
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MakefileSettings">
<option name="linkedExternalProjectsSettings">
<MakefileProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="version" value="2" />
</MakefileProjectSettings>
</option>
</component>
<component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -4,7 +4,7 @@
# 1 = enable # 1 = enable
# ---- STOCK QUANSHENG FEATURES ---- # ---- STOCK QUANSHENG FEATURES ----
ENABLE_FMRADIO ?= 0 ENABLE_FMRADIO ?= 1
ENABLE_UART ?= 1 ENABLE_UART ?= 1
ENABLE_AIRCOPY ?= 0 ENABLE_AIRCOPY ?= 0
ENABLE_NOAA ?= 0 ENABLE_NOAA ?= 0
@@ -17,15 +17,15 @@ ENABLE_DTMF_CALLING ?= 0
ENABLE_FLASHLIGHT ?= 1 ENABLE_FLASHLIGHT ?= 1
# ---- CUSTOM MODS ---- # ---- CUSTOM MODS ----
ENABLE_SPECTRUM ?= 0 ENABLE_SPECTRUM ?= 1
ENABLE_BIG_FREQ ?= 1 ENABLE_BIG_FREQ ?= 0
ENABLE_SMALL_BOLD ?= 1 ENABLE_SMALL_BOLD ?= 0
ENABLE_CUSTOM_MENU_LAYOUT ?= 1 ENABLE_CUSTOM_MENU_LAYOUT ?= 1
ENABLE_KEEP_MEM_NAME ?= 1 ENABLE_KEEP_MEM_NAME ?= 1
ENABLE_WIDE_RX ?= 1 ENABLE_WIDE_RX ?= 1
ENABLE_TX_WHEN_AM ?= 0 ENABLE_TX_WHEN_AM ?= 0
ENABLE_F_CAL_MENU ?= 0 ENABLE_F_CAL_MENU ?= 1
ENABLE_CTCSS_TAIL_PHASE_SHIFT ?= 0 ENABLE_CTCSS_TAIL_PHASE_SHIFT ?= 1
ENABLE_BOOT_BEEPS ?= 0 ENABLE_BOOT_BEEPS ?= 0
ENABLE_SHOW_CHARGE_LEVEL ?= 0 ENABLE_SHOW_CHARGE_LEVEL ?= 0
ENABLE_REVERSE_BAT_SYMBOL ?= 0 ENABLE_REVERSE_BAT_SYMBOL ?= 0
@@ -36,26 +36,26 @@ ENABLE_FASTER_CHANNEL_SCAN ?= 1
ENABLE_RSSI_BAR ?= 1 ENABLE_RSSI_BAR ?= 1
ENABLE_AUDIO_BAR ?= 1 ENABLE_AUDIO_BAR ?= 1
ENABLE_COPY_CHAN_TO_VFO ?= 1 ENABLE_COPY_CHAN_TO_VFO ?= 1
ENABLE_REDUCE_LOW_MID_TX_POWER ?= 0 ENABLE_REDUCE_LOW_MID_TX_POWER ?= 1
ENABLE_BYP_RAW_DEMODULATORS ?= 0 ENABLE_BYP_RAW_DEMODULATORS ?= 1
ENABLE_BLMIN_TMP_OFF ?= 0 ENABLE_BLMIN_TMP_OFF ?= 1
ENABLE_SCAN_RANGES ?= 1 ENABLE_SCAN_RANGES ?= 1
ENABLE_FEAT_F4HWN ?= 1 ENABLE_FEAT_F4HWN ?= 1
ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0 ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
ENABLE_FEAT_F4HWN_SPECTRUM ?= 1 ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 1 ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 0
ENABLE_FEAT_F4HWN_CHARGING_C ?= 0 ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
ENABLE_FEAT_F4HWN_SLEEP ?= 1 ENABLE_FEAT_F4HWN_SLEEP ?= 1
ENABLE_FEAT_F4HWN_RESUME_STATE ?= 1 ENABLE_FEAT_F4HWN_RESUME_STATE ?= 1
ENABLE_FEAT_F4HWN_NARROWER ?= 1 ENABLE_FEAT_F4HWN_NARROWER ?= 1
ENABLE_FEAT_F4HWN_INV ?= 1 ENABLE_FEAT_F4HWN_INV ?= 1
ENABLE_FEAT_F4HWN_CTR ?= 1 ENABLE_FEAT_F4HWN_CTR ?= 0
ENABLE_FEAT_F4HWN_RESCUE_OPS ?= 0 ENABLE_FEAT_F4HWN_RESCUE_OPS ?= 0
ENABLE_FEAT_F4HWN_VOL ?= 0 ENABLE_FEAT_F4HWN_VOL ?= 1
ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0 ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0
ENABLE_FEAT_F4HWN_PMR ?= 0 ENABLE_FEAT_F4HWN_PMR ?= 0
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 0 ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 0
ENABLE_FEAT_F4HWN_CA ?= 1 ENABLE_FEAT_F4HWN_CA ?= 0
ENABLE_FEAT_F4HWN_DEBUG ?= 0 ENABLE_FEAT_F4HWN_DEBUG ?= 0
ENABLE_REGA ?= 0 ENABLE_REGA ?= 0
@@ -67,7 +67,7 @@ ENABLE_UART_RW_BK_REGS ?= 0
# ---- COMPILER/LINKER OPTIONS ---- # ---- COMPILER/LINKER OPTIONS ----
ENABLE_CLANG ?= 0 ENABLE_CLANG ?= 0
ENABLE_SWD ?= 0 ENABLE_SWD ?= 0
ENABLE_OVERLAY ?= 0 ENABLE_OVERLAY ?= 1
ENABLE_LTO ?= 1 ENABLE_LTO ?= 1
############################################################# #############################################################
@@ -138,6 +138,7 @@ OBJS += app/app.o
OBJS += app/chFrScanner.o OBJS += app/chFrScanner.o
OBJS += app/common.o OBJS += app/common.o
OBJS += app/dtmf.o OBJS += app/dtmf.o
OBJS += app/fskmodem.o
ifeq ($(ENABLE_REGA),1) ifeq ($(ENABLE_REGA),1)
OBJS += app/rega.o OBJS += app/rega.o
endif endif

View File

@@ -97,6 +97,8 @@ Special thanks to Jean-Cyrille F6IWW (2 times), Fabrice 14RC123, David F4BPP, Ol
* improve ScnRev menu (CARRIER from 250ms to 20s, STOP, TIMEOUT from 5s to 2m) * improve ScnRev menu (CARRIER from 250ms to 20s, STOP, TIMEOUT from 5s to 2m)
* improve KeyLck menu (OFF, delay from 15s to 10m) * improve KeyLck menu (OFF, delay from 15s to 10m)
* add HAM CA F Lock band (for Canadian zone), * add HAM CA F Lock band (for Canadian zone),
* add PMR 446 F Lock band,
* add FRS/GMRS/MURS F Lock band,
* remove blink and SOS functionality, * remove blink and SOS functionality,
* remove AM Fix menu (AM Fix is ENABLED by default), * remove AM Fix menu (AM Fix is ENABLED by default),
* add support of 3500mAh battery, * add support of 3500mAh battery,
@@ -116,13 +118,14 @@ Special thanks to Jean-Cyrille F6IWW (2 times), Fabrice 14RC123, David F4BPP, Ol
* scan lists [1, 2, 3], * scan lists [1, 2, 3],
* scan all (all channels with ou without list), * scan all (all channels with ou without list),
* add scan list shortcuts, * add scan list shortcuts,
* add scan resume mode on startup, * add resume mode on startup (scan, bandscope and broadcast FM),
* new actions: * new actions:
* RX MODE, * RX MODE,
* MAIN ONLY, * MAIN ONLY,
* PTT, * PTT,
* WIDE NARROW, * WIDE NARROW,
* 1750Hz, * 1750Hz,
* MUTE,
* POWER HIGH (RescueOps), * POWER HIGH (RescueOps),
* REMOVE OFFSET (RescueOps), * REMOVE OFFSET (RescueOps),
* new key combinations: * new key combinations:

View File

@@ -45,16 +45,13 @@ uint8_t gAirCopyIsSendMode;
uint16_t g_FSK_Buffer[36]; uint16_t g_FSK_Buffer[36];
static void AIRCOPY_clear() static void AIRCOPY_clear() {
{ for (uint8_t i = 0; i < 15; i++) {
for (uint8_t i = 0; i < 15; i++)
{
crc[i] = 0; crc[i] = 0;
} }
} }
bool AIRCOPY_SendMessage(void) bool AIRCOPY_SendMessage(void) {
{
static uint8_t gAircopySendCountdown = 1; static uint8_t gAircopySendCountdown = 1;
if (gAircopyState != AIRCOPY_TRANSFER) { if (gAircopyState != AIRCOPY_TRANSFER) {
@@ -94,8 +91,7 @@ bool AIRCOPY_SendMessage(void)
return 0; return 0;
} }
void AIRCOPY_StorePacket(void) void AIRCOPY_StorePacket(void) {
{
if (gFSKWriteIndex < 36) { if (gFSKWriteIndex < 36) {
return; return;
} }
@@ -146,8 +142,7 @@ void AIRCOPY_StorePacket(void)
gAirCopyBlockNumber++; gAirCopyBlockNumber++;
} }
static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
{
if (bKeyHeld || !bKeyPressed) { if (bKeyHeld || !bKeyPressed) {
return; return;
} }
@@ -194,8 +189,7 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gRequestDisplayScreen = DISPLAY_AIRCOPY; gRequestDisplayScreen = DISPLAY_AIRCOPY;
} }
static void AIRCOPY_Key_EXIT(bool bKeyPressed, bool bKeyHeld) static void AIRCOPY_Key_EXIT(bool bKeyPressed, bool bKeyHeld) {
{
if (bKeyHeld || !bKeyPressed) { if (bKeyHeld || !bKeyPressed) {
return; return;
} }
@@ -220,8 +214,7 @@ static void AIRCOPY_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
gRequestDisplayScreen = DISPLAY_AIRCOPY; gRequestDisplayScreen = DISPLAY_AIRCOPY;
} }
static void AIRCOPY_Key_MENU(bool bKeyPressed, bool bKeyHeld) static void AIRCOPY_Key_MENU(bool bKeyPressed, bool bKeyHeld) {
{
if (bKeyHeld || !bKeyPressed) { if (bKeyHeld || !bKeyPressed) {
return; return;
} }
@@ -242,8 +235,7 @@ static void AIRCOPY_Key_MENU(bool bKeyPressed, bool bKeyHeld)
gAircopyState = AIRCOPY_TRANSFER; gAircopyState = AIRCOPY_TRANSFER;
} }
void AIRCOPY_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) void AIRCOPY_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
{
switch (Key) { switch (Key) {
case KEY_0: case KEY_0:
case KEY_1: case KEY_1:

492
app/app.c

File diff suppressed because it is too large Load Diff

View File

@@ -24,12 +24,20 @@
#include "radio.h" #include "radio.h"
void APP_EndTransmission(void); void APP_EndTransmission(void);
void APP_StartListening(FUNCTION_Type_t function); void APP_StartListening(FUNCTION_Type_t function);
uint32_t APP_SetFreqByStepAndLimits(VFO_Info_t *pInfo, int8_t direction, uint32_t lower, uint32_t upper); uint32_t APP_SetFreqByStepAndLimits(VFO_Info_t *pInfo, int8_t direction, uint32_t lower, uint32_t upper);
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t direction); uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t direction);
void APP_Update(void); void APP_Update(void);
void APP_TimeSlice10ms(void); void APP_TimeSlice10ms(void);
void APP_TimeSlice500ms(void); void APP_TimeSlice500ms(void);
void APP_EndTransmission(void);
#endif #endif

View File

@@ -248,7 +248,7 @@ void DTMF_HandleRequest(void)
return; return;
} }
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED) if (!gRxVfo->DTMF_DECODING_ENABLE)
{ // D-DCD is disabled or we're alive { // D-DCD is disabled or we're alive
DTMF_clear_RX(); DTMF_clear_RX();
return; return;
@@ -266,28 +266,28 @@ void DTMF_HandleRequest(void)
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true)) if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
{ // bugger { // bugger
if (gEeprom.PERMIT_REMOTE_KILL) // if (gEeprom.PERMIT_REMOTE_KILL)
{ // {
gSetting_KILLED = true; // oooerr ! // gSetting_KILLED = true; // oooerr !
//
DTMF_clear_RX(); // DTMF_clear_RX();
//
SETTINGS_SaveSettings(); // SETTINGS_SaveSettings();
//
gDTMF_ReplyState = DTMF_REPLY_AB; // gDTMF_ReplyState = DTMF_REPLY_AB;
//
#ifdef ENABLE_FMRADIO // #ifdef ENABLE_FMRADIO
if (gFmRadioMode) // if (gFmRadioMode)
{ // {
FM_TurnOff(); // FM_TurnOff();
GUI_SelectNextDisplay(DISPLAY_MAIN); // GUI_SelectNextDisplay(DISPLAY_MAIN);
} // }
#endif // #endif
} // }
else // else
{ // {
gDTMF_ReplyState = DTMF_REPLY_NONE; gDTMF_ReplyState = DTMF_REPLY_NONE;
} // }
gDTMF_CallState = DTMF_CALL_STATE_NONE; gDTMF_CallState = DTMF_CALL_STATE_NONE;
@@ -297,30 +297,30 @@ void DTMF_HandleRequest(void)
} }
} }
if (gDTMF_RX_index >= 9) // if (gDTMF_RX_index >= 9)
{ // look for the REVIVE code // { // look for the REVIVE code
//
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE); // sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
//
Offset = gDTMF_RX_index - strlen(String); // Offset = gDTMF_RX_index - strlen(String);
//
if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true)) // if (CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
{ // shit, we're back ! // { // shit, we're back !
//
gSetting_KILLED = false; // gSetting_KILLED = false;
//
DTMF_clear_RX(); // DTMF_clear_RX();
//
SETTINGS_SaveSettings(); // SETTINGS_SaveSettings();
//
gDTMF_ReplyState = DTMF_REPLY_AB; // gDTMF_ReplyState = DTMF_REPLY_AB;
gDTMF_CallState = DTMF_CALL_STATE_NONE; // gDTMF_CallState = DTMF_CALL_STATE_NONE;
//
gUpdateDisplay = true; // gUpdateDisplay = true;
gUpdateStatus = true; // gUpdateStatus = true;
return; // return;
} // }
} // }
if (gDTMF_RX_index >= 2) if (gDTMF_RX_index >= 2)
{ // look for ACK reply { // look for ACK reply
@@ -360,7 +360,7 @@ void DTMF_HandleRequest(void)
} }
} }
if (gSetting_KILLED || gDTMF_CallState != DTMF_CALL_STATE_NONE) if (gDTMF_CallState != DTMF_CALL_STATE_NONE)
{ // we've been killed or expecting a reply { // we've been killed or expecting a reply
return; return;
} }

View File

@@ -184,7 +184,7 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
{ {
int ret = -1; int ret = -1;
const uint16_t Test2 = BK1080_ReadRegister(BK1080_REG_07); const uint16_t Test2 = BK1080_ReadRegister(BK1080_REG_07_TEST1);
// This is supposed to be a signed value, but above function is unsigned // This is supposed to be a signed value, but above function is unsigned
const uint16_t Deviation = BK1080_REG_07_GET_FREQD(Test2); const uint16_t Deviation = BK1080_REG_07_GET_FREQD(Test2);
@@ -196,7 +196,7 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
return ret; return ret;
} }
const uint16_t Status = BK1080_ReadRegister(BK1080_REG_10); const uint16_t Status = BK1080_ReadRegister(BK1080_REG_10_RSSI_STATUS);
if ((Status & BK1080_REG_10_MASK_AFCRL) != BK1080_REG_10_AFCRL_NOT_RAILED || BK1080_REG_10_GET_RSSI(Status) < 10) { if ((Status & BK1080_REG_10_MASK_AFCRL) != BK1080_REG_10_AFCRL_NOT_RAILED || BK1080_REG_10_GET_RSSI(Status) < 10) {
BK1080_FrequencyDeviation = Deviation; BK1080_FrequencyDeviation = Deviation;
@@ -377,6 +377,27 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state)
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
break; break;
case KEY_4:
gEeprom.BK1080_AGC_ENABLED = !gEeprom.BK1080_AGC_ENABLED;
BK1080_UpdateSysconf();
gRequestSaveSettings = true;
gRequestSaveFM = true;
break;
case KEY_5:
gEeprom.BK1080_DEEMPHASIS_CONFIG++;
BK1080_UpdateSysconf();
gRequestSaveSettings = true;
gRequestSaveFM = true;
break;
case KEY_6:
gEeprom.BK1080_BLEND_CONFIG++;
BK1080_UpdateSysconf();
gRequestSaveSettings = true;
gRequestSaveFM = true;
break;
case KEY_STAR: case KEY_STAR:
ACTION_Scan(autoScan); ACTION_Scan(autoScan);
break; break;
@@ -390,12 +411,13 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state)
static void Key_EXIT(uint8_t state) static void Key_EXIT(uint8_t state)
{ {
if (state != BUTTON_EVENT_SHORT)
return;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
if (gFM_ScanState == FM_SCAN_OFF) { if (state == BUTTON_EVENT_SHORT) {
return;
}
if (gFM_ScanState == FM_SCAN_OFF || state == BUTTON_EVENT_LONG) {
if (gInputBoxIndex == 0) { if (gInputBoxIndex == 0) {
if (!gAskToSave && !gAskToDelete) { if (!gAskToSave && !gAskToDelete) {
ACTION_FM(); ACTION_FM();
@@ -572,6 +594,7 @@ void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
break; break;
} }
GUI_DisplayScreen();
} }
void FM_Play(void) void FM_Play(void)

219
app/fskmodem.c Normal file
View File

@@ -0,0 +1,219 @@
//
// Created by bruno on 25.2.2025.
//
#include "fskmodem.h"
uint16_t TONE2_FREQ;
uint8_t seq = 0;
DataPacket dataPacket;
DataPacket inBoundPacket;
uint8_t *dataPTR = dataPacket.data;
SMSEnteringState gEnteringSMS = SMS_NOT_ENTERING;
void MSG_ConfigureFSK(bool rx) {
BK4819_WriteRegister(BK4819_REG_70, TONE2_ENABLE_BIT | (96U << 0));
switch (gEeprom.FSKMode) {
case MOD_AFSK_2400:
TONE2_FREQ = 24779U; // Estimated
break;
case MOD_AFSK_1200:
TONE2_FREQ = 12389U;
break;
case MOD_FSK_700:
TONE2_FREQ = 7227U;
break;
case MOD_FSK_450:
TONE2_FREQ = 4646U;
break;
case MOD_FSK_1200_2400:
TONE2_FREQ = 12389U; // Default to 1200Hz, dynamic switching may be required
break;
case MOD_NOAA_SAME:
TONE2_FREQ = 2083U; // NOAA SAME uses 2083.3 Hz for mark and 1562.5 Hz for space
break;
}
BK4819_WriteRegister(BK4819_REG_72, TONE2_FREQ);
// uint16_t fskConfig = FSK_ENABLE_BIT | FSK_RX_BW_1_2K | FSK_RX_GAIN_DEFAULT | FSK_PREAMBLE_TYPE_AA;
// if (gEeprom.FSKMode == MOD_AFSK_1200) {
// fskConfig = FSK_ENABLE_BIT | FSK_TX_MODE_FSK_1_2K_2_4K | FSK_RX_MODE_FSK_1_2K_2_4K_NOAA;
// }
uint16_t fskConfig = FSK_ENABLE_BIT | FSK_PREAMBLE_TYPE_AA;
switch (gEeprom.FSKMode) {
case MOD_FSK_700:
case MOD_FSK_450:
case MOD_FSK_1200_2400:
fskConfig |= FSK_TX_MODE_FSK_1_2K_2_4K | FSK_RX_MODE_FSK_1_2K_2_4K_NOAA | FSK_RX_BW_1_2K;
break;
case MOD_AFSK_1200:
fskConfig |= FSK_TX_MODE_FFSK_1200_1800 | FSK_RX_MODE_FFSK_1200_1800 | FSK_RX_BW_FFSK_1200_1800;
break;
case MOD_AFSK_2400:
fskConfig |= FSK_TX_MODE_FFSK_1200_2400 | FSK_RX_MODE_FFSK_1200_2400 | FSK_RX_BW_2_4K_FFSK_1200_2400;
break;
case MOD_NOAA_SAME:
fskConfig |= FSK_TX_MODE_NOAA_SAME | FSK_RX_MODE_FSK_1_2K_2_4K_NOAA | FSK_RX_BW_NOAA_SAME;
break;
default:
// Unsupported mode; keep previous setting
break;
}
BK4819_WriteRegister(BK4819_REG_58, fskConfig);
BK4819_WriteRegister(BK4819_REG_5A, FSK_SYNC_BYTE0 << 8 | FSK_SYNC_BYTE1);
BK4819_WriteRegister(BK4819_REG_5B, FSK_SYNC_BYTE2 << 8 | FSK_SYNC_BYTE3);
BK4819_WriteRegister(BK4819_REG_5C, FSK_CRC_ON);
if (rx) {
BK4819_WriteRegister(BK4819_REG_5E, (64U << 3) | (1U << 0));
}
size_t size = sizeof(dataPacket);
if (rx) {
size = (((size + 1) / 2) * 2) + 2;
}
BK4819_WriteRegister(BK4819_REG_5D, (size << 8));
BK4819_FskClearFifo();
uint16_t fskParams = FSK_SYNC_LEN_BIT | ((rx ? 0U : 15U) << 4);
if (gCurrentVfo->SCRAMBLING_TYPE > 0) {
fskParams |= FSK_SCRAMBLE_ENABLE;
}
BK4819_WriteRegister(BK4819_REG_59, fskParams);
BK4819_WriteRegister(BK4819_REG_02, 0);
}
void MSG_EnableRX(const bool enable) {
if (enable) {
MSG_ConfigureFSK(true);
//if(gEeprom.MESSENGER_CONFIG.data.receive)
BK4819_FskEnableRx();
} else {
BK4819_WriteRegister(BK4819_REG_70, 0);
BK4819_WriteRegister(BK4819_REG_58, 0);
}
}
void MSG_FSKSendData() {
// turn off CTCSS/CDCSS during FFSK
const uint16_t css_val = BK4819_ReadRegister(BK4819_REG_51);
BK4819_WriteRegister(BK4819_REG_51, 0);
// set the FM deviation level
const uint16_t dev_val = BK4819_ReadRegister(BK4819_REG_40);
{
uint16_t deviation;
switch (gEeprom.VfoInfo[gEeprom.TX_VFO].CHANNEL_BANDWIDTH) {
case BK4819_FILTER_BW_WIDE:
deviation = 1300;
break; // 20k // measurements by kamilsss655
case BK4819_FILTER_BW_NARROW:
deviation = 1200;
break; // 10k
// case BK4819_FILTER_BW_NARROWAVIATION: deviation = 850; break; // 5k
// case BK4819_FILTER_BW_NARROWER: deviation = 850; break; // 5k
// case BK4819_FILTER_BW_NARROWEST: deviation = 850; break; // 5k
default:
deviation = 850;
break; // 5k
}
//BK4819_WriteRegister(0x40, (3u << 12) | (deviation & 0xfff));
BK4819_WriteRegister(BK4819_REG_40, (dev_val & 0xf000) | (deviation & 0xfff));
}
// REG_2B 0
//
// <15> 1 Enable CTCSS/CDCSS DC cancellation after FM Demodulation 1 = enable 0 = disable
// <14> 1 Enable AF DC cancellation after FM Demodulation 1 = enable 0 = disable
// <10> 0 AF RX HPF 300Hz filter 0 = enable 1 = disable
// <9> 0 AF RX LPF 3kHz filter 0 = enable 1 = disable
// <8> 0 AF RX de-emphasis filter 0 = enable 1 = disable
// <2> 0 AF TX HPF 300Hz filter 0 = enable 1 = disable
// <1> 0 AF TX LPF filter 0 = enable 1 = disable
// <0> 0 AF TX pre-emphasis filter 0 = enable 1 = disable
//
// disable the 300Hz HPF and FM pre-emphasis filter
//
const uint16_t filt_val = BK4819_ReadRegister(BK4819_REG_2B);
BK4819_WriteRegister(BK4819_REG_2B, (1u << 2) | (1u << 0));
MSG_ConfigureFSK(false);
SYSTEM_DelayMs(100);
{ // load the entire packet data into the TX FIFO buffer
uint16_t *ptr = (uint16_t *) &dataPacket;
size_t wordCount = sizeof(dataPacket) / sizeof(uint16_t);
for (size_t i = 0; i < wordCount; i++) {
BK4819_WriteRegister(BK4819_REG_5F, ptr[i]);
}
}
// enable FSK TX
BK4819_FskEnableTx();
{
// allow up to 310ms for the TX to complete
// if it takes any longer then somethings gone wrong, we shut the TX down
unsigned int timeout = 1000 / 5;
while (timeout-- > 0) {
SYSTEM_DelayMs(5);
if (BK4819_ReadRegister(BK4819_REG_0C) & (1u << 0)) { // we have interrupt flags
BK4819_WriteRegister(BK4819_REG_02, 0);
if (BK4819_ReadRegister(BK4819_REG_02) & BK4819_REG_02_FSK_TX_FINISHED)
timeout = 0; // TX is complete
}
}
}
//BK4819_WriteRegister(BK4819_REG_02, 0);
SYSTEM_DelayMs(100);
// disable TX
MSG_ConfigureFSK(true);
// restore FM deviation level
BK4819_WriteRegister(BK4819_REG_40, dev_val);
// restore TX/RX filtering
BK4819_WriteRegister(BK4819_REG_2B, filt_val);
// restore the CTCSS/CDCSS setting
BK4819_WriteRegister(BK4819_REG_51, css_val);
SYSTEM_DelayMs(50);
APP_EndTransmission();
FUNCTION_Select(FUNCTION_FOREGROUND);
gUpdateStatus = true;
gUpdateDisplay = true;
gFlagEndTransmission = false;
}
void prepareDataPacket() {
dataPacket.src = gEeprom.FSKSRCAddress;
dataPacket.seq = seq++;
}

106
app/fskmodem.h Normal file
View File

@@ -0,0 +1,106 @@
//
// Created by bruno on 25.2.2025.
//
#ifndef UV_K5_FIRMWARE_CUSTOM_FSKMODEM_H
#define UV_K5_FIRMWARE_CUSTOM_FSKMODEM_H
#include <stdint.h>
#include <stdbool.h>
#include "../driver/bk4819.h"
#include "../driver/bk4819-regs.h"
#include "../settings.h"
#include "stddef.h"
#include "../driver/system.h"
#include "../misc.h"
#include "../app/app.h"
// REG_70 bit definitions
#define TONE1_ENABLE_BIT (1U << 15)
#define TONE1_GAIN_MASK (0x7FU << 8)
#define TONE2_ENABLE_BIT (1U << 7)
#define TONE2_GAIN_MASK (0x7FU << 0)
// REG_58 bit definitions
// FSK Tx Mode Selection (REG_58<15:13>)
#define FSK_TX_MODE_FSK_1_2K_2_4K (0U << 13) // 000
#define FSK_TX_MODE_FFSK_1200_1800 (1U << 13) // 001
#define FSK_TX_MODE_FFSK_1200_2400 (3U << 13) // 011
#define FSK_TX_MODE_NOAA_SAME (5U << 13) // 101
// FSK Rx Mode Selection (REG_58<12:10>)
#define FSK_RX_MODE_FSK_1_2K_2_4K_NOAA (0U << 10) // 000
#define FSK_RX_MODE_FFSK_1200_1800 (7U << 10) // 111
#define FSK_RX_MODE_FFSK_1200_2400 (4U << 10) // 100
// FSK Rx Gain (REG_58<9:8>)
#define FSK_RX_GAIN_DEFAULT (0U << 8) // 00
#define FSK_RX_GAIN_TYPE_C (1U << 8) // 01
#define FSK_RX_GAIN_TYPE_B (2U << 8) // 10
#define FSK_UNKNOWN_MASK (3U << 6)
// FSK Preamble Type Selection (REG_58<5:4>)
#define FSK_PREAMBLE_TYPE_AA (3U << 4) // 11
#define FSK_PREAMBLE_TYPE_55 (2U << 4) // 10
#define FSK_PREAMBLE_TYPE_UNKNOWN (0U << 4) // 00
// FSK Rx Bandwidth Setting (REG_58<3:1>)
#define FSK_RX_BW_2_4K_FFSK_1200_2400 (4U << 1) // 100
#define FSK_RX_BW_1_2K (0U << 1) // 000
#define FSK_RX_BW_FFSK_1200_1800 (1U << 1) // 001
#define FSK_RX_BW_NOAA_SAME (2U << 1) // 010
#define FSK_ENABLE_BIT (1U << 0)
// REG_59 bit definitions
#define FSK_CLEAR_TX_FIFO (1U << 15)
#define FSK_CLEAR_RX_FIFO (1U << 14)
#define FSK_SCRAMBLE_ENABLE (1U << 13)
#define FSK_RX_ENABLE (1U << 12)
#define FSK_TX_ENABLE (1U << 11)
#define FSK_INVERT_RX (1U << 10)
#define FSK_INVERT_TX (1U << 9)
#define FSK_PREAMBLE_LEN_MASK (15U << 4)
#define FSK_SYNC_LEN_BIT (1U << 3)
//#define FSK_SYNC_BYTE0 0x30
//#define FSK_SYNC_BYTE1 0x72
//#define FSK_SYNC_BYTE2 0x57
//#define FSK_SYNC_BYTE3 0x6c
#define FSK_SYNC_BYTE0 0x42
#define FSK_SYNC_BYTE1 0x52
#define FSK_SYNC_BYTE2 0x4E
#define FSK_SYNC_BYTE3 0x51
#define FSK_CRC_ON (1U << 6)
#define FSK_CRC_OFF (0U << 6)
#define DataPacketDataSize (36)
typedef struct {
uint32_t dest;
uint32_t src;
uint8_t seq;
uint8_t flags;
uint8_t data[DataPacketDataSize];
} DataPacket;
void prepareDataPacket();
void MSG_FSKSendData();
void MSG_EnableRX(bool enable);
extern DataPacket dataPacket;
extern DataPacket inBoundPacket;
typedef enum {
SMS_NOT_ENTERING,
SMS_ENTERING_DEST,
SMS_ENTERING_MESSAGE
} SMSEnteringState;
extern SMSEnteringState gEnteringSMS;
extern uint8_t *dataPTR;
#endif //UV_K5_FIRMWARE_CUSTOM_FSKMODEM_H

View File

@@ -20,15 +20,21 @@
#include "app/app.h" #include "app/app.h"
#include "app/chFrScanner.h" #include "app/chFrScanner.h"
#include "app/common.h" #include "app/common.h"
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
#include "app/fm.h" #include "app/fm.h"
#endif #endif
#include "app/generic.h" #include "app/generic.h"
#include "app/main.h" #include "app/main.h"
#include "app/scanner.h" #include "app/scanner.h"
#ifdef ENABLE_SPECTRUM #ifdef ENABLE_SPECTRUM
#include "app/spectrum.h" #include "app/spectrum.h"
#endif #endif
#include "audio.h" #include "audio.h"
@@ -43,8 +49,22 @@
#include "ui/ui.h" #include "ui/ui.h"
#include <stdlib.h> #include <stdlib.h>
static void toggle_chan_scanlist(void) #define T9Count 9
{ // toggle the selected channels scanlist setting
const char T9Table[10][T9Count] = {
{'#', '(', ')', ';', ':', '<', '>', '/', '0'},
{',', '.', '?', '&', '!', ' ', '-', '_', '1'},
{'a', 'b', 'c', 'A', 'B', 'C', '[', ']', '2'},
{'d', 'e', 'f', 'D', 'E', 'F', '@', '%', '3'},
{'g', 'h', 'i', 'G', 'H', 'I', '~', '$', '4'},
{'j', 'k', 'l', 'J', 'K', 'L', '|', '*', '5'},
{'m', 'n', 'o', 'M', 'N', 'O', '{', '}', '6'},
{'p', 'q', 'r', 's', 'P', 'Q', 'R', 'S', '7'},
{'t', 'u', 'v', 'T', 'U', 'V', '"', '\'', '8'},
{'w', 'x', 'y', 'z', 'W', 'X', 'Y', 'Z', '9'}
};
static void toggle_chan_scanlist(void) { // toggle the selected channels scanlist setting
if (SCANNER_IsScanning()) if (SCANNER_IsScanning())
return; return;
@@ -60,13 +80,13 @@ static void toggle_chan_scanlist(void)
} }
// Remove exclude // Remove exclude
if(gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] == true) if (gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] == true) {
{
gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] = false; gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] = false;
return; return;
} }
uint8_t scanTmp = gTxVfo->SCANLIST1_PARTICIPATION | (gTxVfo->SCANLIST2_PARTICIPATION << 1) | (gTxVfo->SCANLIST3_PARTICIPATION << 2); uint8_t scanTmp = gTxVfo->SCANLIST1_PARTICIPATION | (gTxVfo->SCANLIST2_PARTICIPATION << 1) |
(gTxVfo->SCANLIST3_PARTICIPATION << 2);
scanTmp = (scanTmp++ < 7) ? scanTmp : 0; scanTmp = (scanTmp++ < 7) ? scanTmp : 0;
@@ -80,8 +100,7 @@ static void toggle_chan_scanlist(void)
gFlagResetVfos = true; gFlagResetVfos = true;
} }
static void processFKeyFunction(const KEY_Code_t Key, const bool beep) static void processFKeyFunction(const KEY_Code_t Key, const bool beep) {
{
uint8_t Vfo = gEeprom.TX_VFO; uint8_t Vfo = gEeprom.TX_VFO;
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
@@ -126,16 +145,14 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
if (gScanStateDir != SCAN_OFF) { if (gScanStateDir != SCAN_OFF) {
if (gCurrentFunction != FUNCTION_INCOMING || if (gCurrentFunction != FUNCTION_INCOMING ||
gRxReceptionMode == RX_MODE_NONE || gRxReceptionMode == RX_MODE_NONE ||
gScanPauseDelayIn_10ms == 0) gScanPauseDelayIn_10ms == 0) { // scan is running (not paused)
{ // scan is running (not paused)
return; return;
} }
} }
const uint8_t vfo = gEeprom.TX_VFO; const uint8_t vfo = gEeprom.TX_VFO;
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo])) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo])) { // copy channel to VFO, then swap to the VFO
{ // copy channel to VFO, then swap to the VFO
gEeprom.ScreenChannel[vfo] = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band; gEeprom.ScreenChannel[vfo] = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band;
gEeprom.VfoInfo[vfo].CHANNEL_SAVE = gEeprom.ScreenChannel[vfo]; gEeprom.VfoInfo[vfo].CHANNEL_SAVE = gEeprom.ScreenChannel[vfo];
@@ -163,7 +180,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
#endif #endif
gTxVfo->Band += 1; gTxVfo->Band += 1;
if (gTxVfo->Band == BAND5_350MHz && !gSetting_350EN) { if (gTxVfo->Band == BAND5_350MHz) {
// skip if not enabled // skip if not enabled
gTxVfo->Band += 1; gTxVfo->Band += 1;
} else if (gTxVfo->Band >= BAND_N_ELEM) { } else if (gTxVfo->Band >= BAND_N_ELEM) {
@@ -234,8 +251,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
APP_RunSpectrum(); APP_RunSpectrum();
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
#endif #endif
} } else {
else {
toggle_chan_scanlist(); toggle_chan_scanlist();
} }
@@ -290,12 +306,10 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
case KEY_SIDE1: case KEY_SIDE1:
uint8_t a = FREQUENCY_GetSortedIdxFromStepIdx(gTxVfo->STEP_SETTING); uint8_t a = FREQUENCY_GetSortedIdxFromStepIdx(gTxVfo->STEP_SETTING);
if (a < STEP_N_ELEM - 1) if (a < STEP_N_ELEM - 1) {
{
gTxVfo->STEP_SETTING = FREQUENCY_GetStepIdxFromSortedIdx(a + 1); gTxVfo->STEP_SETTING = FREQUENCY_GetStepIdxFromSortedIdx(a + 1);
} }
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
{
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
} }
gVfoConfigureMode = VFO_CONFIGURE; gVfoConfigureMode = VFO_CONFIGURE;
@@ -303,12 +317,10 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
break; break;
case KEY_SIDE2: case KEY_SIDE2:
uint8_t b = FREQUENCY_GetSortedIdxFromStepIdx(gTxVfo->STEP_SETTING); uint8_t b = FREQUENCY_GetSortedIdxFromStepIdx(gTxVfo->STEP_SETTING);
if (b > 0) if (b > 0) {
{
gTxVfo->STEP_SETTING = FREQUENCY_GetStepIdxFromSortedIdx(b - 1); gTxVfo->STEP_SETTING = FREQUENCY_GetStepIdxFromSortedIdx(b - 1);
} }
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
{
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
} }
gVfoConfigureMode = VFO_CONFIGURE; gVfoConfigureMode = VFO_CONFIGURE;
@@ -326,8 +338,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
} }
} }
void channelMove(uint16_t Channel) void channelMove(uint16_t Channel) {
{
const uint8_t Vfo = gEeprom.TX_VFO; const uint8_t Vfo = gEeprom.TX_VFO;
if (!RADIO_CheckValidChannel(Channel, false, 0)) { if (!RADIO_CheckValidChannel(Channel, false, 0)) {
@@ -400,8 +411,7 @@ void channelMoveSwitch(void) {
} }
} }
static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
{
if (bKeyHeld) { // key held down if (bKeyHeld) { // key held down
if (bKeyPressed) { if (bKeyPressed) {
if (gScreenToDisplay == DISPLAY_MAIN) { if (gScreenToDisplay == DISPLAY_MAIN) {
@@ -419,8 +429,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
return; return;
} }
if (bKeyPressed) if (bKeyPressed) { // key is pressed
{ // key is pressed
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; // beep when key is pressed gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; // beep when key is pressed
return; // don't use the key till it's released return; // don't use the key till it's released
} }
@@ -463,8 +472,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
// #ifdef ENABLE_NOAA // #ifdef ENABLE_NOAA
// if (!IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE)) // if (!IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
// #endif // #endif
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // user is entering a frequency
{ // user is entering a frequency
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
@@ -479,7 +487,8 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
return; return;
} }
gKeyInputCountdown = (gInputBoxIndex == totalDigits) ? (key_input_timeout_500ms / 16) : (key_input_timeout_500ms / 3); gKeyInputCountdown = (gInputBoxIndex == totalDigits) ? (key_input_timeout_500ms / 16) : (
key_input_timeout_500ms / 3);
const char *inputStr = INPUTBOX_GetAscii(); const char *inputStr = INPUTBOX_GetAscii();
uint8_t inputLength = gInputBoxIndex; uint8_t inputLength = gInputBoxIndex;
@@ -500,12 +509,10 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
// clamp the frequency entered to some valid value // clamp the frequency entered to some valid value
if (Frequency < frequencyBandTable[0].lower) { if (Frequency < frequencyBandTable[0].lower) {
Frequency = frequencyBandTable[0].lower; Frequency = frequencyBandTable[0].lower;
} } else if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower) {
else if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower) {
const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2; const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
Frequency = (Frequency < center) ? BX4819_band1.upper : BX4819_band2.lower; Frequency = (Frequency < center) ? BX4819_band1.upper : BX4819_band2.lower;
} } else if (Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper) {
else if (Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper) {
Frequency = frequencyBandTable[BAND_N_ELEM - 1].upper; Frequency = frequencyBandTable[BAND_N_ELEM - 1].upper;
} }
@@ -523,8 +530,8 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
Frequency = FREQUENCY_RoundToStep(Frequency, gTxVfo->StepFrequency); Frequency = FREQUENCY_RoundToStep(Frequency, gTxVfo->StepFrequency);
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower) if (Frequency >= BX4819_band1.upper &&
{ // clamp the frequency to the limit Frequency < BX4819_band2.lower) { // clamp the frequency to the limit
const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2; const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
Frequency = (Frequency < center) ? BX4819_band1.upper - gTxVfo->StepFrequency : BX4819_band2.lower; Frequency = (Frequency < center) ? BX4819_band1.upper - gTxVfo->StepFrequency : BX4819_band2.lower;
} }
@@ -572,13 +579,10 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gWasFKeyPressed = false; gWasFKeyPressed = false;
gUpdateStatus = true; gUpdateStatus = true;
if(Key == 8) if (Key == 8) {
{
ACTION_BackLightOnDemand(); ACTION_BackLightOnDemand();
return; return;
} } else if (Key == 9) {
else if(Key == 9)
{
ACTION_BackLight(); ACTION_BackLight();
return; return;
} }
@@ -586,8 +590,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
processFKeyFunction(Key, true); processFKeyFunction(Key, true);
} }
static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) {
{
if (!bKeyHeld && bKeyPressed) { // exit key pressed if (!bKeyHeld && bKeyPressed) { // exit key pressed
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
@@ -615,8 +618,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
if (gInputBoxIndex == 0) if (gInputBoxIndex == 0)
gAnotherVoiceID = VOICE_ID_CANCEL; gAnotherVoiceID = VOICE_ID_CANCEL;
#endif #endif
} } else {
else {
gScanKeepResult = false; gScanKeepResult = false;
CHFRSCANNER_Stop(); CHFRSCANNER_Stop();
@@ -636,8 +638,8 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
} }
if (bKeyHeld && bKeyPressed) { // exit key held down if (bKeyHeld && bKeyPressed) { // exit key held down
if (gInputBoxIndex > 0 || gDTMF_InputBox_Index > 0 || gDTMF_InputMode) if (gInputBoxIndex > 0 || gDTMF_InputBox_Index > 0 ||
{ // cancel key input mode (channel/frequency entry) gDTMF_InputMode) { // cancel key input mode (channel/frequency entry)
gDTMF_InputMode = false; gDTMF_InputMode = false;
gDTMF_InputBox_Index = 0; gDTMF_InputBox_Index = 0;
memset(gDTMF_String, 0, sizeof(gDTMF_String)); memset(gDTMF_String, 0, sizeof(gDTMF_String));
@@ -648,8 +650,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
} }
} }
static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld) static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld) {
{
if (bKeyPressed && !bKeyHeld) // menu key pressed if (bKeyPressed && !bKeyHeld) // menu key pressed
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
@@ -658,10 +659,8 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
// Exclude work with list 1, 2, 3 or all list // Exclude work with list 1, 2, 3 or all list
if(gScanStateDir != SCAN_OFF) if (gScanStateDir != SCAN_OFF) {
{ if (FUNCTION_IsRx()) {
if(FUNCTION_IsRx())
{
gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] = true; gMR_ChannelExclude[gTxVfo->CHANNEL_SAVE] = true;
gVfoConfigureMode = VFO_CONFIGURE; gVfoConfigureMode = VFO_CONFIGURE;
@@ -717,15 +716,13 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
} }
#endif #endif
} } else {
else {
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
} }
} }
} }
static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) {
{
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(gEeprom.MENU_LOCK == true) { if(gEeprom.MENU_LOCK == true) {
@@ -780,8 +777,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
#ifdef ENABLE_SCAN_RANGES #ifdef ENABLE_SCAN_RANGES
&& gScanRangeStart == 0 && gScanRangeStart == 0
#endif #endif
) ) { // start entering a DTMF string
{ // start entering a DTMF string
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
memcpy(gDTMF_InputBox, gDTMF_String, MIN(sizeof(gDTMF_InputBox), sizeof(gDTMF_String) - 1)); memcpy(gDTMF_InputBox, gDTMF_String, MIN(sizeof(gDTMF_InputBox), sizeof(gDTMF_String) - 1));
gDTMF_InputBox_Index = 0; gDTMF_InputBox_Index = 0;
@@ -790,12 +786,9 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
gKeyInputCountdown = key_input_timeout_500ms; gKeyInputCountdown = key_input_timeout_500ms;
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
} } else
else
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
} } else { // with the F-key
else
{ // with the F-key
gWasFKeyPressed = false; gWasFKeyPressed = false;
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
@@ -816,13 +809,11 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
gUpdateStatus = true; gUpdateStatus = true;
} }
static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) {
{
#ifdef ENABLE_FEAT_F4HWN // Set Squelch F + UP or Down #ifdef ENABLE_FEAT_F4HWN // Set Squelch F + UP or Down
if (gWasFKeyPressed) { if (gWasFKeyPressed) {
switch(Direction) switch (Direction) {
{
case 1: case 1:
processFKeyFunction(KEY_UP, false); processFKeyFunction(KEY_UP, false);
break; break;
@@ -855,8 +846,7 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
#endif #endif
return; return;
} }
} } else { // short pressed
else { // short pressed
if (gInputBoxIndex > 0) { if (gInputBoxIndex > 0) {
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return; return;
@@ -920,8 +910,13 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
gPttWasReleased = true; gPttWasReleased = true;
} }
void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) void updatePrevChar(KEY_Code_t Key) {
{ if (Key != prevKey) {
prevKey = Key;
}
}
void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (gFmRadioMode && Key != KEY_PTT && Key != KEY_EXIT) { if (gFmRadioMode && Key != KEY_PTT && Key != KEY_EXIT) {
if (!bKeyHeld && bKeyPressed) if (!bKeyHeld && bKeyPressed)
@@ -932,8 +927,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (gDTMF_InputMode && bKeyPressed && !bKeyHeld) { if (gDTMF_InputMode && bKeyPressed && !bKeyHeld) {
const char Character = DTMF_GetCharacter(Key); const char Character = DTMF_GetCharacter(Key);
if (Character != 0xFF) if (Character != 0xFF) { // add key to DTMF string
{ // add key to DTMF string
DTMF_Append(Character); DTMF_Append(Character);
gKeyInputCountdown = key_input_timeout_500ms; gKeyInputCountdown = key_input_timeout_500ms;
gRequestDisplayScreen = DISPLAY_MAIN; gRequestDisplayScreen = DISPLAY_MAIN;
@@ -949,31 +943,142 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
// Key = KEY_SIDE2; // what's this doing ??? // Key = KEY_SIDE2; // what's this doing ???
// } // }
if (Key == KEY_9 && bKeyHeld) {
if (bKeyPressed) {
if (gEnteringSMS == SMS_NOT_ENTERING) {
gEnteringSMS = SMS_ENTERING_DEST;
updatePrevChar(Key);
return;
}
}
}
if (Key == KEY_MENU) {
if (gEnteringSMS == SMS_ENTERING_DEST) {
if (bKeyPressed) {
memset(dataPacket.data, 0, DataPacketDataSize);
prepareDataPacket();
dataPacket.flags = 126;
gEnteringSMS = SMS_ENTERING_MESSAGE;
}
return;
}
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
if (bKeyPressed) {
if (strlen((char *) dataPacket.data)) {
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
: gEeprom.TX_VFO;
if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
AUDIO_AudioPathOff();
gEnableSpeaker = false;
RADIO_PrepareTX();
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
else
BK4819_DisableScramble();
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
MSG_FSKSendData();
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
AUDIO_AudioPathOn();
gEnableSpeaker = true;
BK4819_ExitTxMute();
MSG_EnableRX(true);
gVfoConfigureMode = VFO_CONFIGURE;
dataPTR = dataPacket.data;
memset(dataPacket.data, 0, DataPacketDataSize);
}
gEnteringSMS = SMS_NOT_ENTERING;
}
}
return;
}
}
if (Key == KEY_EXIT && gEnteringSMS != SMS_NOT_ENTERING) {
if (bKeyHeld) {
if (bKeyPressed) {
gEnteringSMS = SMS_NOT_ENTERING;
dataPTR = dataPacket.data;
memset(dataPacket.data, 0, DataPacketDataSize);
}
} else {
if (bKeyPressed) {
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
if (dataPacket.data <= dataPTR) {
*dataPTR = '\0';
if (dataPacket.data < dataPTR) {
dataPTR--;
}
*dataPTR = '\0';
}
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
dataPacket.dest /= 10;
}
}
}
updatePrevChar(Key);
return;
}
if (gEnteringSMS != SMS_NOT_ENTERING && !bKeyHeld) {
if (!dataPTR) {
dataPTR = dataPacket.data;
}
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
if (bKeyPressed) {
if (prevKey != Key) {
dataPTR++;
if (dataPTR - dataPacket.data >= DataPacketDataSize) {
dataPTR = dataPacket.data;
}
prevLetter = 0;
}
*(dataPTR - 1) = T9Table[Key][(prevLetter++) % T9Count];
updatePrevChar(Key);
}
return;
} else if (gEnteringSMS == SMS_ENTERING_DEST) {
if (bKeyPressed) {
dataPacket.dest *= 10;
dataPacket.dest += Key;
prevLetter = 0;
}
return;
}
}
switch (Key) { switch (Key) {
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
case KEY_SIDE1: case KEY_SIDE1:
case KEY_SIDE2: case KEY_SIDE2:
#endif #endif
case KEY_0...KEY_9: case
MAIN_Key_DIGITS(Key, bKeyPressed, bKeyHeld); KEY_0...KEY_9
:
MAIN_Key_DIGITS(Key, bKeyPressed, bKeyHeld
);
break; break;
case KEY_MENU: case KEY_MENU:
MAIN_Key_MENU(bKeyPressed, bKeyHeld); MAIN_Key_MENU(bKeyPressed, bKeyHeld
);
break; break;
case KEY_UP: case KEY_UP:
MAIN_Key_UP_DOWN(bKeyPressed, bKeyHeld, 1); MAIN_Key_UP_DOWN(bKeyPressed, bKeyHeld,
1);
break; break;
case KEY_DOWN: case KEY_DOWN:
MAIN_Key_UP_DOWN(bKeyPressed, bKeyHeld, -1); MAIN_Key_UP_DOWN(bKeyPressed, bKeyHeld,
-1);
break; break;
case KEY_EXIT: case KEY_EXIT:
MAIN_Key_EXIT(bKeyPressed, bKeyHeld); MAIN_Key_EXIT(bKeyPressed, bKeyHeld
);
break; break;
case KEY_STAR: case KEY_STAR:
MAIN_Key_STAR(bKeyPressed, bKeyHeld); MAIN_Key_STAR(bKeyPressed, bKeyHeld
);
break; break;
case KEY_F: case KEY_F:
GENERIC_Key_F(bKeyPressed, bKeyHeld); GENERIC_Key_F(bKeyPressed, bKeyHeld
);
break; break;
case KEY_PTT: case KEY_PTT:
GENERIC_Key_PTT(bKeyPressed); GENERIC_Key_PTT(bKeyPressed);

View File

@@ -17,8 +17,11 @@
#include <string.h> #include <string.h>
#if !defined(ENABLE_OVERLAY) #if !defined(ENABLE_OVERLAY)
#include "ARMCM0.h" #include "ARMCM0.h"
#endif #endif
#include "app/dtmf.h" #include "app/dtmf.h"
#include "app/generic.h" #include "app/generic.h"
#include "app/menu.h" #include "app/menu.h"
@@ -35,9 +38,11 @@
#include "helper/battery.h" #include "helper/battery.h"
#include "misc.h" #include "misc.h"
#include "settings.h" #include "settings.h"
#if defined(ENABLE_OVERLAY) #if defined(ENABLE_OVERLAY)
#include "sram-overlay.h" #include "sram-overlay.h"
#endif #endif
#include "ui/inputbox.h" #include "ui/inputbox.h"
#include "ui/menu.h" #include "ui/menu.h"
#include "ui/ui.h" #include "ui/ui.h"
@@ -76,8 +81,7 @@ uint8_t gUnlockAllTxConfCnt;
} }
#endif #endif
void MENU_StartCssScan(void) void MENU_StartCssScan(void) {
{
SCANNER_Start(true); SCANNER_Start(true);
gUpdateStatus = true; gUpdateStatus = true;
gCssBackgroundScan = true; gCssBackgroundScan = true;
@@ -85,12 +89,10 @@ void MENU_StartCssScan(void)
gRequestDisplayScreen = DISPLAY_MENU; gRequestDisplayScreen = DISPLAY_MENU;
} }
void MENU_CssScanFound(void) void MENU_CssScanFound(void) {
{
if (gScanCssResultType == CODE_TYPE_DIGITAL || gScanCssResultType == CODE_TYPE_REVERSE_DIGITAL) { if (gScanCssResultType == CODE_TYPE_DIGITAL || gScanCssResultType == CODE_TYPE_REVERSE_DIGITAL) {
gMenuCursor = UI_MENU_GetMenuIdx(MENU_R_DCS); gMenuCursor = UI_MENU_GetMenuIdx(MENU_R_DCS);
} } else if (gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) {
else if(gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) {
gMenuCursor = UI_MENU_GetMenuIdx(MENU_R_CTCS); gMenuCursor = UI_MENU_GetMenuIdx(MENU_R_CTCS);
} }
@@ -100,8 +102,7 @@ void MENU_CssScanFound(void)
gUpdateDisplay = true; gUpdateDisplay = true;
} }
void MENU_StopCssScan(void) void MENU_StopCssScan(void) {
{
gCssBackgroundScan = false; gCssBackgroundScan = false;
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@@ -111,12 +112,10 @@ void MENU_StopCssScan(void)
gUpdateStatus = true; gUpdateStatus = true;
} }
int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
{
*pMin = 0; *pMin = 0;
switch (menu_id) switch (menu_id) {
{
case MENU_SQL: case MENU_SQL:
//*pMin = 0; //*pMin = 0;
*pMax = 9; *pMax = 9;
@@ -184,9 +183,9 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMax = ARRAY_SIZE(gSubMenu_ROGER) - 1; *pMax = ARRAY_SIZE(gSubMenu_ROGER) - 1;
break; break;
case MENU_PONMSG: case MENU_FSKMOD:
//*pMin = 0; //*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_PONMSG) - 1; *pMax = ARRAY_SIZE(gSubMenu_FSKMod) - 1;
break; break;
case MENU_R_DCS: case MENU_R_DCS:
@@ -247,15 +246,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
case MENU_NOAA_S: case MENU_NOAA_S:
#endif #endif
#ifndef ENABLE_FEAT_F4HWN
case MENU_350TX:
case MENU_200TX:
case MENU_500TX:
#endif
case MENU_350EN:
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN:
#endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
case MENU_SET_TMR: case MENU_SET_TMR:
#endif #endif
@@ -267,17 +257,20 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMax = ARRAY_SIZE(gModulationStr) - 1; *pMax = ARRAY_SIZE(gModulationStr) - 1;
break; break;
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCR: case MENU_SCR:
//*pMin = 0; //*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SCRAMBLER) - 1; *pMax = 10;
break; break;
#endif
case MENU_AUTOLK: case MENU_AUTOLK:
*pMax = 40; *pMax = 40;
break; break;
case MENU_FSKSRC:
*pMax = INT32_MAX;
*pMin = 0;
break;
case MENU_TOT: case MENU_TOT:
//*pMin = 0; //*pMin = 0;
*pMin = 5; *pMin = 5;
@@ -388,9 +381,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
case MENU_SET_PWR:
*pMax = ARRAY_SIZE(gSubMenu_SET_PWR) - 1;
break;
case MENU_SET_PTT: case MENU_SET_PTT:
//*pMin = 0; //*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1; *pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1;
@@ -406,22 +396,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMax = 15; *pMax = 15;
break; break;
#endif #endif
case MENU_TX_LOCK:
#ifdef ENABLE_FEAT_F4HWN_INV #ifdef ENABLE_FEAT_F4HWN_INV
case MENU_SET_INV: case MENU_SET_INV:
//*pMin = 0; //*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1; *pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
break; break;
#endif #endif
case MENU_SET_LCK:
//*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_LCK) - 1;
break;
case MENU_SET_MET:
case MENU_SET_GUI:
//*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SET_MET) - 1;
break;
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
case MENU_SET_NFM: case MENU_SET_NFM:
//*pMin = 0; //*pMin = 0;
@@ -449,21 +429,17 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
return 0; return 0;
} }
void MENU_AcceptSetting(void) void MENU_AcceptSetting(void) {
{
int32_t Min; int32_t Min;
int32_t Max; int32_t Max;
FREQ_Config_t *pConfig = &gTxVfo->freq_config_RX; FREQ_Config_t *pConfig = &gTxVfo->freq_config_RX;
if (!MENU_GetLimits(UI_MENU_GetCurrentMenuId(), &Min, &Max)) if (!MENU_GetLimits(UI_MENU_GetCurrentMenuId(), &Min, &Max)) {
{
if (gSubMenuSelection < Min) gSubMenuSelection = Min; if (gSubMenuSelection < Min) gSubMenuSelection = Min;
else else if (gSubMenuSelection > Max) gSubMenuSelection = Max;
if (gSubMenuSelection > Max) gSubMenuSelection = Max;
} }
switch (UI_MENU_GetCurrentMenuId()) switch (UI_MENU_GetCurrentMenuId()) {
{
default: default:
return; return;
@@ -474,8 +450,7 @@ void MENU_AcceptSetting(void)
case MENU_STEP: case MENU_STEP:
gTxVfo->STEP_SETTING = FREQUENCY_GetStepIdxFromSortedIdx(gSubMenuSelection); gTxVfo->STEP_SETTING = FREQUENCY_GetStepIdxFromSortedIdx(gSubMenuSelection);
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
{
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
} }
return; return;
@@ -497,12 +472,10 @@ void MENU_AcceptSetting(void)
} }
pConfig->Code = 0; pConfig->Code = 0;
pConfig->CodeType = CODE_TYPE_OFF; pConfig->CodeType = CODE_TYPE_OFF;
} } else if (gSubMenuSelection < 105) {
else if (gSubMenuSelection < 105) {
pConfig->CodeType = CODE_TYPE_DIGITAL; pConfig->CodeType = CODE_TYPE_DIGITAL;
pConfig->Code = gSubMenuSelection - 1; pConfig->Code = gSubMenuSelection - 1;
} } else {
else {
pConfig->CodeType = CODE_TYPE_REVERSE_DIGITAL; pConfig->CodeType = CODE_TYPE_REVERSE_DIGITAL;
pConfig->Code = gSubMenuSelection - 105; pConfig->Code = gSubMenuSelection - 105;
} }
@@ -520,8 +493,7 @@ void MENU_AcceptSetting(void)
} }
pConfig->Code = 0; pConfig->Code = 0;
pConfig->CodeType = CODE_TYPE_OFF; pConfig->CodeType = CODE_TYPE_OFF;
} } else {
else {
pConfig->Code = gSubMenuSelection - 1; pConfig->Code = gSubMenuSelection - 1;
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE; pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
} }
@@ -544,18 +516,14 @@ void MENU_AcceptSetting(void)
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
return; return;
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCR: case MENU_SCR:
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection; gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
#if 0 if (gSubMenuSelection > 0)
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
BK4819_EnableScramble(gSubMenuSelection - 1); BK4819_EnableScramble(gSubMenuSelection - 1);
else else
BK4819_DisableScramble(); BK4819_DisableScramble();
#endif
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
return; return;
#endif
case MENU_BCL: case MENU_BCL:
gTxVfo->BUSY_CHANNEL_LOCK = gSubMenuSelection; gTxVfo->BUSY_CHANNEL_LOCK = gSubMenuSelection;
@@ -772,8 +740,7 @@ void MENU_AcceptSetting(void)
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
case MENU_D_LIST: case MENU_D_LIST:
gDTMF_chosen_contact = gSubMenuSelection - 1; gDTMF_chosen_contact = gSubMenuSelection - 1;
if (gIsDtmfContactValid) if (gIsDtmfContactValid) {
{
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
gDTMF_InputMode = true; gDTMF_InputMode = true;
gDTMF_InputBox_Index = 3; gDTMF_InputBox_Index = 3;
@@ -782,8 +749,12 @@ void MENU_AcceptSetting(void)
} }
return; return;
#endif #endif
case MENU_PONMSG: case MENU_FSKMOD:
gEeprom.POWER_ON_DISPLAY_MODE = gSubMenuSelection; gEeprom.FSKMode = gSubMenuSelection;
break;
case MENU_FSKSRC:
gEeprom.FSKSRCAddress = gSubMenuSelection;
break; break;
case MENU_ROGER: case MENU_ROGER:
@@ -822,54 +793,14 @@ void MENU_AcceptSetting(void)
SETTINGS_FactoryReset(gSubMenuSelection); SETTINGS_FactoryReset(gSubMenuSelection);
return; return;
#ifndef ENABLE_FEAT_F4HWN
case MENU_350TX:
gSetting_350TX = gSubMenuSelection;
break;
#endif
case MENU_F_LOCK: { case MENU_F_LOCK: {
if(gSubMenuSelection == F_LOCK_NONE) { // select 10 times to enable
gUnlockAllTxConfCnt++;
#ifdef ENABLE_FEAT_F4HWN
if(gUnlockAllTxConfCnt < 3)
#else
if(gUnlockAllTxConfCnt < 10)
#endif
return;
}
else
gUnlockAllTxConfCnt = 0;
gSetting_F_LOCK = gSubMenuSelection; gSetting_F_LOCK = gSubMenuSelection;
#ifdef ENABLE_FEAT_F4HWN
if(gSetting_F_LOCK == F_LOCK_ALL) { if(gSetting_F_LOCK == F_LOCK_ALL) {
SETTINGS_ResetTxLock(); SETTINGS_ResetTxLock();
} }
#endif
break; break;
} }
#ifndef ENABLE_FEAT_F4HWN
case MENU_200TX:
gSetting_200TX = gSubMenuSelection;
break;
case MENU_500TX:
gSetting_500TX = gSubMenuSelection;
break;
#endif
case MENU_350EN:
gSetting_350EN = gSubMenuSelection;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
gFlagResetVfos = true;
break;
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN:
gSetting_ScrambleEnable = gSubMenuSelection;
gFlagReconfigureVfos = true;
break;
#endif
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI: case MENU_F_CALI:
@@ -877,8 +808,7 @@ void MENU_AcceptSetting(void)
return; return;
#endif #endif
case MENU_BATCAL: case MENU_BATCAL: { // voltages are averages between discharge curves of 1600 and 2200 mAh
{ // voltages are averages between discharge curves of 1600 and 2200 mAh
// gBatteryCalibration[0] = (520ul * gSubMenuSelection) / 760; // 5.20V empty, blinking above this value, reduced functionality below // gBatteryCalibration[0] = (520ul * gSubMenuSelection) / 760; // 5.20V empty, blinking above this value, reduced functionality below
// gBatteryCalibration[1] = (689ul * gSubMenuSelection) / 760; // 6.89V, ~5%, 1 bars above this value // gBatteryCalibration[1] = (689ul * gSubMenuSelection) / 760; // 6.89V, ~5%, 1 bars above this value
// gBatteryCalibration[2] = (724ul * gSubMenuSelection) / 760; // 7.24V, ~17%, 2 bars above this value // gBatteryCalibration[2] = (724ul * gSubMenuSelection) / 760; // 7.24V, ~17%, 2 bars above this value
@@ -897,8 +827,7 @@ void MENU_AcceptSetting(void)
case MENU_F1LONG: case MENU_F1LONG:
case MENU_F2SHRT: case MENU_F2SHRT:
case MENU_F2LONG: case MENU_F2LONG:
case MENU_MLONG: case MENU_MLONG: {
{
uint8_t *fun[] = { uint8_t *fun[] = {
&gEeprom.KEY_1_SHORT_PRESS_ACTION, &gEeprom.KEY_1_SHORT_PRESS_ACTION,
&gEeprom.KEY_1_LONG_PRESS_ACTION, &gEeprom.KEY_1_LONG_PRESS_ACTION,
@@ -916,10 +845,6 @@ void MENU_AcceptSetting(void)
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
case MENU_SET_PWR:
gSetting_set_pwr = gSubMenuSelection;
gRequestSaveChannel = 1;
break;
case MENU_SET_PTT: case MENU_SET_PTT:
gSetting_set_ptt = gSubMenuSelection; gSetting_set_ptt = gSubMenuSelection;
gSetting_set_ptt_session = gSetting_set_ptt; // Special for action gSetting_set_ptt_session = gSetting_set_ptt; // Special for action
@@ -941,12 +866,6 @@ void MENU_AcceptSetting(void)
case MENU_SET_LCK: case MENU_SET_LCK:
gSetting_set_lck = gSubMenuSelection; gSetting_set_lck = gSubMenuSelection;
break; break;
case MENU_SET_MET:
gSetting_set_met = gSubMenuSelection;
break;
case MENU_SET_GUI:
gSetting_set_gui = gSubMenuSelection;
break;
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
case MENU_SET_NFM: case MENU_SET_NFM:
gSetting_set_nfm = gSubMenuSelection; gSetting_set_nfm = gSubMenuSelection;
@@ -967,35 +886,26 @@ void MENU_AcceptSetting(void)
case MENU_SET_TMR: case MENU_SET_TMR:
gSetting_set_tmr = gSubMenuSelection; gSetting_set_tmr = gSubMenuSelection;
break; break;
case MENU_TX_LOCK:
gTxVfo->TX_LOCK = gSubMenuSelection;
gRequestSaveChannel = 1;
return;
#endif #endif
} }
gRequestSaveSettings = true; gRequestSaveSettings = true;
} }
static void MENU_ClampSelection(int8_t Direction) static void MENU_ClampSelection(int8_t Direction) {
{
int32_t Min; int32_t Min;
int32_t Max; int32_t Max;
if (!MENU_GetLimits(UI_MENU_GetCurrentMenuId(), &Min, &Max)) if (!MENU_GetLimits(UI_MENU_GetCurrentMenuId(), &Min, &Max)) {
{
int32_t Selection = gSubMenuSelection; int32_t Selection = gSubMenuSelection;
if (Selection < Min) Selection = Min; if (Selection < Min) Selection = Min;
else else if (Selection > Max) Selection = Max;
if (Selection > Max) Selection = Max;
gSubMenuSelection = NUMBER_AddWithWraparound(Selection, Direction, Min, Max); gSubMenuSelection = NUMBER_AddWithWraparound(Selection, Direction, Min, Max);
} }
} }
void MENU_ShowCurrentSetting(void) void MENU_ShowCurrentSetting(void) {
{ switch (UI_MENU_GetCurrentMenuId()) {
switch (UI_MENU_GetCurrentMenuId())
{
case MENU_SQL: case MENU_SQL:
gSubMenuSelection = gEeprom.SQUELCH_LEVEL; gSubMenuSelection = gEeprom.SQUELCH_LEVEL;
break; break;
@@ -1013,8 +923,7 @@ void MENU_ShowCurrentSetting(void)
break; break;
case MENU_R_DCS: case MENU_R_DCS:
case MENU_R_CTCS: case MENU_R_CTCS: {
{
DCS_CodeType_t type = gTxVfo->freq_config_RX.CodeType; DCS_CodeType_t type = gTxVfo->freq_config_RX.CodeType;
uint8_t code = gTxVfo->freq_config_RX.Code; uint8_t code = gTxVfo->freq_config_RX.Code;
int menuid = UI_MENU_GetCurrentMenuId(); int menuid = UI_MENU_GetCurrentMenuId();
@@ -1045,8 +954,7 @@ void MENU_ShowCurrentSetting(void)
} }
case MENU_T_DCS: case MENU_T_DCS:
switch (gTxVfo->freq_config_TX.CodeType) switch (gTxVfo->freq_config_TX.CodeType) {
{
case CODE_TYPE_DIGITAL: case CODE_TYPE_DIGITAL:
gSubMenuSelection = gTxVfo->freq_config_TX.Code + 1; gSubMenuSelection = gTxVfo->freq_config_TX.Code + 1;
break; break;
@@ -1060,7 +968,8 @@ void MENU_ShowCurrentSetting(void)
break; break;
case MENU_T_CTCS: case MENU_T_CTCS:
gSubMenuSelection = (gTxVfo->freq_config_TX.CodeType == CODE_TYPE_CONTINUOUS_TONE) ? gTxVfo->freq_config_TX.Code + 1 : 0; gSubMenuSelection = (gTxVfo->freq_config_TX.CodeType == CODE_TYPE_CONTINUOUS_TONE) ?
gTxVfo->freq_config_TX.Code + 1 : 0;
break; break;
case MENU_SFT_D: case MENU_SFT_D:
@@ -1075,11 +984,9 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gTxVfo->CHANNEL_BANDWIDTH; gSubMenuSelection = gTxVfo->CHANNEL_BANDWIDTH;
break; break;
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCR: case MENU_SCR:
gSubMenuSelection = gTxVfo->SCRAMBLING_TYPE; gSubMenuSelection = gTxVfo->SCRAMBLING_TYPE;
break; break;
#endif
case MENU_BCL: case MENU_BCL:
gSubMenuSelection = gTxVfo->BUSY_CHANNEL_LOCK; gSubMenuSelection = gTxVfo->BUSY_CHANNEL_LOCK;
@@ -1109,12 +1016,9 @@ void MENU_ShowCurrentSetting(void)
case MENU_ABR: case MENU_ABR:
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
if(gBackLight) if (gBackLight) {
{
gSubMenuSelection = gBacklightTimeOriginal; gSubMenuSelection = gBacklightTimeOriginal;
} } else {
else
{
gSubMenuSelection = gEeprom.BACKLIGHT_TIME; gSubMenuSelection = gEeprom.BACKLIGHT_TIME;
} }
#else #else
@@ -1135,7 +1039,8 @@ void MENU_ShowCurrentSetting(void)
break; break;
case MENU_TDR: case MENU_TDR:
gSubMenuSelection = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2; gSubMenuSelection =
(gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
break; break;
case MENU_BEEP: case MENU_BEEP:
@@ -1207,15 +1112,9 @@ void MENU_ShowCurrentSetting(void)
break; break;
case MENU_SLIST1: case MENU_SLIST1:
gSubMenuSelection = RADIO_FindNextChannel(0, 1, true, 1);
break;
case MENU_SLIST2: case MENU_SLIST2:
gSubMenuSelection = RADIO_FindNextChannel(0, 1, true, 2);
break;
case MENU_SLIST3: case MENU_SLIST3:
gSubMenuSelection = RADIO_FindNextChannel(0, 1, true, 3); gSubMenuSelection = RADIO_FindNextChannel(0, 1, true, UI_MENU_GetCurrentMenuId() - MENU_SLIST1 + 1);
break; break;
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
@@ -1262,8 +1161,12 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gSetting_live_DTMF_decoder; gSubMenuSelection = gSetting_live_DTMF_decoder;
break; break;
case MENU_PONMSG: case MENU_FSKMOD:
gSubMenuSelection = gEeprom.POWER_ON_DISPLAY_MODE; gSubMenuSelection = gEeprom.FSKMode;
break;
case MENU_FSKSRC:
gSubMenuSelection = (int32_t) gEeprom.FSKSRCAddress;
break; break;
case MENU_ROGER: case MENU_ROGER:
@@ -1306,26 +1209,6 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gSetting_F_LOCK; gSubMenuSelection = gSetting_F_LOCK;
break; break;
#ifndef ENABLE_FEAT_F4HWN
case MENU_200TX:
gSubMenuSelection = gSetting_200TX;
break;
case MENU_500TX:
gSubMenuSelection = gSetting_500TX;
break;
#endif
case MENU_350EN:
gSubMenuSelection = gSetting_350EN;
break;
#ifndef ENABLE_FEAT_F4HWN
case MENU_SCREN:
gSubMenuSelection = gSetting_ScrambleEnable;
break;
#endif
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI: case MENU_F_CALI:
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW; gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
@@ -1344,8 +1227,7 @@ void MENU_ShowCurrentSetting(void)
case MENU_F1LONG: case MENU_F1LONG:
case MENU_F2SHRT: case MENU_F2SHRT:
case MENU_F2LONG: case MENU_F2LONG:
case MENU_MLONG: case MENU_MLONG: {
{
uint8_t *fun[] = { uint8_t *fun[] = {
&gEeprom.KEY_1_SHORT_PRESS_ACTION, &gEeprom.KEY_1_SHORT_PRESS_ACTION,
&gEeprom.KEY_1_LONG_PRESS_ACTION, &gEeprom.KEY_1_LONG_PRESS_ACTION,
@@ -1371,9 +1253,6 @@ void MENU_ShowCurrentSetting(void)
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
case MENU_SET_PWR:
gSubMenuSelection = gSetting_set_pwr;
break;
case MENU_SET_PTT: case MENU_SET_PTT:
gSubMenuSelection = gSetting_set_ptt_session; gSubMenuSelection = gSetting_set_ptt_session;
break; break;
@@ -1394,12 +1273,6 @@ void MENU_ShowCurrentSetting(void)
case MENU_SET_LCK: case MENU_SET_LCK:
gSubMenuSelection = gSetting_set_lck; gSubMenuSelection = gSetting_set_lck;
break; break;
case MENU_SET_MET:
gSubMenuSelection = gSetting_set_met;
break;
case MENU_SET_GUI:
gSubMenuSelection = gSetting_set_gui;
break;
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
case MENU_SET_NFM: case MENU_SET_NFM:
gSubMenuSelection = gSetting_set_nfm; gSubMenuSelection = gSetting_set_nfm;
@@ -1418,9 +1291,6 @@ void MENU_ShowCurrentSetting(void)
case MENU_SET_TMR: case MENU_SET_TMR:
gSubMenuSelection = gSetting_set_tmr; gSubMenuSelection = gSetting_set_tmr;
break; break;
case MENU_TX_LOCK:
gSubMenuSelection = gTxVfo->TX_LOCK;
break;
#endif #endif
default: default:
@@ -1428,8 +1298,7 @@ void MENU_ShowCurrentSetting(void)
} }
} }
static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
{
uint8_t Offset; uint8_t Offset;
int32_t Min; int32_t Min;
int32_t Max; int32_t Max;
@@ -1440,17 +1309,13 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0) if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0) { // currently editing the channel name
{ // currently editing the channel name
if (edit_index < 10) if (edit_index < 10) {
{ if (Key <= KEY_9) {
if (Key <= KEY_9)
{
edit[edit_index] = '0' + Key - KEY_0; edit[edit_index] = '0' + Key - KEY_0;
if (++edit_index >= 10) if (++edit_index >= 10) { // exit edit
{ // exit edit
gFlagAcceptSetting = false; gFlagAcceptSetting = false;
gAskForConfirmation = 1; gAskForConfirmation = 1;
} }
@@ -1466,17 +1331,14 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gRequestDisplayScreen = DISPLAY_MENU; gRequestDisplayScreen = DISPLAY_MENU;
if (!gIsInSubMenu) if (!gIsInSubMenu) {
{ switch (gInputBoxIndex) {
switch (gInputBoxIndex)
{
case 2: case 2:
gInputBoxIndex = 0; gInputBoxIndex = 0;
Value = (gInputBox[0] * 10) + gInputBox[1]; Value = (gInputBox[0] * 10) + gInputBox[1];
if (Value > 0 && Value <= gMenuListCount) if (Value > 0 && Value <= gMenuListCount) {
{
gMenuCursor = Value - 1; gMenuCursor = Value - 1;
gFlagRefreshSetting = true; gFlagRefreshSetting = true;
return; return;
@@ -1490,8 +1352,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
[[fallthrough]]; [[fallthrough]];
case 1: case 1:
Value = gInputBox[0]; Value = gInputBox[0];
if (Value > 0 && Value <= gMenuListCount) if (Value > 0 && Value <= gMenuListCount) {
{
gMenuCursor = Value - 1; gMenuCursor = Value - 1;
gFlagRefreshSetting = true; gFlagRefreshSetting = true;
return; return;
@@ -1505,12 +1366,10 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
return; return;
} }
if (UI_MENU_GetCurrentMenuId() == MENU_OFFSET) if (UI_MENU_GetCurrentMenuId() == MENU_OFFSET) {
{
uint32_t Frequency; uint32_t Frequency;
if (gInputBoxIndex < 6) if (gInputBoxIndex < 6) { // invalid frequency
{ // invalid frequency
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
#endif #endif
@@ -1531,11 +1390,9 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_CH || if (UI_MENU_GetCurrentMenuId() == MENU_MEM_CH ||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH || UI_MENU_GetCurrentMenuId() == MENU_DEL_CH ||
UI_MENU_GetCurrentMenuId() == MENU_1_CALL || UI_MENU_GetCurrentMenuId() == MENU_1_CALL ||
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME) UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME) { // enter 3-digit channel number
{ // enter 3-digit channel number
if (gInputBoxIndex < 3) if (gInputBoxIndex < 3) {
{
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
#endif #endif
@@ -1547,8 +1404,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1; Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
if (IS_MR_CHANNEL(Value)) if (IS_MR_CHANNEL(Value)) {
{
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
#endif #endif
@@ -1560,8 +1416,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
return; return;
} }
if (MENU_GetLimits(UI_MENU_GetCurrentMenuId(), &Min, &Max)) if (MENU_GetLimits(UI_MENU_GetCurrentMenuId(), &Min, &Max)) {
{
gInputBoxIndex = 0; gInputBoxIndex = 0;
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return; return;
@@ -1591,8 +1446,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (Offset == gInputBoxIndex) if (Offset == gInputBoxIndex)
gInputBoxIndex = 0; gInputBoxIndex = 0;
if (Value <= Max) if (Value <= Max) {
{
gSubMenuSelection = Value; gSubMenuSelection = Value;
return; return;
} }
@@ -1600,23 +1454,19 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
} }
static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld) static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld) {
{
if (bKeyHeld || !bKeyPressed) if (bKeyHeld || !bKeyPressed)
return; return;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
if (!gCssBackgroundScan) if (!gCssBackgroundScan) {
{
/* Backlight related menus set full brightness. Set it back to the configured value, /* Backlight related menus set full brightness. Set it back to the configured value,
just in case we are exiting from one of them. */ just in case we are exiting from one of them. */
BACKLIGHT_TurnOn(); BACKLIGHT_TurnOn();
if (gIsInSubMenu) if (gIsInSubMenu) {
{ if (gInputBoxIndex == 0 || UI_MENU_GetCurrentMenuId() != MENU_OFFSET) {
if (gInputBoxIndex == 0 || UI_MENU_GetCurrentMenuId() != MENU_OFFSET)
{
gAskForConfirmation = 0; gAskForConfirmation = 0;
gIsInSubMenu = false; gIsInSubMenu = false;
gInputBoxIndex = 0; gInputBoxIndex = 0;
@@ -1625,8 +1475,7 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_CANCEL; gAnotherVoiceID = VOICE_ID_CANCEL;
#endif #endif
} } else
else
gInputBox[--gInputBoxIndex] = 10; gInputBox[--gInputBoxIndex] = 10;
// *********************** // ***********************
@@ -1645,9 +1494,7 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
{ {
BACKLIGHT_TurnOff(); // turn the backlight OFF BACKLIGHT_TurnOff(); // turn the backlight OFF
} }
} } else {
else
{
MENU_StopCssScan(); MENU_StopCssScan();
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@@ -1660,16 +1507,14 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
gPttWasReleased = true; gPttWasReleased = true;
} }
static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) {
{
if (bKeyHeld || !bKeyPressed) if (bKeyHeld || !bKeyPressed)
return; return;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
gRequestDisplayScreen = DISPLAY_MENU; gRequestDisplayScreen = DISPLAY_MENU;
if (!gIsInSubMenu) if (!gIsInSubMenu) {
{
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
if (UI_MENU_GetCurrentMenuId() != MENU_SCR) if (UI_MENU_GetCurrentMenuId() != MENU_SCR)
gAnotherVoiceID = MenuList[gMenuCursor].voice_id; gAnotherVoiceID = MenuList[gMenuCursor].voice_id;
@@ -1699,10 +1544,8 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
return; return;
} }
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME) if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME) {
{ if (edit_index < 0) { // enter channel name edit mode
if (edit_index < 0)
{ // enter channel name edit mode
if (!RADIO_CheckValidChannel(gSubMenuSelection, false, 0)) if (!RADIO_CheckValidChannel(gSubMenuSelection, false, 0))
return; return;
@@ -1719,10 +1562,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
memcpy(edit_original, edit, sizeof(edit_original)); memcpy(edit_original, edit, sizeof(edit_original));
return; return;
} } else if (edit_index >= 0 && edit_index < 10) { // editing the channel name characters
else
if (edit_index >= 0 && edit_index < 10)
{ // editing the channel name characters
if (++edit_index < 10) if (++edit_index < 10)
return; // next char return; // next char
@@ -1739,15 +1579,12 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
// exiting the sub menu // exiting the sub menu
if (gIsInSubMenu) if (gIsInSubMenu) {
{
if (UI_MENU_GetCurrentMenuId() == MENU_RESET || if (UI_MENU_GetCurrentMenuId() == MENU_RESET ||
UI_MENU_GetCurrentMenuId() == MENU_MEM_CH || UI_MENU_GetCurrentMenuId() == MENU_MEM_CH ||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH || UI_MENU_GetCurrentMenuId() == MENU_DEL_CH ||
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME) UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME) {
{ switch (gAskForConfirmation) {
switch (gAskForConfirmation)
{
case 0: case 0:
gAskForConfirmation = 1; gAskForConfirmation = 1;
break; break;
@@ -1757,8 +1594,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
UI_DisplayMenu(); UI_DisplayMenu();
if (UI_MENU_GetCurrentMenuId() == MENU_RESET) if (UI_MENU_GetCurrentMenuId() == MENU_RESET) {
{
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
AUDIO_SetVoiceID(0, VOICE_ID_CONFIRM); AUDIO_SetVoiceID(0, VOICE_ID_CONFIRM);
AUDIO_PlaySingleVoice(true); AUDIO_PlaySingleVoice(true);
@@ -1777,9 +1613,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
gIsInSubMenu = false; gIsInSubMenu = false;
gAskForConfirmation = 0; gAskForConfirmation = 0;
} }
} } else {
else
{
gFlagAcceptSetting = true; gFlagAcceptSetting = true;
gIsInSubMenu = false; gIsInSubMenu = false;
} }
@@ -1797,22 +1631,18 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
gInputBoxIndex = 0; gInputBoxIndex = 0;
} }
static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld) static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld) {
{
if (bKeyHeld || !bKeyPressed) if (bKeyHeld || !bKeyPressed)
return; return;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0) if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0) { // currently editing the channel name
{ // currently editing the channel name
if (edit_index < 10) if (edit_index < 10) {
{
edit[edit_index] = '-'; edit[edit_index] = '-';
if (++edit_index >= 10) if (++edit_index >= 10) { // exit edit
{ // exit edit
gFlagAcceptSetting = false; gFlagAcceptSetting = false;
gAskForConfirmation = 1; gAskForConfirmation = 1;
} }
@@ -1831,8 +1661,8 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
if (gRxVfo->Modulation == MODULATION_FM) if (gRxVfo->Modulation == MODULATION_FM)
#endif #endif
{ {
if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gIsInSubMenu) if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) &&
{ // scan CTCSS or DCS to find the tone/code of the incoming signal gIsInSubMenu) { // scan CTCSS or DCS to find the tone/code of the incoming signal
if (!SCANNER_IsScanning()) if (!SCANNER_IsScanning())
MENU_StartCssScan(); MENU_StartCssScan();
else else
@@ -1846,23 +1676,18 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
} }
static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) {
{
uint8_t VFO; uint8_t VFO;
uint8_t Channel; uint8_t Channel;
bool bCheckScanList; bool bCheckScanList;
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME && gIsInSubMenu && edit_index >= 0) if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME && gIsInSubMenu && edit_index >= 0) { // change the character
{ // change the character if (bKeyPressed && edit_index < 10 && Direction != 0) {
if (bKeyPressed && edit_index < 10 && Direction != 0)
{
const char unwanted[] = "$%&!\"':;?^`|{}"; const char unwanted[] = "$%&!\"':;?^`|{}";
char c = edit[edit_index] + Direction; char c = edit[edit_index] + Direction;
unsigned int i = 0; unsigned int i = 0;
while (i < sizeof(unwanted) && c >= 32 && c <= 126) while (i < sizeof(unwanted) && c >= 32 && c <= 126) {
{ if (c == unwanted[i++]) { // choose next character
if (c == unwanted[i++])
{ // choose next character
c += Direction; c += Direction;
i = 0; i = 0;
} }
@@ -1874,25 +1699,21 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
return; return;
} }
if (!bKeyHeld) if (!bKeyHeld) {
{
if (!bKeyPressed) if (!bKeyPressed)
return; return;
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
gInputBoxIndex = 0; gInputBoxIndex = 0;
} } else if (!bKeyPressed)
else
if (!bKeyPressed)
return; return;
if (SCANNER_IsScanning()) { if (SCANNER_IsScanning()) {
return; return;
} }
if (!gIsInSubMenu) if (!gIsInSubMenu) {
{
gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1); gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1);
gFlagRefreshSetting = true; gFlagRefreshSetting = true;
@@ -1910,15 +1731,12 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
return; return;
} }
if (UI_MENU_GetCurrentMenuId() == MENU_OFFSET) if (UI_MENU_GetCurrentMenuId() == MENU_OFFSET) {
{
int32_t Offset = (Direction * gTxVfo->StepFrequency) + gSubMenuSelection; int32_t Offset = (Direction * gTxVfo->StepFrequency) + gSubMenuSelection;
if (Offset < 99999990) if (Offset < 99999990) {
{
if (Offset < 0) if (Offset < 0)
Offset = 99999990; Offset = 99999990;
} } else
else
Offset = 0; Offset = 0;
gSubMenuSelection = FREQUENCY_RoundToStep(Offset, gTxVfo->StepFrequency); gSubMenuSelection = FREQUENCY_RoundToStep(Offset, gTxVfo->StepFrequency);
@@ -1928,8 +1746,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
VFO = 0; VFO = 0;
switch (UI_MENU_GetCurrentMenuId()) switch (UI_MENU_GetCurrentMenuId()) {
{
case MENU_DEL_CH: case MENU_DEL_CH:
case MENU_1_CALL: case MENU_1_CALL:
case MENU_MEM_NAME: case MENU_MEM_NAME:
@@ -1962,10 +1779,8 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
gRequestDisplayScreen = DISPLAY_MENU; gRequestDisplayScreen = DISPLAY_MENU;
} }
void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
{ switch (Key) {
switch (Key)
{
case KEY_0: case KEY_0:
case KEY_1: case KEY_1:
case KEY_2: case KEY_2:
@@ -1994,16 +1809,13 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
MENU_Key_STAR(bKeyPressed, bKeyHeld); MENU_Key_STAR(bKeyPressed, bKeyHeld);
break; break;
case KEY_F: case KEY_F:
if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0) if (UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME &&
{ // currently editing the channel name edit_index >= 0) { // currently editing the channel name
if (!bKeyHeld && bKeyPressed) if (!bKeyHeld && bKeyPressed) {
{
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
if (edit_index < 10) if (edit_index < 10) {
{
edit[edit_index] = ' '; edit[edit_index] = ' ';
if (++edit_index >= 10) if (++edit_index >= 10) { // exit edit
{ // exit edit
gFlagAcceptSetting = false; gFlagAcceptSetting = false;
gAskForConfirmation = 1; gAskForConfirmation = 1;
} }
@@ -2024,18 +1836,14 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
break; break;
} }
if (gScreenToDisplay == DISPLAY_MENU) if (gScreenToDisplay == DISPLAY_MENU) {
{ if (
if (UI_MENU_GetCurrentMenuId() == MENU_VOL ||
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
UI_MENU_GetCurrentMenuId() == MENU_F_CALI || UI_MENU_GetCurrentMenuId() == MENU_F_CALI ||
#endif #endif
UI_MENU_GetCurrentMenuId() == MENU_BATCAL) UI_MENU_GetCurrentMenuId() == MENU_BATCAL) {
{
gMenuCountdown = menu_timeout_long_500ms; gMenuCountdown = menu_timeout_long_500ms;
} } else {
else
{
gMenuCountdown = menu_timeout_500ms; gMenuCountdown = menu_timeout_500ms;
} }
} }

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -166,17 +166,6 @@ const uint8_t BITMAP_Antenna[5] =
0b00000011 0b00000011
}; };
const uint8_t BITMAP_VFO_Lock[7] =
{
0b01111100,
0b01000110,
0b01000101,
0b01000101,
0b01000101,
0b01000110,
0b01111100,
};
const uint8_t BITMAP_VFO_Default[7] = const uint8_t BITMAP_VFO_Default[7] =
{ {
0b01111111, 0b01111111,

View File

@@ -38,7 +38,6 @@ extern const uint8_t BITMAP_NotReady[7];
extern const uint8_t BITMAP_Antenna[5]; extern const uint8_t BITMAP_Antenna[5];
extern const uint8_t BITMAP_VFO_Default[7]; extern const uint8_t BITMAP_VFO_Default[7];
extern const uint8_t BITMAP_VFO_NotDefault[7]; extern const uint8_t BITMAP_VFO_NotDefault[7];
extern const uint8_t BITMAP_VFO_Lock[7];
extern const uint8_t BITMAP_ScanList0[7]; extern const uint8_t BITMAP_ScanList0[7];
extern const uint8_t BITMAP_ScanList1[7]; extern const uint8_t BITMAP_ScanList1[7];
extern const uint8_t BITMAP_ScanList2[7]; extern const uint8_t BITMAP_ScanList2[7];

View File

@@ -2,7 +2,8 @@
#export DOCKER_DEFAULT_PLATFORM=linux/amd64 #export DOCKER_DEFAULT_PLATFORM=linux/amd64
#export DOCKER_NETWORK="--network=host" #export DOCKER_NETWORK="--network=host"
IMAGE_NAME="uvk5" IMAGE_NAME="uvk5"
rm "${PWD}/compiled-firmware/*" rm -rf "${PWD}/compiled-firmware/*"
mkdir -p "${PWD}/compiled-firmware"
echo "Building docker image $IMAGE_NAME" echo "Building docker image $IMAGE_NAME"
if ! docker build -t $DOCKER_NETWORK $IMAGE_NAME . if ! docker build -t $DOCKER_NETWORK $IMAGE_NAME .
then then
@@ -10,121 +11,6 @@ then
exit 1 exit 1
fi fi
custom() {
echo "Custom compilation..." echo "Custom compilation..."
docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \ docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME \
EDITION_STRING=Custom \ /bin/bash -c "cd /app && make -j && cp f4hwn* /app/compiled-firmware/ && ls -l /app/compiled-firmware/ || echo 'No files to copy'"
TARGET=f4hwn.custom \
&& cp f4hwn.custom* compiled-firmware/"
}
standard() {
echo "Standard compilation..."
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \
ENABLE_SPECTRUM=0 \
ENABLE_FMRADIO=0 \
ENABLE_AIRCOPY=0 \
ENABLE_NOAA=0 \
EDITION_STRING=Standard \
TARGET=f4hwn.standard \
&& cp f4hwn.standard* compiled-firmware/"
}
bandscope() {
echo "Bandscope compilation..."
docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \
ENABLE_SPECTRUM=1 \
ENABLE_FMRADIO=0 \
ENABLE_AIRCOPY=1 \
ENABLE_FEAT_F4HWN_PMR=1 \
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=1 \
ENABLE_NOAA=0 \
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
EDITION_STRING=Bandscope \
TARGET=f4hwn.bandscope \
&& cp f4hwn.bandscope* compiled-firmware/"
}
broadcast() {
echo "Broadcast compilation..."
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \
ENABLE_SPECTRUM=0 \
ENABLE_FMRADIO=1 \
ENABLE_AIRCOPY=1 \
ENABLE_FEAT_F4HWN_PMR=1 \
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=1 \
ENABLE_NOAA=0 \
EDITION_STRING=Broadcast \
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
TARGET=f4hwn.broadcast \
&& cp f4hwn.broadcast* compiled-firmware/"
}
voxless() {
echo "Voxless compilation..."
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \
ENABLE_SPECTRUM=1 \
ENABLE_FMRADIO=1 \
ENABLE_VOX=0 \
ENABLE_AIRCOPY=0 \
ENABLE_AUDIO_BAR=0 \
ENABLE_FEAT_F4HWN_SPECTRUM=0 \
ENABLE_FEAT_F4HWN_PMR=1 \
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=1 \
ENABLE_NOAA=0 \
ENABLE_FEAT_F4HWN_RESUME_STATE=0 \
ENABLE_FEAT_F4HWN_CHARGING_C=0 \
ENABLE_FEAT_F4HWN_INV=1 \
ENABLE_FEAT_F4HWN_CTR=0 \
ENABLE_FEAT_F4HWN_NARROWER=0 \
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
EDITION_STRING=Voxless \
TARGET=f4hwn.voxless \
&& cp f4hwn.voxless* compiled-firmware/"
}
rescueops() {
echo "RescueOps compilation..."
docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \
ENABLE_SPECTRUM=0 \
ENABLE_FMRADIO=0 \
ENABLE_AIRCOPY=1 \
ENABLE_FEAT_F4HWN_PMR=1 \
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=1 \
ENABLE_NOAA=1 \
ENABLE_FEAT_F4HWN_RESCUE_OPS=1 \
EDITION_STRING=RescueOps \
TARGET=f4hwn.rescueops \
&& cp f4hwn.rescueops* compiled-firmware/"
}
case "$1" in
custom)
custom
;;
standard)
standard
;;
bandscope)
bandscope
;;
broadcast)
broadcast
;;
voxless)
voxless
;;
rescueops)
rescueops
;;
all)
bandscope
broadcast
rescueops
voxless
;;
*)
echo "Usage: $0 {custom|bandscope|broadcast|voxless|standard|all}"
exit 1
;;
esac

View File

@@ -68,12 +68,6 @@ void BACKLIGHT_InitHardware()
static void BACKLIGHT_Sound(void) static void BACKLIGHT_Sound(void)
{ {
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_SOUND || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_ALL)
{
AUDIO_PlayBeep(BEEP_880HZ_60MS_DOUBLE_BEEP);
AUDIO_PlayBeep(BEEP_880HZ_60MS_DOUBLE_BEEP);
}
gK5startup = false; gK5startup = false;
} }

View File

@@ -19,14 +19,42 @@
enum BK1080_Register_t { enum BK1080_Register_t {
BK1080_REG_00 = 0x00U, BK1080_REG_00 = 0x00U,
BK1080_REG_01_CHIP_ID = 0x01U,
BK1080_REG_02_POWER_CONFIGURATION = 0x02U, BK1080_REG_02_POWER_CONFIGURATION = 0x02U,
BK1080_REG_03_CHANNEL = 0x03U, BK1080_REG_03_CHANNEL = 0x03U,
BK1080_REG_04_SYSTEM_CONFIGURATION1 = 0x04U,
BK1080_REG_05_SYSTEM_CONFIGURATION2 = 0x05U, BK1080_REG_05_SYSTEM_CONFIGURATION2 = 0x05U,
BK1080_REG_07 = 0x07U, BK1080_REG_06_SYSTEM_CONFIGURATION3 = 0x06U,
BK1080_REG_10 = 0x0AU, BK1080_REG_07_TEST1 = 0x07U,
BK1080_REG_08_TEST2 = 0x08U,
BK1080_REG_09_BOOT_CONFIGURATION = 0x09U,
BK1080_REG_10_RSSI_STATUS = 0x0AU,
BK1080_REG_11_RSSI_THRESHOLD = 0x0BU,
BK1080_REG_12_INTERNAL = 0x0CU,
BK1080_REG_13_INTERNAL = 0x0DU,
BK1080_REG_14_INTERNAL = 0x0EU,
BK1080_REG_15_INTERNAL = 0x0FU,
BK1080_REG_16_INTERNAL = 0x10U,
BK1080_REG_17_INTERNAL = 0x11U,
BK1080_REG_18_INTERNAL = 0x12U,
BK1080_REG_19_INTERNAL = 0x13U,
BK1080_REG_20_INTERNAL = 0x14U,
BK1080_REG_21_INTERNAL = 0x15U,
BK1080_REG_22_INTERNAL = 0x16U,
BK1080_REG_23_INTERNAL = 0x17U,
BK1080_REG_24_INTERNAL = 0x18U,
BK1080_REG_25_INTERNAL = 0x19U, BK1080_REG_25_INTERNAL = 0x19U,
BK1080_REG_26_INTERNAL = 0x1AU,
BK1080_REG_27_INTERNAL = 0x1BU,
BK1080_REG_28_INTERNAL = 0x1CU,
BK1080_REG_29_INTERNAL = 0x1DU,
BK1080_REG_30_INTERNAL = 0x1EU,
BK1080_REG_31_INTERNAL = 0x1FU,
BK1080_REG_32_INTERNAL = 0x20U,
BK1080_REG_33_INTERNAL = 0x21U,
}; };
typedef enum BK1080_Register_t BK1080_Register_t; typedef enum BK1080_Register_t BK1080_Register_t;
// REG 07 // REG 07

View File

@@ -19,6 +19,7 @@
#include "driver/gpio.h" #include "driver/gpio.h"
#include "driver/i2c.h" #include "driver/i2c.h"
#include "driver/system.h" #include "driver/system.h"
#include "../settings.h"
#include "misc.h" #include "misc.h"
#ifndef ARRAY_SIZE #ifndef ARRAY_SIZE
@@ -69,10 +70,11 @@ void BK1080_Init(uint16_t freq, uint8_t band/*, uint8_t space*/)
} }
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, gMute ? 0x0A10 : 0x0A1F); BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, 0x0A10 | (gEeprom.VOLUME_GAIN >> 2));
#else #else
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, 0x0A1F); BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, 0x0A1F);
#endif #endif
BK1080_UpdateSysconf();
BK1080_SetFrequency(freq, band/*, space*/); BK1080_SetFrequency(freq, band/*, space*/);
} }
else { else {
@@ -104,6 +106,15 @@ void BK1080_WriteRegister(BK1080_Register_t Register, uint16_t Value)
I2C_Stop(); I2C_Stop();
} }
void BK1080_UpdateSysconf(void) {
BK1080_WriteRegister(BK1080_REG_04_SYSTEM_CONFIGURATION1,
(gEeprom.BK1080_DEEMPHASIS_CONFIG == DEEMPHASIS_OFF ? BK1080_DEEMPHASIS_OFF : BK1080_DEEMPHASIS_ON) |
(gEeprom.BK1080_DEEMPHASIS_CONFIG == DEEMPHASIS_EUR ? BK1080_DEEMPHASIS_EUR : BK1080_DEEMPHASIS_USA) |
(gEeprom.BK1080_AGC_ENABLED ? BK1080_AGC_ON : BK1080_AGC_OFF) |
(gEeprom.BK1080_BLEND_CONFIG << 6)
);
}
void BK1080_Mute(bool Mute) void BK1080_Mute(bool Mute)
{ {
BK1080_WriteRegister(BK1080_REG_02_POWER_CONFIGURATION, Mute ? 0x4201 : 0x0201); BK1080_WriteRegister(BK1080_REG_02_POWER_CONFIGURATION, Mute ? 0x4201 : 0x0201);
@@ -130,7 +141,7 @@ void BK1080_SetFrequency(uint16_t frequency, uint8_t band/*, uint8_t space*/)
void BK1080_GetFrequencyDeviation(uint16_t Frequency) void BK1080_GetFrequencyDeviation(uint16_t Frequency)
{ {
BK1080_BaseFrequency = Frequency; BK1080_BaseFrequency = Frequency;
BK1080_FrequencyDeviation = BK1080_ReadRegister(BK1080_REG_07) / 16; BK1080_FrequencyDeviation = BK1080_ReadRegister(BK1080_REG_07_TEST1) / 16;
} }
uint16_t BK1080_GetFreqLoLimit(uint8_t band) uint16_t BK1080_GetFreqLoLimit(uint8_t band)

View File

@@ -24,10 +24,20 @@
extern uint16_t BK1080_BaseFrequency; extern uint16_t BK1080_BaseFrequency;
extern uint16_t BK1080_FrequencyDeviation; extern uint16_t BK1080_FrequencyDeviation;
#define BK1080_DEEMPHASIS_USA (0 << 11)
#define BK1080_DEEMPHASIS_EUR (1 << 11)
#define BK1080_DEEMPHASIS_ON (0 << 13)
#define BK1080_DEEMPHASIS_OFF (1 << 13)
#define BK1080_AGC_ON (0 << 10)
#define BK1080_AGC_OFF (1 << 10)
void BK1080_Init0(void); void BK1080_Init0(void);
void BK1080_Init(uint16_t Frequency, uint8_t band/*, uint8_t space*/); void BK1080_Init(uint16_t Frequency, uint8_t band/*, uint8_t space*/);
uint16_t BK1080_ReadRegister(BK1080_Register_t Register); uint16_t BK1080_ReadRegister(BK1080_Register_t Register);
void BK1080_WriteRegister(BK1080_Register_t Register, uint16_t Value); void BK1080_WriteRegister(BK1080_Register_t Register, uint16_t Value);
void BK1080_UpdateSysconf(void);
void BK1080_Mute(bool Mute); void BK1080_Mute(bool Mute);
uint16_t BK1080_GetFreqLoLimit(uint8_t band); uint16_t BK1080_GetFreqLoLimit(uint8_t band);
uint16_t BK1080_GetFreqHiLimit(uint8_t band); uint16_t BK1080_GetFreqHiLimit(uint8_t band);

View File

@@ -74,6 +74,7 @@ enum BK4819_REGISTER_t {
BK4819_REG_3D = 0x3DU, BK4819_REG_3D = 0x3DU,
BK4819_REG_3E = 0x3EU, BK4819_REG_3E = 0x3EU,
BK4819_REG_3F = 0x3FU, BK4819_REG_3F = 0x3FU,
BK4819_REG_40 = 0x40U,
BK4819_REG_43 = 0x43U, BK4819_REG_43 = 0x43U,
BK4819_REG_46 = 0x46U, BK4819_REG_46 = 0x46U,
BK4819_REG_47 = 0x47U, BK4819_REG_47 = 0x47U,
@@ -96,6 +97,7 @@ enum BK4819_REGISTER_t {
BK4819_REG_5A = 0x5AU, BK4819_REG_5A = 0x5AU,
BK4819_REG_5B = 0x5BU, BK4819_REG_5B = 0x5BU,
BK4819_REG_5C = 0x5CU, BK4819_REG_5C = 0x5CU,
BK4819_REG_5E = 0x5EU,
BK4819_REG_5D = 0x5DU, BK4819_REG_5D = 0x5DU,
BK4819_REG_5F = 0x5FU, BK4819_REG_5F = 0x5FU,
BK4819_REG_63 = 0x63U, BK4819_REG_63 = 0x63U,

View File

@@ -48,6 +48,21 @@ __inline uint16_t scale_freq(const uint16_t freq)
return (((uint32_t)freq * 1353245u) + (1u << 16)) >> 17; // with rounding return (((uint32_t)freq * 1353245u) + (1u << 16)) >> 17; // with rounding
} }
void BK4819_FskEnableTx(void){
const uint16_t fsk_reg59 = BK4819_ReadRegister(BK4819_REG_59);
BK4819_WriteRegister(BK4819_REG_59, (1u << 11) | fsk_reg59);
}
void BK4819_FskClearFifo(void){
const uint16_t fsk_reg59 = BK4819_ReadRegister(BK4819_REG_59);
BK4819_WriteRegister(BK4819_REG_59, (1u << 15) | (1u << 14) | fsk_reg59);
}
void BK4819_FskEnableRx(void){
const uint16_t fsk_reg59 = BK4819_ReadRegister(BK4819_REG_59);
BK4819_WriteRegister(BK4819_REG_59, (1u << 12) | fsk_reg59);
}
void BK4819_Init(void) void BK4819_Init(void)
{ {
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_BK4819_SCN);

View File

@@ -77,6 +77,11 @@ void BK4819_InitAGC(bool amModulation);
void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet); void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet);
void BK4819_ResetFSK(void);
void BK4819_FskClearFifo(void);
void BK4819_FskEnableRx(void);
void BK4819_FskEnableTx(void);
void BK4819_SetCDCSSCodeWord(uint32_t CodeWord); void BK4819_SetCDCSSCodeWord(uint32_t CodeWord);
void BK4819_SetCTCSSFrequency(uint32_t BaudRate); void BK4819_SetCTCSSFrequency(uint32_t BaudRate);
void BK4819_SetTailDetection(const uint32_t freq_10Hz); void BK4819_SetTailDetection(const uint32_t freq_10Hz);

View File

@@ -26,6 +26,8 @@ KEY_Code_t gKeyReading0 = KEY_INVALID;
KEY_Code_t gKeyReading1 = KEY_INVALID; KEY_Code_t gKeyReading1 = KEY_INVALID;
uint16_t gDebounceCounter = 0; uint16_t gDebounceCounter = 0;
bool gWasFKeyPressed = false; bool gWasFKeyPressed = false;
uint8_t prevLetter = 0;
KEY_Code_t prevKey = KEY_INVALID;
static const struct { static const struct {

View File

@@ -49,6 +49,8 @@ extern KEY_Code_t gKeyReading0;
extern KEY_Code_t gKeyReading1; extern KEY_Code_t gKeyReading1;
extern uint16_t gDebounceCounter; extern uint16_t gDebounceCounter;
extern bool gWasFKeyPressed; extern bool gWasFKeyPressed;
extern uint8_t prevLetter;
extern KEY_Code_t prevKey;
KEY_Code_t KEYBOARD_Poll(void); KEY_Code_t KEYBOARD_Poll(void);

View File

@@ -226,22 +226,22 @@ uint8_t cmds[] = {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
} }
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO) // #if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value) // void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value)
{ // {
gFrameBuffer[line][54] = 0x0c; // gFrameBuffer[line][54] = 0x0c;
gFrameBuffer[line][55] = 0x12; // gFrameBuffer[line][55] = 0x12;
//
gFrameBuffer[line][121] = 0x12; // gFrameBuffer[line][121] = 0x12;
gFrameBuffer[line][122] = 0x0c; // gFrameBuffer[line][122] = 0x0c;
//
uint8_t filled = map(value, min, max, 56, 120); // uint8_t filled = map(value, min, max, 56, 120);
//
for (uint8_t i = 56; i <= 120; i++) { // for (uint8_t i = 56; i <= 120; i++) {
gFrameBuffer[line][i] = (i <= filled) ? 0x2d : 0x21; // gFrameBuffer[line][i] = (i <= filled) ? 0x2d : 0x21;
} // }
} // }
#endif // #endif
#endif #endif
void ST7565_Init(void) void ST7565_Init(void)

View File

@@ -4084,9 +4084,9 @@ called in the following order:
a=>b [label="GetVersion ()", textcolor="gray", linecolor="gray"]; a=>b [label="GetVersion ()", textcolor="gray", linecolor="gray"];
--- [label="Obtain driver features"]; --- [label="Obtain driver features"];
a=>b [label="GetCapabilities (...)", textcolor="gray", linecolor="gray"]; a=>b [label="GetCapabilities (...)", textcolor="gray", linecolor="gray"];
--- [label="Setup software resources"]; --- [label="Sup software resources"];
a=>b [label="Initialize (...)", textcolor="red", linecolor="red"]; a=>b [label="Initialize (...)", textcolor="red", linecolor="red"];
--- [label="Setup the peripheral"]; --- [label="Sup the peripheral"];
a=>b [label="PowerControl (ARM_POWER_FULL)", textcolor="red", linecolor="red"]; a=>b [label="PowerControl (ARM_POWER_FULL)", textcolor="red", linecolor="red"];
--- [label="Operate with the peripheral"]; --- [label="Operate with the peripheral"];
a=>b [label="Data Transfer Functions"]; a=>b [label="Data Transfer Functions"];

View File

@@ -40,7 +40,10 @@
// printf_config.h header file // printf_config.h header file
// default: undefined // default: undefined
#ifdef PRINTF_INCLUDE_CONFIG_H #ifdef PRINTF_INCLUDE_CONFIG_H
#include "printf_config.h" #define PRINTF_DISABLE_SUPPORT_LONG_LONG
#define PRINTF_DISABLE_SUPPORT_EXPONENTIAL
#define PRINTF_DISABLE_SUPPORT_PTRDIFF_T
#define PRINTF_DISABLE_SUPPORT_FLOAT
#endif #endif
@@ -125,13 +128,13 @@ typedef void (*out_fct_type)(char character, void* buffer, size_t idx, size_t ma
// wrapper (used as buffer) for output function type // wrapper (used as buffer) for output function type
typedef struct { typedef struct {
void (*fct)(char character, void *arg); void (*fct)(char character, void *arg);
void *arg; void *arg;
} out_fct_wrap_type; } out_fct_wrap_type;
// internal buffer output // internal buffer output
static inline void _out_buffer(char character, void* buffer, size_t idx, size_t maxlen) static inline void _out_buffer(char character, void *buffer, size_t idx, size_t maxlen) {
{
if (idx < maxlen) { if (idx < maxlen) {
((char *) buffer)[idx] = character; ((char *) buffer)[idx] = character;
} }
@@ -139,16 +142,19 @@ static inline void _out_buffer(char character, void* buffer, size_t idx, size_t
// internal null output // internal null output
static inline void _out_null(char character, void* buffer, size_t idx, size_t maxlen) static inline void _out_null(char character, void *buffer, size_t idx, size_t maxlen) {
{ (void) character;
(void)character; (void)buffer; (void)idx; (void)maxlen; (void) buffer;
(void) idx;
(void) maxlen;
} }
// internal _putchar wrapper // internal _putchar wrapper
static inline void _out_char(char character, void* buffer, size_t idx, size_t maxlen) static inline void _out_char(char character, void *buffer, size_t idx, size_t maxlen) {
{ (void) buffer;
(void)buffer; (void)idx; (void)maxlen; (void) idx;
(void) maxlen;
if (character) { if (character) {
_putchar(character); _putchar(character);
} }
@@ -156,9 +162,9 @@ static inline void _out_char(char character, void* buffer, size_t idx, size_t ma
// internal output function wrapper // internal output function wrapper
static inline void _out_fct(char character, void* buffer, size_t idx, size_t maxlen) static inline void _out_fct(char character, void *buffer, size_t idx, size_t maxlen) {
{ (void) idx;
(void)idx; (void)maxlen; (void) maxlen;
if (character) { if (character) {
// buffer is the output fct pointer // buffer is the output fct pointer
((out_fct_wrap_type *) buffer)->fct(character, ((out_fct_wrap_type *) buffer)->arg); ((out_fct_wrap_type *) buffer)->fct(character, ((out_fct_wrap_type *) buffer)->arg);
@@ -168,8 +174,7 @@ static inline void _out_fct(char character, void* buffer, size_t idx, size_t max
// internal secure strlen // internal secure strlen
// \return The length of the string (excluding the terminating 0) limited by 'maxsize' // \return The length of the string (excluding the terminating 0) limited by 'maxsize'
static inline unsigned int _strnlen_s(const char* str, size_t maxsize) static inline unsigned int _strnlen_s(const char *str, size_t maxsize) {
{
const char *s; const char *s;
for (s = str; *s && maxsize--; ++s); for (s = str; *s && maxsize--; ++s);
return (unsigned int) (s - str); return (unsigned int) (s - str);
@@ -178,15 +183,13 @@ static inline unsigned int _strnlen_s(const char* str, size_t maxsize)
// internal test if char is a digit (0-9) // internal test if char is a digit (0-9)
// \return true if char is a digit // \return true if char is a digit
static inline bool _is_digit(char ch) static inline bool _is_digit(char ch) {
{
return (ch >= '0') && (ch <= '9'); return (ch >= '0') && (ch <= '9');
} }
// internal ASCII string to unsigned int conversion // internal ASCII string to unsigned int conversion
static unsigned int _atoi(const char** str) static unsigned int _atoi(const char **str) {
{
unsigned int i = 0U; unsigned int i = 0U;
while (_is_digit(**str)) { while (_is_digit(**str)) {
i = i * 10U + (unsigned int) (*((*str)++) - '0'); i = i * 10U + (unsigned int) (*((*str)++) - '0');
@@ -196,8 +199,9 @@ static unsigned int _atoi(const char** str)
// output the specified string in reverse, taking care of any zero-padding // output the specified string in reverse, taking care of any zero-padding
static size_t _out_rev(out_fct_type out, char* buffer, size_t idx, size_t maxlen, const char* buf, size_t len, unsigned int width, unsigned int flags) static size_t
{ _out_rev(out_fct_type out, char *buffer, size_t idx, size_t maxlen, const char *buf, size_t len, unsigned int width,
unsigned int flags) {
const size_t start_idx = idx; const size_t start_idx = idx;
// pad spaces up to given width // pad spaces up to given width
@@ -224,8 +228,9 @@ static size_t _out_rev(out_fct_type out, char* buffer, size_t idx, size_t maxlen
// internal itoa format // internal itoa format
static size_t _ntoa_format(out_fct_type out, char* buffer, size_t idx, size_t maxlen, char* buf, size_t len, bool negative, unsigned int base, unsigned int prec, unsigned int width, unsigned int flags) static size_t
{ _ntoa_format(out_fct_type out, char *buffer, size_t idx, size_t maxlen, char *buf, size_t len, bool negative,
unsigned int base, unsigned int prec, unsigned int width, unsigned int flags) {
// pad leading zeros // pad leading zeros
if (!(flags & FLAGS_LEFT)) { if (!(flags & FLAGS_LEFT)) {
if (width && (flags & FLAGS_ZEROPAD) && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) { if (width && (flags & FLAGS_ZEROPAD) && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) {
@@ -249,11 +254,9 @@ static size_t _ntoa_format(out_fct_type out, char* buffer, size_t idx, size_t ma
} }
if ((base == 16U) && !(flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) { if ((base == 16U) && !(flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
buf[len++] = 'x'; buf[len++] = 'x';
} } else if ((base == 16U) && (flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
else if ((base == 16U) && (flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
buf[len++] = 'X'; buf[len++] = 'X';
} } else if ((base == 2U) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
else if ((base == 2U) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
buf[len++] = 'b'; buf[len++] = 'b';
} }
if (len < PRINTF_NTOA_BUFFER_SIZE) { if (len < PRINTF_NTOA_BUFFER_SIZE) {
@@ -264,11 +267,9 @@ static size_t _ntoa_format(out_fct_type out, char* buffer, size_t idx, size_t ma
if (len < PRINTF_NTOA_BUFFER_SIZE) { if (len < PRINTF_NTOA_BUFFER_SIZE) {
if (negative) { if (negative) {
buf[len++] = '-'; buf[len++] = '-';
} } else if (flags & FLAGS_PLUS) {
else if (flags & FLAGS_PLUS) {
buf[len++] = '+'; // ignore the space if the '+' exists buf[len++] = '+'; // ignore the space if the '+' exists
} } else if (flags & FLAGS_SPACE) {
else if (flags & FLAGS_SPACE) {
buf[len++] = ' '; buf[len++] = ' ';
} }
} }
@@ -278,8 +279,8 @@ static size_t _ntoa_format(out_fct_type out, char* buffer, size_t idx, size_t ma
// internal itoa for 'long' type // internal itoa for 'long' type
static size_t _ntoa_long(out_fct_type out, char* buffer, size_t idx, size_t maxlen, unsigned long value, bool negative, unsigned long base, unsigned int prec, unsigned int width, unsigned int flags) static size_t _ntoa_long(out_fct_type out, char *buffer, size_t idx, size_t maxlen, unsigned long value, bool negative,
{ unsigned long base, unsigned int prec, unsigned int width, unsigned int flags) {
char buf[PRINTF_NTOA_BUFFER_SIZE]; char buf[PRINTF_NTOA_BUFFER_SIZE];
size_t len = 0U; size_t len = 0U;
@@ -574,8 +575,7 @@ static size_t _etoa(out_fct_type out, char* buffer, size_t idx, size_t maxlen, d
// internal vsnprintf // internal vsnprintf
static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const char* format, va_list va) static int _vsnprintf(out_fct_type out, char *buffer, const size_t maxlen, const char *format, va_list va) {
{
unsigned int flags, width, precision, n; unsigned int flags, width, precision, n;
size_t idx = 0U; size_t idx = 0U;
@@ -584,16 +584,14 @@ static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const
out = _out_null; out = _out_null;
} }
while (*format) while (*format) {
{
// format specifier? %[flags][width][.precision][length] // format specifier? %[flags][width][.precision][length]
if (*format != '%') { if (*format != '%') {
// no // no
out(*format, buffer, idx++, maxlen); out(*format, buffer, idx++, maxlen);
format++; format++;
continue; continue;
} } else {
else {
// yes, evaluate it // yes, evaluate it
format++; format++;
} }
@@ -602,12 +600,34 @@ static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const
flags = 0U; flags = 0U;
do { do {
switch (*format) { switch (*format) {
case '0': flags |= FLAGS_ZEROPAD; format++; n = 1U; break; case '0':
case '-': flags |= FLAGS_LEFT; format++; n = 1U; break; flags |= FLAGS_ZEROPAD;
case '+': flags |= FLAGS_PLUS; format++; n = 1U; break; format++;
case ' ': flags |= FLAGS_SPACE; format++; n = 1U; break; n = 1U;
case '#': flags |= FLAGS_HASH; format++; n = 1U; break; break;
default : n = 0U; break; case '-':
flags |= FLAGS_LEFT;
format++;
n = 1U;
break;
case '+':
flags |= FLAGS_PLUS;
format++;
n = 1U;
break;
case ' ':
flags |= FLAGS_SPACE;
format++;
n = 1U;
break;
case '#':
flags |= FLAGS_HASH;
format++;
n = 1U;
break;
default :
n = 0U;
break;
} }
} while (n); } while (n);
@@ -615,14 +635,12 @@ static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const
width = 0U; width = 0U;
if (_is_digit(*format)) { if (_is_digit(*format)) {
width = _atoi(&format); width = _atoi(&format);
} } else if (*format == '*') {
else if (*format == '*') {
const int w = va_arg(va, int); const int w = va_arg(va, int);
if (w < 0) { if (w < 0) {
flags |= FLAGS_LEFT; // reverse padding flags |= FLAGS_LEFT; // reverse padding
width = (unsigned int) -w; width = (unsigned int) -w;
} } else {
else {
width = (unsigned int) w; width = (unsigned int) w;
} }
format++; format++;
@@ -635,8 +653,7 @@ static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const
format++; format++;
if (_is_digit(*format)) { if (_is_digit(*format)) {
precision = _atoi(&format); precision = _atoi(&format);
} } else if (*format == '*') {
else if (*format == '*') {
const int prec = (int) va_arg(va, int); const int prec = (int) va_arg(va, int);
precision = prec > 0 ? (unsigned int) prec : 0U; precision = prec > 0 ? (unsigned int) prec : 0U;
format++; format++;
@@ -692,14 +709,11 @@ static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const
unsigned int base; unsigned int base;
if (*format == 'x' || *format == 'X') { if (*format == 'x' || *format == 'X') {
base = 16U; base = 16U;
} } else if (*format == 'o') {
else if (*format == 'o') {
base = 8U; base = 8U;
} } else if (*format == 'b') {
else if (*format == 'b') {
base = 2U; base = 2U;
} } else {
else {
base = 10U; base = 10U;
flags &= ~FLAGS_HASH; // no hash for dec format flags &= ~FLAGS_HASH; // no hash for dec format
} }
@@ -726,28 +740,32 @@ static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const
const long long value = va_arg(va, long long); const long long value = va_arg(va, long long);
idx = _ntoa_long_long(out, buffer, idx, maxlen, (unsigned long long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags); idx = _ntoa_long_long(out, buffer, idx, maxlen, (unsigned long long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags);
#endif #endif
} } else if (flags & FLAGS_LONG) {
else if (flags & FLAGS_LONG) {
const long value = va_arg(va, long); const long value = va_arg(va, long);
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags); idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long) (value > 0 ? value : 0 - value),
value < 0, base, precision, width, flags);
} else {
const int value = (flags & FLAGS_CHAR) ? (char) va_arg(va, int) : (flags & FLAGS_SHORT)
? (short int) va_arg(va, int)
: va_arg(va, int);
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned int) (value > 0 ? value : 0 - value),
value < 0, base, precision, width, flags);
} }
else { } else {
const int value = (flags & FLAGS_CHAR) ? (char)va_arg(va, int) : (flags & FLAGS_SHORT) ? (short int)va_arg(va, int) : va_arg(va, int);
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned int)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags);
}
}
else {
// unsigned // unsigned
if (flags & FLAGS_LONG_LONG) { if (flags & FLAGS_LONG_LONG) {
#if defined(PRINTF_SUPPORT_LONG_LONG) #if defined(PRINTF_SUPPORT_LONG_LONG)
idx = _ntoa_long_long(out, buffer, idx, maxlen, va_arg(va, unsigned long long), false, base, precision, width, flags); idx = _ntoa_long_long(out, buffer, idx, maxlen, va_arg(va, unsigned long long), false, base, precision, width, flags);
#endif #endif
} } else if (flags & FLAGS_LONG) {
else if (flags & FLAGS_LONG) { idx = _ntoa_long(out, buffer, idx, maxlen, va_arg(va, unsigned long), false, base, precision,
idx = _ntoa_long(out, buffer, idx, maxlen, va_arg(va, unsigned long), false, base, precision, width, flags); width, flags);
} } else {
else { const unsigned int value = (flags & FLAGS_CHAR) ? (unsigned char) va_arg(va, unsigned int)
const unsigned int value = (flags & FLAGS_CHAR) ? (unsigned char)va_arg(va, unsigned int) : (flags & FLAGS_SHORT) ? (unsigned short int)va_arg(va, unsigned int) : va_arg(va, unsigned int); : (flags & FLAGS_SHORT)
? (unsigned short int) va_arg(va,
unsigned int)
: va_arg(va, unsigned int);
idx = _ntoa_long(out, buffer, idx, maxlen, value, false, base, precision, width, flags); idx = _ntoa_long(out, buffer, idx, maxlen, value, false, base, precision, width, flags);
} }
} }
@@ -829,7 +847,8 @@ static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const
} }
else { else {
#endif #endif
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)((uintptr_t)va_arg(va, void*)), false, 16U, precision, width, flags); idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long) ((uintptr_t) va_arg(va, void*)), false, 16U,
precision, width, flags);
#if defined(PRINTF_SUPPORT_LONG_LONG) #if defined(PRINTF_SUPPORT_LONG_LONG)
} }
#endif #endif
@@ -859,8 +878,7 @@ static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int printf_(const char* format, ...) int printf_(const char *format, ...) {
{
va_list va; va_list va;
va_start(va, format); va_start(va, format);
char buffer[1]; char buffer[1];
@@ -870,8 +888,7 @@ int printf_(const char* format, ...)
} }
int sprintf_(char* buffer, const char* format, ...) int sprintf_(char *buffer, const char *format, ...) {
{
va_list va; va_list va;
va_start(va, format); va_start(va, format);
const int ret = _vsnprintf(_out_buffer, buffer, (size_t) -1, format, va); const int ret = _vsnprintf(_out_buffer, buffer, (size_t) -1, format, va);
@@ -880,8 +897,7 @@ int sprintf_(char* buffer, const char* format, ...)
} }
int snprintf_(char* buffer, size_t count, const char* format, ...) int snprintf_(char *buffer, size_t count, const char *format, ...) {
{
va_list va; va_list va;
va_start(va, format); va_start(va, format);
const int ret = _vsnprintf(_out_buffer, buffer, count, format, va); const int ret = _vsnprintf(_out_buffer, buffer, count, format, va);
@@ -890,21 +906,18 @@ int snprintf_(char* buffer, size_t count, const char* format, ...)
} }
int vprintf_(const char* format, va_list va) int vprintf_(const char *format, va_list va) {
{
char buffer[1]; char buffer[1];
return _vsnprintf(_out_char, buffer, (size_t) -1, format, va); return _vsnprintf(_out_char, buffer, (size_t) -1, format, va);
} }
int vsnprintf_(char* buffer, size_t count, const char* format, va_list va) int vsnprintf_(char *buffer, size_t count, const char *format, va_list va) {
{
return _vsnprintf(_out_buffer, buffer, count, format, va); return _vsnprintf(_out_buffer, buffer, count, format, va);
} }
int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...) int fctprintf(void (*out)(char character, void *arg), void *arg, const char *format, ...) {
{
va_list va; va_list va;
va_start(va, format); va_start(va, format);
const out_fct_wrap_type out_fct_wrap = {out, arg}; const out_fct_wrap_type out_fct_wrap = {out, arg};

420
font.c
View File

@@ -18,202 +18,202 @@
// removed last and middle column which was all 0x00 // removed last and middle column which was all 0x00
// also the space char is not needed // also the space char is not needed
const uint8_t gFontBig[95 - 1][16 - 2] = //const uint8_t gFontBig[95 - 1][16 - 2] =
{ //{
#if 0 //#if 0
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // ' ' //// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // ' '
{0x00, 0x00, 0x70, 0xF8, 0xF8, 0x70, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '!' // {0x00, 0x00, 0x70, 0xF8, 0xF8, 0x70, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '!'
{0x00, 0x1E, 0x3E, 0x00, 0x00, 0x3E, 0x1E, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '"' // {0x00, 0x1E, 0x3E, 0x00, 0x00, 0x3E, 0x1E, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '"'
{0x40, 0xF0, 0xF0, 0x40, 0xF0, 0xF0, 0x40, /*0x00,*/ 0x04, 0x1F, 0x1F, 0x04, 0x1F, 0x1F, 0x04}, // , 0x00}, // '#' // {0x40, 0xF0, 0xF0, 0x40, 0xF0, 0xF0, 0x40, /*0x00,*/ 0x04, 0x1F, 0x1F, 0x04, 0x1F, 0x1F, 0x04}, // , 0x00}, // '#'
{0x70, 0xF8, 0x88, 0x8F, 0x8F, 0x98, 0x30, /*0x00,*/ 0x06, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07}, // , 0x00}, // '$' // {0x70, 0xF8, 0x88, 0x8F, 0x8F, 0x98, 0x30, /*0x00,*/ 0x06, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07}, // , 0x00}, // '$'
{0x60, 0x60, 0x00, 0x00, 0x80, 0xC0, 0x60, /*0x00,*/ 0x18, 0x0C, 0x06, 0x03, 0x01, 0x18, 0x18}, // , 0x00}, // '%' // {0x60, 0x60, 0x00, 0x00, 0x80, 0xC0, 0x60, /*0x00,*/ 0x18, 0x0C, 0x06, 0x03, 0x01, 0x18, 0x18}, // , 0x00}, // '%'
{0x00, 0xB0, 0xF8, 0xC8, 0x78, 0xB0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // '&' // {0x00, 0xB0, 0xF8, 0xC8, 0x78, 0xB0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // '&'
{0x00, 0x20, 0x3E, 0x1E, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // ''' // {0x00, 0x20, 0x3E, 0x1E, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '''
{0x00, 0x00, 0xE0, 0xF0, 0x18, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x07, 0x0F, 0x18, 0x10, 0x00}, // , 0x00}, // '(' // {0x00, 0x00, 0xE0, 0xF0, 0x18, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x07, 0x0F, 0x18, 0x10, 0x00}, // , 0x00}, // '('
{0x00, 0x00, 0x08, 0x18, 0xF0, 0xE0, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x18, 0x0F, 0x07, 0x00}, // , 0x00}, // ')' // {0x00, 0x00, 0x08, 0x18, 0xF0, 0xE0, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x18, 0x0F, 0x07, 0x00}, // , 0x00}, // ')'
{0x00, 0x40, 0xC0, 0x80, 0x80, 0xC0, 0x40, /*0x00,*/ 0x01, 0x05, 0x07, 0x03, 0x03, 0x07, 0x05}, // , 0x01}, // '*' // {0x00, 0x40, 0xC0, 0x80, 0x80, 0xC0, 0x40, /*0x00,*/ 0x01, 0x05, 0x07, 0x03, 0x03, 0x07, 0x05}, // , 0x01}, // '*'
{0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, /*0x00,*/ 0x00, 0x01, 0x01, 0x07, 0x07, 0x01, 0x01}, // , 0x00}, // '+' // {0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, /*0x00,*/ 0x00, 0x01, 0x01, 0x07, 0x07, 0x01, 0x01}, // , 0x00}, // '+'
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x20, 0x3C, 0x1C, 0x00, 0x00}, // , 0x00}, // ',' // {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x20, 0x3C, 0x1C, 0x00, 0x00}, // , 0x00}, // ','
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, // , 0x00}, // '-' // {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, // , 0x00}, // '-'
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00}, // , 0x00}, // '.' // {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00}, // , 0x00}, // '.'
{0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, /*0x00,*/ 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00}, // , 0x00}, // '/' // {0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, /*0x00,*/ 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00}, // , 0x00}, // '/'
{0xF0, 0xF8, 0x08, 0x88, 0x48, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x1F, 0x12, 0x11, 0x10, 0x1F, 0x0F}, // , 0x00}, // '0' // {0xF0, 0xF8, 0x08, 0x88, 0x48, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x1F, 0x12, 0x11, 0x10, 0x1F, 0x0F}, // , 0x00}, // '0'
{0x00, 0x20, 0x30, 0xF8, 0xF8, 0x00, 0x00, /*0x00,*/ 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x10, 0x10}, // , 0x00}, // '1' // {0x00, 0x20, 0x30, 0xF8, 0xF8, 0x00, 0x00, /*0x00,*/ 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x10, 0x10}, // , 0x00}, // '1'
{0x10, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x30, /*0x00,*/ 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x18}, // , 0x00}, // '2' // {0x10, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x30, /*0x00,*/ 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x18}, // , 0x00}, // '2'
{0x10, 0x18, 0x88, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x08, 0x18, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '3' // {0x10, 0x18, 0x88, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x08, 0x18, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '3'
{0x80, 0xC0, 0x60, 0x30, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x01, 0x01, 0x01, 0x11, 0x1F, 0x1F, 0x11}, // , 0x00}, // '4' // {0x80, 0xC0, 0x60, 0x30, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x01, 0x01, 0x01, 0x11, 0x1F, 0x1F, 0x11}, // , 0x00}, // '4'
{0xF8, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x08, /*0x00,*/ 0x08, 0x18, 0x10, 0x10, 0x11, 0x1F, 0x0F}, // , 0x00}, // '5' // {0xF8, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x08, /*0x00,*/ 0x08, 0x18, 0x10, 0x10, 0x11, 0x1F, 0x0F}, // , 0x00}, // '5'
{0xE0, 0xF0, 0x98, 0x88, 0x88, 0x80, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '6' // {0xE0, 0xF0, 0x98, 0x88, 0x88, 0x80, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '6'
{0x18, 0x18, 0x08, 0x08, 0x88, 0xF8, 0x78, /*0x00,*/ 0x00, 0x00, 0x1E, 0x1F, 0x01, 0x00, 0x00}, // , 0x00}, // '7' // {0x18, 0x18, 0x08, 0x08, 0x88, 0xF8, 0x78, /*0x00,*/ 0x00, 0x00, 0x1E, 0x1F, 0x01, 0x00, 0x00}, // , 0x00}, // '7'
{0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '8' // {0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '8'
{0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0xF0, /*0x00,*/ 0x00, 0x10, 0x10, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // '9' // {0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0xF0, /*0x00,*/ 0x00, 0x10, 0x10, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // '9'
{0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // , 0x00}, // ':' // {0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // , 0x00}, // ':'
{0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1C, 0x0C, 0x00, 0x00}, // , 0x00}, // ';' // {0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1C, 0x0C, 0x00, 0x00}, // , 0x00}, // ';'
{0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x10, /*0x00,*/ 0x00, 0x01, 0x03, 0x06, 0x0C, 0x18, 0x10}, // , 0x00}, // '<' // {0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x10, /*0x00,*/ 0x00, 0x01, 0x03, 0x06, 0x0C, 0x18, 0x10}, // , 0x00}, // '<'
{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /*0x00,*/ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04}, // , 0x00}, // '=' // {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /*0x00,*/ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04}, // , 0x00}, // '='
{0x00, 0x10, 0x30, 0x60, 0xC0, 0x80, 0x00, /*0x00,*/ 0x00, 0x10, 0x18, 0x0C, 0x06, 0x03, 0x01}, // , 0x00}, // '>' // {0x00, 0x10, 0x30, 0x60, 0xC0, 0x80, 0x00, /*0x00,*/ 0x00, 0x10, 0x18, 0x0C, 0x06, 0x03, 0x01}, // , 0x00}, // '>'
{0x30, 0x38, 0x08, 0x88, 0xC8, 0x78, 0x30, /*0x00,*/ 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '?' // {0x30, 0x38, 0x08, 0x88, 0xC8, 0x78, 0x30, /*0x00,*/ 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '?'
{0xE0, 0xF0, 0x10, 0x90, 0x90, 0xF0, 0xE0, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x17, 0x17, 0x17, 0x03}, // , 0x00}, // '@' // {0xE0, 0xF0, 0x10, 0x90, 0x90, 0xF0, 0xE0, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x17, 0x17, 0x17, 0x03}, // , 0x00}, // '@'
{0xC0, 0xE0, 0x30, 0x18, 0x30, 0xE0, 0xC0, /*0x00,*/ 0x1F, 0x1F, 0x01, 0x01, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'A' // {0xC0, 0xE0, 0x30, 0x18, 0x30, 0xE0, 0xC0, /*0x00,*/ 0x1F, 0x1F, 0x01, 0x01, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'A'
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'B' // {0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'B'
{0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, /*0x00,*/ 0x07, 0x0F, 0x18, 0x10, 0x10, 0x18, 0x0C}, // , 0x00}, // 'C' // {0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, /*0x00,*/ 0x07, 0x0F, 0x18, 0x10, 0x10, 0x18, 0x0C}, // , 0x00}, // 'C'
{0x08, 0xF8, 0xF8, 0x08, 0x18, 0xF0, 0xE0, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'D' // {0x08, 0xF8, 0xF8, 0x08, 0x18, 0xF0, 0xE0, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'D'
{0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x11, 0x18, 0x1C}, // , 0x00}, // 'E' // {0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x11, 0x18, 0x1C}, // , 0x00}, // 'E'
{0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x01, 0x00, 0x00}, // , 0x00}, // 'F' // {0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x01, 0x00, 0x00}, // , 0x00}, // 'F'
{0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, /*0x00,*/ 0x07, 0x0F, 0x18, 0x11, 0x11, 0x0F, 0x1F}, // , 0x00}, // 'G' // {0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, /*0x00,*/ 0x07, 0x0F, 0x18, 0x11, 0x11, 0x0F, 0x1F}, // , 0x00}, // 'G'
{0xF8, 0xF8, 0x80, 0x80, 0x80, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'H' // {0xF8, 0xF8, 0x80, 0x80, 0x80, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'H'
{0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'I' // {0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'I'
{0x00, 0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, /*0x00,*/ 0x0E, 0x1E, 0x10, 0x10, 0x1F, 0x0F, 0x00}, // , 0x00}, // 'J' // {0x00, 0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, /*0x00,*/ 0x0E, 0x1E, 0x10, 0x10, 0x1F, 0x0F, 0x00}, // , 0x00}, // 'J'
{0x08, 0xF8, 0xF8, 0x80, 0xE0, 0x78, 0x18, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x01, 0x03, 0x1E, 0x1C}, // , 0x00}, // 'K' // {0x08, 0xF8, 0xF8, 0x80, 0xE0, 0x78, 0x18, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x01, 0x03, 0x1E, 0x1C}, // , 0x00}, // 'K'
{0x08, 0xF8, 0xF8, 0x08, 0x00, 0x00, 0x00, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x18, 0x1C}, // , 0x00}, // 'L' // {0x08, 0xF8, 0xF8, 0x08, 0x00, 0x00, 0x00, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x18, 0x1C}, // , 0x00}, // 'L'
{0xF8, 0xF8, 0x70, 0xE0, 0x70, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'M' // {0xF8, 0xF8, 0x70, 0xE0, 0x70, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'M'
{0xF8, 0xF8, 0x70, 0xE0, 0xC0, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'N' // {0xF8, 0xF8, 0x70, 0xE0, 0xC0, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'N'
{0xE0, 0xF0, 0x18, 0x08, 0x18, 0xF0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x18, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'O' // {0xE0, 0xF0, 0x18, 0x08, 0x18, 0xF0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x18, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'O'
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'P' // {0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'P'
{0xF0, 0xF8, 0x08, 0x08, 0x08, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x1C, 0x78, 0x7F, 0x4F}, // , 0x00}, // 'Q' // {0xF0, 0xF8, 0x08, 0x08, 0x08, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x1C, 0x78, 0x7F, 0x4F}, // , 0x00}, // 'Q'
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x00, 0x01, 0x1F, 0x1E}, // , 0x00}, // 'R' // {0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x00, 0x01, 0x1F, 0x1E}, // , 0x00}, // 'R'
{0x30, 0x78, 0xC8, 0x88, 0x88, 0x38, 0x30, /*0x00,*/ 0x0C, 0x1C, 0x10, 0x10, 0x11, 0x1F, 0x0E}, // , 0x00}, // 'S' // {0x30, 0x78, 0xC8, 0x88, 0x88, 0x38, 0x30, /*0x00,*/ 0x0C, 0x1C, 0x10, 0x10, 0x11, 0x1F, 0x0E}, // , 0x00}, // 'S'
{0x00, 0x38, 0x18, 0xF8, 0xF8, 0x18, 0x38, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'T' // {0x00, 0x38, 0x18, 0xF8, 0xF8, 0x18, 0x38, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'T'
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'U' // {0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'U'
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x03, 0x07, 0x0C, 0x18, 0x0C, 0x07, 0x03}, // , 0x00}, // 'V' // {0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x03, 0x07, 0x0C, 0x18, 0x0C, 0x07, 0x03}, // , 0x00}, // 'V'
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x07, 0x1F, 0x1C, 0x07, 0x1C, 0x1F, 0x07}, // , 0x00}, // 'W' // {0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x07, 0x1F, 0x1C, 0x07, 0x1C, 0x1F, 0x07}, // , 0x00}, // 'W'
{0x18, 0x78, 0xE0, 0x80, 0xE0, 0x78, 0x18, /*0x00,*/ 0x18, 0x1E, 0x07, 0x01, 0x07, 0x1E, 0x18}, // , 0x00}, // 'X' // {0x18, 0x78, 0xE0, 0x80, 0xE0, 0x78, 0x18, /*0x00,*/ 0x18, 0x1E, 0x07, 0x01, 0x07, 0x1E, 0x18}, // , 0x00}, // 'X'
{0x00, 0x78, 0xF8, 0x80, 0x80, 0xF8, 0x78, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'Y' // {0x00, 0x78, 0xF8, 0x80, 0x80, 0xF8, 0x78, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'Y'
{0x38, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x38, /*0x00,*/ 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x1C}, // , 0x00}, // 'Z' // {0x38, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x38, /*0x00,*/ 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x1C}, // , 0x00}, // 'Z'
{0x00, 0x00, 0xF8, 0xF8, 0x08, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x1F, 0x1F, 0x10, 0x10, 0x00}, // , 0x00}, // '[' // {0x00, 0x00, 0xF8, 0xF8, 0x08, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x1F, 0x1F, 0x10, 0x10, 0x00}, // , 0x00}, // '['
{0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E, 0x1C}, // , 0x00}, // '"\' // {0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E, 0x1C}, // , 0x00}, // '"\'
{0x00, 0x00, 0x08, 0x08, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x00}, // , 0x00}, // ']' // {0x00, 0x00, 0x08, 0x08, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x00}, // , 0x00}, // ']'
{0x10, 0x18, 0x0E, 0x07, 0x0E, 0x18, 0x10, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '^' // {0x10, 0x18, 0x0E, 0x07, 0x0E, 0x18, 0x10, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '^'
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}, // , 0x40}, // '_' // {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}, // , 0x40}, // '_'
{0x00, 0x00, 0x07, 0x0F, 0x08, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '`' // {0x00, 0x00, 0x07, 0x0F, 0x08, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '`'
{0x00, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, /*0x00,*/ 0x0E, 0x1F, 0x11, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'a' // {0x00, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, /*0x00,*/ 0x0E, 0x1F, 0x11, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'a'
{0x08, 0xF8, 0xF8, 0x40, 0xC0, 0x80, 0x00, /*0x00,*/ 0x10, 0x1F, 0x0F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'b' // {0x08, 0xF8, 0xF8, 0x40, 0xC0, 0x80, 0x00, /*0x00,*/ 0x10, 0x1F, 0x0F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'b'
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x18, 0x08}, // , 0x00}, // 'c' // {0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x18, 0x08}, // , 0x00}, // 'c'
{0x00, 0x80, 0xC0, 0x48, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'd' // {0x00, 0x80, 0xC0, 0x48, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'd'
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x11, 0x11, 0x11, 0x19, 0x09}, // , 0x00}, // 'e' // {0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x11, 0x11, 0x11, 0x19, 0x09}, // , 0x00}, // 'e'
{0x80, 0xF0, 0xF8, 0x88, 0x18, 0x30, 0x00, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'f' // {0x80, 0xF0, 0xF8, 0x88, 0x18, 0x30, 0x00, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'f'
{0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, /*0x00,*/ 0x4F, 0xDF, 0x90, 0x90, 0xFF, 0x7F, 0x00}, // , 0x00}, // 'g' // {0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, /*0x00,*/ 0x4F, 0xDF, 0x90, 0x90, 0xFF, 0x7F, 0x00}, // , 0x00}, // 'g'
{0x08, 0xF8, 0xF8, 0x80, 0x40, 0xC0, 0x80, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'h' // {0x08, 0xF8, 0xF8, 0x80, 0x40, 0xC0, 0x80, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'h'
{0x00, 0x00, 0x40, 0xD8, 0xD8, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'i' // {0x00, 0x00, 0x40, 0xD8, 0xD8, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'i'
{0x00, 0x00, 0x00, 0x00, 0x40, 0xD8, 0xD8, /*0x00,*/ 0x00, 0x60, 0xE0, 0x80, 0x80, 0xFF, 0x7F}, // , 0x00}, // 'j' // {0x00, 0x00, 0x00, 0x00, 0x40, 0xD8, 0xD8, /*0x00,*/ 0x00, 0x60, 0xE0, 0x80, 0x80, 0xFF, 0x7F}, // , 0x00}, // 'j'
{0x08, 0xF8, 0xF8, 0x00, 0x80, 0xC0, 0x40, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x03, 0x07, 0x1C, 0x18}, // , 0x00}, // 'k' // {0x08, 0xF8, 0xF8, 0x00, 0x80, 0xC0, 0x40, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x03, 0x07, 0x1C, 0x18}, // , 0x00}, // 'k'
{0x00, 0x00, 0x08, 0xF8, 0xF8, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'l' // {0x00, 0x00, 0x08, 0xF8, 0xF8, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'l'
{0xC0, 0xC0, 0xC0, 0x80, 0xC0, 0xC0, 0x80, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'm' // {0xC0, 0xC0, 0xC0, 0x80, 0xC0, 0xC0, 0x80, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'm'
{0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'n' // {0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'n'
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'o' // {0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'o'
{0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x80, 0xFF, 0xFF, 0x90, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'p' // {0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x80, 0xFF, 0xFF, 0x90, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'p'
{0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x90, 0xFF, 0xFF, 0x80}, // , 0x00}, // 'q' // {0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x90, 0xFF, 0xFF, 0x80}, // , 0x00}, // 'q'
{0x40, 0xC0, 0x80, 0xC0, 0x40, 0xC0, 0x80, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x01}, // , 0x00}, // 'r' // {0x40, 0xC0, 0x80, 0xC0, 0x40, 0xC0, 0x80, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x01}, // , 0x00}, // 'r'
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x08, 0x19, 0x13, 0x12, 0x16, 0x1C, 0x08}, // , 0x00}, // 's' // {0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x08, 0x19, 0x13, 0x12, 0x16, 0x1C, 0x08}, // , 0x00}, // 's'
{0x40, 0x40, 0xF0, 0xF8, 0x40, 0x40, 0x00, /*0x00,*/ 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x18, 0x08}, // , 0x00}, // 't' // {0x40, 0x40, 0xF0, 0xF8, 0x40, 0x40, 0x00, /*0x00,*/ 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x18, 0x08}, // , 0x00}, // 't'
{0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'u' // {0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'u'
{0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x00, 0x07, 0x0F, 0x18, 0x18, 0x0F, 0x07}, // , 0x00}, // 'v' // {0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x00, 0x07, 0x0F, 0x18, 0x18, 0x0F, 0x07}, // , 0x00}, // 'v'
{0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x0F, 0x1F, 0x18, 0x0E, 0x18, 0x1F, 0x0F}, // , 0x00}, // 'w' // {0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x0F, 0x1F, 0x18, 0x0E, 0x18, 0x1F, 0x0F}, // , 0x00}, // 'w'
{0x40, 0xC0, 0x80, 0x00, 0x80, 0xC0, 0x40, /*0x00,*/ 0x10, 0x18, 0x0F, 0x07, 0x0F, 0x18, 0x10}, // , 0x00}, // 'x' // {0x40, 0xC0, 0x80, 0x00, 0x80, 0xC0, 0x40, /*0x00,*/ 0x10, 0x18, 0x0F, 0x07, 0x0F, 0x18, 0x10}, // , 0x00}, // 'x'
{0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x8F, 0x9F, 0x90, 0x90, 0xD0, 0x7F, 0x3F}, // , 0x00}, // 'y' // {0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x8F, 0x9F, 0x90, 0x90, 0xD0, 0x7F, 0x3F}, // , 0x00}, // 'y'
{0xC0, 0xC0, 0x40, 0x40, 0xC0, 0xC0, 0x40, /*0x00,*/ 0x18, 0x1C, 0x16, 0x13, 0x11, 0x18, 0x18}, // , 0x00}, // 'z' // {0xC0, 0xC0, 0x40, 0x40, 0xC0, 0xC0, 0x40, /*0x00,*/ 0x18, 0x1C, 0x16, 0x13, 0x11, 0x18, 0x18}, // , 0x00}, // 'z'
{0x00, 0x80, 0x80, 0xF0, 0x78, 0x08, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10}, // , 0x00}, // '{' // {0x00, 0x80, 0x80, 0xF0, 0x78, 0x08, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10}, // , 0x00}, // '{'
{0x00, 0x00, 0x00, 0x78, 0x78, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00}, // , 0x00}, // '|' // {0x00, 0x00, 0x00, 0x78, 0x78, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00}, // , 0x00}, // '|'
{0x00, 0x08, 0x08, 0x78, 0xF0, 0x80, 0x80, /*0x00,*/ 0x00, 0x10, 0x10, 0x1F, 0x0F, 0x00, 0x00}, // , 0x00}, // '}' // {0x00, 0x08, 0x08, 0x78, 0xF0, 0x80, 0x80, /*0x00,*/ 0x00, 0x10, 0x10, 0x1F, 0x0F, 0x00, 0x00}, // , 0x00}, // '}'
{0x10, 0x18, 0x08, 0x18, 0x10, 0x18, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // , 0x00} // '->' // {0x10, 0x18, 0x08, 0x18, 0x10, 0x18, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // , 0x00} // '->'
#else //#else
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' ' // // {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
{0x00, 0x00, 0x00, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00}, // '!' // {0x00, 0x00, 0x00, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00}, // '!'
{0x00, 0x0F, 0x1F, 0x00, 0x00, 0x1F, 0x0F, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '"' // {0x00, 0x0F, 0x1F, 0x00, 0x00, 0x1F, 0x0F, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '"'
{0x20, 0xF8, 0xF8, 0x20, 0xF8, 0xF8, 0x20, /*0x00,*/ 0x02, 0x0F, 0x0F, 0x02, 0x0F, 0x0F, 0x02}, // '#' // {0x20, 0xF8, 0xF8, 0x20, 0xF8, 0xF8, 0x20, /*0x00,*/ 0x02, 0x0F, 0x0F, 0x02, 0x0F, 0x0F, 0x02}, // '#'
{0x70, 0xF8, 0x88, 0x8E, 0x8E, 0x98, 0x10, /*0x00,*/ 0x04, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07}, // '$' // {0x70, 0xF8, 0x88, 0x8E, 0x8E, 0x98, 0x10, /*0x00,*/ 0x04, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07}, // '$'
{0x30, 0x30, 0x00, 0x80, 0xC0, 0x60, 0x30, /*0x00,*/ 0x0C, 0x06, 0x03, 0x01, 0x00, 0x0C, 0x0C}, // '%' // {0x30, 0x30, 0x00, 0x80, 0xC0, 0x60, 0x30, /*0x00,*/ 0x0C, 0x06, 0x03, 0x01, 0x00, 0x0C, 0x0C}, // '%'
{0x80, 0xD8, 0x7C, 0xE4, 0xBC, 0xD8, 0x40, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x07, 0x0F, 0x08}, // '&' // {0x80, 0xD8, 0x7C, 0xE4, 0xBC, 0xD8, 0x40, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x07, 0x0F, 0x08}, // '&'
{0x00, 0x10, 0x1F, 0x0F, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ''' // {0x00, 0x10, 0x1F, 0x0F, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '''
{0x00, 0x00, 0xF0, 0xF8, 0x0C, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x03, 0x07, 0x0C, 0x08, 0x00}, // '(' // {0x00, 0x00, 0xF0, 0xF8, 0x0C, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x03, 0x07, 0x0C, 0x08, 0x00}, // '('
{0x00, 0x00, 0x04, 0x0C, 0xF8, 0xF0, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0C, 0x07, 0x03, 0x00}, // ')' // {0x00, 0x00, 0x04, 0x0C, 0xF8, 0xF0, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0C, 0x07, 0x03, 0x00}, // ')'
{0x00, 0x80, 0xA0, 0xE0, 0xC0, 0xE0, 0xA0, /*0x80,*/ 0x00, 0x00, 0x02, 0x03, 0x01, 0x03, 0x02}, // '*' // {0x00, 0x80, 0xA0, 0xE0, 0xC0, 0xE0, 0xA0, /*0x80,*/ 0x00, 0x00, 0x02, 0x03, 0x01, 0x03, 0x02}, // '*'
{0x00, 0x80, 0x80, 0xE0, 0xE0, 0x80, 0x80, /*0x00,*/ 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00}, // '+' // {0x00, 0x80, 0x80, 0xE0, 0xE0, 0x80, 0x80, /*0x00,*/ 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00}, // '+'
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1E, 0x0E, 0x00, 0x00}, // ',' // {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1E, 0x0E, 0x00, 0x00}, // ','
{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '-' // {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '-'
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // '.' // {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // '.'
{0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, /*0x00,*/ 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00}, // '/' // {0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, /*0x00,*/ 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00}, // '/'
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '0' // {0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '0'
{0x00, 0x10, 0x18, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x08, 0x08}, // '1' // {0x00, 0x10, 0x18, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x08, 0x08}, // '1'
{0x18, 0x1C, 0x04, 0x84, 0xC4, 0x7C, 0x38, /*0x00,*/ 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08}, // '2' // {0x18, 0x1C, 0x04, 0x84, 0xC4, 0x7C, 0x38, /*0x00,*/ 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08}, // '2'
{0x18, 0x1C, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '3' // {0x18, 0x1C, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '3'
{0x80, 0xC0, 0x60, 0x30, 0x18, 0xFC, 0xFC, /*0x00,*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x0F}, // '4' // {0x80, 0xC0, 0x60, 0x30, 0x18, 0xFC, 0xFC, /*0x00,*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x0F}, // '4'
{0x7C, 0x7C, 0x44, 0x44, 0x44, 0xC4, 0x84, /*0x00,*/ 0x04, 0x0C, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '5' // {0x7C, 0x7C, 0x44, 0x44, 0x44, 0xC4, 0x84, /*0x00,*/ 0x04, 0x0C, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '5'
{0xF0, 0xF8, 0x4C, 0x44, 0x44, 0xC4, 0x80, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '6' // {0xF0, 0xF8, 0x4C, 0x44, 0x44, 0xC4, 0x80, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '6'
{0x04, 0x04, 0x04, 0x84, 0xE4, 0x7C, 0x1C, /*0x00,*/ 0x00, 0x00, 0x0E, 0x0F, 0x01, 0x00, 0x00}, // '7' // {0x04, 0x04, 0x04, 0x84, 0xE4, 0x7C, 0x1C, /*0x00,*/ 0x00, 0x00, 0x0E, 0x0F, 0x01, 0x00, 0x00}, // '7'
{0xB8, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '8' // {0xB8, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '8'
{0x78, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, /*0x00,*/ 0x00, 0x08, 0x08, 0x08, 0x0C, 0x07, 0x03}, // '9' // {0x78, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, /*0x00,*/ 0x00, 0x08, 0x08, 0x08, 0x0C, 0x07, 0x03}, // '9'
{0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00}, // ':' // {0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00}, // ':'
{0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0E, 0x06, 0x00, 0x00}, // ';' // {0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0E, 0x06, 0x00, 0x00}, // ';'
{0x00, 0x80, 0xC0, 0x60, 0x30, 0x18, 0x08, /*0x00,*/ 0x00, 0x00, 0x01, 0x03, 0x06, 0x0C, 0x08}, // '<' // {0x00, 0x80, 0xC0, 0x60, 0x30, 0x18, 0x08, /*0x00,*/ 0x00, 0x00, 0x01, 0x03, 0x06, 0x0C, 0x08}, // '<'
{0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /*0x00,*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}, // '=' // {0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /*0x00,*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}, // '='
{0x00, 0x08, 0x18, 0x30, 0x60, 0xC0, 0x80, /*0x00,*/ 0x00, 0x08, 0x0C, 0x06, 0x03, 0x01, 0x00}, // '>' // {0x00, 0x08, 0x18, 0x30, 0x60, 0xC0, 0x80, /*0x00,*/ 0x00, 0x08, 0x0C, 0x06, 0x03, 0x01, 0x00}, // '>'
{0x38, 0x3C, 0x04, 0x84, 0xC4, 0x7C, 0x38, /*0x00,*/ 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00}, // '?' // {0x38, 0x3C, 0x04, 0x84, 0xC4, 0x7C, 0x38, /*0x00,*/ 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00}, // '?'
{0xF0, 0xF8, 0x08, 0xC8, 0xC8, 0xF8, 0xF0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x01}, // '@' // {0xF0, 0xF8, 0x08, 0xC8, 0xC8, 0xF8, 0xF0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x01}, // '@'
{0xF8, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'A' // {0xF8, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'A'
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'B' // {0xFC, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'B'
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0x1C, 0x18, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0E, 0x06}, // 'C' // {0xF8, 0xFC, 0x04, 0x04, 0x04, 0x1C, 0x18, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0E, 0x06}, // 'C'
{0xFC, 0xFC, 0x04, 0x04, 0x0C, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x0C, 0x07, 0x03}, // 'D' // {0xFC, 0xFC, 0x04, 0x04, 0x0C, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x0C, 0x07, 0x03}, // 'D'
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08}, // 'E' // {0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08}, // 'E'
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'F' // {0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'F'
{0xF8, 0xFC, 0x04, 0x84, 0x84, 0x9C, 0x98, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'G' // {0xF8, 0xFC, 0x04, 0x84, 0x84, 0x9C, 0x98, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'G'
{0xFC, 0xFC, 0x40, 0x40, 0x40, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'H' // {0xFC, 0xFC, 0x40, 0x40, 0x40, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'H'
{0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'I' // {0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'I'
{0x00, 0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x0F, 0x07, 0x00}, // 'J' // {0x00, 0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x0F, 0x07, 0x00}, // 'J'
{0xFC, 0xFC, 0xE0, 0x30, 0x18, 0x0C, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'K' // {0xFC, 0xFC, 0xE0, 0x30, 0x18, 0x0C, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'K'
{0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08}, // 'L' // {0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08}, // 'L'
{0xFC, 0xFC, 0x18, 0x70, 0x18, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'M' // {0xFC, 0xFC, 0x18, 0x70, 0x18, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'M'
{0xFC, 0xFC, 0x60, 0xC0, 0x80, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x01, 0x0F, 0x0F}, // 'N' // {0xFC, 0xFC, 0x60, 0xC0, 0x80, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x01, 0x0F, 0x0F}, // 'N'
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'O' // {0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'O'
{0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'P' // {0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'P'
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0C, 0x0C, 0x1F, 0x17}, // 'Q' // {0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0C, 0x0C, 0x1F, 0x17}, // 'Q'
{0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'R' // {0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'R'
{0x38, 0x7C, 0x44, 0x44, 0x44, 0xCC, 0x88, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'S' // {0x38, 0x7C, 0x44, 0x44, 0x44, 0xCC, 0x88, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'S'
{0x00, 0x04, 0x04, 0xFC, 0xFC, 0x04, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // 'T' // {0x00, 0x04, 0x04, 0xFC, 0xFC, 0x04, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // 'T'
{0xFC, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0xFC, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'U' // {0xFC, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0xFC, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'U'
{0x7C, 0xFC, 0x80, 0x00, 0x80, 0xFC, 0x7C, /*0x00,*/ 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00}, // 'V' // {0x7C, 0xFC, 0x80, 0x00, 0x80, 0xFC, 0x7C, /*0x00,*/ 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00}, // 'V'
{0xFC, 0xFC, 0x00, 0x80, 0x00, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x06, 0x03, 0x06, 0x0F, 0x0F}, // 'W' // {0xFC, 0xFC, 0x00, 0x80, 0x00, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x06, 0x03, 0x06, 0x0F, 0x0F}, // 'W'
{0x0C, 0x3C, 0xF0, 0xC0, 0xF0, 0x3C, 0x0C, /*0x00,*/ 0x0C, 0x0F, 0x03, 0x00, 0x03, 0x0F, 0x0C}, // 'X' // {0x0C, 0x3C, 0xF0, 0xC0, 0xF0, 0x3C, 0x0C, /*0x00,*/ 0x0C, 0x0F, 0x03, 0x00, 0x03, 0x0F, 0x0C}, // 'X'
{0x00, 0x3C, 0x7C, 0xC0, 0xC0, 0x7C, 0x3C, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // 'Y' // {0x00, 0x3C, 0x7C, 0xC0, 0xC0, 0x7C, 0x3C, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // 'Y'
{0x04, 0x04, 0x84, 0xC4, 0x64, 0x3C, 0x1C, /*0x00,*/ 0x0E, 0x0F, 0x09, 0x08, 0x08, 0x08, 0x08}, // 'Z' // {0x04, 0x04, 0x84, 0xC4, 0x64, 0x3C, 0x1C, /*0x00,*/ 0x0E, 0x0F, 0x09, 0x08, 0x08, 0x08, 0x08}, // 'Z'
{0x00, 0x00, 0xFC, 0xFC, 0x04, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x00}, // '[' // {0x00, 0x00, 0xFC, 0xFC, 0x04, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x00}, // '['
{0x38, 0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E}, // '"\' // {0x38, 0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E}, // '"\'
{0x00, 0x00, 0x04, 0x04, 0xFC, 0xFC, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x00}, // ']' // {0x00, 0x00, 0x04, 0x04, 0xFC, 0xFC, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x00}, // ']'
{0x08, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '^' // {0x08, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '^'
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}, // '_' // {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}, // '_'
{0x00, 0x00, 0x03, 0x07, 0x04, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '`' // {0x00, 0x00, 0x03, 0x07, 0x04, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '`'
{0x00, 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'a' // {0x00, 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'a'
{0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'b' // {0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'b'
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0x60, 0x40, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0C, 0x04}, // 'c' // {0xC0, 0xE0, 0x20, 0x20, 0x20, 0x60, 0x40, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0C, 0x04}, // 'c'
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xFC, 0xFC, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'd' // {0xC0, 0xE0, 0x20, 0x20, 0x20, 0xFC, 0xFC, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'd'
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x09, 0x09, 0x09, 0x09, 0x01}, // 'e' // {0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x09, 0x09, 0x09, 0x09, 0x01}, // 'e'
{0x20, 0x20, 0xF8, 0xFC, 0x24, 0x24, 0x04, /*0x00,*/ 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00}, // 'f' // {0x20, 0x20, 0xF8, 0xFC, 0x24, 0x24, 0x04, /*0x00,*/ 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00}, // 'f'
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F}, // 'g' // {0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F}, // 'g'
{0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'h' // {0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'h'
{0x00, 0x00, 0x20, 0xEC, 0xEC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'i' // {0x00, 0x00, 0x20, 0xEC, 0xEC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'i'
{0x00, 0x00, 0x00, 0x00, 0x20, 0xEC, 0xEC, /*0x00,*/ 0x00, 0x30, 0x70, 0x40, 0x40, 0x7F, 0x3F}, // 'j' // {0x00, 0x00, 0x00, 0x00, 0x20, 0xEC, 0xEC, /*0x00,*/ 0x00, 0x30, 0x70, 0x40, 0x40, 0x7F, 0x3F}, // 'j'
{0xFC, 0xFC, 0x00, 0x80, 0xC0, 0x60, 0x20, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'k' // {0xFC, 0xFC, 0x00, 0x80, 0xC0, 0x60, 0x20, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'k'
{0x00, 0x00, 0x04, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'l' // {0x00, 0x00, 0x04, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'l'
{0xE0, 0xE0, 0x20, 0xE0, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x0F}, // 'm' // {0xE0, 0xE0, 0x20, 0xE0, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x0F}, // 'm'
{0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'n' // {0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'n'
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'o' // {0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'o'
{0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x7F, 0x7F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'p' // {0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x7F, 0x7F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'p'
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x7F, 0x7F}, // 'q' // {0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x7F, 0x7F}, // 'q'
{0xE0, 0xE0, 0x60, 0x20, 0x20, 0x20, 0x20, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'r' // {0xE0, 0xE0, 0x60, 0x20, 0x20, 0x20, 0x20, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'r'
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, /*0x00,*/ 0x08, 0x09, 0x09, 0x09, 0x09, 0x0F, 0x06}, // 's' // {0xC0, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, /*0x00,*/ 0x08, 0x09, 0x09, 0x09, 0x09, 0x0F, 0x06}, // 's'
{0x20, 0x20, 0xFC, 0xFC, 0x20, 0x20, 0x00, /*0x00,*/ 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08}, // 't' // {0x20, 0x20, 0xFC, 0xFC, 0x20, 0x20, 0x00, /*0x00,*/ 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08}, // 't'
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'u' // {0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'u'
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00}, // 'v' // {0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00}, // 'v'
{0xE0, 0xE0, 0x00, 0x80, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0F, 0x08, 0x0F, 0x07}, // 'w' // {0xE0, 0xE0, 0x00, 0x80, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0F, 0x08, 0x0F, 0x07}, // 'w'
{0x60, 0xE0, 0x80, 0x00, 0x80, 0xE0, 0x60, /*0x00,*/ 0x0C, 0x0E, 0x03, 0x01, 0x03, 0x0E, 0x0C}, // 'x' // {0x60, 0xE0, 0x80, 0x00, 0x80, 0xE0, 0x60, /*0x00,*/ 0x0C, 0x0E, 0x03, 0x01, 0x03, 0x0E, 0x0C}, // 'x'
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F}, // 'y' // {0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F}, // 'y'
{0x20, 0x20, 0x20, 0xA0, 0xE0, 0x60, 0x20, /*0x00,*/ 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08}, // 'z' // {0x20, 0x20, 0x20, 0xA0, 0xE0, 0x60, 0x20, /*0x00,*/ 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08}, // 'z'
{0x00, 0x00, 0x40, 0xF8, 0xBC, 0x04, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08}, // '{' // {0x00, 0x00, 0x40, 0xF8, 0xBC, 0x04, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08}, // '{'
{0x00, 0x00, 0x00, 0xBC, 0xBC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // '|' // {0x00, 0x00, 0x00, 0xBC, 0xBC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // '|'
{0x00, 0x04, 0x04, 0xBC, 0xF8, 0x40, 0x00, /*0x00,*/ 0x00, 0x08, 0x08, 0x0F, 0x07, 0x00, 0x00}, // '}' // {0x00, 0x04, 0x04, 0xBC, 0xF8, 0x40, 0x00, /*0x00,*/ 0x00, 0x08, 0x08, 0x0F, 0x07, 0x00, 0x00}, // '}'
{0x08, 0x0C, 0x04, 0x0C, 0x08, 0x0C, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // '->' // {0x08, 0x0C, 0x04, 0x0C, 0x08, 0x0C, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // '->'
#endif //#endif
}; //};
#if 0 #if 0
// original font // original font
@@ -252,20 +252,20 @@ const uint8_t gFontBig[95 - 1][16 - 2] =
#else #else
// Terminus font // Terminus font
const uint8_t gFontBigDigits[11][26 - 6] = // const uint8_t gFontBigDigits[11][26 - 6] =
{ // {
{/*0x00, 0x00,*/ 0xFC, 0xFE, 0xFE, 0x06, 0x06, 0x06, 0x06, 0xFE, 0xFE, 0xFC, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/}, // {/*0x00, 0x00,*/ 0xFC, 0xFE, 0xFE, 0x06, 0x06, 0x06, 0x06, 0xFE, 0xFE, 0xFC, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/},
{/*0x00, 0x00,*/ 0x00, 0x00, 0x18, 0x1C, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x60, 0x60, 0x7F, 0x7F, 0x7F, 0x60, 0x60, 0x00, /*0x00*/}, // {/*0x00, 0x00,*/ 0x00, 0x00, 0x18, 0x1C, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x60, 0x60, 0x7F, 0x7F, 0x7F, 0x60, 0x60, 0x00, /*0x00*/},
{/*0x00, 0x00,*/ 0x1C, 0x1E, 0x1E, 0x06, 0x06, 0x06, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x60, 0x70, 0x78, 0x7C, 0x6E, 0x67, 0x63, 0x61, 0x60, 0x60, /*0x00*/}, // {/*0x00, 0x00,*/ 0x1C, 0x1E, 0x1E, 0x06, 0x06, 0x06, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x60, 0x70, 0x78, 0x7C, 0x6E, 0x67, 0x63, 0x61, 0x60, 0x60, /*0x00*/},
{/*0x00, 0x00,*/ 0x0C, 0x0E, 0x0E, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x30, 0x70, 0x70, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3E, /*0x00*/}, // {/*0x00, 0x00,*/ 0x0C, 0x0E, 0x0E, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x30, 0x70, 0x70, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3E, /*0x00*/},
{/*0x00, 0x00,*/ 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0xFE, 0xFE, 0xFE, /*0x00,*/ /*0x00, 0x00,*/ 0x0F, 0x0F, 0x0F, 0x0C, 0x0C, 0x0C, 0x0C, 0x7F, 0x7F, 0x7F, /*0x00*/}, // {/*0x00, 0x00,*/ 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0xFE, 0xFE, 0xFE, /*0x00,*/ /*0x00, 0x00,*/ 0x0F, 0x0F, 0x0F, 0x0C, 0x0C, 0x0C, 0x0C, 0x7F, 0x7F, 0x7F, /*0x00*/},
{/*0x00, 0x00,*/ 0xFE, 0xFE, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x86, /*0x00,*/ /*0x00, 0x00,*/ 0x30, 0x70, 0x70, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/}, // {/*0x00, 0x00,*/ 0xFE, 0xFE, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x86, /*0x00,*/ /*0x00, 0x00,*/ 0x30, 0x70, 0x70, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/},
{/*0x00, 0x00,*/ 0xF8, 0xFC, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x80, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/}, // {/*0x00, 0x00,*/ 0xF8, 0xFC, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x80, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/},
{/*0x00, 0x00,*/ 0x0E, 0x0E, 0x0E, 0x06, 0x06, 0x86, 0xE6, 0xFE, 0x7E, 0x1E, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x7C, 0x7F, 0x7F, 0x03, 0x00, 0x00, /*0x00*/}, // {/*0x00, 0x00,*/ 0x0E, 0x0E, 0x0E, 0x06, 0x06, 0x86, 0xE6, 0xFE, 0x7E, 0x1E, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x7C, 0x7F, 0x7F, 0x03, 0x00, 0x00, /*0x00*/},
{/*0x00, 0x00,*/ 0x7C, 0xFE, 0xFE, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3F, /*0x00*/}, // {/*0x00, 0x00,*/ 0x7C, 0xFE, 0xFE, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3F, /*0x00*/},
{/*0x00, 0x00,*/ 0xFC, 0xFE, 0xFE, 0x06, 0x06, 0x06, 0x06, 0xFE, 0xFE, 0xFC, /*0x00,*/ /*0x00, 0x00,*/ 0x01, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x7F, 0x3F, 0x1F, /*0x00*/}, // {/*0x00, 0x00,*/ 0xFC, 0xFE, 0xFE, 0x06, 0x06, 0x06, 0x06, 0xFE, 0xFE, 0xFC, /*0x00,*/ /*0x00, 0x00,*/ 0x01, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x7F, 0x3F, 0x1F, /*0x00*/},
{/*0x00, 0x00,*/ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, /*0x00*/} // {/*0x00, 0x00,*/ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, /*0x00*/}
}; // };
#endif #endif
/* /*
const uint8_t gFontSmallDigits[11][7] = const uint8_t gFontSmallDigits[11][7] =

View File

@@ -94,18 +94,18 @@ const uint16_t gStepFrequencyTable[] = {
const STEP_Setting_t StepSortedIndexes[] = { const STEP_Setting_t StepSortedIndexes[] = {
STEP_0_01kHz, STEP_0_05kHz, STEP_0_1kHz, STEP_0_25kHz, STEP_0_5kHz, STEP_1kHz, STEP_1_25kHz, STEP_2_5kHz, STEP_5kHz, STEP_6_25kHz, STEP_0_01kHz, STEP_0_05kHz, STEP_0_1kHz, STEP_0_25kHz, STEP_0_5kHz, STEP_1kHz, STEP_1_25kHz, STEP_2_5kHz,
STEP_8_33kHz, STEP_9kHz, STEP_10kHz, STEP_12_5kHz, STEP_15kHz, STEP_20kHz, STEP_25kHz, STEP_30kHz, STEP_50kHz, STEP_100kHz, STEP_5kHz, STEP_6_25kHz,
STEP_8_33kHz, STEP_9kHz, STEP_10kHz, STEP_12_5kHz, STEP_15kHz, STEP_20kHz, STEP_25kHz, STEP_30kHz, STEP_50kHz,
STEP_100kHz,
STEP_125kHz, STEP_200kHz, STEP_250kHz, STEP_500kHz STEP_125kHz, STEP_200kHz, STEP_250kHz, STEP_500kHz
}; };
STEP_Setting_t FREQUENCY_GetStepIdxFromSortedIdx(uint8_t sortedIdx) STEP_Setting_t FREQUENCY_GetStepIdxFromSortedIdx(uint8_t sortedIdx) {
{
return StepSortedIndexes[sortedIdx]; return StepSortedIndexes[sortedIdx];
} }
uint32_t FREQUENCY_GetSortedIdxFromStepIdx(uint8_t stepIdx) uint32_t FREQUENCY_GetSortedIdxFromStepIdx(uint8_t stepIdx) {
{
for (uint8_t i = 0; i < ARRAY_SIZE(gStepFrequencyTable); i++) for (uint8_t i = 0; i < ARRAY_SIZE(gStepFrequencyTable); i++)
if (StepSortedIndexes[i] == stepIdx) if (StepSortedIndexes[i] == stepIdx)
return i; return i;
@@ -115,8 +115,7 @@ uint32_t FREQUENCY_GetSortedIdxFromStepIdx(uint8_t stepIdx)
static_assert(ARRAY_SIZE(gStepFrequencyTable) == STEP_N_ELEM); static_assert(ARRAY_SIZE(gStepFrequencyTable) == STEP_N_ELEM);
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency) FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency) {
{
for (int32_t band = BAND_N_ELEM - 1; band >= 0; band--) for (int32_t band = BAND_N_ELEM - 1; band >= 0; band--)
if (Frequency >= frequencyBandTable[band].lower) if (Frequency >= frequencyBandTable[band].lower)
return (FREQUENCY_Band_t) band; return (FREQUENCY_Band_t) band;
@@ -124,16 +123,16 @@ FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency)
return BAND1_50MHz; return BAND1_50MHz;
} }
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency) uint8_t
{ FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle,
int32_t UpperLimit, int32_t Frequency) {
if (Frequency <= LowerLimit) if (Frequency <= LowerLimit)
return TxpLow; return TxpLow;
if (UpperLimit <= Frequency) if (UpperLimit <= Frequency)
return TxpHigh; return TxpHigh;
if (Frequency <= Middle) if (Frequency <= Middle) {
{
TxpMid += ((TxpMid - TxpLow) * (Frequency - LowerLimit)) / (Middle - LowerLimit); TxpMid += ((TxpMid - TxpLow) * (Frequency - LowerLimit)) / (Middle - LowerLimit);
return TxpMid; return TxpMid;
} }
@@ -144,11 +143,11 @@ uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t T
} }
uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step) uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step) {
{
if (step == 833) { if (step == 833) {
uint32_t base = freq / 2500 * 2500; uint32_t base = freq / 2500 * 2500;
int chno = (freq - base) / 700; // convert entered aviation 8.33Khz channel number scheme to actual frequency. int chno =
(freq - base) / 700; // convert entered aviation 8.33Khz channel number scheme to actual frequency.
return base + (chno * 833) + (chno == 3); return base + (chno * 833) + (chno == 3);
} }
@@ -159,8 +158,7 @@ uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step)
return (freq + (step + 1) / 2) / step * step; return (freq + (step + 1) / 2) / step * step;
} }
int32_t TX_freq_check(const uint32_t Frequency) int32_t TX_freq_check(const uint32_t Frequency) { // return '0' if TX frequency is allowed
{ // return '0' if TX frequency is allowed
// otherwise return '-1' // otherwise return '-1'
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper) if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper)
@@ -169,66 +167,58 @@ int32_t TX_freq_check(const uint32_t Frequency)
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower) if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
return -1; // BX chip does not work in this range return -1; // BX chip does not work in this range
switch (gSetting_F_LOCK) switch (gSetting_F_LOCK) {
{
case F_LOCK_DEF: case F_LOCK_DEF:
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < frequencyBandTable[BAND3_137MHz].upper) if (Frequency >= frequencyBandTable[BAND3_137MHz].lower &&
Frequency < frequencyBandTable[BAND3_137MHz].upper)
return 0; return 0;
if (Frequency >= frequencyBandTable[BAND4_174MHz].lower && Frequency < frequencyBandTable[BAND4_174MHz].upper) if (Frequency >= frequencyBandTable[BAND4_174MHz].lower &&
#ifndef ENABLE_FEAT_F4HWN Frequency < frequencyBandTable[BAND4_174MHz].upper)
if (gSetting_200TX)
#endif
return 0; return 0;
if (Frequency >= frequencyBandTable[BAND5_350MHz].lower && Frequency < frequencyBandTable[BAND5_350MHz].upper) if (Frequency >= frequencyBandTable[BAND5_350MHz].lower &&
#ifndef ENABLE_FEAT_F4HWN Frequency < frequencyBandTable[BAND5_350MHz].upper)
if (gSetting_350TX && gSetting_350EN)
#else
if (gSetting_350EN)
#endif
return 0; return 0;
if (Frequency >= frequencyBandTable[BAND6_400MHz].lower && Frequency < frequencyBandTable[BAND6_400MHz].upper) if (Frequency >= frequencyBandTable[BAND6_400MHz].lower &&
Frequency < frequencyBandTable[BAND6_400MHz].upper)
return 0; return 0;
if (Frequency >= frequencyBandTable[BAND7_470MHz].lower && Frequency <= 60000000) if (Frequency >= frequencyBandTable[BAND7_470MHz].lower && Frequency <= 60000000)
#ifndef ENABLE_FEAT_F4HWN
if (gSetting_500TX)
#endif
return 0; return 0;
break; break;
case F_LOCK_FCC: // case F_LOCK_FCC:
if (Frequency >= 14400000 && Frequency < 14800000) // if (Frequency >= 14400000 && Frequency < 14800000)
return 0; // return 0;
if (Frequency >= 42000000 && Frequency < 45000000) // if (Frequency >= 42000000 && Frequency < 45000000)
return 0; // return 0;
break; // break;
//
case F_LOCK_CE: // case F_LOCK_CE:
if (Frequency >= 14400000 && Frequency < 14600000) // if (Frequency >= 14400000 && Frequency < 14600000)
return 0; // return 0;
if (Frequency >= 43000000 && Frequency < 44000000) // if (Frequency >= 43000000 && Frequency < 44000000)
return 0; // return 0;
break; // break;
//
case F_LOCK_GB: // case F_LOCK_GB:
if (Frequency >= 14400000 && Frequency < 14800000) // if (Frequency >= 14400000 && Frequency < 14800000)
return 0; // return 0;
if (Frequency >= 43000000 && Frequency < 44000000) // if (Frequency >= 43000000 && Frequency < 44000000)
return 0; // return 0;
break; // break;
//
case F_LOCK_430: // case F_LOCK_430:
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < 17400000) // if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < 17400000)
return 0; // return 0;
if (Frequency >= 40000000 && Frequency < 43000000) // if (Frequency >= 40000000 && Frequency < 43000000)
return 0; // return 0;
break; // break;
//
case F_LOCK_438: // case F_LOCK_438:
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < 17400000) // if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < 17400000)
return 0; // return 0;
if (Frequency >= 40000000 && Frequency < 43800000) // if (Frequency >= 40000000 && Frequency < 43800000)
return 0; // return 0;
break; // break;
#ifdef ENABLE_FEAT_F4HWN_PMR #ifdef ENABLE_FEAT_F4HWN_PMR
case F_LOCK_PMR: case F_LOCK_PMR:
@@ -275,8 +265,7 @@ int32_t TX_freq_check(const uint32_t Frequency)
return -1; return -1;
} }
int32_t RX_freq_check(const uint32_t Frequency) int32_t RX_freq_check(const uint32_t Frequency) { // return '0' if RX frequency is allowed
{ // return '0' if RX frequency is allowed
// otherwise return '-1' // otherwise return '-1'
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper) if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper)

View File

@@ -17,16 +17,24 @@
#include <string.h> #include <string.h>
#include "app/dtmf.h" #include "app/dtmf.h"
#if defined(ENABLE_FMRADIO) #if defined(ENABLE_FMRADIO)
#include "app/fm.h" #include "app/fm.h"
#endif #endif
#include "audio.h" #include "audio.h"
#include "bsp/dp32g030/gpio.h" #include "bsp/dp32g030/gpio.h"
#include "dcs.h" #include "dcs.h"
#include "driver/backlight.h" #include "driver/backlight.h"
#if defined(ENABLE_FMRADIO) #if defined(ENABLE_FMRADIO)
#include "driver/bk1080.h" #include "driver/bk1080.h"
#endif #endif
#include "driver/bk4819.h" #include "driver/bk4819.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "driver/system.h" #include "driver/system.h"
@@ -39,18 +47,18 @@
#include "settings.h" #include "settings.h"
#include "ui/status.h" #include "ui/status.h"
#include "ui/ui.h" #include "ui/ui.h"
#include "app/app.h"
FUNCTION_Type_t gCurrentFunction; FUNCTION_Type_t gCurrentFunction;
bool FUNCTION_IsRx() bool FUNCTION_IsRx() {
{
return gCurrentFunction == FUNCTION_MONITOR || return gCurrentFunction == FUNCTION_MONITOR ||
gCurrentFunction == FUNCTION_INCOMING || gCurrentFunction == FUNCTION_INCOMING ||
gCurrentFunction == FUNCTION_RECEIVE; gCurrentFunction == FUNCTION_RECEIVE;
} }
void FUNCTION_Init(void) void FUNCTION_Init(void) {
{
g_CxCSS_TAIL_Found = false; g_CxCSS_TAIL_Found = false;
g_CDCSS_Lost = false; g_CDCSS_Lost = false;
g_CTCSS_Lost = false; g_CTCSS_Lost = false;
@@ -86,8 +94,7 @@ void FUNCTION_Init(void)
gUpdateStatus = true; gUpdateStatus = true;
} }
void FUNCTION_Foreground(const FUNCTION_Type_t PreviousFunction) void FUNCTION_Foreground(const FUNCTION_Type_t PreviousFunction) {
{
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
if (gDTMF_ReplyState != DTMF_REPLY_NONE) if (gDTMF_ReplyState != DTMF_REPLY_NONE)
RADIO_PrepareCssTX(); RADIO_PrepareCssTX();
@@ -109,8 +116,7 @@ void FUNCTION_Foreground(const FUNCTION_Type_t PreviousFunction)
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT ||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY) gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY) {
{
gDTMF_auto_reset_time_500ms = gEeprom.DTMF_auto_reset_time * 2; gDTMF_auto_reset_time_500ms = gEeprom.DTMF_auto_reset_time * 2;
} }
#endif #endif
@@ -119,12 +125,9 @@ void FUNCTION_Foreground(const FUNCTION_Type_t PreviousFunction)
void FUNCTION_PowerSave() { void FUNCTION_PowerSave() {
#ifdef ENABLE_FEAT_F4HWN_SLEEP #ifdef ENABLE_FEAT_F4HWN_SLEEP
if(gWakeUp) if (gWakeUp) {
{
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 200; // deep sleep now indexed on BatSav gPowerSave_10ms = gEeprom.BATTERY_SAVE * 200; // deep sleep now indexed on BatSav
} } else {
else
{
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10; gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
} }
#else #else
@@ -147,9 +150,11 @@ void FUNCTION_PowerSave() {
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
} }
void FUNCTION_Transmit() void FUNCTION_Transmit() {
{
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11 // if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11
MSG_EnableRX(false);
BK4819_DisableDTMF(); BK4819_DisableDTMF();
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
@@ -167,8 +172,7 @@ void FUNCTION_Transmit()
#endif #endif
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
if (gAlarmState == ALARM_STATE_SITE_ALARM) if (gAlarmState == ALARM_STATE_SITE_ALARM) {
{
GUI_DisplayScreen(); GUI_DisplayScreen();
AUDIO_AudioPathOff(); AUDIO_AudioPathOff();
@@ -206,8 +210,10 @@ void FUNCTION_Transmit()
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
if (gAlarmState != ALARM_STATE_OFF) { if (gAlarmState != ALARM_STATE_OFF) {
#ifdef ENABLE_TX1750 #ifdef ENABLE_TX1750
if (gAlarmState == ALARM_STATE_TX1750) if (gAlarmState == ALARM_STATE_TX1750) {
BK4819_TransmitTone(true, 1750); BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750);
gAlarmState = ALARM_STATE_OFF;
}
#endif #endif
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
@@ -220,20 +226,18 @@ void FUNCTION_Transmit()
SYSTEM_DelayMs(2); SYSTEM_DelayMs(2);
AUDIO_AudioPathOn(); AUDIO_AudioPathOn();
gEnableSpeaker = true; gEnableSpeaker = true;
BK4819_ExitTxMute();
gVfoConfigureMode = VFO_CONFIGURE; gVfoConfigureMode = VFO_CONFIGURE;
return; return;
} }
#endif #endif
#ifdef ENABLE_FEAT_F4HWN
BK4819_DisableScramble(); if (gCurrentVfo->SCRAMBLING_TYPE > 0)
#else
if (gCurrentVfo->SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1); BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
else else
BK4819_DisableScramble(); BK4819_DisableScramble();
#endif
if (gSetting_backlight_on_tx_rx & BACKLIGHT_ON_TR_TX) { if (gSetting_backlight_on_tx_rx & BACKLIGHT_ON_TR_TX) {
BACKLIGHT_TurnOn(); BACKLIGHT_TurnOn();
@@ -241,9 +245,7 @@ void FUNCTION_Transmit()
} }
void FUNCTION_Select(FUNCTION_Type_t Function) {
void FUNCTION_Select(FUNCTION_Type_t Function)
{
const FUNCTION_Type_t PreviousFunction = gCurrentFunction; const FUNCTION_Type_t PreviousFunction = gCurrentFunction;
const bool bWasPowerSave = PreviousFunction == FUNCTION_POWER_SAVE; const bool bWasPowerSave = PreviousFunction == FUNCTION_POWER_SAVE;

View File

@@ -14,13 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
#ifndef FUNCTIONS_H #ifndef FUNCTIONS_H
#define FUNCTIONS_H #define FUNCTIONS_H
#include <stdint.h> #include <stdint.h>
enum FUNCTION_Type_t enum FUNCTION_Type_t {
{
FUNCTION_FOREGROUND = 0, // ??? FUNCTION_FOREGROUND = 0, // ???
FUNCTION_TRANSMIT, // transmitting FUNCTION_TRANSMIT, // transmitting
FUNCTION_MONITOR, // receiving with squelch forced open FUNCTION_MONITOR, // receiving with squelch forced open
@@ -32,11 +32,12 @@ enum FUNCTION_Type_t
}; };
typedef enum FUNCTION_Type_t FUNCTION_Type_t; typedef enum FUNCTION_Type_t FUNCTION_Type_t;
extern FUNCTION_Type_t gCurrentFunction; extern FUNCTION_Type_t gCurrentFunction;
void FUNCTION_Init(void); void FUNCTION_Init(void);
void FUNCTION_Select(FUNCTION_Type_t Function); void FUNCTION_Select(FUNCTION_Type_t Function);
bool FUNCTION_IsRx(); bool FUNCTION_IsRx();
#endif #endif

View File

@@ -137,10 +137,6 @@ void BATTERY_GetReadings(const bool bDisplayBatteryLevel)
} }
} }
if ((gScreenToDisplay == DISPLAY_MENU) && UI_MENU_GetCurrentMenuId() == MENU_VOL)
gUpdateDisplay = true;
if (gBatteryCurrent < 501) if (gBatteryCurrent < 501)
{ {
if (gChargingWithTypeC) if (gChargingWithTypeC)

View File

@@ -19,6 +19,7 @@
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
#include "app/aircopy.h" #include "app/aircopy.h"
#endif #endif
#include "bsp/dp32g030/gpio.h" #include "bsp/dp32g030/gpio.h"
#include "driver/bk4819.h" #include "driver/bk4819.h"
#include "driver/keyboard.h" #include "driver/keyboard.h"
@@ -31,13 +32,12 @@
#include "ui/menu.h" #include "ui/menu.h"
#include "ui/ui.h" #include "ui/ui.h"
BOOT_Mode_t BOOT_GetMode(void) #if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
{ BOOT_Mode_t BOOT_GetMode(void) {
unsigned int i; unsigned int i;
KEY_Code_t Keys[2]; KEY_Code_t Keys[2];
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++) {
{
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT)) if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
return BOOT_MODE_NORMAL; // PTT not pressed return BOOT_MODE_NORMAL; // PTT not pressed
Keys[i] = KEYBOARD_Poll(); Keys[i] = KEYBOARD_Poll();
@@ -51,16 +51,12 @@ BOOT_Mode_t BOOT_GetMode(void)
} }
#endif #endif
if (Keys[0] == Keys[1]) if (Keys[0] == Keys[1]) {
{
gKeyReading0 = Keys[0]; gKeyReading0 = Keys[0];
gKeyReading1 = Keys[0]; gKeyReading1 = Keys[0];
gDebounceCounter = 2; gDebounceCounter = 2;
if (Keys[0] == KEY_SIDE1)
return BOOT_MODE_F_LOCK;
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
if (Keys[0] == KEY_SIDE2) if (Keys[0] == KEY_SIDE2)
return BOOT_MODE_AIRCOPY; return BOOT_MODE_AIRCOPY;
@@ -70,14 +66,9 @@ BOOT_Mode_t BOOT_GetMode(void)
return BOOT_MODE_NORMAL; return BOOT_MODE_NORMAL;
} }
void BOOT_ProcessMode(BOOT_Mode_t Mode) void BOOT_ProcessMode(BOOT_Mode_t Mode) {
{ Mode = Mode;
if (Mode == BOOT_MODE_F_LOCK)
{
GUI_SelectNextDisplay(DISPLAY_MENU);
}
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
else
if (Mode == BOOT_MODE_AIRCOPY) if (Mode == BOOT_MODE_AIRCOPY)
{ {
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF; gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
@@ -111,15 +102,14 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
gEeprom.BACKLIGHT_TIME = 61; gEeprom.BACKLIGHT_TIME = 61;
gEeprom.KEY_LOCK = 0; gEeprom.KEY_LOCK = 0;
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
gEeprom.CURRENT_STATE = 0; // Don't scan if scan resume is active... gEeprom.CURRENT_STATE = 0; // Don't resume is active...
#endif #endif
GUI_SelectNextDisplay(DISPLAY_AIRCOPY); GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
} }
#endif #endif
else
{
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
} }
}
#endif

View File

@@ -20,10 +20,10 @@
#include <stdint.h> #include <stdint.h>
#include "driver/keyboard.h" #include "driver/keyboard.h"
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
enum BOOT_Mode_t enum BOOT_Mode_t
{ {
BOOT_MODE_NORMAL = 0, BOOT_MODE_NORMAL = 0,
BOOT_MODE_F_LOCK,
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
BOOT_MODE_RESCUE_OPS, BOOT_MODE_RESCUE_OPS,
#endif #endif
@@ -38,4 +38,4 @@ BOOT_Mode_t BOOT_GetMode(void);
void BOOT_ProcessMode(BOOT_Mode_t Mode); void BOOT_ProcessMode(BOOT_Mode_t Mode);
#endif #endif
#endif

87
main.c
View File

@@ -19,7 +19,9 @@
#include <stdio.h> // NULL #include <stdio.h> // NULL
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
#include "am_fix.h" #include "am_fix.h"
#endif #endif
#include "audio.h" #include "audio.h"
@@ -31,13 +33,19 @@
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
#include "app/action.h" #include "app/action.h"
#include "ui/ui.h" #include "ui/ui.h"
#endif #endif
#ifdef ENABLE_SPECTRUM #ifdef ENABLE_SPECTRUM
#include "app/spectrum.h" #include "app/spectrum.h"
#endif #endif
#include "app/chFrScanner.h" #include "app/chFrScanner.h"
#endif #endif
#include "app/app.h" #include "app/app.h"
@@ -51,8 +59,11 @@
#include "driver/system.h" #include "driver/system.h"
#include "driver/systick.h" #include "driver/systick.h"
#include "driver/eeprom.h" #include "driver/eeprom.h"
#ifdef ENABLE_UART #ifdef ENABLE_UART
#include "driver/uart.h" #include "driver/uart.h"
#endif #endif
#include "helper/battery.h" #include "helper/battery.h"
@@ -61,8 +72,8 @@
#include "ui/lock.h" #include "ui/lock.h"
#include "ui/welcome.h" #include "ui/welcome.h"
#include "ui/menu.h" #include "ui/menu.h"
void _putchar(__attribute__((unused)) char c)
{ void _putchar(__attribute__((unused)) char c) {
#ifdef ENABLE_UART #ifdef ENABLE_UART
UART_Send((uint8_t *) &c, 1); UART_Send((uint8_t *) &c, 1);
@@ -70,8 +81,7 @@ void _putchar(__attribute__((unused)) char c)
} }
void Main(void) void Main(void) {
{
// Enable clock gating of blocks we need // Enable clock gating of blocks we need
SYSCON_DEV_CLK_GATE = 0 SYSCON_DEV_CLK_GATE = 0
| SYSCON_DEV_CLK_GATE_GPIOA_BITS_ENABLE | SYSCON_DEV_CLK_GATE_GPIOA_BITS_ENABLE
@@ -130,6 +140,7 @@ void Main(void)
AM_fix_init(); AM_fix_init();
#endif #endif
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
BOOT_Mode_t BootMode = BOOT_GetMode(); BOOT_Mode_t BootMode = BOOT_GetMode();
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
@@ -150,56 +161,26 @@ void Main(void)
*/ */
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if (BootMode == BOOT_MODE_F_LOCK && gEeprom.MENU_LOCK == true)
{
BootMode = BOOT_MODE_NORMAL;
}
#endif #endif
if (BootMode == BOOT_MODE_F_LOCK)
{
gF_LOCK = true; // flag to say include the hidden menu items
#ifdef ENABLE_FEAT_F4HWN
gEeprom.KEY_LOCK = 0;
SETTINGS_SaveSettings();
#ifndef ENABLE_VOX
gMenuCursor = 67; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
#else
gMenuCursor = 68; // move to hidden section, fix me if change... !!!
#endif
#ifdef ENABLE_NOAA
gMenuCursor += 1; // move to hidden section, fix me if change... !!!
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
gMenuCursor += 1; // move to hidden section, fix me if change... !!!
#endif
gSubMenuSelection = gSetting_F_LOCK;
#endif
}
// count the number of menu items // count the number of menu items
gMenuListCount = 0; gMenuListCount = 0;
while (MenuList[gMenuListCount].name[0] != '\0') { while (MenuList[gMenuListCount].name[0] != '\0') {
if(!gF_LOCK && MenuList[gMenuListCount].menu_id == FIRST_HIDDEN_MENU_ITEM)
break;
gMenuListCount++; gMenuListCount++;
} }
// wait for user to release all butts before moving on // wait for user to release all butts before moving on
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
KEYBOARD_Poll() != KEY_INVALID || KEYBOARD_Poll() != KEY_INVALID
BootMode != BOOT_MODE_NORMAL) #if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
{ // keys are pressed || BootMode != BOOT_MODE_NORMAL
#endif
) { // keys are pressed
UI_DisplayReleaseKeys(); UI_DisplayReleaseKeys();
BACKLIGHT_TurnOn(); BACKLIGHT_TurnOn();
// 500ms // 500ms
for (int i = 0; i < 50;) for (int i = 0; i < 50;) {
{
i = (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && KEYBOARD_Poll() == KEY_INVALID) ? i + 1 : 0; i = (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && KEYBOARD_Poll() == KEY_INVALID) ? i + 1 : 0;
SYSTEM_DelayMs(10); SYSTEM_DelayMs(10);
} }
@@ -208,8 +189,7 @@ void Main(void)
gDebounceCounter = 0; gDebounceCounter = 0;
} }
if (!gChargingWithTypeC && gBatteryDisplayLevel == 0) if (!gChargingWithTypeC && gBatteryDisplayLevel == 0) {
{
FUNCTION_Select(FUNCTION_POWER_SAVE); FUNCTION_Select(FUNCTION_POWER_SAVE);
if (gEeprom.BACKLIGHT_TIME < 61) // backlight is not set to be always on if (gEeprom.BACKLIGHT_TIME < 61) // backlight is not set to be always on
@@ -218,29 +198,11 @@ void Main(void)
BACKLIGHT_TurnOn(); // turn the backlight ON BACKLIGHT_TurnOn(); // turn the backlight ON
gReducedService = true; gReducedService = true;
} } else {
else
{
UI_DisplayWelcome(); UI_DisplayWelcome();
BACKLIGHT_TurnOn(); BACKLIGHT_TurnOn();
#ifdef ENABLE_FEAT_F4HWN
if (gEeprom.POWER_ON_DISPLAY_MODE != POWER_ON_DISPLAY_MODE_NONE && gEeprom.POWER_ON_DISPLAY_MODE != POWER_ON_DISPLAY_MODE_SOUND)
#else
if (gEeprom.POWER_ON_DISPLAY_MODE != POWER_ON_DISPLAY_MODE_NONE)
#endif
{ // 2.55 second boot-up screen
while (boot_counter_10ms > 0)
{
if (KEYBOARD_Poll() != KEY_INVALID)
{ // halt boot beeps
boot_counter_10ms = 0;
break;
}
}
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);
}
#ifdef ENABLE_PWRON_PASSWORD #ifdef ENABLE_PWRON_PASSWORD
if (gEeprom.POWER_ON_PASSWORD < 1000000) if (gEeprom.POWER_ON_PASSWORD < 1000000)
@@ -261,7 +223,9 @@ void Main(void)
} }
#endif #endif
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
BOOT_ProcessMode(BootMode); BOOT_ProcessMode(BootMode);
#endif
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0); GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
@@ -362,7 +326,6 @@ void Main(void)
APP_RunSpectrum(); APP_RunSpectrum();
} }
#endif #endif
// Pas besoin de `default`, aucun effet si l'état n'est pas traité.
#endif #endif
while (true) { while (true) {

9
misc.c
View File

@@ -91,16 +91,10 @@ const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
bool gSetting_350TX; bool gSetting_350TX;
#endif #endif
#ifdef ENABLE_DTMF_CALLING
bool gSetting_KILLED;
#endif
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
bool gSetting_200TX; bool gSetting_200TX;
bool gSetting_500TX; bool gSetting_500TX;
#endif #endif
bool gSetting_350EN;
uint8_t gSetting_F_LOCK; uint8_t gSetting_F_LOCK;
bool gSetting_ScrambleEnable; bool gSetting_ScrambleEnable;
@@ -116,15 +110,12 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
uint8_t gSetting_set_pwr = 1;
bool gSetting_set_ptt = 0; bool gSetting_set_ptt = 0;
uint8_t gSetting_set_tot = 0; uint8_t gSetting_set_tot = 0;
uint8_t gSetting_set_ctr = 10; uint8_t gSetting_set_ctr = 10;
bool gSetting_set_inv = false; bool gSetting_set_inv = false;
uint8_t gSetting_set_eot = 0; uint8_t gSetting_set_eot = 0;
bool gSetting_set_lck = false; bool gSetting_set_lck = false;
bool gSetting_set_met = 0;
bool gSetting_set_gui = 0;
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
bool gSetting_set_nfm = 0; bool gSetting_set_nfm = 0;
#endif #endif

9
misc.h
View File

@@ -143,17 +143,11 @@ extern const uint8_t gMicGain_dB2[5];
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
extern bool gSetting_350TX; extern bool gSetting_350TX;
#endif #endif
#ifdef ENABLE_DTMF_CALLING
extern bool gSetting_KILLED;
#endif
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
extern bool gSetting_200TX; extern bool gSetting_200TX;
extern bool gSetting_500TX; extern bool gSetting_500TX;
#endif #endif
extern bool gSetting_350EN;
extern uint8_t gSetting_F_LOCK; extern uint8_t gSetting_F_LOCK;
extern bool gSetting_ScrambleEnable; extern bool gSetting_ScrambleEnable;
@@ -169,15 +163,12 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
extern uint8_t gSetting_set_pwr;
extern bool gSetting_set_ptt; extern bool gSetting_set_ptt;
extern uint8_t gSetting_set_tot; extern uint8_t gSetting_set_tot;
extern uint8_t gSetting_set_ctr; extern uint8_t gSetting_set_ctr;
extern bool gSetting_set_inv; extern bool gSetting_set_inv;
extern uint8_t gSetting_set_eot; extern uint8_t gSetting_set_eot;
extern bool gSetting_set_lck; extern bool gSetting_set_lck;
extern bool gSetting_set_met;
extern bool gSetting_set_gui;
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
extern bool gSetting_set_nfm; extern bool gSetting_set_nfm;
#endif #endif

View File

@@ -1,4 +0,0 @@
#define PRINTF_DISABLE_SUPPORT_LONG_LONG
#define PRINTF_DISABLE_SUPPORT_EXPONENTIAL
#define PRINTF_DISABLE_SUPPORT_PTRDIFF_T
#define PRINTF_DISABLE_SUPPORT_FLOAT

218
radio.c
View File

@@ -19,9 +19,11 @@
#include "am_fix.h" #include "am_fix.h"
#include "app/dtmf.h" #include "app/dtmf.h"
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
#include "app/fm.h" #include "app/fm.h"
#endif #endif
#include "audio.h" #include "audio.h"
#include "bsp/dp32g030/gpio.h" #include "bsp/dp32g030/gpio.h"
#include "dcs.h" #include "dcs.h"
@@ -54,8 +56,7 @@ const char gModulationStr[MODULATION_UKNOWN][4] = {
#endif #endif
}; };
bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList) bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList) {
{
// return true if the channel appears valid // return true if the channel appears valid
if (!IS_MR_CHANNEL(channel)) if (!IS_MR_CHANNEL(channel))
return false; return false;
@@ -112,8 +113,7 @@ bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanL
return PriorityCh1 != channel && PriorityCh2 != channel; return PriorityCh1 != channel && PriorityCh2 != channel;
} }
uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScanList, uint8_t VFO) uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScanList, uint8_t VFO) {
{
for (unsigned int i = 0; IS_MR_CHANNEL(i); i++, Channel += Direction) { for (unsigned int i = 0; IS_MR_CHANNEL(i); i++, Channel += Direction) {
if (Channel == 0xFF) { if (Channel == 0xFF) {
Channel = MR_CHANNEL_LAST; Channel = MR_CHANNEL_LAST;
@@ -129,8 +129,7 @@ uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScan
return 0xFF; return 0xFF;
} }
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency) void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency) {
{
memset(pInfo, 0, sizeof(*pInfo)); memset(pInfo, 0, sizeof(*pInfo));
pInfo->Band = FREQUENCY_GetBand(Frequency); pInfo->Band = FREQUENCY_GetBand(Frequency);
@@ -141,7 +140,6 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t
pInfo->StepFrequency = gStepFrequencyTable[pInfo->STEP_SETTING]; pInfo->StepFrequency = gStepFrequencyTable[pInfo->STEP_SETTING];
pInfo->CHANNEL_SAVE = ChannelSave; pInfo->CHANNEL_SAVE = ChannelSave;
pInfo->FrequencyReverse = false; pInfo->FrequencyReverse = false;
pInfo->TX_LOCK = true;
pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW1; pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
pInfo->freq_config_RX.Frequency = Frequency; pInfo->freq_config_RX.Frequency = Frequency;
pInfo->freq_config_TX.Frequency = Frequency; pInfo->freq_config_TX.Frequency = Frequency;
@@ -157,18 +155,9 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t
RADIO_ConfigureSquelchAndOutputPower(pInfo); RADIO_ConfigureSquelchAndOutputPower(pInfo);
} }
void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure) void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure) {
{
VFO_Info_t *pVfo = &gEeprom.VfoInfo[VFO]; VFO_Info_t *pVfo = &gEeprom.VfoInfo[VFO];
if (!gSetting_350EN) {
if (gEeprom.FreqChannel[VFO] == FREQ_CHANNEL_FIRST + BAND5_350MHz)
gEeprom.FreqChannel[VFO] = FREQ_CHANNEL_FIRST + BAND6_400MHz;
if (gEeprom.ScreenChannel[VFO] == FREQ_CHANNEL_FIRST + BAND5_350MHz)
gEeprom.ScreenChannel[VFO] = FREQ_CHANNEL_FIRST + BAND6_400MHz;
}
uint8_t channel = gEeprom.ScreenChannel[VFO]; uint8_t channel = gEeprom.ScreenChannel[VFO];
if (IS_VALID_CHANNEL(channel)) { if (IS_VALID_CHANNEL(channel)) {
@@ -192,14 +181,12 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (channel == 0xFF) { if (channel == 0xFF) {
channel = gEeprom.FreqChannel[VFO]; channel = gEeprom.FreqChannel[VFO];
gEeprom.ScreenChannel[VFO] = gEeprom.FreqChannel[VFO]; gEeprom.ScreenChannel[VFO] = gEeprom.FreqChannel[VFO];
} } else {
else {
gEeprom.ScreenChannel[VFO] = channel; gEeprom.ScreenChannel[VFO] = channel;
gEeprom.MrChannel[VFO] = channel; gEeprom.MrChannel[VFO] = channel;
} }
} }
} } else
else
channel = FREQ_CHANNEL_LAST - 1; channel = FREQ_CHANNEL_LAST - 1;
ChannelAttributes_t att = gMR_ChannelAttributes[channel]; ChannelAttributes_t att = gMR_ChannelAttributes[channel];
@@ -227,8 +214,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
bParticipation1 = att.scanlist1; bParticipation1 = att.scanlist1;
bParticipation2 = att.scanlist2; bParticipation2 = att.scanlist2;
bParticipation3 = att.scanlist3; bParticipation3 = att.scanlist3;
} } else {
else {
band = channel - FREQ_CHANNEL_FIRST; band = channel - FREQ_CHANNEL_FIRST;
bParticipation1 = true; bParticipation1 = true;
bParticipation2 = true; bParticipation2 = true;
@@ -247,8 +233,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
else else
base = 0x0C80 + ((channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16); base = 0x0C80 + ((channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16);
if (configure == VFO_CONFIGURE_RELOAD || IS_FREQ_CHANNEL(channel)) if (configure == VFO_CONFIGURE_RELOAD || IS_FREQ_CHANNEL(channel)) {
{
uint8_t tmp; uint8_t tmp;
uint8_t data[8]; uint8_t data[8];
@@ -272,20 +257,16 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
pVfo->StepFrequency = gStepFrequencyTable[tmp]; pVfo->StepFrequency = gStepFrequencyTable[tmp];
tmp = data[7]; tmp = data[7];
#ifndef ENABLE_FEAT_F4HWN if (tmp > 10)
if (tmp > (ARRAY_SIZE(gSubMenu_SCRAMBLER) - 1))
tmp = 0; tmp = 0;
pVfo->SCRAMBLING_TYPE = tmp; pVfo->SCRAMBLING_TYPE = tmp;
#else //pVfo->SCRAMBLING_TYPE = 0;
pVfo->SCRAMBLING_TYPE = 0;
#endif
pVfo->freq_config_RX.CodeType = (data[2] >> 0) & 0x0F; pVfo->freq_config_RX.CodeType = (data[2] >> 0) & 0x0F;
pVfo->freq_config_TX.CodeType = (data[2] >> 4) & 0x0F; pVfo->freq_config_TX.CodeType = (data[2] >> 4) & 0x0F;
tmp = data[0]; tmp = data[0];
switch (pVfo->freq_config_RX.CodeType) switch (pVfo->freq_config_RX.CodeType) {
{
default: default:
case CODE_TYPE_OFF: case CODE_TYPE_OFF:
pVfo->freq_config_RX.CodeType = CODE_TYPE_OFF; pVfo->freq_config_RX.CodeType = CODE_TYPE_OFF;
@@ -306,8 +287,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
pVfo->freq_config_RX.Code = tmp; pVfo->freq_config_RX.Code = tmp;
tmp = data[1]; tmp = data[1];
switch (pVfo->freq_config_TX.CodeType) switch (pVfo->freq_config_TX.CodeType) {
{
default: default:
case CODE_TYPE_OFF: case CODE_TYPE_OFF:
pVfo->freq_config_TX.CodeType = CODE_TYPE_OFF; pVfo->freq_config_TX.CodeType = CODE_TYPE_OFF;
@@ -327,33 +307,25 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
} }
pVfo->freq_config_TX.Code = tmp; pVfo->freq_config_TX.Code = tmp;
if (data[4] == 0xFF) if (data[4] == 0xFF) {
{
pVfo->FrequencyReverse = false; pVfo->FrequencyReverse = false;
pVfo->CHANNEL_BANDWIDTH = BK4819_FILTER_BW_WIDE; pVfo->CHANNEL_BANDWIDTH = BK4819_FILTER_BW_WIDE;
pVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1; pVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
pVfo->BUSY_CHANNEL_LOCK = false; pVfo->BUSY_CHANNEL_LOCK = false;
pVfo->TX_LOCK = true; } else {
}
else
{
const uint8_t d4 = data[4]; const uint8_t d4 = data[4];
pVfo->FrequencyReverse = !!((d4 >> 0) & 1u); pVfo->FrequencyReverse = !!((d4 >> 0) & 1u);
pVfo->CHANNEL_BANDWIDTH = !!((d4 >> 1) & 1u); pVfo->CHANNEL_BANDWIDTH = !!((d4 >> 1) & 1u);
pVfo->OUTPUT_POWER = ((d4 >> 2) & 7u); pVfo->OUTPUT_POWER = ((d4 >> 2) & 7u);
pVfo->BUSY_CHANNEL_LOCK = !!((d4 >> 5) & 1u); pVfo->BUSY_CHANNEL_LOCK = !!((d4 >> 5) & 1u);
pVfo->TX_LOCK = !!((d4 >> 6) & 1u);
} }
if (data[5] == 0xFF) if (data[5] == 0xFF) {
{
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
pVfo->DTMF_DECODING_ENABLE = false; pVfo->DTMF_DECODING_ENABLE = false;
#endif #endif
pVfo->DTMF_PTT_ID_TX_MODE = PTT_ID_OFF; pVfo->DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
} } else {
else
{
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
pVfo->DTMF_DECODING_ENABLE = ((data[5] >> 0) & 1u) ? true : false; pVfo->DTMF_DECODING_ENABLE = ((data[5] >> 0) & 1u) ? true : false;
#endif #endif
@@ -402,29 +374,18 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
RADIO_ApplyOffset(pVfo); RADIO_ApplyOffset(pVfo);
if (IS_MR_CHANNEL(channel)) if (IS_MR_CHANNEL(channel)) { // 16 bytes allocated to the channel name but only 10 used, the rest are 0's
{ // 16 bytes allocated to the channel name but only 10 used, the rest are 0's
SETTINGS_FetchChannelName(pVfo->Name, channel); SETTINGS_FetchChannelName(pVfo->Name, channel);
} }
if (!pVfo->FrequencyReverse) if (!pVfo->FrequencyReverse) {
{
pVfo->pRX = &pVfo->freq_config_RX; pVfo->pRX = &pVfo->freq_config_RX;
pVfo->pTX = &pVfo->freq_config_TX; pVfo->pTX = &pVfo->freq_config_TX;
} } else {
else
{
pVfo->pRX = &pVfo->freq_config_TX; pVfo->pRX = &pVfo->freq_config_TX;
pVfo->pTX = &pVfo->freq_config_RX; pVfo->pTX = &pVfo->freq_config_RX;
} }
if (!gSetting_350EN)
{
FREQ_Config_t *pConfig = pVfo->pRX;
if (pConfig->Frequency >= 35000000 && pConfig->Frequency < 40000000)
pConfig->Frequency = 43300000;
}
pVfo->Compander = att.compander; pVfo->Compander = att.compander;
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
@@ -442,8 +403,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
RADIO_ConfigureSquelchAndOutputPower(pVfo); RADIO_ConfigureSquelchAndOutputPower(pVfo);
} }
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) {
{
// ******************************* // *******************************
@@ -452,8 +412,7 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
FREQUENCY_Band_t Band = FREQUENCY_GetBand(pInfo->pRX->Frequency); FREQUENCY_Band_t Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00; uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
if (gEeprom.SQUELCH_LEVEL == 0) if (gEeprom.SQUELCH_LEVEL == 0) { // squelch == 0 (off)
{ // squelch == 0 (off)
pInfo->SquelchOpenRSSIThresh = 0; // 0 ~ 255 pInfo->SquelchOpenRSSIThresh = 0; // 0 ~ 255
pInfo->SquelchOpenNoiseThresh = 127; // 127 ~ 0 pInfo->SquelchOpenNoiseThresh = 127; // 127 ~ 0
pInfo->SquelchCloseGlitchThresh = 255; // 255 ~ 0 pInfo->SquelchCloseGlitchThresh = 255; // 255 ~ 0
@@ -461,9 +420,7 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
pInfo->SquelchCloseRSSIThresh = 0; // 0 ~ 255 pInfo->SquelchCloseRSSIThresh = 0; // 0 ~ 255
pInfo->SquelchCloseNoiseThresh = 127; // 127 ~ 0 pInfo->SquelchCloseNoiseThresh = 127; // 127 ~ 0
pInfo->SquelchOpenGlitchThresh = 255; // 255 ~ 0 pInfo->SquelchOpenGlitchThresh = 255; // 255 ~ 0
} } else { // squelch >= 1
else
{ // squelch >= 1
Base += gEeprom.SQUELCH_LEVEL; // my eeprom squelch-1 Base += gEeprom.SQUELCH_LEVEL; // my eeprom squelch-1
// VHF UHF // VHF UHF
EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10 EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10
@@ -527,30 +484,13 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
uint8_t Op = 0; // Low eeprom calibration data uint8_t Op = 0; // Low eeprom calibration data
uint8_t currentPower = pInfo->OUTPUT_POWER; uint8_t currentPower = pInfo->OUTPUT_POWER;
if(currentPower == OUTPUT_POWER_USER)
{ if (currentPower == OUTPUT_POWER_MID) {
if(gSetting_set_pwr == 5)
{
Op = 1; // Mid eeprom calibration data Op = 1; // Mid eeprom calibration data
} } else if (currentPower == OUTPUT_POWER_HIGH) {
else if(gSetting_set_pwr == 6)
{
Op = 2; // High eeprom calibration data
}
currentPower = gSetting_set_pwr;
}
else
{
if (currentPower == OUTPUT_POWER_MID)
{
Op = 1; // Mid eeprom calibration data
}
else if(currentPower == OUTPUT_POWER_HIGH)
{
Op = 2; // High eeprom calibration data Op = 2; // High eeprom calibration data
} }
currentPower--; currentPower--;
}
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (Op * 3), Txp, 3); EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (Op * 3), Txp, 3);
@@ -604,13 +544,10 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
static const uint8_t dividers[6] = {25, 19, 13, 10, 7, 4}; static const uint8_t dividers[6] = {25, 19, 13, 10, 7, 4};
for (uint8_t p = 0; p < 3; p++) for (uint8_t p = 0; p < 3; p++) {
{ if (currentPower < 6) {
if (currentPower < 6)
{
Txp[p] = (Txp[p] * (currentPower == 5 ? 3 : 4)) / dividers[currentPower]; Txp[p] = (Txp[p] * (currentPower == 5 ? 3 : 4)) / dividers[currentPower];
} } else // case 6
else // case 6
{ {
Txp[p] += 30; Txp[p] += 30;
} }
@@ -643,12 +580,10 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
// ******************************* // *******************************
} }
void RADIO_ApplyOffset(VFO_Info_t *pInfo) void RADIO_ApplyOffset(VFO_Info_t *pInfo) {
{
uint32_t Frequency = pInfo->freq_config_RX.Frequency; uint32_t Frequency = pInfo->freq_config_RX.Frequency;
switch (pInfo->TX_OFFSET_FREQUENCY_DIRECTION) switch (pInfo->TX_OFFSET_FREQUENCY_DIRECTION) {
{
case TX_OFFSET_FREQUENCY_DIRECTION_OFF: case TX_OFFSET_FREQUENCY_DIRECTION_OFF:
break; break;
case TX_OFFSET_FREQUENCY_DIRECTION_ADD: case TX_OFFSET_FREQUENCY_DIRECTION_ADD:
@@ -662,19 +597,19 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo)
pInfo->freq_config_TX.Frequency = Frequency; pInfo->freq_config_TX.Frequency = Frequency;
} }
static void RADIO_SelectCurrentVfo(void) static void RADIO_SelectCurrentVfo(void) {
{
// if crossband is active and DW not the gCurrentVfo is gTxVfo (gTxVfo/TX_VFO is only ever changed by the user) // if crossband is active and DW not the gCurrentVfo is gTxVfo (gTxVfo/TX_VFO is only ever changed by the user)
// otherwise it is set to gRxVfo which is set to gTxVfo in RADIO_SelectVfos // otherwise it is set to gRxVfo which is set to gTxVfo in RADIO_SelectVfos
// so in the end gCurrentVfo is equal to gTxVfo unless dual watch changes it on incomming transmition (again, this can only happen when XB off) // so in the end gCurrentVfo is equal to gTxVfo unless dual watch changes it on incomming transmition (again, this can only happen when XB off)
// note: it is called only in certain situations so could be not up-to-date // note: it is called only in certain situations so could be not up-to-date
gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF || gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) ? gRxVfo : gTxVfo; gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF || gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) ? gRxVfo
: gTxVfo;
} }
void RADIO_SelectVfos(void) void RADIO_SelectVfos(void) {
{
// if crossband without DW is used then RX_VFO is the opposite to the TX_VFO // if crossband without DW is used then RX_VFO is the opposite to the TX_VFO
gEeprom.RX_VFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF || gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) ? gEeprom.TX_VFO : !gEeprom.TX_VFO; gEeprom.RX_VFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF || gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
? gEeprom.TX_VFO : !gEeprom.TX_VFO;
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO]; gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO];
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO]; gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
@@ -682,13 +617,11 @@ void RADIO_SelectVfos(void)
RADIO_SelectCurrentVfo(); RADIO_SelectCurrentVfo();
} }
void RADIO_SetupRegisters(bool switchToForeground) void RADIO_SetupRegisters(bool switchToForeground) {
{
BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH; BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
if(Bandwidth == BK4819_FILTER_BW_NARROW && gSetting_set_nfm == 1) if (Bandwidth == BK4819_FILTER_BW_NARROW && gSetting_set_nfm == 1) {
{
Bandwidth = BK4819_FILTER_BW_NARROWER; Bandwidth = BK4819_FILTER_BW_NARROWER;
} }
#endif #endif
@@ -699,8 +632,7 @@ void RADIO_SetupRegisters(bool switchToForeground)
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false); BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
switch (Bandwidth) switch (Bandwidth) {
{
default: default:
Bandwidth = BK4819_FILTER_BW_WIDE; Bandwidth = BK4819_FILTER_BW_WIDE;
[[fallthrough]]; [[fallthrough]];
@@ -722,8 +654,7 @@ void RADIO_SetupRegisters(bool switchToForeground)
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false); BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
while (1) while (1) {
{
const uint16_t Status = BK4819_ReadRegister(BK4819_REG_0C); const uint16_t Status = BK4819_ReadRegister(BK4819_REG_0C);
if ((Status & 1u) == 0) // INTERRUPT REQUEST if ((Status & 1u) == 0) // INTERRUPT REQUEST
break; break;
@@ -772,13 +703,11 @@ void RADIO_SetupRegisters(bool switchToForeground)
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE)) if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
#endif #endif
{ {
if (gRxVfo->Modulation == MODULATION_FM) if (gRxVfo->Modulation == MODULATION_FM) { // FM
{ // FM
uint8_t CodeType = gRxVfo->pRX->CodeType; uint8_t CodeType = gRxVfo->pRX->CodeType;
uint8_t Code = gRxVfo->pRX->Code; uint8_t Code = gRxVfo->pRX->Code;
switch (CodeType) switch (CodeType) {
{
default: default:
case CODE_TYPE_OFF: case CODE_TYPE_OFF:
BK4819_SetCTCSSFrequency(SQL_TONE); BK4819_SetCTCSSFrequency(SQL_TONE);
@@ -817,14 +746,10 @@ void RADIO_SetupRegisters(bool switchToForeground)
break; break;
} }
#ifndef ENABLE_FEAT_F4HWN if (gRxVfo->SCRAMBLING_TYPE > 0)
if (gRxVfo->SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
BK4819_EnableScramble(gRxVfo->SCRAMBLING_TYPE - 1); BK4819_EnableScramble(gRxVfo->SCRAMBLING_TYPE - 1);
else else
BK4819_DisableScramble(); BK4819_DisableScramble();
#else
BK4819_DisableScramble();
#endif
} }
} }
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
@@ -850,8 +775,7 @@ void RADIO_SetupRegisters(bool switchToForeground)
) { ) {
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD); BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST; InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
} } else
else
#endif #endif
{ {
BK4819_DisableVox(); BK4819_DisableVox();
@@ -919,13 +843,11 @@ void RADIO_SetupRegisters(bool switchToForeground)
} }
#endif #endif
void RADIO_SetTxParameters(void) void RADIO_SetTxParameters(void) {
{
BK4819_FilterBandwidth_t Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH; BK4819_FilterBandwidth_t Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
if(Bandwidth == BK4819_FILTER_BW_NARROW && gSetting_set_nfm == 1) if (Bandwidth == BK4819_FILTER_BW_NARROW && gSetting_set_nfm == 1) {
{
Bandwidth = BK4819_FILTER_BW_NARROWER; Bandwidth = BK4819_FILTER_BW_NARROWER;
} }
#endif #endif
@@ -936,8 +858,7 @@ void RADIO_SetTxParameters(void)
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_RX_ENABLE, false); BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_RX_ENABLE, false);
switch (Bandwidth) switch (Bandwidth) {
{
default: default:
Bandwidth = BK4819_FILTER_BW_WIDE; Bandwidth = BK4819_FILTER_BW_WIDE;
[[fallthrough]]; [[fallthrough]];
@@ -956,7 +877,8 @@ void RADIO_SetTxParameters(void)
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency); BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
// TX compressor // TX compressor
BK4819_SetCompander((gRxVfo->Modulation == MODULATION_FM && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0); BK4819_SetCompander((gRxVfo->Modulation == MODULATION_FM && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3))
? gRxVfo->Compander : 0);
BK4819_PrepareTransmit(); BK4819_PrepareTransmit();
@@ -972,8 +894,7 @@ void RADIO_SetTxParameters(void)
SYSTEM_DelayMs(10); SYSTEM_DelayMs(10);
switch (gCurrentVfo->pTX->CodeType) switch (gCurrentVfo->pTX->CodeType) {
{
default: default:
case CODE_TYPE_OFF: case CODE_TYPE_OFF:
BK4819_ExitSubAu(); BK4819_ExitSubAu();
@@ -990,8 +911,7 @@ void RADIO_SetTxParameters(void)
} }
} }
void RADIO_SetModulation(ModulationMode_t modulation) void RADIO_SetModulation(ModulationMode_t modulation) {
{
BK4819_AF_Type_t mod; BK4819_AF_Type_t mod;
switch (modulation) { switch (modulation) {
default: default:
@@ -1024,8 +944,7 @@ void RADIO_SetModulation(ModulationMode_t modulation)
RADIO_SetupAGC(modulation == MODULATION_AM, false); RADIO_SetupAGC(modulation == MODULATION_AM, false);
} }
void RADIO_SetupAGC(bool listeningAM, bool disable) void RADIO_SetupAGC(bool listeningAM, bool disable) {
{
static uint8_t lastSettings; static uint8_t lastSettings;
uint8_t newSettings = (listeningAM << 1) | (disable << 1); uint8_t newSettings = (listeningAM << 1) | (disable << 1);
if (lastSettings == newSettings) if (lastSettings == newSettings)
@@ -1036,14 +955,12 @@ void RADIO_SetupAGC(bool listeningAM, bool disable)
if (!listeningAM) { // if not actively listening AM we don't need any AM specific regulation if (!listeningAM) { // if not actively listening AM we don't need any AM specific regulation
BK4819_SetAGC(!disable); BK4819_SetAGC(!disable);
BK4819_InitAGC(false); BK4819_InitAGC(false);
} } else {
else {
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
if (gSetting_AM_fix) { // if AM fix active lock AGC so AM-fix can do it's job if (gSetting_AM_fix) { // if AM fix active lock AGC so AM-fix can do it's job
BK4819_SetAGC(0); BK4819_SetAGC(0);
AM_fix_enable(!disable); AM_fix_enable(!disable);
} } else
else
#endif #endif
{ {
BK4819_SetAGC(!disable); BK4819_SetAGC(!disable);
@@ -1052,8 +969,7 @@ void RADIO_SetupAGC(bool listeningAM, bool disable)
} }
} }
void RADIO_SetVfoState(VfoState_t State) void RADIO_SetVfoState(VfoState_t State) {
{
if (State == VFO_STATE_NORMAL) { if (State == VFO_STATE_NORMAL) {
VfoState[0] = VFO_STATE_NORMAL; VfoState[0] = VFO_STATE_NORMAL;
VfoState[1] = VFO_STATE_NORMAL; VfoState[1] = VFO_STATE_NORMAL;
@@ -1071,18 +987,15 @@ void RADIO_SetVfoState(VfoState_t State)
} }
void RADIO_PrepareTX(void) void RADIO_PrepareTX(void) {
{
VfoState_t State = VFO_STATE_NORMAL; // default to OK to TX VfoState_t State = VFO_STATE_NORMAL; // default to OK to TX
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) { // dual-RX is enabled
{ // dual-RX is enabled
gDualWatchCountdown_10ms = dual_watch_count_after_tx_10ms; gDualWatchCountdown_10ms = dual_watch_count_after_tx_10ms;
gScheduleDualWatch = false; gScheduleDualWatch = false;
if (!gRxVfoIsActive) if (!gRxVfoIsActive) { // use the current RX vfo
{ // use the current RX vfo
gEeprom.RX_VFO = gEeprom.TX_VFO; gEeprom.RX_VFO = gEeprom.TX_VFO;
gRxVfo = gTxVfo; gRxVfo = gTxVfo;
gRxVfoIsActive = true; gRxVfoIsActive = true;
@@ -1096,7 +1009,7 @@ void RADIO_PrepareTX(void)
RADIO_SelectCurrentVfo(); RADIO_SelectCurrentVfo();
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
if(TX_freq_check(gCurrentVfo->pTX->Frequency) != 0 && gCurrentVfo->TX_LOCK == true if (TX_freq_check(gCurrentVfo->pTX->Frequency) != 0
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
&& gAlarmState != ALARM_STATE_SITE_ALARM && gAlarmState != ALARM_STATE_SITE_ALARM
#endif #endif
@@ -1200,8 +1113,7 @@ void RADIO_PrepareTX(void)
#endif #endif
} }
void RADIO_SendCssTail(void) void RADIO_SendCssTail(void) {
{
switch (gCurrentVfo->pTX->CodeType) { switch (gCurrentVfo->pTX->CodeType) {
case CODE_TYPE_DIGITAL: case CODE_TYPE_DIGITAL:
case CODE_TYPE_REVERSE_DIGITAL: case CODE_TYPE_REVERSE_DIGITAL:
@@ -1215,8 +1127,7 @@ void RADIO_SendCssTail(void)
SYSTEM_DelayMs(200); SYSTEM_DelayMs(200);
} }
void RADIO_SendEndOfTransmission(void) void RADIO_SendEndOfTransmission(void) {
{
BK4819_PlayRoger(); BK4819_PlayRoger();
DTMF_SendEndOfTransmission(); DTMF_SendEndOfTransmission();
@@ -1226,8 +1137,7 @@ void RADIO_SendEndOfTransmission(void)
RADIO_SetupRegisters(false); RADIO_SetupRegisters(false);
} }
void RADIO_PrepareCssTX(void) void RADIO_PrepareCssTX(void) {
{
RADIO_PrepareTX(); RADIO_PrepareTX();
SYSTEM_DelayMs(200); SYSTEM_DelayMs(200);

View File

@@ -107,7 +107,6 @@ typedef struct VFO_Info_t
uint8_t SquelchOpenGlitchThresh; uint8_t SquelchOpenGlitchThresh;
STEP_Setting_t STEP_SETTING; STEP_Setting_t STEP_SETTING;
uint8_t TX_LOCK;
uint8_t OUTPUT_POWER; uint8_t OUTPUT_POWER;
uint8_t TXP_CalculatedSetting; uint8_t TXP_CalculatedSetting;
bool FrequencyReverse; bool FrequencyReverse;

View File

@@ -17,9 +17,11 @@
#include <string.h> #include <string.h>
#include "app/dtmf.h" #include "app/dtmf.h"
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
#include "app/fm.h" #include "app/fm.h"
#endif #endif
#include "driver/bk1080.h" #include "driver/bk1080.h"
#include "driver/bk4819.h" #include "driver/bk4819.h"
#include "driver/eeprom.h" #include "driver/eeprom.h"
@@ -40,8 +42,7 @@ static const uint32_t gDefaultFrequencyTable[] =
EEPROM_Config_t gEeprom = {0}; EEPROM_Config_t gEeprom = {0};
void SETTINGS_InitEEPROM(void) void SETTINGS_InitEEPROM(void) {
{
uint8_t Data[16] = {0}; uint8_t Data[16] = {0};
// 0E70..0E77 // 0E70..0E77
EEPROM_ReadBuffer(0x0E70, Data, 8); EEPROM_ReadBuffer(0x0E70, Data, 8);
@@ -141,12 +142,7 @@ void SETTINGS_InitEEPROM(void)
gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE; gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_NONE;
gEeprom.SCAN_RESUME_MODE = (Data[5] < 105) ? Data[5] : 14; gEeprom.SCAN_RESUME_MODE = (Data[5] < 105) ? Data[5] : 14;
gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 41) ? Data[6] : 0; gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 41) ? Data[6] : 0;
#ifdef ENABLE_FEAT_F4HWN gEeprom.FSKMode = Data[7];
gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 6) ? Data[7] : POWER_ON_DISPLAY_MODE_VOLTAGE;
#else
gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 4) ? Data[7] : POWER_ON_DISPLAY_MODE_VOLTAGE;
#endif
// 0E98..0E9F // 0E98..0E9F
#ifdef ENABLE_PWRON_PASSWORD #ifdef ENABLE_PWRON_PASSWORD
EEPROM_ReadBuffer(0x0E98, Data, 8); EEPROM_ReadBuffer(0x0E98, Data, 8);
@@ -162,8 +158,7 @@ void SETTINGS_InitEEPROM(void)
if ((Data[1] < 200 && Data[1] > 90) && (Data[2] < Data[1] - 9 && Data[1] < 160 && Data[2] > 50)) { if ((Data[1] < 200 && Data[1] > 90) && (Data[2] < Data[1] - 9 && Data[1] < 160 && Data[2] > 50)) {
gEeprom.S0_LEVEL = Data[1]; gEeprom.S0_LEVEL = Data[1];
gEeprom.S9_LEVEL = Data[2]; gEeprom.S9_LEVEL = Data[2];
} } else {
else {
gEeprom.S0_LEVEL = 130; gEeprom.S0_LEVEL = 130;
gEeprom.S9_LEVEL = 76; gEeprom.S9_LEVEL = 76;
} }
@@ -264,37 +259,29 @@ void SETTINGS_InitEEPROM(void)
*/ */
// Fix me probably after Chirp update... // Fix me probably after Chirp update...
for (unsigned int i = 0; i < 3; i++) for (unsigned int i = 0; i < 3; i++) {
{
gEeprom.SCAN_LIST_ENABLED[i] = (Data[1] >> i) & 1; gEeprom.SCAN_LIST_ENABLED[i] = (Data[1] >> i) & 1;
} }
for (unsigned int i = 0; i < 3; i++) for (unsigned int i = 0; i < 3; i++) {
{
const unsigned int j = 1 + (i * 2); const unsigned int j = 1 + (i * 2);
gEeprom.SCANLIST_PRIORITY_CH1[i] = Data[j + 1]; gEeprom.SCANLIST_PRIORITY_CH1[i] = Data[j + 1];
gEeprom.SCANLIST_PRIORITY_CH2[i] = Data[j + 2]; gEeprom.SCANLIST_PRIORITY_CH2[i] = Data[j + 2];
} }
EEPROM_ReadBuffer(0x0F20, Data, 8);
gEeprom.FSKSRCAddress = Data[0];
gEeprom.FSKSRCAddress |= Data[1] << 8;
gEeprom.FSKSRCAddress |= Data[2] << 16;
gEeprom.FSKSRCAddress |= Data[3] << 24;
gEeprom.BK1080_AGC_ENABLED = Data[4] & 0x01;
gEeprom.BK1080_BLEND_CONFIG = (Data[4] >> 1) & 0x03;
gEeprom.BK1080_DEEMPHASIS_CONFIG = (Data[4] >> 3) & 0x03;
// 0F40..0F47 // 0F40..0F47
EEPROM_ReadBuffer(0x0F40, Data, 8); EEPROM_ReadBuffer(0x0F40, Data, 8);
gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF; gSetting_F_LOCK = (Data[0] < F_LOCK_LEN) ? Data[0] : F_LOCK_DEF;
#ifndef ENABLE_FEAT_F4HWN gSetting_ScrambleEnable = true;
gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true
#endif
#ifdef ENABLE_DTMF_CALLING
gSetting_KILLED = (Data[2] < 2) ? Data[2] : false;
#endif
#ifndef ENABLE_FEAT_F4HWN
gSetting_200TX = (Data[3] < 2) ? Data[3] : false;
gSetting_500TX = (Data[4] < 2) ? Data[4] : false;
#endif
gSetting_350EN = (Data[5] < 2) ? Data[5] : true;
#ifdef ENABLE_FEAT_F4HWN
gSetting_ScrambleEnable = false;
#else
gSetting_ScrambleEnable = (Data[6] < 2) ? Data[6] : true;
#endif
//gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false; //gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
gSetting_live_DTMF_decoder = !!(Data[7] & (1u << 1)); gSetting_live_DTMF_decoder = !!(Data[7] & (1u << 1));
@@ -309,8 +296,7 @@ void SETTINGS_InitEEPROM(void)
#endif #endif
gSetting_backlight_on_tx_rx = (Data[7] >> 6) & 3u; gSetting_backlight_on_tx_rx = (Data[7] >> 6) & 3u;
if (!gEeprom.VFO_OPEN) if (!gEeprom.VFO_OPEN) {
{
gEeprom.ScreenChannel[0] = gEeprom.MrChannel[0]; gEeprom.ScreenChannel[0] = gEeprom.MrChannel[0];
gEeprom.ScreenChannel[1] = gEeprom.MrChannel[1]; gEeprom.ScreenChannel[1] = gEeprom.MrChannel[1];
} }
@@ -343,7 +329,6 @@ void SETTINGS_InitEEPROM(void)
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
// 1FF0..0x1FF7 // 1FF0..0x1FF7
EEPROM_ReadBuffer(0x1FF0, Data, 8); EEPROM_ReadBuffer(0x1FF0, Data, 8);
gSetting_set_pwr = (((Data[7] & 0xF0) >> 4) < 7) ? ((Data[7] & 0xF0) >> 4) : 0;
gSetting_set_ptt = (((Data[7] & 0x0F)) < 2) ? ((Data[7] & 0x0F)) : 0; gSetting_set_ptt = (((Data[7] & 0x0F)) < 2) ? ((Data[7] & 0x0F)) : 0;
gSetting_set_tot = (((Data[6] & 0xF0) >> 4) < 4) ? ((Data[6] & 0xF0) >> 4) : 0; gSetting_set_tot = (((Data[6] & 0xF0) >> 4) < 4) ? ((Data[6] & 0xF0) >> 4) : 0;
@@ -354,8 +339,6 @@ void SETTINGS_InitEEPROM(void)
gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0; gSetting_set_inv = (((tmp >> 0) & 0x01) < 2) ? ((tmp >> 0) & 0x01): 0;
gSetting_set_lck = (((tmp >> 1) & 0x01) < 2) ? ((tmp >> 1) & 0x01): 0; gSetting_set_lck = (((tmp >> 1) & 0x01) < 2) ? ((tmp >> 1) & 0x01): 0;
gSetting_set_met = (((tmp >> 2) & 0x01) < 2) ? ((tmp >> 2) & 0x01): 0;
gSetting_set_gui = (((tmp >> 3) & 0x01) < 2) ? ((tmp >> 3) & 0x01): 0;
gSetting_set_ctr = (((Data[5] & 0x0F)) > 00 && ((Data[5] & 0x0F)) < 16) ? ((Data[5] & 0x0F)) : 10; gSetting_set_ctr = (((Data[5] & 0x0F)) > 00 && ((Data[5] & 0x0F)) < 16) ? ((Data[5] & 0x0F)) : 10;
gSetting_set_tmr = ((Data[4] & 1) < 2) ? (Data[4] & 1): 0; gSetting_set_tmr = ((Data[4] & 1) < 2) ? (Data[4] & 1): 0;
@@ -369,8 +352,6 @@ void SETTINGS_InitEEPROM(void)
gSetting_set_inv = 0; gSetting_set_inv = 0;
#endif #endif
gSetting_set_lck = (tmp >> 1) & 0x01; gSetting_set_lck = (tmp >> 1) & 0x01;
gSetting_set_met = (tmp >> 2) & 0x01;
gSetting_set_gui = (tmp >> 3) & 0x01;
#ifdef ENABLE_FEAT_F4HWN_CTR #ifdef ENABLE_FEAT_F4HWN_CTR
int ctr_value = Data[5] & 0x0F; int ctr_value = Data[5] & 0x0F;
@@ -394,8 +375,7 @@ void SETTINGS_InitEEPROM(void)
#endif #endif
} }
void SETTINGS_LoadCalibration(void) void SETTINGS_LoadCalibration(void) {
{
// uint8_t Mic; // uint8_t Mic;
EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[3], 8); EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[3], 8);
@@ -408,8 +388,7 @@ void SETTINGS_LoadCalibration(void)
memcpy(gEEPROM_RSSI_CALIB[2], gEEPROM_RSSI_CALIB[0], 8); memcpy(gEEPROM_RSSI_CALIB[2], gEEPROM_RSSI_CALIB[0], 8);
EEPROM_ReadBuffer(0x1F40, gBatteryCalibration, 12); EEPROM_ReadBuffer(0x1F40, gBatteryCalibration, 12);
if (gBatteryCalibration[0] >= 5000) if (gBatteryCalibration[0] >= 5000) {
{
gBatteryCalibration[0] = 1900; gBatteryCalibration[0] = 1900;
gBatteryCalibration[1] = 2000; gBatteryCalibration[1] = 2000;
} }
@@ -425,8 +404,7 @@ void SETTINGS_LoadCalibration(void)
gEeprom.MIC_SENSITIVITY_TUNING = gMicGain_dB2[gEeprom.MIC_SENSITIVITY]; gEeprom.MIC_SENSITIVITY_TUNING = gMicGain_dB2[gEeprom.MIC_SENSITIVITY];
{ {
struct struct {
{
int16_t BK4819_XtalFreqLow; int16_t BK4819_XtalFreqLow;
uint16_t EEPROM_1F8A; uint16_t EEPROM_1F8A;
uint16_t EEPROM_1F8C; uint16_t EEPROM_1F8C;
@@ -438,7 +416,8 @@ void SETTINGS_LoadCalibration(void)
// radio 2 .. 05 00 46 00 50 00 2C 0E // radio 2 .. 05 00 46 00 50 00 2C 0E
EEPROM_ReadBuffer(0x1F88, &Misc, 8); EEPROM_ReadBuffer(0x1F88, &Misc, 8);
gEeprom.BK4819_XTAL_FREQ_LOW = (Misc.BK4819_XtalFreqLow >= -1000 && Misc.BK4819_XtalFreqLow <= 1000) ? Misc.BK4819_XtalFreqLow : 0; gEeprom.BK4819_XTAL_FREQ_LOW = (Misc.BK4819_XtalFreqLow >= -1000 && Misc.BK4819_XtalFreqLow <= 1000)
? Misc.BK4819_XtalFreqLow : 0;
gEEPROM_1F8A = Misc.EEPROM_1F8A & 0x01FF; gEEPROM_1F8A = Misc.EEPROM_1F8A & 0x01FF;
gEEPROM_1F8C = Misc.EEPROM_1F8C & 0x01FF; gEEPROM_1F8C = Misc.EEPROM_1F8C & 0x01FF;
gEeprom.VOLUME_GAIN = (Misc.VOLUME_GAIN < 64) ? Misc.VOLUME_GAIN : 58; gEeprom.VOLUME_GAIN = (Misc.VOLUME_GAIN < 64) ? Misc.VOLUME_GAIN : 58;
@@ -453,10 +432,8 @@ void SETTINGS_LoadCalibration(void)
} }
} }
uint32_t SETTINGS_FetchChannelFrequency(const int channel) uint32_t SETTINGS_FetchChannelFrequency(const int channel) {
{ struct {
struct
{
uint32_t frequency; uint32_t frequency;
uint32_t offset; uint32_t offset;
} __attribute__((packed)) info; } __attribute__((packed)) info;
@@ -466,8 +443,7 @@ uint32_t SETTINGS_FetchChannelFrequency(const int channel)
return info.frequency; return info.frequency;
} }
void SETTINGS_FetchChannelName(char *s, const int channel) void SETTINGS_FetchChannelName(char *s, const int channel) {
{
if (s == NULL) if (s == NULL)
return; return;
@@ -492,16 +468,14 @@ void SETTINGS_FetchChannelName(char *s, const int channel)
s[i--] = 0; // null term s[i--] = 0; // null term
} }
void SETTINGS_FactoryReset(bool bIsAll) void SETTINGS_FactoryReset(bool bIsAll) {
{
uint16_t i; uint16_t i;
uint8_t Template[8]; uint8_t Template[8];
memset(Template, 0xFF, sizeof(Template)); memset(Template, 0xFF, sizeof(Template));
//for (i = 0x0C80; i < 0x1E00; i += 8) //for (i = 0x0C80; i < 0x1E00; i += 8)
for (i = 0x0000; i < 0x1E00; i += 8) for (i = 0x0000; i < 0x1E00; i += 8) {
{
if ( if (
!(i >= 0x0EE0 && i < 0x0F18) && // ANI ID + DTMF codes !(i >= 0x0EE0 && i < 0x0F18) && // ANI ID + DTMF codes
!(i >= 0x0F30 && i < 0x0F50) && // AES KEY + F LOCK + Scramble Enable !(i >= 0x0F30 && i < 0x0F50) && // AES KEY + F LOCK + Scramble Enable
@@ -516,14 +490,12 @@ void SETTINGS_FactoryReset(bool bIsAll)
!(i >= 0x0E40 && i < 0x0E70) && // FM Channels !(i >= 0x0E40 && i < 0x0E70) && // FM Channels
!(i >= 0x0E88 && i < 0x0E90) // FM settings !(i >= 0x0E88 && i < 0x0E90) // FM settings
)) ))
) ) {
{
EEPROM_WriteBuffer(i, Template); EEPROM_WriteBuffer(i, Template);
} }
} }
if (bIsAll) if (bIsAll) {
{
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + BAND6_400MHz, 43350000); RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + BAND6_400MHz, 43350000);
#ifdef ENABLE_FEAT_F4HWN_RESET_CHANNEL #ifdef ENABLE_FEAT_F4HWN_RESET_CHANNEL
@@ -571,8 +543,7 @@ void SETTINGS_SaveFM(void)
} }
#endif #endif
void SETTINGS_SaveVfoIndices(void) void SETTINGS_SaveVfoIndices(void) {
{
uint8_t State[8]; uint8_t State[8];
#ifndef ENABLE_NOAA #ifndef ENABLE_NOAA
@@ -593,8 +564,7 @@ void SETTINGS_SaveVfoIndices(void)
EEPROM_WriteBuffer(0x0E80, State); EEPROM_WriteBuffer(0x0E80, State);
} }
void SETTINGS_SaveSettings(void) void SETTINGS_SaveSettings(void) {
{
uint8_t State[8]; uint8_t State[8];
uint8_t tmp = 0; uint8_t tmp = 0;
@@ -634,17 +604,13 @@ void SETTINGS_SaveSettings(void)
State[4] = gEeprom.DUAL_WATCH; State[4] = gEeprom.DUAL_WATCH;
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
if(!gSaveRxMode) if (!gSaveRxMode) {
{
State[2] = gCB; State[2] = gCB;
State[4] = gDW; State[4] = gDW;
} }
if(gBackLight) if (gBackLight) {
{
State[5] = gBacklightTimeOriginal; State[5] = gBacklightTimeOriginal;
} } else {
else
{
State[5] = gEeprom.BACKLIGHT_TIME; State[5] = gEeprom.BACKLIGHT_TIME;
} }
#else #else
@@ -658,7 +624,8 @@ void SETTINGS_SaveSettings(void)
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE #ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) | ((gEeprom.SCAN_LIST_DEFAULT & 0x07) << 4); State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) |
((gEeprom.SCAN_LIST_DEFAULT & 0x07) << 4);
#else #else
State[7] = gEeprom.VFO_OPEN; State[7] = gEeprom.VFO_OPEN;
#endif #endif
@@ -672,7 +639,7 @@ void SETTINGS_SaveSettings(void)
State[4] = gEeprom.KEY_2_LONG_PRESS_ACTION; State[4] = gEeprom.KEY_2_LONG_PRESS_ACTION;
State[5] = gEeprom.SCAN_RESUME_MODE; State[5] = gEeprom.SCAN_RESUME_MODE;
State[6] = gEeprom.AUTO_KEYPAD_LOCK; State[6] = gEeprom.AUTO_KEYPAD_LOCK;
State[7] = gEeprom.POWER_ON_DISPLAY_MODE; State[7] = gEeprom.FSKMode;
EEPROM_WriteBuffer(0x0E90, State); EEPROM_WriteBuffer(0x0E90, State);
#ifdef ENABLE_PWRON_PASSWORD #ifdef ENABLE_PWRON_PASSWORD
@@ -743,24 +710,26 @@ void SETTINGS_SaveSettings(void)
State[7] = gEeprom.SCANLIST_PRIORITY_CH2[2]; State[7] = gEeprom.SCANLIST_PRIORITY_CH2[2];
EEPROM_WriteBuffer(0x0F18, State); EEPROM_WriteBuffer(0x0F18, State);
State[0] = gEeprom.FSKSRCAddress & 0xFF;
State[1] = (gEeprom.FSKSRCAddress >> 8) & 0xFF;
State[2] = (gEeprom.FSKSRCAddress >> 16) & 0xFF;
State[3] = (gEeprom.FSKSRCAddress >> 24) & 0xFF;
State[4] = ((gEeprom.BK1080_AGC_ENABLED & 0x01) |
((gEeprom.BK1080_BLEND_CONFIG & 0x03) << 1) |
((gEeprom.BK1080_DEEMPHASIS_CONFIG & 0x03) << 3));
EEPROM_WriteBuffer(0x0F20, State);
memset(State, 0xFF, sizeof(State)); memset(State, 0xFF, sizeof(State));
State[0] = gSetting_F_LOCK; State[0] = gSetting_F_LOCK;
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
State[1] = gSetting_350TX; State[1] = gSetting_350TX;
#endif #endif
#ifdef ENABLE_DTMF_CALLING
State[2] = gSetting_KILLED;
#endif
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
State[3] = gSetting_200TX; State[3] = gSetting_200TX;
State[4] = gSetting_500TX; State[4] = gSetting_500TX;
#endif #endif
State[5] = gSetting_350EN;
#ifdef ENABLE_FEAT_F4HWN
State[6] = false;
#else
State[6] = gSetting_ScrambleEnable; State[6] = gSetting_ScrambleEnable;
#endif
//if (!gSetting_TX_EN) State[7] &= ~(1u << 0); //if (!gSetting_TX_EN) State[7] &= ~(1u << 0);
if (!gSetting_live_DTMF_decoder) State[7] &= ~(1u << 1); if (!gSetting_live_DTMF_decoder) State[7] &= ~(1u << 1);
@@ -796,10 +765,6 @@ void SETTINGS_SaveSettings(void)
tmp = tmp | (1 << 0); tmp = tmp | (1 << 0);
if (gSetting_set_lck == 1) if (gSetting_set_lck == 1)
tmp = tmp | (1 << 1); tmp = tmp | (1 << 1);
if (gSetting_set_met == 1)
tmp = tmp | (1 << 2);
if (gSetting_set_gui == 1)
tmp = tmp | (1 << 3);
*/ */
#ifdef ENABLE_FEAT_F4HWN_SLEEP #ifdef ENABLE_FEAT_F4HWN_SLEEP
@@ -809,14 +774,11 @@ void SETTINGS_SaveSettings(void)
#endif #endif
tmp = (gSetting_set_inv << 0) | tmp = (gSetting_set_inv << 0) |
(gSetting_set_lck << 1) | (gSetting_set_lck << 1);
(gSetting_set_met << 2) |
(gSetting_set_gui << 3);
State[5] = ((tmp << 4) | (gSetting_set_ctr & 0x0F)); State[5] = ((tmp << 4) | (gSetting_set_ctr & 0x0F));
State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F)); State[6] = ((gSetting_set_tot << 4) | (gSetting_set_eot & 0x0F));
State[7] = ((gSetting_set_pwr << 4) | (gSetting_set_ptt & 0x0F)); State[7] = gSetting_set_ptt & 0x0F;
gEeprom.KEY_LOCK_PTT = gSetting_set_lck; gEeprom.KEY_LOCK_PTT = gSetting_set_lck;
EEPROM_WriteBuffer(0x1FF0, State); EEPROM_WriteBuffer(0x1FF0, State);
@@ -827,8 +789,7 @@ void SETTINGS_SaveSettings(void)
#endif #endif
} }
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode) void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode) {
{
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(Channel)) if (IS_NOAA_CHANNEL(Channel))
return; return;
@@ -856,7 +817,6 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
State._8[2] = (pVFO->freq_config_TX.CodeType << 4) | pVFO->freq_config_RX.CodeType; State._8[2] = (pVFO->freq_config_TX.CodeType << 4) | pVFO->freq_config_RX.CodeType;
State._8[3] = (pVFO->Modulation << 4) | pVFO->TX_OFFSET_FREQUENCY_DIRECTION; State._8[3] = (pVFO->Modulation << 4) | pVFO->TX_OFFSET_FREQUENCY_DIRECTION;
State._8[4] = 0 State._8[4] = 0
| (pVFO->TX_LOCK << 6)
| (pVFO->BUSY_CHANNEL_LOCK << 5) | (pVFO->BUSY_CHANNEL_LOCK << 5)
| (pVFO->OUTPUT_POWER << 2) | (pVFO->OUTPUT_POWER << 2)
| (pVFO->CHANNEL_BANDWIDTH << 1) | (pVFO->CHANNEL_BANDWIDTH << 1)
@@ -867,11 +827,8 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
#endif #endif
; ;
State._8[6] = pVFO->STEP_SETTING; State._8[6] = pVFO->STEP_SETTING;
#ifdef ENABLE_FEAT_F4HWN
State._8[7] = 0;
#else
State._8[7] = pVFO->SCRAMBLING_TYPE; State._8[7] = pVFO->SCRAMBLING_TYPE;
#endif
EEPROM_WriteBuffer(OffsetVFO + 8, State._8); EEPROM_WriteBuffer(OffsetVFO + 8, State._8);
SETTINGS_UpdateChannel(Channel, pVFO, true, true, true); SETTINGS_UpdateChannel(Channel, pVFO, true, true, true);
@@ -890,8 +847,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
} }
void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration) void SETTINGS_SaveBatteryCalibration(const uint16_t *batteryCalibration) {
{
uint16_t buf[4]; uint16_t buf[4];
EEPROM_WriteBuffer(0x1F40, batteryCalibration); EEPROM_WriteBuffer(0x1F40, batteryCalibration);
EEPROM_ReadBuffer(0x1F48, buf, sizeof(buf)); EEPROM_ReadBuffer(0x1F48, buf, sizeof(buf));
@@ -900,8 +856,7 @@ void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration)
EEPROM_WriteBuffer(0x1F48, buf); EEPROM_WriteBuffer(0x1F48, buf);
} }
void SETTINGS_SaveChannelName(uint8_t channel, const char * name) void SETTINGS_SaveChannelName(uint8_t channel, const char *name) {
{
uint16_t offset = channel * 16; uint16_t offset = channel * 16;
uint8_t buf[16] = {0}; uint8_t buf[16] = {0};
memcpy(buf, name, MIN(strlen(name), 10u)); memcpy(buf, name, MIN(strlen(name), 10u));
@@ -909,8 +864,7 @@ void SETTINGS_SaveChannelName(uint8_t channel, const char * name)
EEPROM_WriteBuffer(0x0F58 + offset, buf + 8); EEPROM_WriteBuffer(0x0F58 + offset, buf + 8);
} }
void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool check, bool save) void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool check, bool save) {
{
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (!IS_NOAA_CHANNEL(channel)) if (!IS_NOAA_CHANNEL(channel))
#endif #endif
@@ -940,8 +894,7 @@ void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep,
state[channel & 7u] = att.__val; state[channel & 7u] = att.__val;
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
if(save) if (save) {
{
EEPROM_WriteBuffer(offset, state); EEPROM_WriteBuffer(offset, state);
} }
#else #else
@@ -959,8 +912,7 @@ void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep,
} }
} }
void SETTINGS_WriteBuildOptions(void) void SETTINGS_WriteBuildOptions(void) {
{
uint8_t State[8]; uint8_t State[8];
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
@@ -1021,36 +973,39 @@ State[1] = 0
} }
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE #ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
void SETTINGS_WriteCurrentState(void)
{ void SETTINGS_WriteCurrentState(void) {
uint8_t State[8]; uint8_t State[8];
EEPROM_ReadBuffer(0x0E78, State, sizeof(State)); EEPROM_ReadBuffer(0x0E78, State, sizeof(State));
//State[3] = (gEeprom.CURRENT_STATE << 4) | (gEeprom.BATTERY_SAVE & 0x0F); //State[3] = (gEeprom.CURRENT_STATE << 4) | (gEeprom.BATTERY_SAVE & 0x0F);
State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) | ((gEeprom.SCAN_LIST_DEFAULT & 0x07) << 4); State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) |
((gEeprom.SCAN_LIST_DEFAULT & 0x07) << 4);
EEPROM_WriteBuffer(0x0E78, State); EEPROM_WriteBuffer(0x0E78, State);
} }
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_VOL #ifdef ENABLE_FEAT_F4HWN_VOL
void SETTINGS_WriteCurrentVol(void)
{ void SETTINGS_WriteCurrentVol(void) {
uint8_t State[8]; uint8_t State[8];
EEPROM_ReadBuffer(0x1F88, State, sizeof(State)); EEPROM_ReadBuffer(0x1F88, State, sizeof(State));
State[6] = gEeprom.VOLUME_GAIN; State[6] = gEeprom.VOLUME_GAIN;
EEPROM_WriteBuffer(0x1F88, State); EEPROM_WriteBuffer(0x1F88, State);
} }
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
void SETTINGS_ResetTxLock(void)
{ void SETTINGS_ResetTxLock(void) {
uint8_t State[8]; uint8_t State[8];
for(uint8_t channel = 0; channel < 200; channel++) for (uint8_t channel = 0; channel < 200; channel++) {
{
uint16_t OffsetVFO = channel * 16; uint16_t OffsetVFO = channel * 16;
EEPROM_ReadBuffer(OffsetVFO + 8, State, sizeof(State)); EEPROM_ReadBuffer(OffsetVFO + 8, State, sizeof(State));
State[4] |= (1 << 6); State[4] |= (1 << 6);
EEPROM_WriteBuffer(OffsetVFO + 8, State); EEPROM_WriteBuffer(OffsetVFO + 8, State);
} }
} }
#endif #endif

View File

@@ -23,8 +23,20 @@
#include "frequencies.h" #include "frequencies.h"
#include <helper/battery.h> #include <helper/battery.h>
#include "radio.h" #include "radio.h"
#include "functions.h"
#include "app/fskmodem.h"
#include <driver/backlight.h> #include <driver/backlight.h>
// Modem Modulation
typedef enum ModemModulation {
MOD_FSK_450, // for bad conditions
MOD_FSK_700, // for medium conditions
MOD_AFSK_1200, // for good conditions
MOD_AFSK_2400,
MOD_FSK_1200_2400,
MOD_NOAA_SAME
} ModemModulation;
enum POWER_OnDisplayMode_t { enum POWER_OnDisplayMode_t {
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
POWER_ON_DISPLAY_MODE_ALL, POWER_ON_DISPLAY_MODE_ALL,
@@ -40,14 +52,14 @@ typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;
enum TxLockModes_t { enum TxLockModes_t {
F_LOCK_DEF, //all default frequencies + configurable F_LOCK_DEF, //all default frequencies + configurable
F_LOCK_FCC,
#ifdef ENABLE_FEAT_F4HWN_CA #ifdef ENABLE_FEAT_F4HWN_CA
F_LOCK_FCC,
F_LOCK_CA, F_LOCK_CA,
#endif
F_LOCK_CE, F_LOCK_CE,
F_LOCK_GB, F_LOCK_GB,
F_LOCK_430, F_LOCK_430,
F_LOCK_438, F_LOCK_438,
#endif
#ifdef ENABLE_FEAT_F4HWN_PMR #ifdef ENABLE_FEAT_F4HWN_PMR
F_LOCK_PMR, F_LOCK_PMR,
#endif #endif
@@ -161,6 +173,19 @@ enum CHANNEL_DisplayMode_t {
}; };
typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t; typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t;
enum BK1080_DEEMPHASIS {
DEEMPHASIS_OFF = 0,
DEEMPHASIS_USA = 1,
DEEMPHASIS_EUR = 2
};
enum BK1080_BLEND {
BLEND_DEF = 0,
BLEND_POS6 = 1,
BLEND_NEG12 = 2,
BLEND_NEG6 = 3
};
typedef struct { typedef struct {
uint8_t ScreenChannel[2]; // current channels set in the radio (memory or frequency channels) uint8_t ScreenChannel[2]; // current channels set in the radio (memory or frequency channels)
uint8_t FreqChannel[2]; // last frequency channels used uint8_t FreqChannel[2]; // last frequency channels used
@@ -186,6 +211,9 @@ typedef struct {
bool FM_IsMrMode; bool FM_IsMrMode;
uint16_t FM_FrequencyPlaying; uint16_t FM_FrequencyPlaying;
uint8_t FM_Band : 2; uint8_t FM_Band : 2;
enum BK1080_DEEMPHASIS BK1080_DEEMPHASIS_CONFIG: 2;
enum BK1080_BLEND BK1080_BLEND_CONFIG : 2;
bool BK1080_AGC_ENABLED;
//uint8_t FM_Space : 2; //uint8_t FM_Space : 2;
#endif #endif
@@ -302,32 +330,54 @@ typedef struct {
uint8_t S0_LEVEL; uint8_t S0_LEVEL;
uint8_t S9_LEVEL; uint8_t S9_LEVEL;
#endif #endif
ModemModulation FSKMode;
uint32_t FSKSRCAddress;
} EEPROM_Config_t; } EEPROM_Config_t;
extern EEPROM_Config_t gEeprom; extern EEPROM_Config_t gEeprom;
void SETTINGS_InitEEPROM(void); void SETTINGS_InitEEPROM(void);
void SETTINGS_LoadCalibration(void); void SETTINGS_LoadCalibration(void);
uint32_t SETTINGS_FetchChannelFrequency(const int channel); uint32_t SETTINGS_FetchChannelFrequency(const int channel);
void SETTINGS_FetchChannelName(char *s, const int channel); void SETTINGS_FetchChannelName(char *s, const int channel);
void SETTINGS_FactoryReset(bool bIsAll); void SETTINGS_FactoryReset(bool bIsAll);
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
void SETTINGS_SaveFM(void); void SETTINGS_SaveFM(void);
#endif #endif
void SETTINGS_SaveVfoIndices(void); void SETTINGS_SaveVfoIndices(void);
void SETTINGS_SaveSettings(void); void SETTINGS_SaveSettings(void);
void SETTINGS_SaveChannelName(uint8_t channel, const char *name); void SETTINGS_SaveChannelName(uint8_t channel, const char *name);
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode); void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode);
void SETTINGS_SaveBatteryCalibration(const uint16_t *batteryCalibration); void SETTINGS_SaveBatteryCalibration(const uint16_t *batteryCalibration);
void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool check, bool save); void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool check, bool save);
void SETTINGS_WriteBuildOptions(void); void SETTINGS_WriteBuildOptions(void);
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE #ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
void SETTINGS_WriteCurrentState(void); void SETTINGS_WriteCurrentState(void);
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_VOL #ifdef ENABLE_FEAT_F4HWN_VOL
void SETTINGS_WriteCurrentVol(void); void SETTINGS_WriteCurrentVol(void);
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
void SETTINGS_ResetTxLock(void); void SETTINGS_ResetTxLock(void);
#endif #endif
#endif #endif

View File

@@ -52,7 +52,7 @@ void UI_DisplayAircopy(void)
gAircopyState = AIRCOPY_READY; gAircopyState = AIRCOPY_READY;
} }
UI_PrintString(pPrintStr, 2, 127, 0, 8); UI_PrintString(pPrintStr, 2, 127, 0 /*, 8 */);
if (gInputBoxIndex == 0) { if (gInputBoxIndex == 0) {
uint32_t frequency = gRxVfo->freq_config_RX.Frequency; uint32_t frequency = gRxVfo->freq_config_RX.Frequency;
@@ -61,11 +61,13 @@ void UI_DisplayAircopy(void)
UI_PrintStringSmallNormal(String + 7, 97, 0, 3); UI_PrintStringSmallNormal(String + 7, 97, 0, 3);
String[7] = 0; String[7] = 0;
// show the main large frequency digits // show the main large frequency digits
UI_DisplayFrequency(String, 16, 2, false); //UI_DisplayFrequency(String, 16, 2, false);
UI_PrintStringSmallNormal(String, 0, 20, 2);
} else { } else {
const char *ascii = INPUTBOX_GetAscii(); const char *ascii = INPUTBOX_GetAscii();
sprintf(String, "%.3s.%.3s", ascii, ascii + 3); sprintf(String, "%.3s.%.3s", ascii, ascii + 3);
UI_DisplayFrequency(String, 16, 2, false); //UI_DisplayFrequency(String, 16, 2, false);
UI_PrintStringSmallNormal(String, 0, 20, 2);
} }
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
@@ -81,7 +83,7 @@ void UI_DisplayAircopy(void)
// Draw gauge // Draw gauge
if(gAircopyStep != 0) if(gAircopyStep != 0)
{ {
UI_PrintString(String, 2, 127, 5, 8); UI_PrintString(String, 2, 127, 5 /*, 8 */);
gFrameBuffer[4][1] = 0x3c; gFrameBuffer[4][1] = 0x3c;
gFrameBuffer[4][2] = 0x42; gFrameBuffer[4][2] = 0x42;

View File

@@ -29,13 +29,61 @@
#include "ui/inputbox.h" #include "ui/inputbox.h"
#include "ui/ui.h" #include "ui/ui.h"
const char gBlendStrings[][4] = {
"DEF",
"+6 ",
"-12",
"-6 "
};
const char gDeemphasisStrings[][3] = {
"NO",
"US",
"EU"
};
bool wasStereo;
uint8_t oldRssi;
void UI_UpdateFMThings(bool force) {
force = force;
char String[16] = {0};
const uint16_t Status = BK1080_ReadRegister(BK1080_REG_10_RSSI_STATUS);
bool isStereo = Status & (1 << 9);
uint8_t rssi = Status & 0xFF;
if (!force && isStereo == wasStereo && rssi == oldRssi) {
return;
}
oldRssi = rssi;
wasStereo = isStereo;
sprintf(String, "%s RSSI%d/255",
isStereo ? "STER" : "MONO", rssi);
UI_PrintStringSmallNormal(String, 1, 0, 4);
ST7565_BlitLine(4);
}
void UI_DisplayFM(void) void UI_DisplayFM(void)
{ {
char String[16] = {0}; char String[16] = {0};
char *pPrintStr = String; char *pPrintStr = String;
UI_DisplayClear(); UI_DisplayClear();
UI_PrintString("FM", 2, 0, 0, 8); UI_UpdateFMThings(true);
UI_PrintString("FM", 2, 0, 0 /*, 8 */);
sprintf(String, "%s D%s B%s",
gEeprom.BK1080_AGC_ENABLED ? " AGC" : "NAGC",
gDeemphasisStrings[gEeprom.BK1080_DEEMPHASIS_CONFIG],
gBlendStrings[gEeprom.BK1080_BLEND_CONFIG]);
UI_PrintStringSmallNormal(String, 1, 0, 5);
sprintf(String, "%d%s-%dM", sprintf(String, "%d%s-%dM",
BK1080_GetFreqLoLimit(gEeprom.FM_Band)/10, BK1080_GetFreqLoLimit(gEeprom.FM_Band)/10,
@@ -50,37 +98,37 @@ void UI_DisplayFM(void)
//UI_PrintStringSmallNormal(String, 127 - 4*7, 0, 6); //UI_PrintStringSmallNormal(String, 127 - 4*7, 0, 6);
if (gAskToSave) { if (gAskToSave) {
pPrintStr = "SAVE?"; pPrintStr = "SAV?";
} else if (gAskToDelete) { } else if (gAskToDelete) {
pPrintStr = "DEL?"; pPrintStr = "DEL?";
} else if (gFM_ScanState == FM_SCAN_OFF) { } else if (gFM_ScanState == FM_SCAN_OFF) {
if (gEeprom.FM_IsMrMode) { if (gEeprom.FM_IsMrMode) {
sprintf(String, "MR(CH%02u)", gEeprom.FM_SelectedChannel + 1); sprintf(String, "CH%02u", gEeprom.FM_SelectedChannel + 1);
pPrintStr = String; pPrintStr = String;
} else { } else {
pPrintStr = "VFO"; pPrintStr = "VFO";
for (unsigned int i = 0; i < 20; i++) { for (unsigned int i = 0; i < 20; i++) {
if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i]) { if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i]) {
sprintf(String, "VFO(CH%02u)", i + 1); sprintf(String, "C%02u MHz", i + 1);
pPrintStr = String; pPrintStr = String;
break; break;
} }
} }
} }
} else if (gFM_AutoScan) { } else if (gFM_AutoScan) {
sprintf(String, "A-SCAN(%u)", gFM_ChannelPosition + 1); sprintf(String, "A-SCN(%u)", gFM_ChannelPosition + 1);
pPrintStr = String; pPrintStr = String;
} else { } else {
pPrintStr = "M-SCAN"; pPrintStr = "M-SCN";
} }
UI_PrintString(pPrintStr, 0, 127, 3, 10); // memory, vfo, scan UI_PrintString(pPrintStr, 0, 127, 3 /*, 12 */); // memory, vfo, scan
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex > 0)) { if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex > 0)) {
UI_GenerateChannelString(String, gFM_ChannelPosition); UI_GenerateChannelString(String, gFM_ChannelPosition);
} else if (gAskToDelete) { } else if (gAskToDelete) {
sprintf(String, "CH-%02u", gEeprom.FM_SelectedChannel + 1); sprintf(String, "C-%02u", gEeprom.FM_SelectedChannel + 1);
} else { } else {
if (gInputBoxIndex == 0) { if (gInputBoxIndex == 0) {
sprintf(String, " %3d.%d", gEeprom.FM_FrequencyPlaying / 10, gEeprom.FM_FrequencyPlaying % 10); sprintf(String, " %3d.%d", gEeprom.FM_FrequencyPlaying / 10, gEeprom.FM_FrequencyPlaying % 10);
@@ -89,12 +137,12 @@ void UI_DisplayFM(void)
sprintf(String, "%.3s.%.1s",ascii, ascii + 3); sprintf(String, "%.3s.%.1s",ascii, ascii + 3);
} }
UI_DisplayFrequency(String, 36, 1, gInputBoxIndex == 0); // frequency UI_PrintString(String, 0, 20, 1 /*, 10 */); // frequency
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
return; return;
} }
UI_PrintString(String, 0, 127, 1, 10); UI_PrintString(String, 0, 127, 1 /*, 10 */);
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
} }

View File

@@ -19,6 +19,7 @@
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
void UI_DisplayFM(void); void UI_DisplayFM(void);
void UI_UpdateFMThings(bool force);
#endif #endif
#endif #endif

View File

@@ -27,12 +27,10 @@
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof((arr)[0])) #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof((arr)[0]))
#endif #endif
void UI_GenerateChannelString(char *pString, const uint8_t Channel) void UI_GenerateChannelString(char *pString, const uint8_t Channel) {
{
unsigned int i; unsigned int i;
if (gInputBoxIndex == 0) if (gInputBoxIndex == 0) {
{
sprintf(pString, "CH-%02u", Channel + 1); sprintf(pString, "CH-%02u", Channel + 1);
return; return;
} }
@@ -44,8 +42,7 @@ void UI_GenerateChannelString(char *pString, const uint8_t Channel)
pString[i + 3] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0'; pString[i + 3] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
} }
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber) void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber) {
{
if (gInputBoxIndex > 0) { if (gInputBoxIndex > 0) {
for (unsigned int i = 0; i < 3; i++) { for (unsigned int i = 0; i < 3; i++) {
pString[i] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0'; pString[i] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
@@ -65,41 +62,44 @@ void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uin
} }
} }
void UI_PrintStringBuffer(const char *pString, uint8_t * buffer, uint32_t char_width, const uint8_t *font) void *memcpy_inv(void *dst, const void *src, size_t n) {
{ if (!dst || !src) return dst;
uint8_t *d = (uint8_t *) dst;
const uint8_t *s = (const uint8_t *) src;
while (n--) {
*d++ = ~(*s++);
}
return dst;
}
void UI_PrintStringBuffer(const char *pString, uint8_t *buffer, uint32_t char_width, const uint8_t *font, bool inv) {
const size_t Length = strlen(pString); const size_t Length = strlen(pString);
const unsigned int char_spacing = char_width + 1; const unsigned int char_spacing = char_width + 1;
const uint32_t total_width = Length * char_spacing; // Total width of the text
if (inv) {
// Draw background rectangle from 1 px before the first char to 1 px after the last char
memset(buffer, 0xFF, total_width + 2);
}
for (size_t i = 0; i < Length; i++) { for (size_t i = 0; i < Length; i++) {
const unsigned int index = pString[i] - ' ' - 1; const unsigned int index = pString[i] - ' ' - 1;
if (pString[i] > ' ' && pString[i] < 127) { if (pString[i] > ' ' && pString[i] < 127) {
const uint32_t offset = i * char_spacing + 1; const uint32_t offset = i * char_spacing + 1;
if (inv) {
memcpy_inv(buffer + offset, font + index * char_width, char_width);
} else {
memcpy(buffer + offset, font + index * char_width, char_width); memcpy(buffer + offset, font + index * char_width, char_width);
} }
} }
} }
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width)
{
size_t i;
size_t Length = strlen(pString);
if (End > Start)
Start += (((End - Start) - (Length * Width)) + 1) / 2;
for (i = 0; i < Length; i++)
{
const unsigned int ofs = (unsigned int)Start + (i * Width);
if (pString[i] > ' ' && pString[i] < 127)
{
const unsigned int index = pString[i] - ' ' - 1;
memcpy(gFrameBuffer[Line + 0] + ofs, &gFontBig[index][0], 7);
memcpy(gFrameBuffer[Line + 1] + ofs, &gFontBig[index][7], 7);
}
}
} }
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t char_width, const uint8_t *font) void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t char_width,
{ const uint8_t *font, bool inv) {
const size_t Length = strlen(pString); const size_t Length = strlen(pString);
const unsigned int char_spacing = char_width + 1; const unsigned int char_spacing = char_width + 1;
@@ -107,17 +107,52 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
Start += (((End - Start) - Length * char_spacing) + 1) / 2; Start += (((End - Start) - Length * char_spacing) + 1) / 2;
} }
UI_PrintStringBuffer(pString, gFrameBuffer[Line] + Start, char_width, font); UI_PrintStringBuffer(pString, gFrameBuffer[Line] + Start, char_width, font, inv);
} }
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
{ UI_PrintStringSmall(pString, Start, End, Line, ARRAY_SIZE(gFontSmall[0]), (const uint8_t *) gFontSmall, false);
UI_PrintStringSmall(pString, Start, End, Line, ARRAY_SIZE(gFontSmall[0]), (const uint8_t *)gFontSmall);
} }
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) //void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line /*, uint8_t Width */) {
{ // UI_PrintStringSmallNormal(pString, Start, End, Line);
//// size_t i;
//// size_t Length = strlen(pString);
////
//// if (End > Start)
//// Start += (((End - Start) - (Length * Width)) + 1) / 2;
////
//// for (i = 0; i < Length; i++)
//// {
//// const unsigned int ofs = (unsigned int)Start + (i * Width);
//// if (pString[i] > ' ' && pString[i] < 127)
//// {
//// const unsigned int index = pString[i] - ' ' - 1;
//// memcpy(gFrameBuffer[Line + 0] + ofs, &gFontSmall[index + '0'][0], 7);
//// memcpy(gFrameBuffer[Line + 1] + ofs, &gFontSmall[index + '0'][7], 7);
//// }
//// }
//}
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
//#ifdef ENABLE_SMALL_BOLD
// const uint8_t *font = (uint8_t *)gFontSmallBold;
// const uint8_t char_width = ARRAY_SIZE(gFontSmallBold[0]);
//#else
// const uint8_t *font = (uint8_t *) gFontSmall;
// const uint8_t char_width = ARRAY_SIZE(gFontSmall[0]);
//#endif
//
// UI_PrintStringSmall(pString, Start, End, Line, char_width, font);
UI_PrintStringSmall(pString, Start, End, Line, ARRAY_SIZE(gFontSmall[0]), (const uint8_t *) gFontSmall, true);
}
void UI_PrintStringSmallBufferNormal(const char *pString, uint8_t *buffer) {
UI_PrintStringBuffer(pString, buffer, ARRAY_SIZE(gFontSmall[0]), (uint8_t *) gFontSmall, false);
}
void UI_PrintStringSmallBufferBold(const char *pString, uint8_t *buffer) {
#ifdef ENABLE_SMALL_BOLD #ifdef ENABLE_SMALL_BOLD
const uint8_t *font = (uint8_t *) gFontSmallBold; const uint8_t *font = (uint8_t *) gFontSmallBold;
const uint8_t char_width = ARRAY_SIZE(gFontSmallBold[0]); const uint8_t char_width = ARRAY_SIZE(gFontSmallBold[0]);
@@ -125,61 +160,45 @@ void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, ui
const uint8_t *font = (uint8_t *) gFontSmall; const uint8_t *font = (uint8_t *) gFontSmall;
const uint8_t char_width = ARRAY_SIZE(gFontSmall[0]); const uint8_t char_width = ARRAY_SIZE(gFontSmall[0]);
#endif #endif
UI_PrintStringBuffer(pString, buffer, char_width, font, false);
UI_PrintStringSmall(pString, Start, End, Line, char_width, font);
} }
void UI_PrintStringSmallBufferNormal(const char *pString, uint8_t * buffer) //void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center) {
{ // const unsigned int char_width = 13;
UI_PrintStringBuffer(pString, buffer, ARRAY_SIZE(gFontSmall[0]), (uint8_t *)gFontSmall); // uint8_t *pFb0 = gFrameBuffer[Y] + X;
} // uint8_t *pFb1 = pFb0 + 128;
// bool bCanDisplay = false;
void UI_PrintStringSmallBufferBold(const char *pString, uint8_t * buffer) //
{ // uint8_t len = strlen(string);
#ifdef ENABLE_SMALL_BOLD // for (int i = 0; i < len; i++) {
const uint8_t *font = (uint8_t *)gFontSmallBold; // char c = string[i];
const uint8_t char_width = ARRAY_SIZE(gFontSmallBold[0]); // if (c == '-') c = '9' + 1;
#else // if (bCanDisplay || c != ' ') {
const uint8_t *font = (uint8_t *)gFontSmall; // bCanDisplay = true;
const uint8_t char_width = ARRAY_SIZE(gFontSmall[0]); // if (c >= '0' && c <= '9' + 1) {
#endif // memcpy(pFb0 + 2, gFontSmall[(unsigned char) c], char_width - 3);
UI_PrintStringBuffer(pString, buffer, char_width, font); // memcpy(pFb1 + 2, gFontSmall[(unsigned char) c] + char_width - 3, char_width - 3);
} // } else if (c == '.') {
// *pFb1 = 0x60;
void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center) // pFb0++;
{ // pFb1++;
const unsigned int char_width = 13; // *pFb1 = 0x60;
uint8_t *pFb0 = gFrameBuffer[Y] + X; // pFb0++;
uint8_t *pFb1 = pFb0 + 128; // pFb1++;
bool bCanDisplay = false; // *pFb1 = 0x60;
// pFb0++;
uint8_t len = strlen(string); // pFb1++;
for(int i = 0; i < len; i++) { // continue;
char c = string[i]; // }
if(c=='-') c = '9' + 1; //
if (bCanDisplay || c != ' ') // } else if (center) {
{ // pFb0 -= 6;
bCanDisplay = true; // pFb1 -= 6;
if(c>='0' && c<='9' + 1) { // }
memcpy(pFb0 + 2, gFontBigDigits[c-'0'], char_width - 3); // pFb0 += char_width;
memcpy(pFb1 + 2, gFontBigDigits[c-'0'] + char_width - 3, char_width - 3); // pFb1 += char_width;
} // }
else if(c=='.') { //}
*pFb1 = 0x60; pFb0++; pFb1++;
*pFb1 = 0x60; pFb0++; pFb1++;
*pFb1 = 0x60; pFb0++; pFb1++;
continue;
}
}
else if (center) {
pFb0 -= 6;
pFb1 -= 6;
}
pFb0 += char_width;
pFb1 += char_width;
}
}
/* /*
void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center) void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center)
@@ -221,8 +240,7 @@ void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center)
} }
*/ */
void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black) void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black) {
{
const uint8_t pattern = 1 << (y % 8); const uint8_t pattern = 1 << (y % 8);
if (black) if (black)
buffer[y / 8][x] |= pattern; buffer[y / 8][x] |= pattern;
@@ -230,8 +248,7 @@ void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black
buffer[y / 8][x] &= ~pattern; buffer[y / 8][x] &= ~pattern;
} }
static void sort(int16_t *a, int16_t *b) static void sort(int16_t *a, int16_t *b) {
{
if (*a > *b) { if (*a > *b) {
int16_t t = *a; int16_t t = *a;
*a = *b; *a = *b;
@@ -240,6 +257,7 @@ static void sort(int16_t *a, int16_t *b)
} }
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
/* /*
void UI_DrawLineDottedBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black) void UI_DrawLineDottedBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black)
{ {
@@ -270,6 +288,30 @@ static void sort(int16_t *a, int16_t *b)
UI_DrawPixelBuffer(&gStatusLine, x, y, fill); UI_DrawPixelBuffer(&gStatusLine, x, y, fill);
} }
//void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
// bool statusbar, bool fill) {
// uint8_t c;
// uint8_t pixels;
// const uint8_t *p = (const uint8_t *) pString;
//
// while ((c = *p++) && c != '\0') {
// c -= 0x20;
// for (int i = 0; i < 3; ++i) {
// pixels = gFont3x5[c][i];
// for (int j = 0; j < 6; ++j) {
// if (pixels & 1) {
// if (statusbar)
// PutPixelStatus(x + i, y + j, fill);
// else
// PutPixel(x + i, y + j, fill);
// }
// pixels >>= 1;
// }
// }
// x += 4;
// }
//}
void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y, void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
bool statusbar, bool fill) { bool statusbar, bool fill) {
uint8_t c; uint8_t c;
@@ -278,9 +320,10 @@ static void sort(int16_t *a, int16_t *b)
while ((c = *p++) && c != '\0') { while ((c = *p++) && c != '\0') {
c -= 0x20; c -= 0x20;
for (int i = 0; i < 3; ++i) { for (int i = 0; i < (int) ARRAY_SIZE(gFontSmall[0]); ++i) {
pixels = gFont3x5[c][i]; if (c) {
for (int j = 0; j < 6; ++j) { pixels = gFontSmall[c - 1][i];
for (int j = 0; j < 8; ++j) {
if (pixels & 1) { if (pixels & 1) {
if (statusbar) if (statusbar)
PutPixelStatus(x + i, y + j, fill); PutPixelStatus(x + i, y + j, fill);
@@ -290,13 +333,15 @@ static void sort(int16_t *a, int16_t *b)
pixels >>= 1; pixels >>= 1;
} }
} }
x += 4; }
x += ARRAY_SIZE(gFontSmall[0]) + 1;
} }
} }
#endif #endif
void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black) void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black) {
{
if (x2 == x1) { if (x2 == x1) {
sort(&y1, &y2); sort(&y1, &y2);
for (int16_t i = y1; i <= y2; i++) { for (int16_t i = y1; i <= y2; i++) {
@@ -308,15 +353,13 @@ void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x
int b = y1 - a * x1 / multipl; int b = y1 - a * x1 / multipl;
sort(&x1, &x2); sort(&x1, &x2);
for(int i = x1; i<= x2; i++) for (int i = x1; i <= x2; i++) {
{
UI_DrawPixelBuffer(buffer, i, i * a / multipl + b, black); UI_DrawPixelBuffer(buffer, i, i * a / multipl + b, black);
} }
} }
} }
void UI_DrawRectangleBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black) void UI_DrawRectangleBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black) {
{
UI_DrawLineBuffer(buffer, x1, y1, x1, y2, black); UI_DrawLineBuffer(buffer, x1, y1, x1, y2, black);
UI_DrawLineBuffer(buffer, x1, y1, x2, y1, black); UI_DrawLineBuffer(buffer, x1, y1, x2, y1, black);
UI_DrawLineBuffer(buffer, x2, y1, x2, y2, black); UI_DrawLineBuffer(buffer, x2, y1, x2, y2, black);
@@ -324,8 +367,7 @@ void UI_DrawRectangleBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int1
} }
void UI_DisplayPopup(const char *string) void UI_DisplayPopup(const char *string) {
{
UI_DisplayClear(); UI_DisplayClear();
// for(uint8_t i = 1; i < 5; i++) { // for(uint8_t i = 1; i < 5; i++) {
@@ -342,11 +384,17 @@ void UI_DisplayPopup(const char *string)
// UI_DrawPixelBuffer(117, y, true); // UI_DrawPixelBuffer(117, y, true);
// } // }
// DrawRectangle(9,9, 118,38, true); // DrawRectangle(9,9, 118,38, true);
UI_PrintString(string, 9, 118, 2, 8); UI_PrintString(string, 9, 118, 2 /*, 8 */);
UI_PrintStringSmallNormal("Press EXIT", 9, 118, 6); UI_PrintStringSmallNormal("Press EXIT", 9, 118, 6);
} }
void UI_DisplayClear() void UI_ClearLine(uint8_t Line) {
{ if (Line < 8) { // ST7565 has 8 pages (rows of 8 pixels)
memset(gFrameBuffer[Line], 0x00, 128); // Clear all pixels on the line
}
}
void UI_DisplayClear() {
memset(gFrameBuffer, 0, sizeof(gFrameBuffer)); memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
} }

View File

@@ -22,13 +22,14 @@
void UI_GenerateChannelString(char *pString, const uint8_t Channel); void UI_GenerateChannelString(char *pString, const uint8_t Channel);
void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber); void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uint8_t ChannelNumber);
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width); //void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line /*, uint8_t Width */);
#define UI_PrintString UI_PrintStringSmallNormal
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line); void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line); void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
void UI_PrintStringSmallBufferNormal(const char *pString, uint8_t *buffer); void UI_PrintStringSmallBufferNormal(const char *pString, uint8_t *buffer);
void UI_PrintStringSmallBufferBold(const char *pString, uint8_t * buffer); void UI_PrintStringSmallBufferBold(const char *pString, uint8_t * buffer);
void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center); //void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center);
void UI_ClearLine(uint8_t Line);
void UI_DisplayPopup(const char *string); void UI_DisplayPopup(const char *string);
void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black); void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black);

View File

@@ -37,11 +37,11 @@ static void Render(void)
memset(gStatusLine, 0, sizeof(gStatusLine)); memset(gStatusLine, 0, sizeof(gStatusLine));
UI_DisplayClear(); UI_DisplayClear();
UI_PrintString("PASSWORD", 0, 127, 1, 10); UI_PrintString("PASSWORD", 0, 127, 1 /*, 10 */);
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
String[i] = (gInputBox[i] == 10) ? '-' : 'x'; String[i] = (gInputBox[i] == 10) ? '-' : 'x';
String[6] = 0; String[6] = 0;
UI_PrintString(String, 0, 127, 3, 12); UI_PrintString(String, 0, 127, 3 /*, 12 */);
ST7565_BlitStatusLine(); ST7565_BlitStatusLine();
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();

627
ui/main.c

File diff suppressed because it is too large Load Diff

547
ui/menu.c

File diff suppressed because it is too large Load Diff

View File

@@ -28,8 +28,7 @@ typedef struct {
uint8_t menu_id; uint8_t menu_id;
} t_menu_item; } t_menu_item;
enum enum {
{
MENU_SQL = 0, MENU_SQL = 0,
MENU_STEP, MENU_STEP,
MENU_TXP, MENU_TXP,
@@ -41,13 +40,8 @@ enum
MENU_OFFSET, MENU_OFFSET,
MENU_TOT, MENU_TOT,
MENU_W_N, MENU_W_N,
#ifndef ENABLE_FEAT_F4HWN
MENU_SCR, MENU_SCR,
#endif
MENU_BCL, MENU_BCL,
#ifdef ENABLE_FEAT_F4HWN
MENU_TX_LOCK,
#endif
MENU_MEM_CH, MENU_MEM_CH,
MENU_DEL_CH, MENU_DEL_CH,
MENU_MEM_NAME, MENU_MEM_NAME,
@@ -98,9 +92,9 @@ enum
MENU_D_LIST, MENU_D_LIST,
#endif #endif
MENU_D_LIVE_DEC, MENU_D_LIVE_DEC,
MENU_PONMSG, MENU_FSKSRC,
MENU_FSKMOD,
MENU_ROGER, MENU_ROGER,
MENU_VOL,
MENU_BAT_TXT, MENU_BAT_TXT,
MENU_AM, MENU_AM,
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
@@ -113,15 +107,6 @@ enum
#endif #endif
MENU_RESET, MENU_RESET,
MENU_F_LOCK, MENU_F_LOCK,
#ifndef ENABLE_FEAT_F4HWN
MENU_200TX,
MENU_350TX,
MENU_500TX,
#endif
MENU_350EN,
#ifndef ENABLE_FEAT_F4HWN
MENU_SCREN,
#endif
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
MENU_F_CALI, // reference xtal calibration MENU_F_CALI, // reference xtal calibration
#endif #endif
@@ -129,15 +114,12 @@ enum
MENU_SET_OFF, MENU_SET_OFF,
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
MENU_SET_PWR,
MENU_SET_PTT, MENU_SET_PTT,
MENU_SET_TOT, MENU_SET_TOT,
MENU_SET_EOT, MENU_SET_EOT,
MENU_SET_CTR, MENU_SET_CTR,
MENU_SET_INV, MENU_SET_INV,
MENU_SET_LCK, MENU_SET_LCK,
MENU_SET_MET,
MENU_SET_GUI,
MENU_SET_TMR, MENU_SET_TMR,
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
MENU_SET_NFM, MENU_SET_NFM,
@@ -161,10 +143,9 @@ enum
MENU_BATTYP MENU_BATTYP
}; };
extern const uint8_t FIRST_HIDDEN_MENU_ITEM;
extern const t_menu_item MenuList[]; extern const t_menu_item MenuList[];
extern const char gSubMenu_TXP[8][6]; extern const char gSubMenu_TXP[7][5];
extern const char gSubMenu_SFT_D[3][4]; extern const char gSubMenu_SFT_D[3][4];
extern const char gSubMenu_W_N[2][7]; extern const char gSubMenu_W_N[2][7];
extern const char gSubMenu_OFF_ON[2][4]; extern const char gSubMenu_OFF_ON[2][4];
@@ -184,11 +165,8 @@ extern const char gSubMenu_D_RSP[4][11];
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
extern const char gSubMenu_SET_PWR[7][6];
extern const char gSubMenu_SET_PTT[2][8]; extern const char gSubMenu_SET_PTT[2][8];
extern const char gSubMenu_SET_TOT[4][7]; extern const char gSubMenu_SET_TOT[4][7];
extern const char gSubMenu_SET_LCK[2][9];
extern const char gSubMenu_SET_MET[2][8];
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
extern const char gSubMenu_SET_NFM[2][9]; extern const char gSubMenu_SET_NFM[2][9];
#endif #endif
@@ -198,11 +176,7 @@ extern const char gSubMenu_D_RSP[4][11];
#endif #endif
extern const char *const gSubMenu_PTT_ID[5]; extern const char *const gSubMenu_PTT_ID[5];
#ifdef ENABLE_FEAT_F4HWN extern const char gSubMenu_FSKMod[6][8];
extern const char gSubMenu_PONMSG[5][8];
#else
extern const char gSubMenu_PONMSG[4][8];
#endif
extern const char gSubMenu_ROGER[3][6]; extern const char gSubMenu_ROGER[3][6];
extern const char gSubMenu_RESET[2][4]; extern const char gSubMenu_RESET[2][4];
extern const char *const gSubMenu_F_LOCK[F_LOCK_LEN]; extern const char *const gSubMenu_F_LOCK[F_LOCK_LEN];
@@ -210,11 +184,10 @@ extern const char gSubMenu_RX_TX[4][6];
extern const char gSubMenu_BAT_TXT[3][8]; extern const char gSubMenu_BAT_TXT[3][8];
extern const char gSubMenu_BATTYP[3][9]; extern const char gSubMenu_BATTYP[3][9];
#ifndef ENABLE_FEAT_F4HWN typedef struct {
extern const char gSubMenu_SCRAMBLER[11][7]; char *name;
#endif uint8_t id;
} t_sidefunction;
typedef struct {char* name; uint8_t id;} t_sidefunction;
extern const uint8_t gSubMenu_SIDEFUNCTIONS_size; extern const uint8_t gSubMenu_SIDEFUNCTIONS_size;
extern const t_sidefunction gSubMenu_SIDEFUNCTIONS[]; extern const t_sidefunction gSubMenu_SIDEFUNCTIONS[];
@@ -229,7 +202,9 @@ extern char edit[17];
extern int edit_index; extern int edit_index;
void UI_DisplayMenu(void); void UI_DisplayMenu(void);
int UI_MENU_GetCurrentMenuId(); int UI_MENU_GetCurrentMenuId();
uint8_t UI_MENU_GetMenuIdx(uint8_t id); uint8_t UI_MENU_GetMenuIdx(uint8_t id);
#endif #endif

View File

@@ -40,7 +40,7 @@ void UI_DisplayScanner(void)
pPrintStr = "FREQ:**.*****"; pPrintStr = "FREQ:**.*****";
} }
UI_PrintString(pPrintStr, 2, 0, 1, 8); UI_PrintString(pPrintStr, 2, 0, 1 /*, 8 */);
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) { if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) {
pPrintStr = "CTC:******"; pPrintStr = "CTC:******";
@@ -52,10 +52,10 @@ void UI_DisplayScanner(void)
pPrintStr = String; pPrintStr = String;
} }
UI_PrintString(pPrintStr, 2, 0, 3, 8); UI_PrintString(pPrintStr, 2, 0, 3 /*, 8 */);
memset(String, 0, sizeof(String)); memset(String, 0, sizeof(String));
if (gScannerSaveState == SCAN_SAVE_CHANNEL) { if (gScannerSaveState == SCAN_SAVE_CHANNEL) {
pPrintStr = "SAVE?"; pPrintStr = "SAV?";
Start = 0; Start = 0;
bCentered = 1; bCentered = 1;
} else { } else {
@@ -63,21 +63,21 @@ void UI_DisplayScanner(void)
bCentered = 0; bCentered = 0;
if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) { if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) {
strcpy(String, "SAVE:"); strcpy(String, "SAV:");
UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel); UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel);
pPrintStr = String; pPrintStr = String;
} else if (gScanCssState < SCAN_CSS_STATE_FOUND) { } else if (gScanCssState < SCAN_CSS_STATE_FOUND) {
strcpy(String, "SCAN"); strcpy(String, "SCN");
memset(String + 4, '.', (gScanProgressIndicator & 7) + 1); memset(String + 4, '.', (gScanProgressIndicator & 7) + 1);
pPrintStr = String; pPrintStr = String;
} else if (gScanCssState == SCAN_CSS_STATE_FOUND) { } else if (gScanCssState == SCAN_CSS_STATE_FOUND) {
pPrintStr = "SCAN CMP."; pPrintStr = "SCN CMP.";
} else { } else {
pPrintStr = "SCAN FAIL."; pPrintStr = "SCN FAIL.";
} }
} }
UI_PrintString(pPrintStr, Start, bCentered ? 127 : 0, 5, 8); UI_PrintString(pPrintStr, Start, bCentered ? 127 : 0, 5 /*, 8 */);
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
} }

View File

@@ -84,13 +84,6 @@ void UI_DisplayStatus()
unsigned int x1 = x; unsigned int x1 = x;
#ifdef ENABLE_DTMF_CALLING
if (gSetting_KILLED) {
memset(line + x, 0xFF, 10);
x1 = x + 10;
}
else
#endif
{ // SCAN indicator { // SCAN indicator
if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning()) { if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning()) {
if (IS_MR_CHANNEL(gNextMrChannel) && !SCANNER_IsScanning()) { // channel mode if (IS_MR_CHANNEL(gNextMrChannel) && !SCANNER_IsScanning()) { // channel mode

View File

@@ -28,27 +28,20 @@
#include "version.h" #include "version.h"
#include "bitmaps.h" #include "bitmaps.h"
void UI_DisplayReleaseKeys(void) void UI_DisplayReleaseKeys(void) {
{
memset(gStatusLine, 0, sizeof(gStatusLine)); memset(gStatusLine, 0, sizeof(gStatusLine));
#if defined(ENABLE_FEAT_F4HWN_CTR) || defined(ENABLE_FEAT_F4HWN_INV) #if defined(ENABLE_FEAT_F4HWN_CTR) || defined(ENABLE_FEAT_F4HWN_INV)
ST7565_ContrastAndInv(); ST7565_ContrastAndInv();
#endif #endif
UI_DisplayClear(); UI_DisplayClear();
UI_PrintString("RELEASE", 0, 127, 1, 10); UI_PrintString("RELEASE KEYS", 0, 127, 1 /*, 10 */);
UI_PrintString("ALL KEYS", 0, 127, 3, 10);
ST7565_BlitStatusLine(); // blank status line ST7565_BlitStatusLine(); // blank status line
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
} }
void UI_DisplayWelcome(void) void UI_DisplayWelcome(void) {
{
char WelcomeString0[16];
char WelcomeString1[16];
char WelcomeString2[16];
char WelcomeString3[20];
memset(gStatusLine, 0, sizeof(gStatusLine)); memset(gStatusLine, 0, sizeof(gStatusLine));
@@ -56,147 +49,16 @@ void UI_DisplayWelcome(void)
ST7565_ContrastAndInv(); ST7565_ContrastAndInv();
#endif #endif
UI_DisplayClear(); UI_DisplayClear();
#ifdef ENABLE_FEAT_F4HWN
ST7565_BlitStatusLine(); ST7565_BlitStatusLine();
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_NONE || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_SOUND) {
ST7565_FillScreen(0x00);
#else
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_NONE || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_FULL_SCREEN) {
ST7565_FillScreen(0xFF);
#endif
} else {
memset(WelcomeString0, 0, sizeof(WelcomeString0));
memset(WelcomeString1, 0, sizeof(WelcomeString1));
EEPROM_ReadBuffer(0x0EB0, WelcomeString0, 16);
EEPROM_ReadBuffer(0x0EC0, WelcomeString1, 16);
sprintf(WelcomeString2, "%u.%02uV %u%%",
gBatteryVoltageAverage / 100,
gBatteryVoltageAverage % 100,
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_VOLTAGE)
{
strcpy(WelcomeString0, "VOLTAGE");
strcpy(WelcomeString1, WelcomeString2);
}
else if(gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_ALL)
{
if(strlen(WelcomeString0) == 0 && strlen(WelcomeString1) == 0)
{
strcpy(WelcomeString0, "WELCOME");
strcpy(WelcomeString1, WelcomeString2);
}
else if(strlen(WelcomeString0) == 0 || strlen(WelcomeString1) == 0)
{
if(strlen(WelcomeString0) == 0)
{
strcpy(WelcomeString0, WelcomeString1);
}
strcpy(WelcomeString1, WelcomeString2);
}
}
else if(gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_MESSAGE)
{
if(strlen(WelcomeString0) == 0)
{
strcpy(WelcomeString0, "WELCOME");
}
if(strlen(WelcomeString1) == 0)
{
strcpy(WelcomeString1, "BIENVENUE");
}
}
UI_PrintString(WelcomeString0, 0, 127, 0, 10);
UI_PrintString(WelcomeString1, 0, 127, 2, 10);
#ifdef ENABLE_FEAT_F4HWN
UI_PrintStringSmallNormal(Version, 0, 128, 4);
UI_DrawLineBuffer(gFrameBuffer, 0, 31, 127, 31, 1); // Be ware, status zone = 8 lines, the rest = 56 ->total 64 UI_DrawLineBuffer(gFrameBuffer, 0, 31, 127, 31, 1); // Be ware, status zone = 8 lines, the rest = 56 ->total 64
for (uint8_t i = 18; i < 110; i++) for (uint8_t i = 18; i < 110; i++) {
{
gFrameBuffer[4][i] ^= 0xFF; gFrameBuffer[4][i] ^= 0xFF;
} }
sprintf(WelcomeString3, "%s Edition", Edition);
UI_PrintStringSmallNormal(WelcomeString3, 0, 127, 6);
/*
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
#if ENABLE_FEAT_F4HWN_RESCUE_OPS > 1
UI_PrintStringSmallNormal(Edition, 18, 0, 6);
if(gEeprom.MENU_LOCK == true) {
memcpy(gFrameBuffer[6] + 103, BITMAP_Ready, sizeof(BITMAP_Ready));
}
else
{
memcpy(gFrameBuffer[6] + 103, BITMAP_NotReady, sizeof(BITMAP_NotReady));
}
#else
UI_PrintStringSmallNormal(Edition, 18, 0, 5);
memcpy(gFrameBuffer[5] + 103, BITMAP_Ready, sizeof(BITMAP_Ready));
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
UI_PrintStringSmallNormal("RescueOps", 18, 0, 6);
if(gEeprom.MENU_LOCK == true) {
memcpy(gFrameBuffer[6] + 103, BITMAP_Ready, sizeof(BITMAP_Ready));
}
else
{
memcpy(gFrameBuffer[6] + 103, BITMAP_NotReady, sizeof(BITMAP_NotReady));
}
#endif
#endif
#else
UI_PrintStringSmallNormal(Edition, 18, 0, 6);
memcpy(gFrameBuffer[6] + 103, BITMAP_Ready, sizeof(BITMAP_Ready));
#endif
*/
/*
#ifdef ENABLE_SPECTRUM
#ifdef ENABLE_FMRADIO
UI_PrintStringSmallNormal(Based, 0, 127, 5);
UI_PrintStringSmallNormal(Credits, 0, 127, 6);
#else
UI_PrintStringSmallNormal("Bandscope ", 0, 127, 5);
memcpy(gFrameBuffer[5] + 95, BITMAP_Ready, sizeof(BITMAP_Ready));
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
UI_PrintStringSmallNormal("RescueOps ", 0, 127, 6);
if(gEeprom.MENU_LOCK == true) {
memcpy(gFrameBuffer[6] + 95, BITMAP_Ready, sizeof(BITMAP_Ready));
}
#else
UI_PrintStringSmallNormal("Broadcast ", 0, 127, 6);
#endif
#endif
#else
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
UI_PrintStringSmallNormal("RescueOps ", 0, 127, 5);
if(gEeprom.MENU_LOCK == true) {
memcpy(gFrameBuffer[5] + 95, BITMAP_Ready, sizeof(BITMAP_Ready));
}
#else
UI_PrintStringSmallNormal("Bandscope ", 0, 127, 5);
#endif
UI_PrintStringSmallNormal("Broadcast ", 0, 127, 6);
memcpy(gFrameBuffer[6] + 95, BITMAP_Ready, sizeof(BITMAP_Ready));
#endif
*/
#else
UI_PrintStringSmallNormal(Version, 0, 127, 6);
#endif
//ST7565_BlitStatusLine(); // blank status line : I think it's useless //ST7565_BlitStatusLine(); // blank status line : I think it's useless
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
} }
}

View File

@@ -7,7 +7,6 @@
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
const char Version[] = AUTHOR_STRING_2 " " VERSION_STRING_2; const char Version[] = AUTHOR_STRING_2 " " VERSION_STRING_2;
const char Edition[] = EDITION_STRING;
#else #else
const char Version[] = AUTHOR_STRING VER; const char Version[] = AUTHOR_STRING VER;
#endif #endif

View File

@@ -21,7 +21,3 @@ extern const char Version[];
extern const char UART_Version[]; extern const char UART_Version[];
#endif #endif
#ifdef ENABLE_FEAT_F4HWN
extern const char Edition[];
#endif