Do some stuff
All checks were successful
Build Firmware / build (push) Successful in 3m32s

This commit is contained in:
2025-03-04 16:46:02 +01:00
parent fabf38f1bc
commit 72558f93f3
34 changed files with 937 additions and 1248 deletions

View File

@@ -9,7 +9,7 @@ ENABLE_UART ?= 1
ENABLE_AIRCOPY ?= 0 ENABLE_AIRCOPY ?= 0
ENABLE_NOAA ?= 0 ENABLE_NOAA ?= 0
ENABLE_VOICE ?= 0 ENABLE_VOICE ?= 0
ENABLE_VOX ?= 0 ENABLE_VOX ?= 1
ENABLE_ALARM ?= 0 ENABLE_ALARM ?= 0
ENABLE_TX1750 ?= 1 ENABLE_TX1750 ?= 1
ENABLE_PWRON_PASSWORD ?= 0 ENABLE_PWRON_PASSWORD ?= 0
@@ -44,12 +44,12 @@ 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 ?= 0 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 ?= 0 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 ?= 1 ENABLE_FEAT_F4HWN_VOL ?= 1
ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0 ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 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
############################################################# #############################################################

View File

@@ -32,6 +32,7 @@
#ifdef ENABLE_FLASHLIGHT #ifdef ENABLE_FLASHLIGHT
#include "app/flashlight.h" #include "app/flashlight.h"
#include "../ui/fmradio.h"
#endif #endif
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
@@ -1485,6 +1486,9 @@ void APP_TimeSlice500ms(void) {
if (gFmRadioMode) // 1of11 if (gFmRadioMode) // 1of11
return; return;
} }
if (gScreenToDisplay == DISPLAY_FM) {
UI_UpdateFMThings(false);
}
#endif #endif
if (gBacklightCountdown_500ms > 0 && !gAskToSave && !gCssBackgroundScan if (gBacklightCountdown_500ms > 0 && !gAskToSave && !gCssBackgroundScan
@@ -1814,18 +1818,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
bool lowBatPopup = gLowBattery && !gLowBatteryConfirmed && gScreenToDisplay == DISPLAY_MAIN; bool lowBatPopup = gLowBattery && !gLowBatteryConfirmed && gScreenToDisplay == DISPLAY_MAIN;
#ifdef ENABLE_FEAT_F4HWN // Disable PTT if KEY_LOCK if ((gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT)
bool lck_condition = false;
if (gSetting_set_lck)
lck_condition = (gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT;
else
lck_condition = (gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT && Key != KEY_PTT;
if (lck_condition)
#else
if ((gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT && Key != KEY_PTT)
#endif
{ // keyboard is locked or low battery popup { // keyboard is locked or low battery popup
// close low battery popup // close low battery popup
@@ -1850,8 +1843,7 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
// KEY_MENU has a special treatment here, because we want to pass hold event to ACTION_Handle // KEY_MENU has a special treatment here, because we want to pass hold event to ACTION_Handle
// but we don't want it to complain when initial press happens // but we don't want it to complain when initial press happens
// we want to react on realese instead // we want to react on realese instead
else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && // pass side buttons else if (!(Key == KEY_MENU && bKeyHeld)) // pass KEY_MENU held
!(Key == KEY_MENU && bKeyHeld)) // pass KEY_MENU held
{ {
if ((!bKeyPressed || bKeyHeld || (Key == KEY_MENU && bKeyPressed)) && if ((!bKeyPressed || bKeyHeld || (Key == KEY_MENU && bKeyPressed)) &&
// prevent released or held, prevent KEY_MENU pressed // prevent released or held, prevent KEY_MENU pressed

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)

View File

@@ -180,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) {
@@ -965,23 +965,27 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
if (gEnteringSMS == SMS_ENTERING_MESSAGE) { if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
if (bKeyPressed) { if (bKeyPressed) {
if (strlen((char *) dataPacket.data)) { if (strlen((char *) dataPacket.data)) {
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true); const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
AUDIO_AudioPathOff(); : gEeprom.TX_VFO;
gEnableSpeaker = false; if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
RADIO_PrepareTX(); AUDIO_AudioPathOff();
if (gCurrentVfo->SCRAMBLING_TYPE > 0) gEnableSpeaker = false;
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1); RADIO_PrepareTX();
else if (gCurrentVfo->SCRAMBLING_TYPE > 0)
BK4819_DisableScramble(); BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
MSG_FSKSendData(); else
AUDIO_AudioPathOn(); BK4819_DisableScramble();
gEnableSpeaker = true; BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
BK4819_ExitTxMute(); MSG_FSKSendData();
MSG_EnableRX(true); BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
gVfoConfigureMode = VFO_CONFIGURE; AUDIO_AudioPathOn();
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false); gEnableSpeaker = true;
dataPTR = dataPacket.data; BK4819_ExitTxMute();
memset(dataPacket.data, 0, DataPacketDataSize); MSG_EnableRX(true);
gVfoConfigureMode = VFO_CONFIGURE;
dataPTR = dataPacket.data;
memset(dataPacket.data, 0, DataPacketDataSize);
}
gEnteringSMS = SMS_NOT_ENTERING; gEnteringSMS = SMS_NOT_ENTERING;
} }
} }

View File

@@ -246,12 +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:
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
case MENU_SET_TMR: case MENU_SET_TMR:
#endif #endif
@@ -265,7 +259,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
case MENU_SCR: case MENU_SCR:
//*pMin = 0; //*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_SCRAMBLER) - 1; *pMax = 10;
break; break;
case MENU_AUTOLK: case MENU_AUTOLK:
@@ -387,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;
@@ -405,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;
@@ -812,40 +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: {
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;
// case MENU_SCREN:
// gSetting_ScrambleEnable = gSubMenuSelection;
// gFlagReconfigureVfos = true;
// break;
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI: case MENU_F_CALI:
@@ -890,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
@@ -915,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;
@@ -941,10 +886,6 @@ 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
} }
@@ -1268,17 +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
#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;
@@ -1323,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;
@@ -1346,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;
@@ -1370,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:

View File

@@ -794,7 +794,7 @@ static void DrawStatus() {
#else #else
sprintf(String, "%d/%d", settings.dbMin, settings.dbMax); sprintf(String, "%d/%d", settings.dbMin, settings.dbMax);
#endif #endif
GUI_DisplaySmallest(String, 0, 1, true, true); GUI_DisplaySmallest(String, 50, 20, true, true);
BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[gBatteryCheckCounter++ % 4], BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[gBatteryCheckCounter++ % 4],
&gBatteryCurrent); &gBatteryCurrent);
@@ -860,9 +860,9 @@ static void DrawF(uint32_t f) {
UI_PrintStringSmallNormal(String, 8, 127, 0); UI_PrintStringSmallNormal(String, 8, 127, 0);
sprintf(String, "%3s", gModulationStr[settings.modulationType]); sprintf(String, "%3s", gModulationStr[settings.modulationType]);
GUI_DisplaySmallest(String, 116, 1, false, true); GUI_DisplaySmallest(String, 95, 1, false, true);
sprintf(String, "%4sk", bwOptions[settings.listenBw]); sprintf(String, "%4sk", bwOptions[settings.listenBw]);
GUI_DisplaySmallest(String, 108, 7, false, true); GUI_DisplaySmallest(String, 90, 10, false, true);
#ifdef ENABLE_FEAT_F4HWN_SPECTRUM #ifdef ENABLE_FEAT_F4HWN_SPECTRUM
ShowChannelName(f); ShowChannelName(f);
@@ -882,14 +882,14 @@ static void DrawNums() {
sprintf(String, "%u.%05u \x7F%u.%02uk", currentFreq / 100000, sprintf(String, "%u.%05u \x7F%u.%02uk", currentFreq / 100000,
currentFreq % 100000, settings.frequencyChangeStep / 100, currentFreq % 100000, settings.frequencyChangeStep / 100,
settings.frequencyChangeStep % 100); settings.frequencyChangeStep % 100);
GUI_DisplaySmallest(String, 36, 49, false, true); GUI_DisplaySmallest(String, 36, 39, false, true);
} else { } else {
sprintf(String, "%u.%05u", GetFStart() / 100000, GetFStart() % 100000); sprintf(String, "%u.%05u", GetFStart() / 100000, GetFStart() % 100000);
GUI_DisplaySmallest(String, 0, 49, false, true); GUI_DisplaySmallest(String, 0, 49, false, true);
sprintf(String, "\x7F%u.%02uk", settings.frequencyChangeStep / 100, sprintf(String, "\x7F%u.%02uk", settings.frequencyChangeStep / 100,
settings.frequencyChangeStep % 100); settings.frequencyChangeStep % 100);
GUI_DisplaySmallest(String, 48, 49, false, true); GUI_DisplaySmallest(String, 48, 10, false, true);
sprintf(String, "%u.%05u", GetFEnd() / 100000, GetFEnd() % 100000); sprintf(String, "%u.%05u", GetFEnd() / 100000, GetFEnd() % 100000);
GUI_DisplaySmallest(String, 93, 49, false, true); GUI_DisplaySmallest(String, 93, 49, false, true);
@@ -1139,7 +1139,7 @@ void OnKeyDownStill(KEY_Code_t key) {
} }
} }
static void RenderFreqInput() { UI_PrintString(freqInputString, 2, 127, 0, 8); } static void RenderFreqInput() { UI_PrintString(freqInputString, 2, 127, 0 /*, 8 */); }
static void RenderStatus() { static void RenderStatus() {
memset(gStatusLine, 0, sizeof(gStatusLine)); memset(gStatusLine, 0, sizeof(gStatusLine));
@@ -1193,8 +1193,8 @@ static void RenderStill() {
gFrameBuffer[2][METER_PAD_LEFT + x] = 0b11111111; gFrameBuffer[2][METER_PAD_LEFT + x] = 0b11111111;
} }
const uint8_t PAD_LEFT = 4; const uint8_t PAD_LEFT = 0;
const uint8_t CELL_WIDTH = 30; const uint8_t CELL_WIDTH = 28;
uint8_t offset = PAD_LEFT; uint8_t offset = PAD_LEFT;
uint8_t row = 4; uint8_t row = 4;

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

@@ -18,15 +18,43 @@
#define BK1080_REGS_H #define BK1080_REGS_H
enum BK1080_Register_t { enum BK1080_Register_t {
BK1080_REG_00 = 0x00U, BK1080_REG_00 = 0x00U,
BK1080_REG_02_POWER_CONFIGURATION = 0x02U, BK1080_REG_01_CHIP_ID = 0x01U,
BK1080_REG_03_CHANNEL = 0x03U, BK1080_REG_02_POWER_CONFIGURATION = 0x02U,
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_25_INTERNAL = 0x19U, 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_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

@@ -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

@@ -24,90 +24,90 @@
#define BX4819_band1_lower 1800000 #define BX4819_band1_lower 1800000
#define BX4819_band2_upper 130000000 #define BX4819_band2_upper 130000000
const freq_band_table_t BX4819_band1 = {BX4819_band1_lower, 63000000}; const freq_band_table_t BX4819_band1 = {BX4819_band1_lower, 63000000};
const freq_band_table_t BX4819_band2 = {84000000, BX4819_band2_upper}; const freq_band_table_t BX4819_band2 = {84000000, BX4819_band2_upper};
const freq_band_table_t frequencyBandTable[] = const freq_band_table_t frequencyBandTable[] =
{ {
#ifndef ENABLE_WIDE_RX #ifndef ENABLE_WIDE_RX
// QS original // QS original
[BAND1_50MHz ]={.lower = 5000000, .upper = 7600000}, [BAND1_50MHz ]={.lower = 5000000, .upper = 7600000},
[BAND7_470MHz]={.lower = 47000000, .upper = 60000000}, [BAND7_470MHz]={.lower = 47000000, .upper = 60000000},
#else #else
// extended range // extended range
[BAND1_50MHz ]={.lower = BX4819_band1_lower, .upper = 10800000}, [BAND1_50MHz]={.lower = BX4819_band1_lower, .upper = 10800000},
[BAND7_470MHz]={.lower = 47000000, .upper = BX4819_band2_upper}, [BAND7_470MHz]={.lower = 47000000, .upper = BX4819_band2_upper},
#endif #endif
[BAND2_108MHz]={.lower = 10800000, .upper = 13700000}, [BAND2_108MHz]={.lower = 10800000, .upper = 13700000},
[BAND3_137MHz]={.lower = 13700000, .upper = 17400000}, [BAND3_137MHz]={.lower = 13700000, .upper = 17400000},
[BAND4_174MHz]={.lower = 17400000, .upper = 35000000}, [BAND4_174MHz]={.lower = 17400000, .upper = 35000000},
[BAND5_350MHz]={.lower = 35000000, .upper = 40000000}, [BAND5_350MHz]={.lower = 35000000, .upper = 40000000},
[BAND6_400MHz]={.lower = 40000000, .upper = 47000000} [BAND6_400MHz]={.lower = 40000000, .upper = 47000000}
}; };
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
const uint32_t NoaaFrequencyTable[10] = const uint32_t NoaaFrequencyTable[10] =
{ {
16255000, 16255000,
16240000, 16240000,
16247500, 16247500,
16242500, 16242500,
16245000, 16245000,
16250000, 16250000,
16252500, 16252500,
16152500, 16152500,
16177500, 16177500,
16327500 16327500
}; };
#endif #endif
// this order of steps has to be preserved for backwards compatibility with other/stock firmwares // this order of steps has to be preserved for backwards compatibility with other/stock firmwares
const uint16_t gStepFrequencyTable[] = { const uint16_t gStepFrequencyTable[] = {
// standard steps // standard steps
[STEP_2_5kHz] = 250, [STEP_2_5kHz] = 250,
[STEP_5kHz] = 500, [STEP_5kHz] = 500,
[STEP_6_25kHz] = 625, [STEP_6_25kHz] = 625,
[STEP_10kHz] = 1000, [STEP_10kHz] = 1000,
[STEP_12_5kHz] = 1250, [STEP_12_5kHz] = 1250,
[STEP_25kHz] = 2500, [STEP_25kHz] = 2500,
[STEP_8_33kHz] = 833, [STEP_8_33kHz] = 833,
// custom steps // custom steps
[STEP_0_01kHz] = 1, [STEP_0_01kHz] = 1,
[STEP_0_05kHz] = 5, [STEP_0_05kHz] = 5,
[STEP_0_1kHz] = 10, [STEP_0_1kHz] = 10,
[STEP_0_25kHz] = 25, [STEP_0_25kHz] = 25,
[STEP_0_5kHz] = 50, [STEP_0_5kHz] = 50,
[STEP_1kHz] = 100, [STEP_1kHz] = 100,
[STEP_1_25kHz] = 125, [STEP_1_25kHz] = 125,
[STEP_9kHz] = 900, [STEP_9kHz] = 900,
[STEP_15kHz] = 1500, [STEP_15kHz] = 1500,
[STEP_20kHz] = 2000, [STEP_20kHz] = 2000,
[STEP_30kHz] = 3000, [STEP_30kHz] = 3000,
[STEP_50kHz] = 5000, [STEP_50kHz] = 5000,
[STEP_100kHz] = 10000, [STEP_100kHz] = 10000,
[STEP_125kHz] = 12500, [STEP_125kHz] = 12500,
[STEP_200kHz] = 20000, [STEP_200kHz] = 20000,
[STEP_250kHz] = 25000, [STEP_250kHz] = 25000,
[STEP_500kHz] = 50000 [STEP_500kHz] = 50000
}; };
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_125kHz, STEP_200kHz, STEP_250kHz, STEP_500kHz 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_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;
return 0; return 0;
} }
@@ -115,25 +115,24 @@ 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;
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,23 +143,22 @@ 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 =
int chno = (freq - base) / 700; // convert entered aviation 8.33Khz channel number scheme to actual frequency. (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);
} }
if(step == 1) if (step == 1)
return freq; return freq;
if(step >= 1000) if (step >= 1000)
step = step/2; step = step / 2;
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,30 +167,22 @@ 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) return 0;
#endif if (Frequency >= frequencyBandTable[BAND5_350MHz].lower &&
return 0; Frequency < frequencyBandTable[BAND5_350MHz].upper)
if (Frequency >= frequencyBandTable[BAND5_350MHz].lower && Frequency < frequencyBandTable[BAND5_350MHz].upper) return 0;
#ifndef ENABLE_FEAT_F4HWN if (Frequency >= frequencyBandTable[BAND6_400MHz].lower &&
if (gSetting_350TX && gSetting_350EN) Frequency < frequencyBandTable[BAND6_400MHz].upper)
#else
if (gSetting_350EN)
#endif
return 0;
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 return 0;
if (gSetting_500TX)
#endif
return 0;
break; break;
// case F_LOCK_FCC: // case F_LOCK_FCC:
@@ -231,28 +221,28 @@ int32_t TX_freq_check(const uint32_t Frequency)
// break; // break;
#ifdef ENABLE_FEAT_F4HWN_PMR #ifdef ENABLE_FEAT_F4HWN_PMR
case F_LOCK_PMR: case F_LOCK_PMR:
if (Frequency >= 44600625 && Frequency <= 44619375) if (Frequency >= 44600625 && Frequency <= 44619375)
return 0; return 0;
break; break;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_GMRS_FRS_MURS #ifdef ENABLE_FEAT_F4HWN_GMRS_FRS_MURS
case F_LOCK_GMRS_FRS_MURS: case F_LOCK_GMRS_FRS_MURS:
// https://forums.radioreference.com/threads/the-great-unofficial-radioreference-frs-gmrs-murs-fact-sheet.275370/ // https://forums.radioreference.com/threads/the-great-unofficial-radioreference-frs-gmrs-murs-fact-sheet.275370/
if ((Frequency >= 46255000 && Frequency <= 46272500) || if ((Frequency >= 46255000 && Frequency <= 46272500) ||
(Frequency >= 46755000 && Frequency <= 46772500)) // FRS/GMRS (Frequency >= 46755000 && Frequency <= 46772500)) // FRS/GMRS
return 0; return 0;
if (Frequency == 15182000 || if (Frequency == 15182000 ||
Frequency == 15188000 || Frequency == 15188000 ||
Frequency == 15194000 || Frequency == 15194000 ||
Frequency == 15457000 || Frequency == 15457000 ||
Frequency == 15460000) // MURS Frequency == 15460000) // MURS
return 0; return 0;
break; break;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_CA #ifdef ENABLE_FEAT_F4HWN_CA
case F_LOCK_CA: case F_LOCK_CA:
if (Frequency >= 14400000 && Frequency < 14800000) if (Frequency >= 14400000 && Frequency < 14800000)
return 0; return 0;
@@ -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

@@ -211,7 +211,7 @@ void FUNCTION_Transmit() {
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(false, 1750); BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750);
gAlarmState = ALARM_STATE_OFF; gAlarmState = ALARM_STATE_OFF;
} }
#endif #endif

View File

@@ -17,8 +17,9 @@
#include <string.h> #include <string.h>
#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,98 +32,84 @@
#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();
SYSTEM_DelayMs(20); SYSTEM_DelayMs(20);
} }
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if (Keys[0] == (10 + gEeprom.SET_KEY)) if (Keys[0] == (10 + gEeprom.SET_KEY))
{ {
return BOOT_MODE_RESCUE_OPS; // Secret KEY pressed return BOOT_MODE_RESCUE_OPS; // Secret KEY pressed
} }
#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) #ifdef ENABLE_AIRCOPY
return BOOT_MODE_F_LOCK; if (Keys[0] == KEY_SIDE2)
return BOOT_MODE_AIRCOPY;
#ifdef ENABLE_AIRCOPY #endif
if (Keys[0] == KEY_SIDE2)
return BOOT_MODE_AIRCOPY;
#endif
} }
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) #ifdef ENABLE_AIRCOPY
if (Mode == BOOT_MODE_AIRCOPY)
{ {
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
gEeprom.BATTERY_SAVE = 0;
#ifdef ENABLE_VOX
gEeprom.VOX_SWITCH = false;
#endif
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
gEeprom.AUTO_KEYPAD_LOCK = false;
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
gEeprom.KEY_1_LONG_PRESS_ACTION = ACTION_OPT_NONE;
gEeprom.KEY_2_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
gEeprom.KEY_2_LONG_PRESS_ACTION = ACTION_OPT_NONE;
gEeprom.KEY_M_LONG_PRESS_ACTION = ACTION_OPT_NONE;
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_LAST - 1, 43400000); // LPD
gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW;
gRxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
gCurrentVfo = gRxVfo;
RADIO_SetupRegisters(true);
BK4819_SetupAircopy();
BK4819_ResetFSK();
gAircopyState = AIRCOPY_READY;
gEeprom.BACKLIGHT_TIME = 61;
gEeprom.KEY_LOCK = 0;
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
gEeprom.CURRENT_STATE = 0; // Don't resume is active... gEeprom.CURRENT_STATE = 0; // Don't resume is active...
#endif #endif
GUI_SelectNextDisplay(DISPLAY_MENU);
} GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
#ifdef ENABLE_AIRCOPY
else
if (Mode == BOOT_MODE_AIRCOPY)
{
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
gEeprom.BATTERY_SAVE = 0;
#ifdef ENABLE_VOX
gEeprom.VOX_SWITCH = false;
#endif
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
gEeprom.AUTO_KEYPAD_LOCK = false;
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
gEeprom.KEY_1_LONG_PRESS_ACTION = ACTION_OPT_NONE;
gEeprom.KEY_2_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
gEeprom.KEY_2_LONG_PRESS_ACTION = ACTION_OPT_NONE;
gEeprom.KEY_M_LONG_PRESS_ACTION = ACTION_OPT_NONE;
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_LAST - 1, 43400000); // LPD
gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW;
gRxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
gCurrentVfo = gRxVfo;
RADIO_SetupRegisters(true);
BK4819_SetupAircopy();
BK4819_ResetFSK();
gAircopyState = AIRCOPY_READY;
gEeprom.BACKLIGHT_TIME = 61;
gEeprom.KEY_LOCK = 0;
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
gEeprom.CURRENT_STATE = 0; // Don't resume is active...
#endif
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
}
#endif
else
{
GUI_SelectNextDisplay(DISPLAY_MAIN);
} }
#endif
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

40
main.c
View File

@@ -140,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
@@ -160,48 +161,21 @@ 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) { // keys are pressed #if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|| BootMode != BOOT_MODE_NORMAL
#endif
) { // keys are pressed
UI_DisplayReleaseKeys(); UI_DisplayReleaseKeys();
BACKLIGHT_TurnOn(); BACKLIGHT_TurnOn();
@@ -249,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);

4
misc.c
View File

@@ -95,7 +95,6 @@ const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
bool gSetting_200TX; bool gSetting_200TX;
bool gSetting_500TX; bool gSetting_500TX;
#endif #endif
bool gSetting_350EN = true;
uint8_t gSetting_F_LOCK; uint8_t gSetting_F_LOCK;
bool gSetting_ScrambleEnable; bool gSetting_ScrambleEnable;
@@ -111,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

4
misc.h
View File

@@ -148,7 +148,6 @@ 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;
@@ -164,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

631
radio.c

File diff suppressed because it is too large Load Diff

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

@@ -274,21 +274,13 @@ void SETTINGS_InitEEPROM(void) {
gEeprom.FSKSRCAddress |= Data[1] << 8; gEeprom.FSKSRCAddress |= Data[1] << 8;
gEeprom.FSKSRCAddress |= Data[2] << 16; gEeprom.FSKSRCAddress |= Data[2] << 16;
gEeprom.FSKSRCAddress |= Data[3] << 24; 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_350TX = (Data[1] < 2) ? Data[1] : false; // was true
#endif
#ifndef ENABLE_FEAT_F4HWN
gSetting_200TX = (Data[3] < 2) ? Data[3] : false;
gSetting_500TX = (Data[4] < 2) ? Data[4] : false;
gSetting_350EN = (Data[5] < 2) ? Data[5] : true;
#else
gSetting_350EN = true;
#endif
gSetting_ScrambleEnable = true; gSetting_ScrambleEnable = true;
//gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false; //gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
@@ -337,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;
@@ -348,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;
@@ -363,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;
@@ -727,6 +714,10 @@ void SETTINGS_SaveSettings(void) {
State[1] = (gEeprom.FSKSRCAddress >> 8) & 0xFF; State[1] = (gEeprom.FSKSRCAddress >> 8) & 0xFF;
State[2] = (gEeprom.FSKSRCAddress >> 16) & 0xFF; State[2] = (gEeprom.FSKSRCAddress >> 16) & 0xFF;
State[3] = (gEeprom.FSKSRCAddress >> 24) & 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); EEPROM_WriteBuffer(0x0F20, State);
memset(State, 0xFF, sizeof(State)); memset(State, 0xFF, sizeof(State));
@@ -738,8 +729,6 @@ void SETTINGS_SaveSettings(void) {
State[3] = gSetting_200TX; State[3] = gSetting_200TX;
State[4] = gSetting_500TX; State[4] = gSetting_500TX;
#endif #endif
State[5] = gSetting_350EN;
State[6] = gSetting_ScrambleEnable; State[6] = gSetting_ScrambleEnable;
//if (!gSetting_TX_EN) State[7] &= ~(1u << 0); //if (!gSetting_TX_EN) State[7] &= ~(1u << 0);
@@ -776,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
@@ -789,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);
@@ -835,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)
@@ -980,9 +961,9 @@ void SETTINGS_WriteBuildOptions(void) {
#endif #endif
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
| (1 << 4) | (1 << 4)
#endif #endif
#ifdef ENABLE_SPECTRUM #ifdef ENABLE_SPECTRUM
| (1 << 5) | (1 << 5)
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
| (1 << 6) | (1 << 6)

View File

@@ -173,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
@@ -198,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

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;
@@ -83,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,15 +29,63 @@
#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);
sprintf(String, "%d%s-%dM", 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",
BK1080_GetFreqLoLimit(gEeprom.FM_Band)/10, BK1080_GetFreqLoLimit(gEeprom.FM_Band)/10,
gEeprom.FM_Band == 0 ? ".5" : "", gEeprom.FM_Band == 0 ? ".5" : "",
BK1080_GetFreqHiLimit(gEeprom.FM_Band)/10 BK1080_GetFreqHiLimit(gEeprom.FM_Band)/10
@@ -55,13 +103,13 @@ void UI_DisplayFM(void)
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, "VF(C%02u)", i + 1); sprintf(String, "C%02u MHz", i + 1);
pPrintStr = String; pPrintStr = String;
break; break;
} }
@@ -74,7 +122,7 @@ void UI_DisplayFM(void)
pPrintStr = "M-SCN"; pPrintStr = "M-SCN";
} }
UI_PrintString(pPrintStr, 0, 127, 3, 12); // 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)) {
@@ -89,12 +137,12 @@ void UI_DisplayFM(void)
sprintf(String, "%.3s.%.1s",ascii, ascii + 3); sprintf(String, "%.3s.%.1s",ascii, ascii + 3);
} }
UI_PrintString(String, 0, 20, 1, 10); // 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

@@ -78,6 +78,13 @@ void *memcpy_inv(void *dst, const void *src, size_t n) {
void UI_PrintStringBuffer(const char *pString, uint8_t *buffer, uint32_t char_width, const uint8_t *font, bool inv) { 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) {
@@ -91,7 +98,6 @@ void UI_PrintStringBuffer(const char *pString, uint8_t *buffer, uint32_t char_wi
} }
} }
void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t char_width, 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 uint8_t *font, bool inv) {
const size_t Length = strlen(pString); const size_t Length = strlen(pString);
@@ -109,26 +115,25 @@ void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End,
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, false);
} }
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 */) {
Width = Width; // UI_PrintStringSmallNormal(pString, Start, End, Line);
UI_PrintStringSmallNormal(pString, Start, End, Line); //// size_t i;
// size_t i; //// size_t Length = strlen(pString);
// size_t Length = strlen(pString); ////
// //// if (End > Start)
// if (End > Start) //// Start += (((End - Start) - (Length * Width)) + 1) / 2;
// Start += (((End - Start) - (Length * Width)) + 1) / 2; ////
// //// for (i = 0; i < Length; i++)
// for (i = 0; i < Length; i++) //// {
// { //// const unsigned int ofs = (unsigned int)Start + (i * Width);
// const unsigned int ofs = (unsigned int)Start + (i * Width); //// if (pString[i] > ' ' && pString[i] < 127)
// if (pString[i] > ' ' && pString[i] < 127) //// {
// { //// const unsigned int index = pString[i] - ' ' - 1;
// const unsigned int index = pString[i] - ' ' - 1; //// memcpy(gFrameBuffer[Line + 0] + ofs, &gFontSmall[index + '0'][0], 7);
// memcpy(gFrameBuffer[Line + 0] + ofs, &gFontSmall[index + '0'][0], 7); //// memcpy(gFrameBuffer[Line + 1] + ofs, &gFontSmall[index + '0'][7], 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) { void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
//#ifdef ENABLE_SMALL_BOLD //#ifdef ENABLE_SMALL_BOLD
@@ -149,7 +154,7 @@ 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) {
#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]);
#else #else
const uint8_t *font = (uint8_t *) gFontSmall; const uint8_t *font = (uint8_t *) gFontSmall;
@@ -283,6 +288,30 @@ void PutPixelStatus(uint8_t x, uint8_t y, bool fill) {
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;
@@ -291,22 +320,25 @@ void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
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];
if (pixels & 1) { for (int j = 0; j < 8; ++j) {
if (statusbar) if (pixels & 1) {
PutPixelStatus(x + i, y + j, fill); if (statusbar)
else PutPixelStatus(x + i, y + j, fill);
PutPixel(x + i, y + j, fill); else
PutPixel(x + i, y + j, fill);
}
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) {
@@ -352,10 +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_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() { 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();

322
ui/main.c
View File

@@ -115,51 +115,19 @@ static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level, uint8_t bars
level = MIN(level, bars); level = MIN(level, bars);
for (uint8_t i = 0; i < level; i++) { for (uint8_t i = 0; i < level; i++) {
#ifdef ENABLE_FEAT_F4HWN const char hollowBar[] = {
if (gSetting_set_met) { 0b01111111,
const char hollowBar[] = { 0b01000001,
0b01111111, 0b01000001,
0b01000001, 0b01111111
0b01000001, };
0b01111111
};
if (i < bars - 4) { if (i < bars - 4) {
for (uint8_t j = 0; j < 4; j++) for (uint8_t j = 0; j < 4; j++)
p_line[xpos + i * 5 + j] = (~(0x7F >> (i + 1))) & 0x7F; p_line[xpos + i * 5 + j] = (~(0x7F >> (i + 1))) & 0x7F;
} else {
memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar));
}
} else { } else {
const char hollowBar[] = {
0b00111110,
0b00100010,
0b00100010,
0b00111110
};
const char simpleBar[] = {
0b00111110,
0b00111110,
0b00111110,
0b00111110
};
if (i < bars - 4) {
memcpy(p_line + (xpos + i * 5), &simpleBar, ARRAY_SIZE(simpleBar));
} else {
memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar));
}
}
#else
if(i < bars - 4) {
for(uint8_t j = 0; j < 4; j++)
p_line[xpos + i * 5 + j] = (~(0x7F >> (i+1))) & 0x7F;
}
else {
memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar)); memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar));
} }
#endif
} }
} }
@@ -197,7 +165,7 @@ void UI_DisplayAudioBar(void) {
if (gCurrentFunction != FUNCTION_TRANSMIT || if (gCurrentFunction != FUNCTION_TRANSMIT ||
gScreenToDisplay != DISPLAY_MAIN gScreenToDisplay != DISPLAY_MAIN
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
|| gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_CallState != DTMF_CALL_STATE_NONE
#endif #endif
) { ) {
@@ -237,7 +205,7 @@ void UI_DisplayAudioBar(void) {
void DisplayRSSIBar(const bool now) { void DisplayRSSIBar(const bool now) {
#if defined(ENABLE_RSSI_BAR) #if defined(ENABLE_RSSI_BAR)
const unsigned int txt_width = 7 * 8; // 8 text chars const unsigned int txt_width = 7 * 10; // 8 text chars
const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
@@ -266,7 +234,7 @@ void DisplayRSSIBar(const bool now) {
if (RxLine >= 0 && center_line != CENTER_LINE_IN_USE) { if (RxLine >= 0 && center_line != CENTER_LINE_IN_USE) {
if (RxBlink == 0 || RxBlink == 1) { if (RxBlink == 0 || RxBlink == 1) {
UI_PrintStringSmallBold("RX", 8, 0, RxLine); UI_PrintStringSmallBold("RX", 24, 0, RxLine);
if (RxBlink == 1) RxBlink = 2; if (RxBlink == 1) RxBlink = 2;
} else { } else {
for (uint8_t i = 8; i < 24; i++) { for (uint8_t i = 8; i < 24; i++) {
@@ -299,7 +267,7 @@ void DisplayRSSIBar(const bool now) {
if (gCurrentFunction == FUNCTION_TRANSMIT || if (gCurrentFunction == FUNCTION_TRANSMIT ||
gScreenToDisplay != DISPLAY_MAIN gScreenToDisplay != DISPLAY_MAIN
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
|| gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_CallState != DTMF_CALL_STATE_NONE
#endif #endif
) )
@@ -348,24 +316,19 @@ void DisplayRSSIBar(const bool now) {
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
if (gSetting_set_gui) { char tempStr[4];
sprintf(str, "%3d", -rssi_dBm);
UI_PrintStringSmallNormal(str, LCD_WIDTH + 8, 0, line - 1);
} else {
sprintf(str, "% 4d %s", -rssi_dBm, "dBm");
if (isMainOnly())
GUI_DisplaySmallest(str, 2, 41, false, true);
else
GUI_DisplaySmallest(str, 2, 25, false, true);
}
if (overS9Bars == 0) { if (overS9Bars == 0) {
sprintf(str, "S%d", s_level); sprintf(tempStr, "S%d", s_level);
} else { } else {
sprintf(str, "+%02d", overS9dBm); sprintf(tempStr, "+%02d", overS9dBm);
} }
UI_PrintStringSmallNormal(str, LCD_WIDTH + 38, 0, line - 1); sprintf(str, "%4ddBm%3s", -rssi_dBm, tempStr);
if (isMainOnly())
UI_PrintStringSmallNormal(str, 2, 0, 4);
else
UI_PrintStringSmallNormal(str, 2, 0, 3);
#else #else
if(overS9Bars == 0) { if(overS9Bars == 0) {
sprintf(str, "% 4d S%d", -rssi_dBm, s_level); sprintf(str, "% 4d S%d", -rssi_dBm, s_level);
@@ -377,7 +340,7 @@ void DisplayRSSIBar(const bool now) {
UI_PrintStringSmallNormal(str, 2, 0, line); UI_PrintStringSmallNormal(str, 2, 0, line);
#endif #endif
DrawLevelBar(bar_x, line, s_level + overS9Bars, 13); DrawLevelBar(bar_x, line, s_level + overS9Bars, 10);
if (now) if (now)
ST7565_BlitLine(line); ST7565_BlitLine(line);
#else #else
@@ -507,7 +470,7 @@ void UI_DisplayMain(void) {
UI_DisplayClear(); UI_DisplayClear();
if (gLowBattery && !gLowBatteryConfirmed) { if (gLowBattery && !gLowBatteryConfirmed) {
UI_DisplayPopup("LOW BATTERY"); UI_DisplayPopup("LOW BATT");
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
return; return;
} }
@@ -515,8 +478,8 @@ void UI_DisplayMain(void) {
#ifndef ENABLE_FEAT_F4HWN #ifndef ENABLE_FEAT_F4HWN
if (gEeprom.KEY_LOCK && gKeypadLocked > 0) if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
{ // tell user how to unlock the keyboard { // tell user how to unlock the keyboard
UI_PrintString("Long press #", 0, LCD_WIDTH, 1, 8); UI_PrintString("Long press #", 0, LCD_WIDTH, 1 /*, 8 */);
UI_PrintString("to unlock", 0, LCD_WIDTH, 3, 8); UI_PrintString("to unlock", 0, LCD_WIDTH, 3 /*, 8 */);
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
return; return;
} }
@@ -535,7 +498,7 @@ void UI_DisplayMain(void) {
shift = 5; shift = 5;
} }
//memcpy(gFrameBuffer[shift] + 2, gFontKeyLock, sizeof(gFontKeyLock)); //memcpy(gFrameBuffer[shift] + 2, gFontKeyLock, sizeof(gFontKeyLock));
UI_PrintStringSmallBold("UNLOCK KEYBOARD", 12, 0, shift); UI_PrintStringSmallBold("KEYLOCK", 12, 0, shift);
//memcpy(gFrameBuffer[shift] + 120, gFontKeyLock, sizeof(gFontKeyLock)); //memcpy(gFrameBuffer[shift] + 120, gFontKeyLock, sizeof(gFontKeyLock));
/* /*
@@ -600,7 +563,7 @@ void UI_DisplayMain(void) {
shift = 3; shift = 3;
} }
UI_PrintString("ScnRng", 5, 0, line + shift, 8); UI_PrintString("ScnRng", 5, 0, line + shift /*, 8 */);
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000); sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
UI_PrintStringSmallNormal(String, 56, 0, line + shift); UI_PrintStringSmallNormal(String, 56, 0, line + shift);
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000); sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
@@ -612,7 +575,7 @@ void UI_DisplayMain(void) {
gScanRangeStart = 0; gScanRangeStart = 0;
} }
#else #else
UI_PrintString("ScnRng", 5, 0, line, 8); UI_PrintString("ScnRng", 5, 0, line /*, 8 */);
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000); sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
UI_PrintStringSmallNormal(String, 56, 0, line); UI_PrintStringSmallNormal(String, 56, 0, line);
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000); sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
@@ -624,21 +587,21 @@ void UI_DisplayMain(void) {
if (gEnteringSMS == SMS_ENTERING_DEST) { if (gEnteringSMS == SMS_ENTERING_DEST) {
UI_PrintString("SMS Dst", 0, 0, line - 1, 8); UI_PrintString("SMS Dst", 0, 0, line - 1 /*, 8 */);
sprintf(String, "%d", dataPacket.dest); sprintf(String, "%d", dataPacket.dest);
UI_PrintStringSmallNormal(String, 0, 0, line); UI_PrintStringSmallNormal(String, 0, 0, line);
continue; continue;
} }
if (gEnteringSMS == SMS_ENTERING_MESSAGE) { if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
UI_PrintString("SMS Dat", 0, 0, line - 1, 8); UI_PrintString("SMS Dat", 0, 0, line - 1 /*, 8 */);
sprintf(String, "%s", dataPacket.data); sprintf(String, "%s", dataPacket.data);
UI_PrintStringSmallNormal(String, 0, 0, line); UI_PrintStringSmallNormal(String, 0, 0, line);
continue; continue;
} }
if (gDTMF_InputMode if (gDTMF_InputMode
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
|| gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx
#endif #endif
) { ) {
@@ -657,7 +620,7 @@ void UI_DisplayMain(void) {
} }
} }
UI_PrintString(pPrintStr, 2, 0, 2 + (vfo_num * 3), 8); UI_PrintString(pPrintStr, 2, 0, 2 + (vfo_num * 3) /*, 8 */);
pPrintStr = ""; pPrintStr = "";
if (!gDTMF_InputMode) { if (!gDTMF_InputMode) {
@@ -680,17 +643,17 @@ void UI_DisplayMain(void) {
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
if (isMainOnly()) { if (isMainOnly()) {
UI_PrintString(pPrintStr, 2, 0, 5, 8); UI_PrintString(pPrintStr, 2, 0, 5 /*, 8 */);
isMainOnlyInputDTMF = true; isMainOnlyInputDTMF = true;
center_line = CENTER_LINE_IN_USE; center_line = CENTER_LINE_IN_USE;
} else { } else {
UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3), 8); UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3) /*, 8 */);
isMainOnlyInputDTMF = false; isMainOnlyInputDTMF = false;
center_line = CENTER_LINE_IN_USE; center_line = CENTER_LINE_IN_USE;
continue; continue;
} }
#else #else
UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3), 8); UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3) /*, 8 */);
center_line = CENTER_LINE_IN_USE; center_line = CENTER_LINE_IN_USE;
continue; continue;
#endif #endif
@@ -709,11 +672,11 @@ void UI_DisplayMain(void) {
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency; uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
if (TX_freq_check(frequency) != 0 && gEeprom.VfoInfo[vfo_num].TX_LOCK == true) { if (TX_freq_check(frequency) != 0) {
if (isMainOnly()) if (isMainOnly())
memcpy(p_line0 + 14, BITMAP_VFO_Lock, sizeof(BITMAP_VFO_Lock)); memcpy(p_line0 + 5, gFontKeyLock, sizeof(gFontKeyLock));
else else
memcpy(p_line0 + 24, BITMAP_VFO_Lock, sizeof(BITMAP_VFO_Lock)); memcpy(p_line0 + 10, gFontKeyLock, sizeof(gFontKeyLock));
} }
if (gCurrentFunction == FUNCTION_TRANSMIT) { // transmitting if (gCurrentFunction == FUNCTION_TRANSMIT) { // transmitting
@@ -750,7 +713,7 @@ void UI_DisplayMain(void) {
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
else { else {
if (RxOnVfofrequency == frequency && !isMainOnly()) { if (RxOnVfofrequency == frequency && !isMainOnly()) {
UI_PrintStringSmallNormal(">>", 8, 0, line); UI_PrintStringSmallNormal(">>", 24, 0, line);
//memcpy(p_line0 + 14, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); //memcpy(p_line0 + 14, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
} }
@@ -761,7 +724,7 @@ void UI_DisplayMain(void) {
} }
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // channel mode if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // channel mode
const unsigned int x = 2; const unsigned int x = 20;
const bool inputting = gInputBoxIndex != 0 && gEeprom.TX_VFO == vfo_num; const bool inputting = gInputBoxIndex != 0 && gEeprom.TX_VFO == vfo_num;
if (!inputting) if (!inputting)
sprintf(String, "M%u", gEeprom.ScreenChannel[vfo_num] + 1); sprintf(String, "M%u", gEeprom.ScreenChannel[vfo_num] + 1);
@@ -770,7 +733,7 @@ void UI_DisplayMain(void) {
UI_PrintStringSmallNormal(String, x, 0, line + 1); UI_PrintStringSmallNormal(String, x, 0, line + 1);
} else if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // frequency mode } else if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // frequency mode
// show the frequency band number // show the frequency band number
const unsigned int x = 2; const unsigned int x = 0;
char *buf = gEeprom.VfoInfo[vfo_num].pRX->Frequency < _1GHz_in_KHz ? "" : "+"; char *buf = gEeprom.VfoInfo[vfo_num].pRX->Frequency < _1GHz_in_KHz ? "" : "+";
sprintf(String, "F%u%s", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST, buf); sprintf(String, "F%u%s", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST, buf);
UI_PrintStringSmallNormal(String, x, 0, line + 1); UI_PrintStringSmallNormal(String, x, 0, line + 1);
@@ -802,24 +765,15 @@ void UI_DisplayMain(void) {
#endif #endif
if (state != VFO_STATE_NORMAL) { if (state != VFO_STATE_NORMAL) {
if (state < ARRAY_SIZE(VfoStateStr)) if (state < ARRAY_SIZE(VfoStateStr))
UI_PrintString(VfoStateStr[state], 31, 0, line, 8); UI_PrintString(VfoStateStr[state], 31, 0, line /*, 8 */);
} else if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && } else if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) &&
gEeprom.TX_VFO == vfo_num) { // user entering a frequency gEeprom.TX_VFO == vfo_num) { // user entering a frequency
const char *ascii = INPUTBOX_GetAscii(); const char *ascii = INPUTBOX_GetAscii();
bool isGigaF = frequency >= _1GHz_in_KHz; bool isGigaF = frequency >= _1GHz_in_KHz;
sprintf(String, "%.*s.%.3s", 3 + isGigaF, ascii, ascii + 3 + isGigaF); sprintf(String, "%.*s.%.3s", 3 + isGigaF, ascii, ascii + 3 + isGigaF);
#ifdef ENABLE_BIG_FREQ
if (!isGigaF) {
// show the remaining 2 small frequency digits
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
String[7] = 0;
// show the main large frequency digits
UI_DisplayFrequency(String, 32, line, false);
} else
#endif
{ {
// show the frequency in the main font // show the frequency in the main font
UI_PrintString(String, 32, 0, line, 8); UI_PrintString(String, 45, 0, line /*, 8 */);
} }
continue; continue;
@@ -888,19 +842,19 @@ void UI_DisplayMain(void) {
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1); UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
String[7] = 0; String[7] = 0;
// show the main large frequency digits // show the main large frequency digits
UI_DisplayFrequency(String, 32, line, false); UI_DisplayFrequency(String, 20, line, false);
} else } else
#endif #endif
{ {
// show the frequency in the main font // show the frequency in the main font
UI_PrintString(String, 32, 0, line, 8); UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
} }
break; break;
case MDF_CHANNEL: // show the channel number case MDF_CHANNEL: // show the channel number
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1); sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintString(String, 32, 0, line, 8); UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
break; break;
case MDF_NAME: // show the channel name case MDF_NAME: // show the channel name
@@ -912,20 +866,20 @@ void UI_DisplayMain(void) {
} }
if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_NAME) { if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_NAME) {
UI_PrintString(String, 32, 0, line, 8); UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
} else { } else {
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
if (isMainOnly()) { if (isMainOnly()) {
UI_PrintString(String, 32, 0, line, 8); UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
} else { } else {
if (activeTxVFO == vfo_num) { if (activeTxVFO == vfo_num) {
UI_PrintStringSmallBold(String, 32 + 4, 0, line); UI_PrintStringSmallBold(String, 40 + 4, 0, line);
} else { } else {
UI_PrintStringSmallNormal(String, 32 + 4, 0, line); UI_PrintStringSmallNormal(String, 40 + 4, 0, line);
} }
} }
#else #else
UI_PrintStringSmallBold(String, 32 + 4, 0, line); UI_PrintStringSmallBold(String, 20 + 4, 0, line);
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
@@ -936,19 +890,19 @@ void UI_DisplayMain(void) {
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 4); UI_PrintStringSmallNormal(String + 7, 113, 0, line + 4);
String[7] = 0; String[7] = 0;
// show the main large frequency digits // show the main large frequency digits
//UI_DisplayFrequency(String, 32, line + 3, false); //UI_DisplayFrequency(String, 20, line + 3, false);
UI_PrintStringSmallNormal(String, 0, 20, line + 3); UI_PrintStringSmallBold(String, 20, 20, line + 3);
} else { } else {
// show the frequency in the main font // show the frequency in the main font
UI_PrintString(String, 32, 0, line + 3, 8); UI_PrintString(String, 40, 0, line + 3 /*, 8 */);
} }
} else { } else {
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000); sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
UI_PrintStringSmallNormal(String, 32 + 4, 0, line + 1); UI_PrintStringSmallBold(String, 40 + 4, 0, line + 1);
} }
#else // show the channel frequency below the channel number/name #else // show the channel frequency below the channel number/name
sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000); sprintf(String, "%03u.%05u", frequency / 100000, frequency % 100000);
UI_PrintStringSmallNormal(String, 32 + 4, 0, line + 1); UI_PrintStringSmallNormal(String, 20 + 4, 0, line + 1);
#endif #endif
} }
@@ -963,12 +917,12 @@ void UI_DisplayMain(void) {
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1); UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
String[7] = 0; String[7] = 0;
// show the main large frequency digits // show the main large frequency digits
UI_DisplayFrequency(String, 32, line, false); UI_DisplayFrequency(String, 20, line, false);
} else } else
#endif #endif
{ {
// show the frequency in the main font // show the frequency in the main font
UI_PrintString(String, 32, 0, line, 8); UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
} }
// show the channel symbols // show the channel symbols
@@ -1075,70 +1029,28 @@ void UI_DisplayMain(void) {
shift = -10; shift = -10;
} }
if (gSetting_set_gui) { UI_PrintStringSmallNormal(s, 50, 0, line + 2);
UI_PrintStringSmallNormal(s, LCD_WIDTH + 22, 0, line + 1); UI_PrintStringSmallNormal(t, 2, 0, line + 2);
UI_PrintStringSmallNormal(t, LCD_WIDTH + 2, 0, line + 1);
if (isMainOnly() && !gDTMF_InputMode) { if (shift == 0) {
if (shift == 0) { UI_PrintStringSmallNormal(String, 65, 0, line + 2);
UI_PrintStringSmallNormal(String, 2, 0, 6);
}
if ((vfoInfo->StepFrequency / 100) < 100) {
sprintf(String, "%d.%02uK", vfoInfo->StepFrequency / 100, vfoInfo->StepFrequency % 100);
} else {
sprintf(String, "%dK", vfoInfo->StepFrequency / 100);
}
UI_PrintStringSmallNormal(String, 46, 0, 6);
}
} else {
if ((s != NULL) && (s[0] != '\0')) {
GUI_DisplaySmallest(s, 58, line == 0 ? 17 : 49, false, true);
}
if ((t != NULL) && (t[0] != '\0')) {
GUI_DisplaySmallest(t, 3, line == 0 ? 17 : 49, false, true);
}
GUI_DisplaySmallest(String, 68 + shift, line == 0 ? 17 : 49, false, true);
//sprintf(String, "%d.%02u", vfoInfo->StepFrequency / 100, vfoInfo->StepFrequency % 100);
//GUI_DisplaySmallest(String, 91, line == 0 ? 2 : 34, false, true);
} }
if ((vfoInfo->StepFrequency / 100) < 100) {
sprintf(String, "%d.%02uK", vfoInfo->StepFrequency / 100, vfoInfo->StepFrequency % 100);
} else {
sprintf(String, "%dK", vfoInfo->StepFrequency / 100);
}
UI_PrintStringSmallNormal(String, 55, 0, line + 1);
#else #else
UI_PrintStringSmallNormal(s, LCD_WIDTH + 24, 0, line + 1); UI_PrintStringSmallNormal(s, LCD_WIDTH + 24, 0, line + 1);
#endif #endif
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) { // show the TX power if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) { // show the TX power
uint8_t currentPower = vfoInfo->OUTPUT_POWER % 8; uint8_t currentPower = vfoInfo->OUTPUT_POWER % 8;
uint8_t arrowPos = 19; const char pwr_short[][3] = {"L1", "L2", "L3", "L4", "L5", "ME",
bool userPower = false; "HI"};
UI_PrintStringSmallNormal(pwr_short[currentPower], LCD_WIDTH + 25, 0, line + 1);
if (currentPower == OUTPUT_POWER_USER) {
currentPower = gSetting_set_pwr;
userPower = true;
} else {
currentPower--;
userPower = false;
}
if (gSetting_set_gui) {
const char pwr_short[][3] = {"L1", "L2", "L3", "L4", "L5", "M", "H"};
//sprintf(String, "%s", pwr_short[currentPower]);
//UI_PrintStringSmallNormal(String, LCD_WIDTH + 42, 0, line + 1);
UI_PrintStringSmallNormal(pwr_short[currentPower], LCD_WIDTH + 42, 0, line + 1);
arrowPos = 38;
} else {
const char pwr_long[][5] = {"LOW1", "LOW2", "LOW3", "LOW4", "LOW5", "MID", "HIGH"};
//sprintf(String, "%s", pwr_long[currentPower]);
//GUI_DisplaySmallest(String, 24, line == 0 ? 17 : 49, false, true);
GUI_DisplaySmallest(pwr_long[currentPower], 24, line == 0 ? 17 : 49, false, true);
}
if (userPower == true) {
memcpy(p_line0 + 256 + arrowPos, BITMAP_PowerUser, sizeof(BITMAP_PowerUser));
}
} }
if (vfoInfo->freq_config_RX.Frequency != vfoInfo->freq_config_TX.Frequency) { // show the TX offset symbol if (vfoInfo->freq_config_RX.Frequency != vfoInfo->freq_config_TX.Frequency) { // show the TX offset symbol
@@ -1156,22 +1068,7 @@ void UI_DisplayMain(void) {
#endif #endif
#if ENABLE_FEAT_F4HWN #if ENABLE_FEAT_F4HWN
if (gSetting_set_gui) { UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 60, 0, line + 1);
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 60, 0, line + 1);
} else {
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(i == 3)
{
GUI_DisplaySmallest(dir_list[i], 43, line == 0 ? 17 : 49, false, true);
}
else
{
#endif
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 41, 0, line + 1);
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
}
#endif
}
#else #else
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 54, 0, line + 1); UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 54, 0, line + 1);
#endif #endif
@@ -1181,11 +1078,7 @@ void UI_DisplayMain(void) {
if (vfoInfo->FrequencyReverse) if (vfoInfo->FrequencyReverse)
#if ENABLE_FEAT_F4HWN #if ENABLE_FEAT_F4HWN
{ {
if (gSetting_set_gui) { UI_PrintStringSmallNormal("R", LCD_WIDTH + 68, 0, line + 1);
UI_PrintStringSmallNormal("R", LCD_WIDTH + 68, 0, line + 1);
} else {
GUI_DisplaySmallest("R", 51, line == 0 ? 17 : 49, false, true);
}
} }
#else #else
UI_PrintStringSmallNormal("R", LCD_WIDTH + 62, 0, line + 1); UI_PrintStringSmallNormal("R", LCD_WIDTH + 62, 0, line + 1);
@@ -1198,16 +1091,9 @@ void UI_DisplayMain(void) {
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1) { if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1) {
narrower = 1; narrower = 1;
} }
const char *bandWidthNames[] = {"WID", "NAR", "NR+"};
if (gSetting_set_gui) { UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], LCD_WIDTH + 30, 0,
const char *bandWidthNames[] = {"W", "N", "N+"}; line);
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], LCD_WIDTH + 80, 0,
line + 1);
} else {
const char *bandWidthNames[] = {"WIDE", "NAR", "NAR+"};
GUI_DisplaySmallest(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], 91, line == 0 ? 17 : 49, false,
true);
}
#else #else
if (gSetting_set_gui) if (gSetting_set_gui)
{ {
@@ -1232,49 +1118,21 @@ void UI_DisplayMain(void) {
#endif #endif
// show the audio scramble symbol // show the audio scramble symbol
if (vfoInfo->SCRAMBLING_TYPE > 0) if (vfoInfo->SCRAMBLING_TYPE > 0) {
UI_PrintStringSmallNormal("S", LCD_WIDTH + 106, 0, line); sprintf(String, "S%d", vfoInfo->SCRAMBLING_TYPE + 25);
UI_PrintStringSmallNormal(String, 105, 0, line + 2);
}
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
/* if (isMainVFO && gMonitor) {
if(isMainVFO) strcpy(String, "MONI");
{
if(gMonitor)
{
sprintf(String, "%s", "MONI");
}
if (gSetting_set_gui)
{
if(!gMonitor)
{
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
}
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1);
}
else
{
if(!gMonitor)
{
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
}
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
}
}
*/
if (isMainVFO) {
if (gMonitor) {
strcpy(String, "MONI");
} else {
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
}
if (gSetting_set_gui) { } else {
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1); sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
} else {
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
}
} }
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line);
#endif #endif
} }
@@ -1324,7 +1182,7 @@ void UI_DisplayMain(void) {
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
if (gScreenToDisplay != DISPLAY_MAIN if (gScreenToDisplay != DISPLAY_MAIN
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
|| gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_CallState != DTMF_CALL_STATE_NONE
#endif #endif
) )
@@ -1402,4 +1260,4 @@ void UI_DisplayMain(void) {
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
} }
// *************************************************************************** // ***************************************************************************

229
ui/menu.c
View File

@@ -54,7 +54,6 @@ const t_menu_item MenuList[] =
{"COMP", MENU_COMPAND}, {"COMP", MENU_COMPAND},
{"Mod", MENU_AM}, // was "AM" {"Mod", MENU_AM}, // was "AM"
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
{"TXLck", MENU_TX_LOCK},
#endif #endif
{"ScAdd1", MENU_S_ADD1}, {"ScAdd1", MENU_S_ADD1},
{"ScAdd2", MENU_S_ADD2}, {"ScAdd2", MENU_S_ADD2},
@@ -131,15 +130,12 @@ const t_menu_item MenuList[] =
{"RxMode", MENU_TDR}, {"RxMode", MENU_TDR},
{"Sql", MENU_SQL}, {"Sql", MENU_SQL},
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
{"SPwr", MENU_SET_PWR},
{"SPTT", MENU_SET_PTT}, {"SPTT", MENU_SET_PTT},
{"STOT", MENU_SET_TOT}, {"STOT", MENU_SET_TOT},
{"SEOT", MENU_SET_EOT}, {"SEOT", MENU_SET_EOT},
{"SCtr", MENU_SET_CTR}, {"SCtr", MENU_SET_CTR},
{"SInv", MENU_SET_INV}, {"SInv", MENU_SET_INV},
{"SLck", MENU_SET_LCK}, {"SLck", MENU_SET_LCK},
//{"SMet", MENU_SET_MET},
//{"SGUI", MENU_SET_GUI},
{"STmr", MENU_SET_TMR}, {"STmr", MENU_SET_TMR},
#ifdef ENABLE_FEAT_F4HWN_SLEEP #ifdef ENABLE_FEAT_F4HWN_SLEEP
{"SOff", MENU_SET_OFF}, {"SOff", MENU_SET_OFF},
@@ -160,13 +156,6 @@ const t_menu_item MenuList[] =
// hidden menu items from here on // hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on // enabled if pressing both the PTT and upper side button at power-on
{"F Lock", MENU_F_LOCK}, {"F Lock", MENU_F_LOCK},
#ifndef ENABLE_FEAT_F4HWN
{"Tx 200", MENU_200TX }, // was "200TX"
{"Tx 350", MENU_350TX }, // was "350TX"
{"Tx 500", MENU_500TX }, // was "500TX"
{"350 En", MENU_350EN }, // was "350EN"
#endif
//{"ScraEn", MENU_SCREN }, // was "SCREN"
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
{"FrCali", MENU_F_CALI}, // reference xtal calibration {"FrCali", MENU_F_CALI}, // reference xtal calibration
#endif #endif
@@ -177,18 +166,15 @@ const t_menu_item MenuList[] =
{"", 0xff} // end of list - DO NOT delete or move this this {"", 0xff} // end of list - DO NOT delete or move this this
}; };
const uint8_t FIRST_HIDDEN_MENU_ITEM = MENU_F_LOCK; const char gSubMenu_TXP[][5] =
const char gSubMenu_TXP[][6] =
{ {
"USR", "<.02",
"L1", ".125",
"L2", ".25",
"L3", ".5",
"L4", "1",
"L5", "2",
"M", "5"
"H"
}; };
const char gSubMenu_SFT_D[][4] = const char gSubMenu_SFT_D[][4] =
@@ -333,32 +319,7 @@ const char gSubMenu_BATTYP[][9] =
"35" "35"
}; };
const char gSubMenu_SCRAMBLER[][7] =
{
"OFF",
"26K",
"27K",
"28K",
"29K",
"30K",
"31K",
"32K",
"33K",
"34K",
"35K"
};
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
const char gSubMenu_SET_PWR[][6] =
{
"<.02",
".125",
".25",
".5",
"1",
"2",
"5"
};
const char gSubMenu_SET_PTT[][8] = const char gSubMenu_SET_PTT[][8] =
{ {
@@ -374,12 +335,6 @@ const char gSubMenu_SET_TOT[][7] = // Use by SET_EOT too
"ALL" "ALL"
}; };
const char gSubMenu_SET_LCK[][9] =
{
"KEY",
"KEY+PTT"
};
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
const char gSubMenu_SET_NFM[][9] = const char gSubMenu_SET_NFM[][9] =
{ {
@@ -500,7 +455,7 @@ void UI_DisplayMenu(void) {
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
if (gMenuCursor > 0 || i > 0) if (gMenuCursor > 0 || i > 0)
if ((gMenuListCount - 1) != gMenuCursor || i != 2) if ((gMenuListCount - 1) != gMenuCursor || i != 2)
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8); UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2 /*, 8 */);
// invert the current menu list item pixels // invert the current menu list item pixels
for (i = 0; i < (8 * menu_list_width); i++) for (i = 0; i < (8 * menu_list_width); i++)
@@ -525,14 +480,17 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#else #else
{ // new menu layout .. experimental & unfinished { // new menu layout .. experimental & unfinished
const int menu_index = gMenuCursor; // current selected menu item const int menu_index = gMenuCursor; // current selected menu item
i = 1; i = 0;
if (!gIsInSubMenu) { if (!gIsInSubMenu) {
while (i < 2) { // leading menu items - small text while (i < 2) { // leading menu items - small text
const int k = menu_index + i - 2; const int k = menu_index + i - 2;
if (k < 0) if (k < 0)
UI_PrintStringSmallNormal(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round UI_PrintStringSmallNormal(MenuList[(gMenuListCount + k) % gMenuListCount].name, 0, 0,
else if (k >= 0 && k < (int) gMenuListCount) i); // wrap-around
else if (k >= (int) gMenuListCount)
UI_PrintStringSmallNormal(MenuList[k % gMenuListCount].name, 0, 0, i); // wrap-around
else
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i); UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
i++; i++;
} }
@@ -546,10 +504,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
while (i < 5) { // trailing menu item - small text while (i < 5) { // trailing menu item - small text
const int k = menu_index + i - 2; const int k = menu_index + i - 2;
if (k >= 0 && k < (int) gMenuListCount) if (k < 0)
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i); UI_PrintStringSmallNormal(MenuList[(gMenuListCount + k) % gMenuListCount].name, 0, 0,
i); // wrap-around
else if (k >= (int) gMenuListCount) else if (k >= (int) gMenuListCount)
UI_PrintStringSmallNormal(MenuList[gMenuListCount - k].name, 0, 0, i); // wrap-a-round UI_PrintStringSmallNormal(MenuList[k % gMenuListCount].name, 0, 0, i); // wrap-around
else
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
i++; i++;
} }
@@ -560,7 +521,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#endif #endif
} else if (menu_index >= 0 && menu_index < (int) gMenuListCount) { // current menu item } else if (menu_index >= 0 && menu_index < (int) gMenuListCount) { // current menu item
// strcat(String, ":"); // strcat(String, ":");
UI_PrintString(MenuList[menu_index].name, 0, 0, 0, 8); UI_PrintString(MenuList[menu_index].name, 0, 0, 0 /*, 8 */);
// UI_PrintStringSmallNormal(String, 0, 0, 0); // UI_PrintStringSmallNormal(String, 0, 0, 0);
} }
@@ -615,11 +576,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
} }
case MENU_TXP: case MENU_TXP:
if (gSubMenuSelection == 0) { sprintf(String, "%sW", gSubMenu_TXP[gSubMenuSelection]);
strcpy(String, gSubMenu_TXP[gSubMenuSelection]);
} else {
sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection], gSubMenu_SET_PWR[gSubMenuSelection - 1]);
}
break; break;
case MENU_R_DCS: case MENU_R_DCS:
@@ -649,14 +606,14 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
case MENU_OFFSET: case MENU_OFFSET:
if (!gIsInSubMenu || gInputBoxIndex == 0) { if (!gIsInSubMenu || gInputBoxIndex == 0) {
sprintf(String, "%3d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000); sprintf(String, "%3d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 1 /*, 8 */);
} 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_PrintString(String, menu_item_x1, menu_item_x2, 1, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 1 /*, 8 */);
} }
UI_PrintString("MHz", menu_item_x1, menu_item_x2, 3, 8); UI_PrintString("MHz", menu_item_x1, menu_item_x2, 3 /*, 8 */);
already_printed = true; already_printed = true;
break; break;
@@ -666,11 +623,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
break; break;
case MENU_SCR: case MENU_SCR:
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]); if (gSubMenuSelection > 0) {
if (gSubMenuSelection > 0) sprintf(String, "%d00", gSubMenuSelection + 25);
BK4819_EnableScramble(gSubMenuSelection - 1); BK4819_EnableScramble(gSubMenuSelection - 1);
else } else {
strcpy(String, "OFF");
BK4819_DisableScramble(); BK4819_DisableScramble();
}
break; break;
case MENU_VOX: case MENU_VOX:
@@ -757,13 +716,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#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:
//case MENU_SCREN:
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
case MENU_SET_TMR: case MENU_SET_TMR:
#endif #endif
@@ -776,16 +728,16 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0); const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection); UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 0 /*, 8 */);
if (valid && !gAskForConfirmation) { // show the frequency so that the user knows the channels frequency if (valid && !gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection); const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000); sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 4 /*, 8 */);
} }
SETTINGS_FetchChannelName(String, gSubMenuSelection); SETTINGS_FetchChannelName(String, gSubMenuSelection);
UI_PrintString(String[0] ? String : "--", menu_item_x1, menu_item_x2, 2, 8); UI_PrintString(String[0] ? String : "--", menu_item_x1, menu_item_x2, 2 /*, 8 */);
already_printed = true; already_printed = true;
break; break;
} }
@@ -794,7 +746,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0); const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
UI_GenerateChannelStringEx(String, valid, gSubMenuSelection); UI_GenerateChannelStringEx(String, valid, gSubMenuSelection);
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 0 /*, 8 */);
if (valid) { if (valid) {
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection); const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
@@ -805,18 +757,18 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
if (edit_index < 0) { // show the channel name if (edit_index < 0) { // show the channel name
SETTINGS_FetchChannelName(String, gSubMenuSelection); SETTINGS_FetchChannelName(String, gSubMenuSelection);
char *pPrintStr = String[0] ? String : "--"; char *pPrintStr = String[0] ? String : "--";
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8); UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2 /*, 8 */);
} else { // show the channel name being edited } else { // show the channel name being edited
//UI_PrintString(edit, menu_item_x1, 0, 2, 8); //UI_PrintString(edit, menu_item_x1, 0, 2 /*, 8 */);
UI_PrintString(edit, menu_item_x1, menu_item_x2, 2, 8); UI_PrintString(edit, menu_item_x1, menu_item_x2, 2 /*, 8 */);
if (edit_index < 10) if (edit_index < 10)
//UI_PrintString("^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor //UI_PrintString("^", menu_item_x1 + (8 * edit_index), 0, 4 /*, 8 */); // show the cursor
UI_PrintString("^", menu_item_x1 - 1 + (8 * edit_index), 0, 4, 8); // show the cursor UI_PrintString("^", menu_item_x1 - 1 + (8 * edit_index), 0, 4 /*, 8 */); // show the cursor
} }
if (!gAskForConfirmation) { // show the frequency so that the user knows the channels frequency if (!gAskForConfirmation) { // show the frequency so that the user knows the channels frequency
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000); sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0), 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 4 + (gIsInSubMenu && edit_index >= 0) /*, 8 */);
} }
} }
@@ -958,17 +910,17 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
break; break;
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
case MENU_F_CALI: { case MENU_F_CALI: {
const uint32_t value = 22656 + gSubMenuSelection; const uint32_t value = 22656 + gSubMenuSelection;
const uint32_t xtal_Hz = (0x4f0000u + value) * 5; const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
writeXtalFreqCal(gSubMenuSelection, false); writeXtalFreqCal(gSubMenuSelection, false);
sprintf(String, "%d\n%u.%06u\nMHz", sprintf(String, "%d\n%u.%06u\nMHz",
gSubMenuSelection, gSubMenuSelection,
xtal_Hz / 1000000, xtal_Hz % 1000000); xtal_Hz / 1000000, xtal_Hz % 1000000);
} }
break; break;
#endif #endif
case MENU_BATCAL: { case MENU_BATCAL: {
@@ -1006,10 +958,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#endif #endif
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
case MENU_SET_PWR:
sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection + 1], gSubMenu_SET_PWR[gSubMenuSelection]);
break;
case MENU_SET_PTT: case MENU_SET_PTT:
strcpy(String, gSubMenu_SET_PTT[gSubMenuSelection]); strcpy(String, gSubMenu_SET_PTT[gSubMenuSelection]);
break; break;
@@ -1038,23 +986,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#endif #endif
break; break;
case MENU_TX_LOCK:
if (TX_freq_check(gEeprom.VfoInfo[gEeprom.TX_VFO].pRX->Frequency) == 0) {
strcpy(String, "Inside\nF Lock\nPlan");
} else {
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
}
break;
case MENU_SET_LCK:
strcpy(String, gSubMenu_SET_LCK[gSubMenuSelection]);
break;
//case MENU_SET_MET:
//case MENU_SET_GUI:
strcpy(String, gSubMenu_SET_MET[gSubMenuSelection]); // Same as SET_MET
break;
#ifdef ENABLE_FEAT_F4HWN_NARROWER #ifdef ENABLE_FEAT_F4HWN_NARROWER
case MENU_SET_NFM: case MENU_SET_NFM:
strcpy(String, gSubMenu_SET_NFM[gSubMenuSelection]); strcpy(String, gSubMenu_SET_NFM[gSubMenuSelection]);
@@ -1062,25 +993,25 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_VOL #ifdef ENABLE_FEAT_F4HWN_VOL
case MENU_SET_VOL: case MENU_SET_VOL:
if (gSubMenuSelection == 0) { if (gSubMenuSelection == 0) {
strcpy(String, gSubMenu_OFF_ON[0]); strcpy(String, gSubMenu_OFF_ON[0]);
} else if (gSubMenuSelection < 64) { } else if (gSubMenuSelection < 64) {
sprintf(String, "%02u", gSubMenuSelection); sprintf(String, "%02u", gSubMenuSelection);
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO) #if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
//ST7565_Gauge(4, 1, 63, gSubMenuSelection); //ST7565_Gauge(4, 1, 63, gSubMenuSelection);
gaugeLine = 4; gaugeLine = 4;
gaugeMin = 1; gaugeMin = 1;
gaugeMax = 63; gaugeMax = 63;
#endif #endif
} }
gEeprom.VOLUME_GAIN = gSubMenuSelection; gEeprom.VOLUME_GAIN = gSubMenuSelection;
BK4819_WriteRegister(BK4819_REG_48, BK4819_WriteRegister(BK4819_REG_48,
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference (11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
(0u << 10) | // AF Rx Gain-1 (0u << 10) | // AF Rx Gain-1
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2 (gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2) (gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
break; break;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
@@ -1092,11 +1023,11 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
} }
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO) //#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
if (gaugeLine != 0) { // if (gaugeLine != 0) {
ST7565_Gauge(gaugeLine, gaugeMin, gaugeMax, gSubMenuSelection); // ST7565_Gauge(gaugeLine, gaugeMin, gaugeMax, gSubMenuSelection);
} // }
#endif //#endif
if (!already_printed) { // we now do multi-line text in a single string if (!already_printed) { // we now do multi-line text in a single string
@@ -1135,7 +1066,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
if (small) if (small)
UI_PrintStringSmallNormal(String + i, menu_item_x1, menu_item_x2, y); UI_PrintStringSmallNormal(String + i, menu_item_x1, menu_item_x2, y);
else else
UI_PrintString(String + i, menu_item_x1, menu_item_x2, y, 8); UI_PrintString(String + i, menu_item_x1, menu_item_x2, y /*, 8 */);
// look for start of next line // look for start of next line
while (i < len && String[i] >= 32) while (i < len && String[i] >= 32)
@@ -1164,21 +1095,21 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
} }
// channel number // channel number
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 0, 8); UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 0 /*, 8 */);
SETTINGS_FetchChannelName(String, gSubMenuSelection); SETTINGS_FetchChannelName(String, gSubMenuSelection);
pPrintStr = String[0] ? String : "--"; pPrintStr = String[0] ? String : "--";
// channel name and scan-list // channel name and scan-list
if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i]) { if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i]) {
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8); UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2 /*, 8 */);
} else { } else {
/* /*
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2); UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) { if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
sprintf(String, "PRI%d:%u", 1, gEeprom.SCANLIST_PRIORITY_CH1[i] + 1); sprintf(String, "PRI%d:%u", 1, gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
UI_PrintString(String, menu_item_x1, menu_item_x2, 3, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 3 , 8);
} }
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) { if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) {
@@ -1194,7 +1125,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
if (IS_MR_CHANNEL(channel)) { if (IS_MR_CHANNEL(channel)) {
sprintf(String, "PRI%d:%u", pri, channel + 1); sprintf(String, "PRI%d:%u", pri, channel + 1);
UI_PrintString(String, menu_item_x1, menu_item_x2, pri * 2 + 1, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, pri * 2 + 1 /*, 8 */);
} }
} }
@@ -1202,14 +1133,14 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
} }
if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gCssBackgroundScan) if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gCssBackgroundScan)
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8); UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4 /*, 8 */);
#ifdef ENABLE_DTMF_CALLING #ifdef ENABLE_DTMF_CALLING
if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid) { if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid) {
Contact[11] = 0; Contact[11] = 0;
memcpy(&gDTMF_ID, Contact + 8, 4); memcpy(&gDTMF_ID, Contact + 8, 4);
sprintf(String, "ID:%4s", gDTMF_ID); sprintf(String, "ID:%4s", gDTMF_ID);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 4 /*, 8 */);
} }
#endif #endif
@@ -1230,7 +1161,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME || UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME ||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation) { // display confirmation UI_MENU_GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation) { // display confirmation
char *pPrintStr = (gAskForConfirmation == 1) ? "SURE?" : "WAIT!"; char *pPrintStr = (gAskForConfirmation == 1) ? "SURE?" : "WAIT!";
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 5, 8); UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 5 /*, 8 */);
} }
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();

View File

@@ -42,9 +42,6 @@ enum {
MENU_W_N, MENU_W_N,
MENU_SCR, MENU_SCR,
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,
@@ -110,13 +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,
MENU_SCREN,
#endif
MENU_350EN,
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
MENU_F_CALI, // reference xtal calibration MENU_F_CALI, // reference xtal calibration
#endif #endif
@@ -124,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,
@@ -156,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];
@@ -179,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
@@ -201,8 +184,6 @@ 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];
extern const char gSubMenu_SCRAMBLER[11][7];
typedef struct { typedef struct {
char *name; char *name;
uint8_t id; uint8_t id;

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

@@ -35,8 +35,7 @@ void UI_DisplayReleaseKeys(void) {
#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();