This commit is contained in:
10
Makefile
10
Makefile
@@ -9,7 +9,7 @@ ENABLE_UART ?= 1
|
||||
ENABLE_AIRCOPY ?= 0
|
||||
ENABLE_NOAA ?= 0
|
||||
ENABLE_VOICE ?= 0
|
||||
ENABLE_VOX ?= 0
|
||||
ENABLE_VOX ?= 1
|
||||
ENABLE_ALARM ?= 0
|
||||
ENABLE_TX1750 ?= 1
|
||||
ENABLE_PWRON_PASSWORD ?= 0
|
||||
@@ -44,12 +44,12 @@ ENABLE_FEAT_F4HWN ?= 1
|
||||
ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
|
||||
ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
|
||||
ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 0
|
||||
ENABLE_FEAT_F4HWN_CHARGING_C ?= 0
|
||||
ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
|
||||
ENABLE_FEAT_F4HWN_SLEEP ?= 1
|
||||
ENABLE_FEAT_F4HWN_RESUME_STATE ?= 1
|
||||
ENABLE_FEAT_F4HWN_NARROWER ?= 1
|
||||
ENABLE_FEAT_F4HWN_INV ?= 0
|
||||
ENABLE_FEAT_F4HWN_CTR ?= 1
|
||||
ENABLE_FEAT_F4HWN_INV ?= 1
|
||||
ENABLE_FEAT_F4HWN_CTR ?= 0
|
||||
ENABLE_FEAT_F4HWN_RESCUE_OPS ?= 0
|
||||
ENABLE_FEAT_F4HWN_VOL ?= 1
|
||||
ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0
|
||||
@@ -67,7 +67,7 @@ ENABLE_UART_RW_BK_REGS ?= 0
|
||||
# ---- COMPILER/LINKER OPTIONS ----
|
||||
ENABLE_CLANG ?= 0
|
||||
ENABLE_SWD ?= 0
|
||||
ENABLE_OVERLAY ?= 0
|
||||
ENABLE_OVERLAY ?= 1
|
||||
ENABLE_LTO ?= 1
|
||||
|
||||
#############################################################
|
||||
|
20
app/app.c
20
app/app.c
@@ -32,6 +32,7 @@
|
||||
#ifdef ENABLE_FLASHLIGHT
|
||||
|
||||
#include "app/flashlight.h"
|
||||
#include "../ui/fmradio.h"
|
||||
|
||||
#endif
|
||||
#ifdef ENABLE_FMRADIO
|
||||
@@ -1485,6 +1486,9 @@ void APP_TimeSlice500ms(void) {
|
||||
if (gFmRadioMode) // 1of11
|
||||
return;
|
||||
}
|
||||
if (gScreenToDisplay == DISPLAY_FM) {
|
||||
UI_UpdateFMThings(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN // Disable PTT if KEY_LOCK
|
||||
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
|
||||
if ((gEeprom.KEY_LOCK || lowBatPopup) && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{ // keyboard is locked or 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
|
||||
// but we don't want it to complain when initial press happens
|
||||
// we want to react on realese instead
|
||||
else if (Key != KEY_SIDE1 && Key != KEY_SIDE2 && // pass side buttons
|
||||
!(Key == KEY_MENU && bKeyHeld)) // pass KEY_MENU held
|
||||
else if (!(Key == KEY_MENU && bKeyHeld)) // pass KEY_MENU held
|
||||
{
|
||||
if ((!bKeyPressed || bKeyHeld || (Key == KEY_MENU && bKeyPressed)) &&
|
||||
// prevent released or held, prevent KEY_MENU pressed
|
||||
|
35
app/fm.c
35
app/fm.c
@@ -184,7 +184,7 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
|
||||
{
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
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) {
|
||||
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;
|
||||
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:
|
||||
ACTION_Scan(autoScan);
|
||||
break;
|
||||
@@ -390,12 +411,13 @@ static void Key_FUNC(KEY_Code_t Key, uint8_t state)
|
||||
|
||||
static void Key_EXIT(uint8_t state)
|
||||
{
|
||||
if (state != BUTTON_EVENT_SHORT)
|
||||
return;
|
||||
|
||||
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 (!gAskToSave && !gAskToDelete) {
|
||||
ACTION_FM();
|
||||
@@ -572,6 +594,7 @@ void FM_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||
break;
|
||||
}
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
|
||||
void FM_Play(void)
|
||||
|
10
app/main.c
10
app/main.c
@@ -180,7 +180,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) {
|
||||
#endif
|
||||
gTxVfo->Band += 1;
|
||||
|
||||
if (gTxVfo->Band == BAND5_350MHz && !gSetting_350EN) {
|
||||
if (gTxVfo->Band == BAND5_350MHz) {
|
||||
// skip if not enabled
|
||||
gTxVfo->Band += 1;
|
||||
} else if (gTxVfo->Band >= BAND_N_ELEM) {
|
||||
@@ -965,7 +965,9 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
if (gEnteringSMS == SMS_ENTERING_MESSAGE) {
|
||||
if (bKeyPressed) {
|
||||
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
|
||||
: gEeprom.TX_VFO;
|
||||
if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
|
||||
AUDIO_AudioPathOff();
|
||||
gEnableSpeaker = false;
|
||||
RADIO_PrepareTX();
|
||||
@@ -973,15 +975,17 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
|
||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||
MSG_FSKSendData();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||
AUDIO_AudioPathOn();
|
||||
gEnableSpeaker = true;
|
||||
BK4819_ExitTxMute();
|
||||
MSG_EnableRX(true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||
dataPTR = dataPacket.data;
|
||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||
}
|
||||
gEnteringSMS = SMS_NOT_ENTERING;
|
||||
}
|
||||
}
|
||||
|
86
app/menu.c
86
app/menu.c
@@ -246,12 +246,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
||||
#ifdef ENABLE_NOAA
|
||||
case MENU_NOAA_S:
|
||||
#endif
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
case MENU_350TX:
|
||||
case MENU_200TX:
|
||||
case MENU_500TX:
|
||||
#endif
|
||||
case MENU_350EN:
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_TMR:
|
||||
#endif
|
||||
@@ -265,7 +259,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
||||
|
||||
case MENU_SCR:
|
||||
//*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_SCRAMBLER) - 1;
|
||||
*pMax = 10;
|
||||
break;
|
||||
|
||||
case MENU_AUTOLK:
|
||||
@@ -387,9 +381,6 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) {
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_PWR:
|
||||
*pMax = ARRAY_SIZE(gSubMenu_SET_PWR) - 1;
|
||||
break;
|
||||
case MENU_SET_PTT:
|
||||
//*pMin = 0;
|
||||
*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;
|
||||
break;
|
||||
#endif
|
||||
case MENU_TX_LOCK:
|
||||
#ifdef ENABLE_FEAT_F4HWN_INV
|
||||
case MENU_SET_INV:
|
||||
//*pMin = 0;
|
||||
*pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1;
|
||||
break;
|
||||
#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
|
||||
case MENU_SET_NFM:
|
||||
//*pMin = 0;
|
||||
@@ -812,40 +793,14 @@ void MENU_AcceptSetting(void) {
|
||||
SETTINGS_FactoryReset(gSubMenuSelection);
|
||||
return;
|
||||
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
case MENU_350TX:
|
||||
gSetting_350TX = gSubMenuSelection;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_F_LOCK: {
|
||||
gSetting_F_LOCK = gSubMenuSelection;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
if (gSetting_F_LOCK == F_LOCK_ALL) {
|
||||
if(gSetting_F_LOCK == F_LOCK_ALL) {
|
||||
SETTINGS_ResetTxLock();
|
||||
}
|
||||
#endif
|
||||
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
|
||||
case MENU_F_CALI:
|
||||
@@ -890,10 +845,6 @@ void MENU_AcceptSetting(void) {
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_PWR:
|
||||
gSetting_set_pwr = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
break;
|
||||
case MENU_SET_PTT:
|
||||
gSetting_set_ptt = gSubMenuSelection;
|
||||
gSetting_set_ptt_session = gSetting_set_ptt; // Special for action
|
||||
@@ -915,12 +866,6 @@ void MENU_AcceptSetting(void) {
|
||||
case MENU_SET_LCK:
|
||||
gSetting_set_lck = gSubMenuSelection;
|
||||
break;
|
||||
case MENU_SET_MET:
|
||||
gSetting_set_met = gSubMenuSelection;
|
||||
break;
|
||||
case MENU_SET_GUI:
|
||||
gSetting_set_gui = gSubMenuSelection;
|
||||
break;
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
case MENU_SET_NFM:
|
||||
gSetting_set_nfm = gSubMenuSelection;
|
||||
@@ -941,10 +886,6 @@ void MENU_AcceptSetting(void) {
|
||||
case MENU_SET_TMR:
|
||||
gSetting_set_tmr = gSubMenuSelection;
|
||||
break;
|
||||
case MENU_TX_LOCK:
|
||||
gTxVfo->TX_LOCK = gSubMenuSelection;
|
||||
gRequestSaveChannel = 1;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1268,17 +1209,6 @@ void MENU_ShowCurrentSetting(void) {
|
||||
gSubMenuSelection = gSetting_F_LOCK;
|
||||
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
|
||||
case MENU_F_CALI:
|
||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||
@@ -1323,9 +1253,6 @@ void MENU_ShowCurrentSetting(void) {
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
case MENU_SET_PWR:
|
||||
gSubMenuSelection = gSetting_set_pwr;
|
||||
break;
|
||||
case MENU_SET_PTT:
|
||||
gSubMenuSelection = gSetting_set_ptt_session;
|
||||
break;
|
||||
@@ -1346,12 +1273,6 @@ void MENU_ShowCurrentSetting(void) {
|
||||
case MENU_SET_LCK:
|
||||
gSubMenuSelection = gSetting_set_lck;
|
||||
break;
|
||||
case MENU_SET_MET:
|
||||
gSubMenuSelection = gSetting_set_met;
|
||||
break;
|
||||
case MENU_SET_GUI:
|
||||
gSubMenuSelection = gSetting_set_gui;
|
||||
break;
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
case MENU_SET_NFM:
|
||||
gSubMenuSelection = gSetting_set_nfm;
|
||||
@@ -1370,9 +1291,6 @@ void MENU_ShowCurrentSetting(void) {
|
||||
case MENU_SET_TMR:
|
||||
gSubMenuSelection = gSetting_set_tmr;
|
||||
break;
|
||||
case MENU_TX_LOCK:
|
||||
gSubMenuSelection = gTxVfo->TX_LOCK;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
|
@@ -794,7 +794,7 @@ static void DrawStatus() {
|
||||
#else
|
||||
sprintf(String, "%d/%d", settings.dbMin, settings.dbMax);
|
||||
#endif
|
||||
GUI_DisplaySmallest(String, 0, 1, true, true);
|
||||
GUI_DisplaySmallest(String, 50, 20, true, true);
|
||||
|
||||
BOARD_ADC_GetBatteryInfo(&gBatteryVoltages[gBatteryCheckCounter++ % 4],
|
||||
&gBatteryCurrent);
|
||||
@@ -860,9 +860,9 @@ static void DrawF(uint32_t f) {
|
||||
UI_PrintStringSmallNormal(String, 8, 127, 0);
|
||||
|
||||
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]);
|
||||
GUI_DisplaySmallest(String, 108, 7, false, true);
|
||||
GUI_DisplaySmallest(String, 90, 10, false, true);
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SPECTRUM
|
||||
ShowChannelName(f);
|
||||
@@ -882,14 +882,14 @@ static void DrawNums() {
|
||||
sprintf(String, "%u.%05u \x7F%u.%02uk", currentFreq / 100000,
|
||||
currentFreq % 100000, settings.frequencyChangeStep / 100,
|
||||
settings.frequencyChangeStep % 100);
|
||||
GUI_DisplaySmallest(String, 36, 49, false, true);
|
||||
GUI_DisplaySmallest(String, 36, 39, false, true);
|
||||
} else {
|
||||
sprintf(String, "%u.%05u", GetFStart() / 100000, GetFStart() % 100000);
|
||||
GUI_DisplaySmallest(String, 0, 49, false, true);
|
||||
|
||||
sprintf(String, "\x7F%u.%02uk", 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);
|
||||
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() {
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
@@ -1193,8 +1193,8 @@ static void RenderStill() {
|
||||
gFrameBuffer[2][METER_PAD_LEFT + x] = 0b11111111;
|
||||
}
|
||||
|
||||
const uint8_t PAD_LEFT = 4;
|
||||
const uint8_t CELL_WIDTH = 30;
|
||||
const uint8_t PAD_LEFT = 0;
|
||||
const uint8_t CELL_WIDTH = 28;
|
||||
uint8_t offset = PAD_LEFT;
|
||||
uint8_t row = 4;
|
||||
|
||||
|
11
bitmaps.c
11
bitmaps.c
@@ -166,17 +166,6 @@ const uint8_t BITMAP_Antenna[5] =
|
||||
0b00000011
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_VFO_Lock[7] =
|
||||
{
|
||||
0b01111100,
|
||||
0b01000110,
|
||||
0b01000101,
|
||||
0b01000101,
|
||||
0b01000101,
|
||||
0b01000110,
|
||||
0b01111100,
|
||||
};
|
||||
|
||||
const uint8_t BITMAP_VFO_Default[7] =
|
||||
{
|
||||
0b01111111,
|
||||
|
@@ -38,7 +38,6 @@ extern const uint8_t BITMAP_NotReady[7];
|
||||
extern const uint8_t BITMAP_Antenna[5];
|
||||
extern const uint8_t BITMAP_VFO_Default[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_ScanList1[7];
|
||||
extern const uint8_t BITMAP_ScanList2[7];
|
||||
|
@@ -19,14 +19,42 @@
|
||||
|
||||
enum BK1080_Register_t {
|
||||
BK1080_REG_00 = 0x00U,
|
||||
BK1080_REG_01_CHIP_ID = 0x01U,
|
||||
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_07 = 0x07U,
|
||||
BK1080_REG_10 = 0x0AU,
|
||||
BK1080_REG_06_SYSTEM_CONFIGURATION3 = 0x06U,
|
||||
BK1080_REG_07_TEST1 = 0x07U,
|
||||
BK1080_REG_08_TEST2 = 0x08U,
|
||||
BK1080_REG_09_BOOT_CONFIGURATION = 0x09U,
|
||||
BK1080_REG_10_RSSI_STATUS = 0x0AU,
|
||||
BK1080_REG_11_RSSI_THRESHOLD = 0x0BU,
|
||||
BK1080_REG_12_INTERNAL = 0x0CU,
|
||||
BK1080_REG_13_INTERNAL = 0x0DU,
|
||||
BK1080_REG_14_INTERNAL = 0x0EU,
|
||||
BK1080_REG_15_INTERNAL = 0x0FU,
|
||||
BK1080_REG_16_INTERNAL = 0x10U,
|
||||
BK1080_REG_17_INTERNAL = 0x11U,
|
||||
BK1080_REG_18_INTERNAL = 0x12U,
|
||||
BK1080_REG_19_INTERNAL = 0x13U,
|
||||
BK1080_REG_20_INTERNAL = 0x14U,
|
||||
BK1080_REG_21_INTERNAL = 0x15U,
|
||||
BK1080_REG_22_INTERNAL = 0x16U,
|
||||
BK1080_REG_23_INTERNAL = 0x17U,
|
||||
BK1080_REG_24_INTERNAL = 0x18U,
|
||||
BK1080_REG_25_INTERNAL = 0x19U,
|
||||
BK1080_REG_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;
|
||||
|
||||
// REG 07
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/i2c.h"
|
||||
#include "driver/system.h"
|
||||
#include "../settings.h"
|
||||
#include "misc.h"
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
@@ -69,10 +70,11 @@ void BK1080_Init(uint16_t freq, uint8_t band/*, uint8_t space*/)
|
||||
}
|
||||
|
||||
#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
|
||||
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, 0x0A1F);
|
||||
#endif
|
||||
BK1080_UpdateSysconf();
|
||||
BK1080_SetFrequency(freq, band/*, space*/);
|
||||
}
|
||||
else {
|
||||
@@ -104,6 +106,15 @@ void BK1080_WriteRegister(BK1080_Register_t Register, uint16_t Value)
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
|
@@ -24,10 +24,20 @@
|
||||
extern uint16_t BK1080_BaseFrequency;
|
||||
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_Init(uint16_t Frequency, uint8_t band/*, uint8_t space*/);
|
||||
uint16_t BK1080_ReadRegister(BK1080_Register_t Register);
|
||||
void BK1080_WriteRegister(BK1080_Register_t Register, uint16_t Value);
|
||||
void BK1080_UpdateSysconf(void);
|
||||
void BK1080_Mute(bool Mute);
|
||||
uint16_t BK1080_GetFreqLoLimit(uint8_t band);
|
||||
uint16_t BK1080_GetFreqHiLimit(uint8_t band);
|
||||
|
@@ -226,22 +226,22 @@ uint8_t cmds[] = {
|
||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||
}
|
||||
|
||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||
void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value)
|
||||
{
|
||||
gFrameBuffer[line][54] = 0x0c;
|
||||
gFrameBuffer[line][55] = 0x12;
|
||||
|
||||
gFrameBuffer[line][121] = 0x12;
|
||||
gFrameBuffer[line][122] = 0x0c;
|
||||
|
||||
uint8_t filled = map(value, min, max, 56, 120);
|
||||
|
||||
for (uint8_t i = 56; i <= 120; i++) {
|
||||
gFrameBuffer[line][i] = (i <= filled) ? 0x2d : 0x21;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// #if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||
// void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value)
|
||||
// {
|
||||
// gFrameBuffer[line][54] = 0x0c;
|
||||
// gFrameBuffer[line][55] = 0x12;
|
||||
//
|
||||
// gFrameBuffer[line][121] = 0x12;
|
||||
// gFrameBuffer[line][122] = 0x0c;
|
||||
//
|
||||
// uint8_t filled = map(value, min, max, 56, 120);
|
||||
//
|
||||
// for (uint8_t i = 56; i <= 120; i++) {
|
||||
// gFrameBuffer[line][i] = (i <= filled) ? 0x2d : 0x21;
|
||||
// }
|
||||
// }
|
||||
// #endif
|
||||
#endif
|
||||
|
||||
void ST7565_Init(void)
|
||||
|
@@ -28,26 +28,26 @@ 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 frequencyBandTable[] =
|
||||
{
|
||||
#ifndef ENABLE_WIDE_RX
|
||||
{
|
||||
#ifndef ENABLE_WIDE_RX
|
||||
// QS original
|
||||
[BAND1_50MHz ]={.lower = 5000000, .upper = 7600000},
|
||||
[BAND7_470MHz]={.lower = 47000000, .upper = 60000000},
|
||||
#else
|
||||
#else
|
||||
// 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},
|
||||
#endif
|
||||
#endif
|
||||
[BAND2_108MHz]={.lower = 10800000, .upper = 13700000},
|
||||
[BAND3_137MHz]={.lower = 13700000, .upper = 17400000},
|
||||
[BAND4_174MHz]={.lower = 17400000, .upper = 35000000},
|
||||
[BAND5_350MHz]={.lower = 35000000, .upper = 40000000},
|
||||
[BAND6_400MHz]={.lower = 40000000, .upper = 47000000}
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
const uint32_t NoaaFrequencyTable[10] =
|
||||
{
|
||||
const uint32_t NoaaFrequencyTable[10] =
|
||||
{
|
||||
16255000,
|
||||
16240000,
|
||||
16247500,
|
||||
@@ -58,7 +58,7 @@ const freq_band_table_t frequencyBandTable[] =
|
||||
16152500,
|
||||
16177500,
|
||||
16327500
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -94,20 +94,20 @@ const uint16_t gStepFrequencyTable[] = {
|
||||
|
||||
|
||||
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_8_33kHz, STEP_9kHz, STEP_10kHz, STEP_12_5kHz, STEP_15kHz, STEP_20kHz, STEP_25kHz, STEP_30kHz, STEP_50kHz, STEP_100kHz,
|
||||
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_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];
|
||||
}
|
||||
|
||||
uint32_t FREQUENCY_GetSortedIdxFromStepIdx(uint8_t stepIdx)
|
||||
{
|
||||
for(uint8_t i = 0; i < ARRAY_SIZE(gStepFrequencyTable); i++)
|
||||
if(StepSortedIndexes[i] == stepIdx)
|
||||
uint32_t FREQUENCY_GetSortedIdxFromStepIdx(uint8_t stepIdx) {
|
||||
for (uint8_t i = 0; i < ARRAY_SIZE(gStepFrequencyTable); i++)
|
||||
if (StepSortedIndexes[i] == stepIdx)
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
@@ -115,25 +115,24 @@ uint32_t FREQUENCY_GetSortedIdxFromStepIdx(uint8_t stepIdx)
|
||||
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--)
|
||||
if (Frequency >= frequencyBandTable[band].lower)
|
||||
return (FREQUENCY_Band_t)band;
|
||||
return (FREQUENCY_Band_t) band;
|
||||
|
||||
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)
|
||||
return TxpLow;
|
||||
|
||||
if (UpperLimit <= Frequency)
|
||||
return TxpHigh;
|
||||
|
||||
if (Frequency <= Middle)
|
||||
{
|
||||
if (Frequency <= Middle) {
|
||||
TxpMid += ((TxpMid - TxpLow) * (Frequency - LowerLimit)) / (Middle - LowerLimit);
|
||||
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)
|
||||
{
|
||||
if(step == 833) {
|
||||
uint32_t base = freq/2500*2500;
|
||||
int chno = (freq - base) / 700; // convert entered aviation 8.33Khz channel number scheme to actual frequency.
|
||||
uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step) {
|
||||
if (step == 833) {
|
||||
uint32_t base = freq / 2500 * 2500;
|
||||
int chno =
|
||||
(freq - base) / 700; // convert entered aviation 8.33Khz channel number scheme to actual frequency.
|
||||
return base + (chno * 833) + (chno == 3);
|
||||
}
|
||||
|
||||
if(step == 1)
|
||||
if (step == 1)
|
||||
return freq;
|
||||
if(step >= 1000)
|
||||
step = step/2;
|
||||
if (step >= 1000)
|
||||
step = step / 2;
|
||||
return (freq + (step + 1) / 2) / step * step;
|
||||
}
|
||||
|
||||
int32_t TX_freq_check(const uint32_t Frequency)
|
||||
{ // return '0' if TX frequency is allowed
|
||||
int32_t TX_freq_check(const uint32_t Frequency) { // return '0' if TX frequency is allowed
|
||||
// otherwise return '-1'
|
||||
|
||||
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper)
|
||||
@@ -169,29 +167,21 @@ int32_t TX_freq_check(const uint32_t Frequency)
|
||||
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||
return -1; // BX chip does not work in this range
|
||||
|
||||
switch (gSetting_F_LOCK)
|
||||
{
|
||||
switch (gSetting_F_LOCK) {
|
||||
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;
|
||||
if (Frequency >= frequencyBandTable[BAND4_174MHz].lower && Frequency < frequencyBandTable[BAND4_174MHz].upper)
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
if (gSetting_200TX)
|
||||
#endif
|
||||
if (Frequency >= frequencyBandTable[BAND4_174MHz].lower &&
|
||||
Frequency < frequencyBandTable[BAND4_174MHz].upper)
|
||||
return 0;
|
||||
if (Frequency >= frequencyBandTable[BAND5_350MHz].lower && Frequency < frequencyBandTable[BAND5_350MHz].upper)
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
if (gSetting_350TX && gSetting_350EN)
|
||||
#else
|
||||
if (gSetting_350EN)
|
||||
#endif
|
||||
if (Frequency >= frequencyBandTable[BAND5_350MHz].lower &&
|
||||
Frequency < frequencyBandTable[BAND5_350MHz].upper)
|
||||
return 0;
|
||||
if (Frequency >= frequencyBandTable[BAND6_400MHz].lower && Frequency < frequencyBandTable[BAND6_400MHz].upper)
|
||||
if (Frequency >= frequencyBandTable[BAND6_400MHz].lower &&
|
||||
Frequency < frequencyBandTable[BAND6_400MHz].upper)
|
||||
return 0;
|
||||
if (Frequency >= frequencyBandTable[BAND7_470MHz].lower && Frequency <= 60000000)
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
if (gSetting_500TX)
|
||||
#endif
|
||||
return 0;
|
||||
break;
|
||||
|
||||
@@ -275,8 +265,7 @@ int32_t TX_freq_check(const uint32_t Frequency)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t RX_freq_check(const uint32_t Frequency)
|
||||
{ // return '0' if RX frequency is allowed
|
||||
int32_t RX_freq_check(const uint32_t Frequency) { // return '0' if RX frequency is allowed
|
||||
// otherwise return '-1'
|
||||
|
||||
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[BAND_N_ELEM - 1].upper)
|
||||
|
@@ -211,7 +211,7 @@ void FUNCTION_Transmit() {
|
||||
if (gAlarmState != ALARM_STATE_OFF) {
|
||||
#ifdef ENABLE_TX1750
|
||||
if (gAlarmState == ALARM_STATE_TX1750) {
|
||||
BK4819_TransmitTone(false, 1750);
|
||||
BK4819_TransmitTone(gEeprom.DTMF_SIDE_TONE, 1750);
|
||||
gAlarmState = ALARM_STATE_OFF;
|
||||
}
|
||||
#endif
|
||||
|
@@ -17,8 +17,9 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
#include "app/aircopy.h"
|
||||
#include "app/aircopy.h"
|
||||
#endif
|
||||
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "driver/bk4819.h"
|
||||
#include "driver/keyboard.h"
|
||||
@@ -31,63 +32,50 @@
|
||||
#include "ui/menu.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;
|
||||
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))
|
||||
return BOOT_MODE_NORMAL; // PTT not pressed
|
||||
Keys[i] = KEYBOARD_Poll();
|
||||
SYSTEM_DelayMs(20);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
if (Keys[0] == (10 + gEeprom.SET_KEY))
|
||||
{
|
||||
return BOOT_MODE_RESCUE_OPS; // Secret KEY pressed
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (Keys[0] == Keys[1])
|
||||
{
|
||||
if (Keys[0] == Keys[1]) {
|
||||
gKeyReading0 = Keys[0];
|
||||
gKeyReading1 = Keys[0];
|
||||
|
||||
gDebounceCounter = 2;
|
||||
|
||||
if (Keys[0] == KEY_SIDE1)
|
||||
return BOOT_MODE_F_LOCK;
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (Keys[0] == KEY_SIDE2)
|
||||
return BOOT_MODE_AIRCOPY;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
return BOOT_MODE_NORMAL;
|
||||
}
|
||||
|
||||
void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
||||
{
|
||||
if (Mode == BOOT_MODE_F_LOCK)
|
||||
{
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||
gEeprom.CURRENT_STATE = 0; // Don't resume is active...
|
||||
#endif
|
||||
GUI_SelectNextDisplay(DISPLAY_MENU);
|
||||
}
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
else
|
||||
void BOOT_ProcessMode(BOOT_Mode_t Mode) {
|
||||
Mode = Mode;
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
if (Mode == BOOT_MODE_AIRCOPY)
|
||||
{
|
||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||
gEeprom.BATTERY_SAVE = 0;
|
||||
#ifdef ENABLE_VOX
|
||||
#ifdef ENABLE_VOX
|
||||
gEeprom.VOX_SWITCH = false;
|
||||
#endif
|
||||
#endif
|
||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||
gEeprom.AUTO_KEYPAD_LOCK = false;
|
||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||
@@ -114,15 +102,14 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
||||
gEeprom.BACKLIGHT_TIME = 61;
|
||||
gEeprom.KEY_LOCK = 0;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||
gEeprom.CURRENT_STATE = 0; // Don't resume is active...
|
||||
#endif
|
||||
#endif
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
#endif
|
||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -20,10 +20,10 @@
|
||||
#include <stdint.h>
|
||||
#include "driver/keyboard.h"
|
||||
|
||||
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||
enum BOOT_Mode_t
|
||||
{
|
||||
BOOT_MODE_NORMAL = 0,
|
||||
BOOT_MODE_F_LOCK,
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
BOOT_MODE_RESCUE_OPS,
|
||||
#endif
|
||||
@@ -38,4 +38,4 @@ BOOT_Mode_t BOOT_GetMode(void);
|
||||
void BOOT_ProcessMode(BOOT_Mode_t Mode);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
40
main.c
40
main.c
@@ -140,6 +140,7 @@ void Main(void) {
|
||||
AM_fix_init();
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||
BOOT_Mode_t BootMode = BOOT_GetMode();
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
@@ -160,48 +161,21 @@ void Main(void) {
|
||||
*/
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
if (BootMode == BOOT_MODE_F_LOCK && gEeprom.MENU_LOCK == true)
|
||||
{
|
||||
BootMode = BOOT_MODE_NORMAL;
|
||||
}
|
||||
#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
|
||||
gMenuListCount = 0;
|
||||
while (MenuList[gMenuListCount].name[0] != '\0') {
|
||||
if (!gF_LOCK && MenuList[gMenuListCount].menu_id == FIRST_HIDDEN_MENU_ITEM)
|
||||
break;
|
||||
|
||||
gMenuListCount++;
|
||||
}
|
||||
|
||||
// wait for user to release all butts before moving on
|
||||
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
|
||||
KEYBOARD_Poll() != KEY_INVALID ||
|
||||
BootMode != BOOT_MODE_NORMAL) { // keys are pressed
|
||||
KEYBOARD_Poll() != KEY_INVALID
|
||||
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||
|| BootMode != BOOT_MODE_NORMAL
|
||||
#endif
|
||||
) { // keys are pressed
|
||||
UI_DisplayReleaseKeys();
|
||||
BACKLIGHT_TurnOn();
|
||||
|
||||
@@ -249,7 +223,9 @@ void Main(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_FEAT_F4HWN_RESCUE_OPS) || defined(ENABLE_AIRCOPY)
|
||||
BOOT_ProcessMode(BootMode);
|
||||
#endif
|
||||
|
||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
|
||||
|
||||
|
4
misc.c
4
misc.c
@@ -95,7 +95,6 @@ const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
|
||||
bool gSetting_200TX;
|
||||
bool gSetting_500TX;
|
||||
#endif
|
||||
bool gSetting_350EN = true;
|
||||
uint8_t gSetting_F_LOCK;
|
||||
bool gSetting_ScrambleEnable;
|
||||
|
||||
@@ -111,15 +110,12 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
uint8_t gSetting_set_pwr = 1;
|
||||
bool gSetting_set_ptt = 0;
|
||||
uint8_t gSetting_set_tot = 0;
|
||||
uint8_t gSetting_set_ctr = 10;
|
||||
bool gSetting_set_inv = false;
|
||||
uint8_t gSetting_set_eot = 0;
|
||||
bool gSetting_set_lck = false;
|
||||
bool gSetting_set_met = 0;
|
||||
bool gSetting_set_gui = 0;
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
bool gSetting_set_nfm = 0;
|
||||
#endif
|
||||
|
4
misc.h
4
misc.h
@@ -148,7 +148,6 @@ extern bool gSetting_200TX;
|
||||
extern bool gSetting_500TX;
|
||||
#endif
|
||||
|
||||
extern bool gSetting_350EN;
|
||||
extern uint8_t gSetting_F_LOCK;
|
||||
extern bool gSetting_ScrambleEnable;
|
||||
|
||||
@@ -164,15 +163,12 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
extern uint8_t gSetting_set_pwr;
|
||||
extern bool gSetting_set_ptt;
|
||||
extern uint8_t gSetting_set_tot;
|
||||
extern uint8_t gSetting_set_ctr;
|
||||
extern bool gSetting_set_inv;
|
||||
extern uint8_t gSetting_set_eot;
|
||||
extern bool gSetting_set_lck;
|
||||
extern bool gSetting_set_met;
|
||||
extern bool gSetting_set_gui;
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
extern bool gSetting_set_nfm;
|
||||
#endif
|
||||
|
289
radio.c
289
radio.c
@@ -19,9 +19,11 @@
|
||||
|
||||
#include "am_fix.h"
|
||||
#include "app/dtmf.h"
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
#include "app/fm.h"
|
||||
#include "app/fm.h"
|
||||
#endif
|
||||
|
||||
#include "audio.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "dcs.h"
|
||||
@@ -54,8 +56,7 @@ const char gModulationStr[MODULATION_UKNOWN][4] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList)
|
||||
{
|
||||
bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanList) {
|
||||
// return true if the channel appears valid
|
||||
if (!IS_MR_CHANNEL(channel))
|
||||
return false;
|
||||
@@ -112,8 +113,7 @@ bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanL
|
||||
return PriorityCh1 != channel && PriorityCh2 != channel;
|
||||
}
|
||||
|
||||
uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScanList, uint8_t VFO)
|
||||
{
|
||||
uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScanList, uint8_t VFO) {
|
||||
for (unsigned int i = 0; IS_MR_CHANNEL(i); i++, Channel += Direction) {
|
||||
if (Channel == 0xFF) {
|
||||
Channel = MR_CHANNEL_LAST;
|
||||
@@ -129,8 +129,7 @@ uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScan
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency)
|
||||
{
|
||||
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency) {
|
||||
memset(pInfo, 0, sizeof(*pInfo));
|
||||
|
||||
pInfo->Band = FREQUENCY_GetBand(Frequency);
|
||||
@@ -141,7 +140,6 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t
|
||||
pInfo->StepFrequency = gStepFrequencyTable[pInfo->STEP_SETTING];
|
||||
pInfo->CHANNEL_SAVE = ChannelSave;
|
||||
pInfo->FrequencyReverse = false;
|
||||
pInfo->TX_LOCK = true;
|
||||
pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
|
||||
pInfo->freq_config_RX.Frequency = Frequency;
|
||||
pInfo->freq_config_TX.Frequency = Frequency;
|
||||
@@ -157,18 +155,9 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t
|
||||
RADIO_ConfigureSquelchAndOutputPower(pInfo);
|
||||
}
|
||||
|
||||
void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure)
|
||||
{
|
||||
void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure) {
|
||||
VFO_Info_t *pVfo = &gEeprom.VfoInfo[VFO];
|
||||
|
||||
if (!gSetting_350EN) {
|
||||
if (gEeprom.FreqChannel[VFO] == FREQ_CHANNEL_FIRST + BAND5_350MHz)
|
||||
gEeprom.FreqChannel[VFO] = FREQ_CHANNEL_FIRST + BAND6_400MHz;
|
||||
|
||||
if (gEeprom.ScreenChannel[VFO] == FREQ_CHANNEL_FIRST + BAND5_350MHz)
|
||||
gEeprom.ScreenChannel[VFO] = FREQ_CHANNEL_FIRST + BAND6_400MHz;
|
||||
}
|
||||
|
||||
uint8_t channel = gEeprom.ScreenChannel[VFO];
|
||||
|
||||
if (IS_VALID_CHANNEL(channel)) {
|
||||
@@ -192,14 +181,12 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
if (channel == 0xFF) {
|
||||
channel = gEeprom.FreqChannel[VFO];
|
||||
gEeprom.ScreenChannel[VFO] = gEeprom.FreqChannel[VFO];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gEeprom.ScreenChannel[VFO] = channel;
|
||||
gEeprom.MrChannel[VFO] = channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
channel = FREQ_CHANNEL_LAST - 1;
|
||||
|
||||
ChannelAttributes_t att = gMR_ChannelAttributes[channel];
|
||||
@@ -227,8 +214,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
bParticipation1 = att.scanlist1;
|
||||
bParticipation2 = att.scanlist2;
|
||||
bParticipation3 = att.scanlist3;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
band = channel - FREQ_CHANNEL_FIRST;
|
||||
bParticipation1 = true;
|
||||
bParticipation2 = true;
|
||||
@@ -247,8 +233,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
else
|
||||
base = 0x0C80 + ((channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16);
|
||||
|
||||
if (configure == VFO_CONFIGURE_RELOAD || IS_FREQ_CHANNEL(channel))
|
||||
{
|
||||
if (configure == VFO_CONFIGURE_RELOAD || IS_FREQ_CHANNEL(channel)) {
|
||||
uint8_t tmp;
|
||||
uint8_t data[8];
|
||||
|
||||
@@ -272,7 +257,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
pVfo->StepFrequency = gStepFrequencyTable[tmp];
|
||||
|
||||
tmp = data[7];
|
||||
if (tmp > (ARRAY_SIZE(gSubMenu_SCRAMBLER) - 1))
|
||||
if (tmp > 10)
|
||||
tmp = 0;
|
||||
pVfo->SCRAMBLING_TYPE = tmp;
|
||||
//pVfo->SCRAMBLING_TYPE = 0;
|
||||
@@ -281,8 +266,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
pVfo->freq_config_TX.CodeType = (data[2] >> 4) & 0x0F;
|
||||
|
||||
tmp = data[0];
|
||||
switch (pVfo->freq_config_RX.CodeType)
|
||||
{
|
||||
switch (pVfo->freq_config_RX.CodeType) {
|
||||
default:
|
||||
case CODE_TYPE_OFF:
|
||||
pVfo->freq_config_RX.CodeType = CODE_TYPE_OFF;
|
||||
@@ -303,8 +287,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
pVfo->freq_config_RX.Code = tmp;
|
||||
|
||||
tmp = data[1];
|
||||
switch (pVfo->freq_config_TX.CodeType)
|
||||
{
|
||||
switch (pVfo->freq_config_TX.CodeType) {
|
||||
default:
|
||||
case CODE_TYPE_OFF:
|
||||
pVfo->freq_config_TX.CodeType = CODE_TYPE_OFF;
|
||||
@@ -324,33 +307,25 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
}
|
||||
pVfo->freq_config_TX.Code = tmp;
|
||||
|
||||
if (data[4] == 0xFF)
|
||||
{
|
||||
if (data[4] == 0xFF) {
|
||||
pVfo->FrequencyReverse = false;
|
||||
pVfo->CHANNEL_BANDWIDTH = BK4819_FILTER_BW_WIDE;
|
||||
pVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1;
|
||||
pVfo->BUSY_CHANNEL_LOCK = false;
|
||||
pVfo->TX_LOCK = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
const uint8_t d4 = data[4];
|
||||
pVfo->FrequencyReverse = !!((d4 >> 0) & 1u);
|
||||
pVfo->CHANNEL_BANDWIDTH = !!((d4 >> 1) & 1u);
|
||||
pVfo->OUTPUT_POWER = ((d4 >> 2) & 7u);
|
||||
pVfo->BUSY_CHANNEL_LOCK = !!((d4 >> 5) & 1u);
|
||||
pVfo->TX_LOCK = !!((d4 >> 6) & 1u);
|
||||
}
|
||||
|
||||
if (data[5] == 0xFF)
|
||||
{
|
||||
if (data[5] == 0xFF) {
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
pVfo->DTMF_DECODING_ENABLE = false;
|
||||
#endif
|
||||
pVfo->DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
pVfo->DTMF_DECODING_ENABLE = ((data[5] >> 0) & 1u) ? true : false;
|
||||
#endif
|
||||
@@ -365,7 +340,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
uint32_t Offset;
|
||||
} __attribute__((packed)) info;
|
||||
EEPROM_ReadBuffer(base, &info, sizeof(info));
|
||||
if(info.Frequency==0xFFFFFFFF)
|
||||
if (info.Frequency == 0xFFFFFFFF)
|
||||
pVfo->freq_config_RX.Frequency = frequencyBandTable[band].lower;
|
||||
else
|
||||
pVfo->freq_config_RX.Frequency = info.Frequency;
|
||||
@@ -399,32 +374,21 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
|
||||
RADIO_ApplyOffset(pVfo);
|
||||
|
||||
if (IS_MR_CHANNEL(channel))
|
||||
{ // 16 bytes allocated to the channel name but only 10 used, the rest are 0's
|
||||
if (IS_MR_CHANNEL(channel)) { // 16 bytes allocated to the channel name but only 10 used, the rest are 0's
|
||||
SETTINGS_FetchChannelName(pVfo->Name, channel);
|
||||
}
|
||||
|
||||
if (!pVfo->FrequencyReverse)
|
||||
{
|
||||
if (!pVfo->FrequencyReverse) {
|
||||
pVfo->pRX = &pVfo->freq_config_RX;
|
||||
pVfo->pTX = &pVfo->freq_config_TX;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
pVfo->pRX = &pVfo->freq_config_TX;
|
||||
pVfo->pTX = &pVfo->freq_config_RX;
|
||||
}
|
||||
|
||||
if (!gSetting_350EN)
|
||||
{
|
||||
FREQ_Config_t *pConfig = pVfo->pRX;
|
||||
if (pConfig->Frequency >= 35000000 && pConfig->Frequency < 40000000)
|
||||
pConfig->Frequency = 43300000;
|
||||
}
|
||||
|
||||
pVfo->Compander = att.compander;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
if(gRemoveOffset)
|
||||
{
|
||||
pVfo->pTX = &pVfo->freq_config_RX;
|
||||
@@ -434,13 +398,12 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
||||
{
|
||||
pVfo->OUTPUT_POWER = OUTPUT_POWER_HIGH;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
RADIO_ConfigureSquelchAndOutputPower(pVfo);
|
||||
}
|
||||
|
||||
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
{
|
||||
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) {
|
||||
|
||||
|
||||
// *******************************
|
||||
@@ -449,8 +412,7 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
FREQUENCY_Band_t Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
|
||||
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
|
||||
|
||||
if (gEeprom.SQUELCH_LEVEL == 0)
|
||||
{ // squelch == 0 (off)
|
||||
if (gEeprom.SQUELCH_LEVEL == 0) { // squelch == 0 (off)
|
||||
pInfo->SquelchOpenRSSIThresh = 0; // 0 ~ 255
|
||||
pInfo->SquelchOpenNoiseThresh = 127; // 127 ~ 0
|
||||
pInfo->SquelchCloseGlitchThresh = 255; // 255 ~ 0
|
||||
@@ -458,9 +420,7 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
pInfo->SquelchCloseRSSIThresh = 0; // 0 ~ 255
|
||||
pInfo->SquelchCloseNoiseThresh = 127; // 127 ~ 0
|
||||
pInfo->SquelchOpenGlitchThresh = 255; // 255 ~ 0
|
||||
}
|
||||
else
|
||||
{ // squelch >= 1
|
||||
} else { // squelch >= 1
|
||||
Base += gEeprom.SQUELCH_LEVEL; // my eeprom squelch-1
|
||||
// VHF UHF
|
||||
EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10
|
||||
@@ -524,30 +484,13 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
uint8_t Op = 0; // Low eeprom calibration data
|
||||
uint8_t currentPower = pInfo->OUTPUT_POWER;
|
||||
|
||||
if(currentPower == OUTPUT_POWER_USER)
|
||||
{
|
||||
if(gSetting_set_pwr == 5)
|
||||
{
|
||||
|
||||
if (currentPower == OUTPUT_POWER_MID) {
|
||||
Op = 1; // Mid eeprom calibration data
|
||||
}
|
||||
else if(gSetting_set_pwr == 6)
|
||||
{
|
||||
Op = 2; // High eeprom calibration data
|
||||
}
|
||||
currentPower = gSetting_set_pwr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentPower == OUTPUT_POWER_MID)
|
||||
{
|
||||
Op = 1; // Mid eeprom calibration data
|
||||
}
|
||||
else if(currentPower == OUTPUT_POWER_HIGH)
|
||||
{
|
||||
} else if (currentPower == OUTPUT_POWER_HIGH) {
|
||||
Op = 2; // High eeprom calibration data
|
||||
}
|
||||
currentPower--;
|
||||
}
|
||||
|
||||
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (Op * 3), Txp, 3);
|
||||
|
||||
@@ -599,21 +542,18 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
}
|
||||
*/
|
||||
|
||||
static const uint8_t dividers[6] = { 25, 19, 13, 10, 7, 4};
|
||||
static const uint8_t dividers[6] = {25, 19, 13, 10, 7, 4};
|
||||
|
||||
for (uint8_t p = 0; p < 3; p++)
|
||||
{
|
||||
if (currentPower < 6)
|
||||
{
|
||||
for (uint8_t p = 0; p < 3; p++) {
|
||||
if (currentPower < 6) {
|
||||
Txp[p] = (Txp[p] * (currentPower == 5 ? 3 : 4)) / dividers[currentPower];
|
||||
}
|
||||
else // case 6
|
||||
} else // case 6
|
||||
{
|
||||
Txp[p] += 30;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef ENABLE_REDUCE_LOW_MID_TX_POWER
|
||||
#ifdef ENABLE_REDUCE_LOW_MID_TX_POWER
|
||||
// make low and mid even lower
|
||||
if (pInfo->OUTPUT_POWER == OUTPUT_POWER_LOW) {
|
||||
Txp[0] /= 5;
|
||||
@@ -625,7 +565,7 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
Txp[1] /= 3;
|
||||
Txp[2] /= 3;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
pInfo->TXP_CalculatedSetting = FREQUENCY_CalculateOutputPower(
|
||||
@@ -640,12 +580,10 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||
// *******************************
|
||||
}
|
||||
|
||||
void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
||||
{
|
||||
void RADIO_ApplyOffset(VFO_Info_t *pInfo) {
|
||||
uint32_t Frequency = pInfo->freq_config_RX.Frequency;
|
||||
|
||||
switch (pInfo->TX_OFFSET_FREQUENCY_DIRECTION)
|
||||
{
|
||||
switch (pInfo->TX_OFFSET_FREQUENCY_DIRECTION) {
|
||||
case TX_OFFSET_FREQUENCY_DIRECTION_OFF:
|
||||
break;
|
||||
case TX_OFFSET_FREQUENCY_DIRECTION_ADD:
|
||||
@@ -659,19 +597,19 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
||||
pInfo->freq_config_TX.Frequency = Frequency;
|
||||
}
|
||||
|
||||
static void RADIO_SelectCurrentVfo(void)
|
||||
{
|
||||
static void RADIO_SelectCurrentVfo(void) {
|
||||
// if crossband is active and DW not the gCurrentVfo is gTxVfo (gTxVfo/TX_VFO is only ever changed by the user)
|
||||
// otherwise it is set to gRxVfo which is set to gTxVfo in RADIO_SelectVfos
|
||||
// so in the end gCurrentVfo is equal to gTxVfo unless dual watch changes it on incomming transmition (again, this can only happen when XB off)
|
||||
// note: it is called only in certain situations so could be not up-to-date
|
||||
gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF || gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) ? gRxVfo : gTxVfo;
|
||||
gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF || gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) ? gRxVfo
|
||||
: gTxVfo;
|
||||
}
|
||||
|
||||
void RADIO_SelectVfos(void)
|
||||
{
|
||||
void RADIO_SelectVfos(void) {
|
||||
// if crossband without DW is used then RX_VFO is the opposite to the TX_VFO
|
||||
gEeprom.RX_VFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF || gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) ? gEeprom.TX_VFO : !gEeprom.TX_VFO;
|
||||
gEeprom.RX_VFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF || gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
? gEeprom.TX_VFO : !gEeprom.TX_VFO;
|
||||
|
||||
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO];
|
||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
|
||||
@@ -679,16 +617,14 @@ void RADIO_SelectVfos(void)
|
||||
RADIO_SelectCurrentVfo();
|
||||
}
|
||||
|
||||
void RADIO_SetupRegisters(bool switchToForeground)
|
||||
{
|
||||
void RADIO_SetupRegisters(bool switchToForeground) {
|
||||
BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
if(Bandwidth == BK4819_FILTER_BW_NARROW && gSetting_set_nfm == 1)
|
||||
{
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
if (Bandwidth == BK4819_FILTER_BW_NARROW && gSetting_set_nfm == 1) {
|
||||
Bandwidth = BK4819_FILTER_BW_NARROWER;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
AUDIO_AudioPathOff();
|
||||
|
||||
@@ -696,20 +632,19 @@ void RADIO_SetupRegisters(bool switchToForeground)
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
||||
|
||||
switch (Bandwidth)
|
||||
{
|
||||
switch (Bandwidth) {
|
||||
default:
|
||||
Bandwidth = BK4819_FILTER_BW_WIDE;
|
||||
[[fallthrough]];
|
||||
case BK4819_FILTER_BW_WIDE:
|
||||
case BK4819_FILTER_BW_NARROW:
|
||||
case BK4819_FILTER_BW_NARROWER:
|
||||
#ifdef ENABLE_AM_FIX
|
||||
#ifdef ENABLE_AM_FIX
|
||||
// BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->Modulation == MODULATION_AM && gSetting_AM_fix);
|
||||
BK4819_SetFilterBandwidth(Bandwidth, true);
|
||||
#else
|
||||
#else
|
||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -719,8 +654,7 @@ void RADIO_SetupRegisters(bool switchToForeground)
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
const uint16_t Status = BK4819_ReadRegister(BK4819_REG_0C);
|
||||
if ((Status & 1u) == 0) // INTERRUPT REQUEST
|
||||
break;
|
||||
@@ -734,14 +668,14 @@ void RADIO_SetupRegisters(bool switchToForeground)
|
||||
BK4819_WriteRegister(BK4819_REG_7D, 0xE940 | (gEeprom.MIC_SENSITIVITY_TUNING & 0x1f));
|
||||
|
||||
uint32_t Frequency;
|
||||
#ifdef ENABLE_NOAA
|
||||
#ifdef ENABLE_NOAA
|
||||
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) || !gIsNoaaMode)
|
||||
Frequency = gRxVfo->pRX->Frequency;
|
||||
else
|
||||
Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||
#else
|
||||
#else
|
||||
Frequency = gRxVfo->pRX->Frequency;
|
||||
#endif
|
||||
#endif
|
||||
BK4819_SetFrequency(Frequency);
|
||||
|
||||
BK4819_SetupSquelch(
|
||||
@@ -758,24 +692,22 @@ void RADIO_SetupRegisters(bool switchToForeground)
|
||||
//BK4819_WriteRegister(BK4819_REG_48, 0xB3A8); // 1011 00 111010 1000
|
||||
BK4819_WriteRegister(BK4819_REG_48,
|
||||
(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.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
|
||||
|
||||
|
||||
uint16_t InterruptMask = BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST;
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
#ifdef ENABLE_NOAA
|
||||
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
if (gRxVfo->Modulation == MODULATION_FM)
|
||||
{ // FM
|
||||
if (gRxVfo->Modulation == MODULATION_FM) { // FM
|
||||
uint8_t CodeType = gRxVfo->pRX->CodeType;
|
||||
uint8_t Code = gRxVfo->pRX->Code;
|
||||
|
||||
switch (CodeType)
|
||||
{
|
||||
switch (CodeType) {
|
||||
default:
|
||||
case CODE_TYPE_OFF:
|
||||
BK4819_SetCTCSSFrequency(SQL_TONE);
|
||||
@@ -820,7 +752,7 @@ void RADIO_SetupRegisters(bool switchToForeground)
|
||||
BK4819_DisableScramble();
|
||||
}
|
||||
}
|
||||
#ifdef ENABLE_NOAA
|
||||
#ifdef ENABLE_NOAA
|
||||
else
|
||||
{
|
||||
BK4819_SetCTCSSFrequency(2625);
|
||||
@@ -830,7 +762,7 @@ void RADIO_SetupRegisters(bool switchToForeground)
|
||||
| BK4819_REG_3F_SQUELCH_FOUND
|
||||
| BK4819_REG_3F_SQUELCH_LOST;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
if (gEeprom.VOX_SWITCH && gCurrentVfo->Modulation == MODULATION_FM
|
||||
@@ -840,11 +772,10 @@ void RADIO_SetupRegisters(bool switchToForeground)
|
||||
#ifdef ENABLE_FMRADIO
|
||||
&& !gFmRadioMode
|
||||
#endif
|
||||
){
|
||||
) {
|
||||
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
||||
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
BK4819_DisableVox();
|
||||
@@ -868,8 +799,8 @@ void RADIO_SetupRegisters(bool switchToForeground)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
void RADIO_ConfigureNOAA(void)
|
||||
{
|
||||
void RADIO_ConfigureNOAA(void)
|
||||
{
|
||||
uint8_t ChanAB;
|
||||
|
||||
gUpdateStatus = true;
|
||||
@@ -909,19 +840,17 @@ void RADIO_SetupRegisters(bool switchToForeground)
|
||||
}
|
||||
else
|
||||
gIsNoaaMode = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void RADIO_SetTxParameters(void)
|
||||
{
|
||||
void RADIO_SetTxParameters(void) {
|
||||
BK4819_FilterBandwidth_t Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
if(Bandwidth == BK4819_FILTER_BW_NARROW && gSetting_set_nfm == 1)
|
||||
{
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
if (Bandwidth == BK4819_FILTER_BW_NARROW && gSetting_set_nfm == 1) {
|
||||
Bandwidth = BK4819_FILTER_BW_NARROWER;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
AUDIO_AudioPathOff();
|
||||
|
||||
@@ -929,27 +858,27 @@ void RADIO_SetTxParameters(void)
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_RX_ENABLE, false);
|
||||
|
||||
switch (Bandwidth)
|
||||
{
|
||||
switch (Bandwidth) {
|
||||
default:
|
||||
Bandwidth = BK4819_FILTER_BW_WIDE;
|
||||
[[fallthrough]];
|
||||
case BK4819_FILTER_BW_WIDE:
|
||||
case BK4819_FILTER_BW_NARROW:
|
||||
case BK4819_FILTER_BW_NARROWER:
|
||||
#ifdef ENABLE_AM_FIX
|
||||
#ifdef ENABLE_AM_FIX
|
||||
// BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->Modulation == MODULATION_AM && gSetting_AM_fix);
|
||||
BK4819_SetFilterBandwidth(Bandwidth, true);
|
||||
#else
|
||||
#else
|
||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
|
||||
|
||||
// TX compressor
|
||||
BK4819_SetCompander((gRxVfo->Modulation == MODULATION_FM && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0);
|
||||
BK4819_SetCompander((gRxVfo->Modulation == MODULATION_FM && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3))
|
||||
? gRxVfo->Compander : 0);
|
||||
|
||||
BK4819_PrepareTransmit();
|
||||
|
||||
@@ -965,8 +894,7 @@ void RADIO_SetTxParameters(void)
|
||||
|
||||
SYSTEM_DelayMs(10);
|
||||
|
||||
switch (gCurrentVfo->pTX->CodeType)
|
||||
{
|
||||
switch (gCurrentVfo->pTX->CodeType) {
|
||||
default:
|
||||
case CODE_TYPE_OFF:
|
||||
BK4819_ExitSubAu();
|
||||
@@ -983,10 +911,9 @@ void RADIO_SetTxParameters(void)
|
||||
}
|
||||
}
|
||||
|
||||
void RADIO_SetModulation(ModulationMode_t modulation)
|
||||
{
|
||||
void RADIO_SetModulation(ModulationMode_t modulation) {
|
||||
BK4819_AF_Type_t mod;
|
||||
switch(modulation) {
|
||||
switch (modulation) {
|
||||
default:
|
||||
case MODULATION_FM:
|
||||
mod = BK4819_AF_FM;
|
||||
@@ -1017,26 +944,23 @@ void RADIO_SetModulation(ModulationMode_t modulation)
|
||||
RADIO_SetupAGC(modulation == MODULATION_AM, false);
|
||||
}
|
||||
|
||||
void RADIO_SetupAGC(bool listeningAM, bool disable)
|
||||
{
|
||||
void RADIO_SetupAGC(bool listeningAM, bool disable) {
|
||||
static uint8_t lastSettings;
|
||||
uint8_t newSettings = (listeningAM << 1) | (disable << 1);
|
||||
if(lastSettings == newSettings)
|
||||
if (lastSettings == newSettings)
|
||||
return;
|
||||
lastSettings = newSettings;
|
||||
|
||||
|
||||
if(!listeningAM) { // if not actively listening AM we don't need any AM specific regulation
|
||||
if (!listeningAM) { // if not actively listening AM we don't need any AM specific regulation
|
||||
BK4819_SetAGC(!disable);
|
||||
BK4819_InitAGC(false);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
#ifdef ENABLE_AM_FIX
|
||||
if(gSetting_AM_fix) { // if AM fix active lock AGC so AM-fix can do it's job
|
||||
if (gSetting_AM_fix) { // if AM fix active lock AGC so AM-fix can do it's job
|
||||
BK4819_SetAGC(0);
|
||||
AM_fix_enable(!disable);
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
BK4819_SetAGC(!disable);
|
||||
@@ -1045,8 +969,7 @@ void RADIO_SetupAGC(bool listeningAM, bool disable)
|
||||
}
|
||||
}
|
||||
|
||||
void RADIO_SetVfoState(VfoState_t State)
|
||||
{
|
||||
void RADIO_SetVfoState(VfoState_t State) {
|
||||
if (State == VFO_STATE_NORMAL) {
|
||||
VfoState[0] = VFO_STATE_NORMAL;
|
||||
VfoState[1] = VFO_STATE_NORMAL;
|
||||
@@ -1064,18 +987,15 @@ void RADIO_SetVfoState(VfoState_t State)
|
||||
}
|
||||
|
||||
|
||||
void RADIO_PrepareTX(void)
|
||||
{
|
||||
void RADIO_PrepareTX(void) {
|
||||
VfoState_t State = VFO_STATE_NORMAL; // default to OK to TX
|
||||
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{ // dual-RX is enabled
|
||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) { // dual-RX is enabled
|
||||
|
||||
gDualWatchCountdown_10ms = dual_watch_count_after_tx_10ms;
|
||||
gScheduleDualWatch = false;
|
||||
|
||||
if (!gRxVfoIsActive)
|
||||
{ // use the current RX vfo
|
||||
if (!gRxVfoIsActive) { // use the current RX vfo
|
||||
gEeprom.RX_VFO = gEeprom.TX_VFO;
|
||||
gRxVfo = gTxVfo;
|
||||
gRxVfoIsActive = true;
|
||||
@@ -1089,17 +1009,17 @@ void RADIO_PrepareTX(void)
|
||||
RADIO_SelectCurrentVfo();
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
if(TX_freq_check(gCurrentVfo->pTX->Frequency) != 0 && gCurrentVfo->TX_LOCK == true
|
||||
if (TX_freq_check(gCurrentVfo->pTX->Frequency) != 0
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
&& gAlarmState != ALARM_STATE_SITE_ALARM
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
if(TX_freq_check(gCurrentVfo->pTX->Frequency) != 0
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
&& gAlarmState != ALARM_STATE_SITE_ALARM
|
||||
#endif
|
||||
#endif
|
||||
){
|
||||
#endif
|
||||
) {
|
||||
// TX frequency not allowed
|
||||
State = VFO_STATE_TX_DISABLE;
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
@@ -1158,9 +1078,9 @@ void RADIO_PrepareTX(void)
|
||||
|
||||
gTxTimerCountdown_500ms = 0; // no timeout
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
if (gAlarmState == ALARM_STATE_OFF)
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
|
||||
gTxTimerCountdown_500ms = ((gEeprom.TX_TIMEOUT_TIMER + 1) * 5) * 2;
|
||||
@@ -1193,8 +1113,7 @@ void RADIO_PrepareTX(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void RADIO_SendCssTail(void)
|
||||
{
|
||||
void RADIO_SendCssTail(void) {
|
||||
switch (gCurrentVfo->pTX->CodeType) {
|
||||
case CODE_TYPE_DIGITAL:
|
||||
case CODE_TYPE_REVERSE_DIGITAL:
|
||||
@@ -1208,24 +1127,22 @@ void RADIO_SendCssTail(void)
|
||||
SYSTEM_DelayMs(200);
|
||||
}
|
||||
|
||||
void RADIO_SendEndOfTransmission(void)
|
||||
{
|
||||
void RADIO_SendEndOfTransmission(void) {
|
||||
BK4819_PlayRoger();
|
||||
DTMF_SendEndOfTransmission();
|
||||
|
||||
// send the CTCSS/DCS tail tone - allows the receivers to mute the usual FM squelch tail/crash
|
||||
if(gEeprom.TAIL_TONE_ELIMINATION)
|
||||
if (gEeprom.TAIL_TONE_ELIMINATION)
|
||||
RADIO_SendCssTail();
|
||||
RADIO_SetupRegisters(false);
|
||||
}
|
||||
|
||||
void RADIO_PrepareCssTX(void)
|
||||
{
|
||||
void RADIO_PrepareCssTX(void) {
|
||||
RADIO_PrepareTX();
|
||||
|
||||
SYSTEM_DelayMs(200);
|
||||
|
||||
if(gEeprom.TAIL_TONE_ELIMINATION)
|
||||
if (gEeprom.TAIL_TONE_ELIMINATION)
|
||||
RADIO_SendCssTail();
|
||||
RADIO_SetupRegisters(true);
|
||||
}
|
||||
|
1
radio.h
1
radio.h
@@ -107,7 +107,6 @@ typedef struct VFO_Info_t
|
||||
uint8_t SquelchOpenGlitchThresh;
|
||||
|
||||
STEP_Setting_t STEP_SETTING;
|
||||
uint8_t TX_LOCK;
|
||||
uint8_t OUTPUT_POWER;
|
||||
uint8_t TXP_CalculatedSetting;
|
||||
bool FrequencyReverse;
|
||||
|
41
settings.c
41
settings.c
@@ -274,21 +274,13 @@ void SETTINGS_InitEEPROM(void) {
|
||||
gEeprom.FSKSRCAddress |= Data[1] << 8;
|
||||
gEeprom.FSKSRCAddress |= Data[2] << 16;
|
||||
gEeprom.FSKSRCAddress |= Data[3] << 24;
|
||||
gEeprom.BK1080_AGC_ENABLED = Data[4] & 0x01;
|
||||
gEeprom.BK1080_BLEND_CONFIG = (Data[4] >> 1) & 0x03;
|
||||
gEeprom.BK1080_DEEMPHASIS_CONFIG = (Data[4] >> 3) & 0x03;
|
||||
|
||||
// 0F40..0F47
|
||||
EEPROM_ReadBuffer(0x0F40, Data, 8);
|
||||
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_TX_EN = (Data[7] & (1u << 0)) ? true : false;
|
||||
@@ -337,7 +329,6 @@ void SETTINGS_InitEEPROM(void) {
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
// 1FF0..0x1FF7
|
||||
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_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_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_tmr = ((Data[4] & 1) < 2) ? (Data[4] & 1): 0;
|
||||
@@ -363,8 +352,6 @@ void SETTINGS_InitEEPROM(void) {
|
||||
gSetting_set_inv = 0;
|
||||
#endif
|
||||
gSetting_set_lck = (tmp >> 1) & 0x01;
|
||||
gSetting_set_met = (tmp >> 2) & 0x01;
|
||||
gSetting_set_gui = (tmp >> 3) & 0x01;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_CTR
|
||||
int ctr_value = Data[5] & 0x0F;
|
||||
@@ -727,6 +714,10 @@ void SETTINGS_SaveSettings(void) {
|
||||
State[1] = (gEeprom.FSKSRCAddress >> 8) & 0xFF;
|
||||
State[2] = (gEeprom.FSKSRCAddress >> 16) & 0xFF;
|
||||
State[3] = (gEeprom.FSKSRCAddress >> 24) & 0xFF;
|
||||
State[4] = ((gEeprom.BK1080_AGC_ENABLED & 0x01) |
|
||||
((gEeprom.BK1080_BLEND_CONFIG & 0x03) << 1) |
|
||||
((gEeprom.BK1080_DEEMPHASIS_CONFIG & 0x03) << 3));
|
||||
|
||||
EEPROM_WriteBuffer(0x0F20, State);
|
||||
|
||||
memset(State, 0xFF, sizeof(State));
|
||||
@@ -738,8 +729,6 @@ void SETTINGS_SaveSettings(void) {
|
||||
State[3] = gSetting_200TX;
|
||||
State[4] = gSetting_500TX;
|
||||
#endif
|
||||
State[5] = gSetting_350EN;
|
||||
|
||||
State[6] = gSetting_ScrambleEnable;
|
||||
|
||||
//if (!gSetting_TX_EN) State[7] &= ~(1u << 0);
|
||||
@@ -776,10 +765,6 @@ void SETTINGS_SaveSettings(void) {
|
||||
tmp = tmp | (1 << 0);
|
||||
if (gSetting_set_lck == 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
|
||||
@@ -789,14 +774,11 @@ void SETTINGS_SaveSettings(void) {
|
||||
#endif
|
||||
|
||||
tmp = (gSetting_set_inv << 0) |
|
||||
(gSetting_set_lck << 1) |
|
||||
(gSetting_set_met << 2) |
|
||||
(gSetting_set_gui << 3);
|
||||
(gSetting_set_lck << 1);
|
||||
|
||||
State[5] = ((tmp << 4) | (gSetting_set_ctr & 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;
|
||||
|
||||
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[3] = (pVFO->Modulation << 4) | pVFO->TX_OFFSET_FREQUENCY_DIRECTION;
|
||||
State._8[4] = 0
|
||||
| (pVFO->TX_LOCK << 6)
|
||||
| (pVFO->BUSY_CHANNEL_LOCK << 5)
|
||||
| (pVFO->OUTPUT_POWER << 2)
|
||||
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
||||
@@ -980,8 +961,8 @@ void SETTINGS_WriteBuildOptions(void) {
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX
|
||||
| (1 << 4)
|
||||
#endif
|
||||
#ifdef ENABLE_SPECTRUM
|
||||
#endif
|
||||
#ifdef ENABLE_SPECTRUM
|
||||
| (1 << 5)
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
|
16
settings.h
16
settings.h
@@ -173,6 +173,19 @@ enum 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 {
|
||||
uint8_t ScreenChannel[2]; // current channels set in the radio (memory or frequency channels)
|
||||
uint8_t FreqChannel[2]; // last frequency channels used
|
||||
@@ -198,6 +211,9 @@ typedef struct {
|
||||
bool FM_IsMrMode;
|
||||
uint16_t FM_FrequencyPlaying;
|
||||
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;
|
||||
#endif
|
||||
|
||||
|
@@ -52,7 +52,7 @@ void UI_DisplayAircopy(void)
|
||||
gAircopyState = AIRCOPY_READY;
|
||||
}
|
||||
|
||||
UI_PrintString(pPrintStr, 2, 127, 0, 8);
|
||||
UI_PrintString(pPrintStr, 2, 127, 0 /*, 8 */);
|
||||
|
||||
if (gInputBoxIndex == 0) {
|
||||
uint32_t frequency = gRxVfo->freq_config_RX.Frequency;
|
||||
@@ -83,7 +83,7 @@ void UI_DisplayAircopy(void)
|
||||
// Draw gauge
|
||||
if(gAircopyStep != 0)
|
||||
{
|
||||
UI_PrintString(String, 2, 127, 5, 8);
|
||||
UI_PrintString(String, 2, 127, 5 /*, 8 */);
|
||||
|
||||
gFrameBuffer[4][1] = 0x3c;
|
||||
gFrameBuffer[4][2] = 0x42;
|
||||
|
60
ui/fmradio.c
60
ui/fmradio.c
@@ -29,13 +29,61 @@
|
||||
#include "ui/inputbox.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)
|
||||
{
|
||||
char String[16] = {0};
|
||||
char *pPrintStr = String;
|
||||
UI_DisplayClear();
|
||||
|
||||
UI_PrintString("FM", 2, 0, 0, 8);
|
||||
UI_UpdateFMThings(true);
|
||||
|
||||
UI_PrintString("FM", 2, 0, 0 /*, 8 */);
|
||||
|
||||
|
||||
sprintf(String, "%s D%s B%s",
|
||||
gEeprom.BK1080_AGC_ENABLED ? " AGC" : "NAGC",
|
||||
gDeemphasisStrings[gEeprom.BK1080_DEEMPHASIS_CONFIG],
|
||||
gBlendStrings[gEeprom.BK1080_BLEND_CONFIG]);
|
||||
|
||||
UI_PrintStringSmallNormal(String, 1, 0, 5);
|
||||
|
||||
sprintf(String, "%d%s-%dM",
|
||||
BK1080_GetFreqLoLimit(gEeprom.FM_Band)/10,
|
||||
@@ -55,13 +103,13 @@ void UI_DisplayFM(void)
|
||||
pPrintStr = "DEL?";
|
||||
} else if (gFM_ScanState == FM_SCAN_OFF) {
|
||||
if (gEeprom.FM_IsMrMode) {
|
||||
sprintf(String, "MR(CH%02u)", gEeprom.FM_SelectedChannel + 1);
|
||||
sprintf(String, "CH%02u", gEeprom.FM_SelectedChannel + 1);
|
||||
pPrintStr = String;
|
||||
} else {
|
||||
pPrintStr = "VFO";
|
||||
for (unsigned int i = 0; i < 20; i++) {
|
||||
if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i]) {
|
||||
sprintf(String, "VF(C%02u)", i + 1);
|
||||
sprintf(String, "C%02u MHz", i + 1);
|
||||
pPrintStr = String;
|
||||
break;
|
||||
}
|
||||
@@ -74,7 +122,7 @@ void UI_DisplayFM(void)
|
||||
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));
|
||||
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex > 0)) {
|
||||
@@ -89,12 +137,12 @@ void UI_DisplayFM(void)
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
||||
UI_PrintString(String, 0, 127, 1, 10);
|
||||
UI_PrintString(String, 0, 127, 1 /*, 10 */);
|
||||
|
||||
ST7565_BlitFullScreen();
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
void UI_DisplayFM(void);
|
||||
void UI_UpdateFMThings(bool force);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
93
ui/helper.c
93
ui/helper.c
@@ -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) {
|
||||
const size_t Length = strlen(pString);
|
||||
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++) {
|
||||
const unsigned int index = pString[i] - ' ' - 1;
|
||||
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,
|
||||
const uint8_t *font, bool inv) {
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
// size_t i;
|
||||
// size_t Length = strlen(pString);
|
||||
//
|
||||
// if (End > Start)
|
||||
// Start += (((End - Start) - (Length * Width)) + 1) / 2;
|
||||
//
|
||||
// for (i = 0; i < Length; i++)
|
||||
// {
|
||||
// const unsigned int ofs = (unsigned int)Start + (i * Width);
|
||||
// if (pString[i] > ' ' && pString[i] < 127)
|
||||
// {
|
||||
// const unsigned int index = pString[i] - ' ' - 1;
|
||||
// memcpy(gFrameBuffer[Line + 0] + ofs, &gFontSmall[index + '0'][0], 7);
|
||||
// memcpy(gFrameBuffer[Line + 1] + ofs, &gFontSmall[index + '0'][7], 7);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
//void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line /*, uint8_t Width */) {
|
||||
// UI_PrintStringSmallNormal(pString, Start, End, Line);
|
||||
//// size_t i;
|
||||
//// size_t Length = strlen(pString);
|
||||
////
|
||||
//// if (End > Start)
|
||||
//// Start += (((End - Start) - (Length * Width)) + 1) / 2;
|
||||
////
|
||||
//// for (i = 0; i < Length; i++)
|
||||
//// {
|
||||
//// const unsigned int ofs = (unsigned int)Start + (i * Width);
|
||||
//// if (pString[i] > ' ' && pString[i] < 127)
|
||||
//// {
|
||||
//// const unsigned int index = pString[i] - ' ' - 1;
|
||||
//// memcpy(gFrameBuffer[Line + 0] + ofs, &gFontSmall[index + '0'][0], 7);
|
||||
//// memcpy(gFrameBuffer[Line + 1] + ofs, &gFontSmall[index + '0'][7], 7);
|
||||
//// }
|
||||
//// }
|
||||
//}
|
||||
|
||||
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line) {
|
||||
//#ifdef ENABLE_SMALL_BOLD
|
||||
@@ -149,7 +154,7 @@ void UI_PrintStringSmallBufferNormal(const char *pString, uint8_t *buffer) {
|
||||
|
||||
void UI_PrintStringSmallBufferBold(const char *pString, uint8_t *buffer) {
|
||||
#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]);
|
||||
#else
|
||||
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);
|
||||
}
|
||||
|
||||
//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,
|
||||
bool statusbar, bool fill) {
|
||||
uint8_t c;
|
||||
@@ -291,9 +320,10 @@ void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
|
||||
|
||||
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) {
|
||||
for (int i = 0; i < (int) ARRAY_SIZE(gFontSmall[0]); ++i) {
|
||||
if (c) {
|
||||
pixels = gFontSmall[c - 1][i];
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
if (pixels & 1) {
|
||||
if (statusbar)
|
||||
PutPixelStatus(x + i, y + j, fill);
|
||||
@@ -303,10 +333,12 @@ void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
|
||||
pixels >>= 1;
|
||||
}
|
||||
}
|
||||
x += 4;
|
||||
}
|
||||
x += ARRAY_SIZE(gFontSmall[0]) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
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);
|
||||
// }
|
||||
// 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);
|
||||
}
|
||||
|
||||
void UI_ClearLine(uint8_t Line) {
|
||||
if (Line < 8) { // ST7565 has 8 pages (rows of 8 pixels)
|
||||
memset(gFrameBuffer[Line], 0x00, 128); // Clear all pixels on the line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UI_DisplayClear() {
|
||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||
}
|
||||
|
@@ -22,13 +22,14 @@
|
||||
|
||||
void UI_GenerateChannelString(char *pString, const uint8_t Channel);
|
||||
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_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
||||
void UI_PrintStringSmallBufferNormal(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_ClearLine(uint8_t Line);
|
||||
void UI_DisplayPopup(const char *string);
|
||||
|
||||
void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black);
|
||||
|
@@ -37,11 +37,11 @@ static void Render(void)
|
||||
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||
UI_DisplayClear();
|
||||
|
||||
UI_PrintString("PASSWORD", 0, 127, 1, 10);
|
||||
UI_PrintString("PASSWORD", 0, 127, 1 /*, 10 */);
|
||||
for (i = 0; i < 6; i++)
|
||||
String[i] = (gInputBox[i] == 10) ? '-' : 'x';
|
||||
String[6] = 0;
|
||||
UI_PrintString(String, 0, 127, 3, 12);
|
||||
UI_PrintString(String, 0, 127, 3 /*, 12 */);
|
||||
|
||||
ST7565_BlitStatusLine();
|
||||
ST7565_BlitFullScreen();
|
||||
|
278
ui/main.c
278
ui/main.c
@@ -115,8 +115,6 @@ static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level, uint8_t bars
|
||||
level = MIN(level, bars);
|
||||
|
||||
for (uint8_t i = 0; i < level; i++) {
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
if (gSetting_set_met) {
|
||||
const char hollowBar[] = {
|
||||
0b01111111,
|
||||
0b01000001,
|
||||
@@ -130,36 +128,6 @@ static void DrawLevelBar(uint8_t xpos, uint8_t line, uint8_t level, uint8_t bars
|
||||
} else {
|
||||
memcpy(p_line + (xpos + i * 5), &hollowBar, ARRAY_SIZE(hollowBar));
|
||||
}
|
||||
} 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));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +165,7 @@ void UI_DisplayAudioBar(void) {
|
||||
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT ||
|
||||
gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
) {
|
||||
@@ -237,7 +205,7 @@ void UI_DisplayAudioBar(void) {
|
||||
void DisplayRSSIBar(const bool now) {
|
||||
#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
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
@@ -266,7 +234,7 @@ void DisplayRSSIBar(const bool now) {
|
||||
|
||||
if (RxLine >= 0 && center_line != CENTER_LINE_IN_USE) {
|
||||
if (RxBlink == 0 || RxBlink == 1) {
|
||||
UI_PrintStringSmallBold("RX", 8, 0, RxLine);
|
||||
UI_PrintStringSmallBold("RX", 24, 0, RxLine);
|
||||
if (RxBlink == 1) RxBlink = 2;
|
||||
} else {
|
||||
for (uint8_t i = 8; i < 24; i++) {
|
||||
@@ -299,7 +267,7 @@ void DisplayRSSIBar(const bool now) {
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT ||
|
||||
gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
@@ -348,24 +316,19 @@ void DisplayRSSIBar(const bool now) {
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
if (gSetting_set_gui) {
|
||||
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);
|
||||
}
|
||||
char tempStr[4];
|
||||
|
||||
if (overS9Bars == 0) {
|
||||
sprintf(str, "S%d", s_level);
|
||||
sprintf(tempStr, "S%d", s_level);
|
||||
} 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
|
||||
if(overS9Bars == 0) {
|
||||
sprintf(str, "% 4d S%d", -rssi_dBm, s_level);
|
||||
@@ -377,7 +340,7 @@ void DisplayRSSIBar(const bool now) {
|
||||
|
||||
UI_PrintStringSmallNormal(str, 2, 0, line);
|
||||
#endif
|
||||
DrawLevelBar(bar_x, line, s_level + overS9Bars, 13);
|
||||
DrawLevelBar(bar_x, line, s_level + overS9Bars, 10);
|
||||
if (now)
|
||||
ST7565_BlitLine(line);
|
||||
#else
|
||||
@@ -507,7 +470,7 @@ void UI_DisplayMain(void) {
|
||||
UI_DisplayClear();
|
||||
|
||||
if (gLowBattery && !gLowBatteryConfirmed) {
|
||||
UI_DisplayPopup("LOW BATTERY");
|
||||
UI_DisplayPopup("LOW BATT");
|
||||
ST7565_BlitFullScreen();
|
||||
return;
|
||||
}
|
||||
@@ -515,8 +478,8 @@ void UI_DisplayMain(void) {
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
|
||||
{ // tell user how to unlock the keyboard
|
||||
UI_PrintString("Long press #", 0, LCD_WIDTH, 1, 8);
|
||||
UI_PrintString("to unlock", 0, LCD_WIDTH, 3, 8);
|
||||
UI_PrintString("Long press #", 0, LCD_WIDTH, 1 /*, 8 */);
|
||||
UI_PrintString("to unlock", 0, LCD_WIDTH, 3 /*, 8 */);
|
||||
ST7565_BlitFullScreen();
|
||||
return;
|
||||
}
|
||||
@@ -535,7 +498,7 @@ void UI_DisplayMain(void) {
|
||||
shift = 5;
|
||||
}
|
||||
//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));
|
||||
|
||||
/*
|
||||
@@ -600,7 +563,7 @@ void UI_DisplayMain(void) {
|
||||
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);
|
||||
UI_PrintStringSmallNormal(String, 56, 0, line + shift);
|
||||
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
||||
@@ -612,7 +575,7 @@ void UI_DisplayMain(void) {
|
||||
gScanRangeStart = 0;
|
||||
}
|
||||
#else
|
||||
UI_PrintString("ScnRng", 5, 0, line, 8);
|
||||
UI_PrintString("ScnRng", 5, 0, line /*, 8 */);
|
||||
sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000);
|
||||
UI_PrintStringSmallNormal(String, 56, 0, line);
|
||||
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
|
||||
@@ -624,21 +587,21 @@ void UI_DisplayMain(void) {
|
||||
|
||||
|
||||
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);
|
||||
UI_PrintStringSmallNormal(String, 0, 0, line);
|
||||
continue;
|
||||
}
|
||||
|
||||
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);
|
||||
UI_PrintStringSmallNormal(String, 0, 0, line);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gDTMF_InputMode
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx
|
||||
#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 = "";
|
||||
if (!gDTMF_InputMode) {
|
||||
@@ -680,17 +643,17 @@ void UI_DisplayMain(void) {
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
if (isMainOnly()) {
|
||||
UI_PrintString(pPrintStr, 2, 0, 5, 8);
|
||||
UI_PrintString(pPrintStr, 2, 0, 5 /*, 8 */);
|
||||
isMainOnlyInputDTMF = true;
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
} else {
|
||||
UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3), 8);
|
||||
UI_PrintString(pPrintStr, 2, 0, 0 + (vfo_num * 3) /*, 8 */);
|
||||
isMainOnlyInputDTMF = false;
|
||||
center_line = CENTER_LINE_IN_USE;
|
||||
continue;
|
||||
}
|
||||
#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;
|
||||
continue;
|
||||
#endif
|
||||
@@ -709,11 +672,11 @@ void UI_DisplayMain(void) {
|
||||
|
||||
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())
|
||||
memcpy(p_line0 + 14, BITMAP_VFO_Lock, sizeof(BITMAP_VFO_Lock));
|
||||
memcpy(p_line0 + 5, gFontKeyLock, sizeof(gFontKeyLock));
|
||||
else
|
||||
memcpy(p_line0 + 24, BITMAP_VFO_Lock, sizeof(BITMAP_VFO_Lock));
|
||||
memcpy(p_line0 + 10, gFontKeyLock, sizeof(gFontKeyLock));
|
||||
}
|
||||
|
||||
if (gCurrentFunction == FUNCTION_TRANSMIT) { // transmitting
|
||||
@@ -750,7 +713,7 @@ void UI_DisplayMain(void) {
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
else {
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -761,7 +724,7 @@ void UI_DisplayMain(void) {
|
||||
}
|
||||
|
||||
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;
|
||||
if (!inputting)
|
||||
sprintf(String, "M%u", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||
@@ -770,7 +733,7 @@ void UI_DisplayMain(void) {
|
||||
UI_PrintStringSmallNormal(String, x, 0, line + 1);
|
||||
} else if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // frequency mode
|
||||
// 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 ? "" : "+";
|
||||
sprintf(String, "F%u%s", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST, buf);
|
||||
UI_PrintStringSmallNormal(String, x, 0, line + 1);
|
||||
@@ -802,24 +765,15 @@ void UI_DisplayMain(void) {
|
||||
#endif
|
||||
if (state != VFO_STATE_NORMAL) {
|
||||
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]) &&
|
||||
gEeprom.TX_VFO == vfo_num) { // user entering a frequency
|
||||
const char *ascii = INPUTBOX_GetAscii();
|
||||
bool isGigaF = frequency >= _1GHz_in_KHz;
|
||||
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
|
||||
UI_PrintString(String, 32, 0, line, 8);
|
||||
UI_PrintString(String, 45, 0, line /*, 8 */);
|
||||
}
|
||||
|
||||
continue;
|
||||
@@ -888,19 +842,19 @@ void UI_DisplayMain(void) {
|
||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
|
||||
String[7] = 0;
|
||||
// show the main large frequency digits
|
||||
UI_DisplayFrequency(String, 32, line, false);
|
||||
UI_DisplayFrequency(String, 20, line, false);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
// show the frequency in the main font
|
||||
UI_PrintString(String, 32, 0, line, 8);
|
||||
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MDF_CHANNEL: // show the channel number
|
||||
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
|
||||
UI_PrintString(String, 32, 0, line, 8);
|
||||
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||
break;
|
||||
|
||||
case MDF_NAME: // show the channel name
|
||||
@@ -912,20 +866,20 @@ void UI_DisplayMain(void) {
|
||||
}
|
||||
|
||||
if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_NAME) {
|
||||
UI_PrintString(String, 32, 0, line, 8);
|
||||
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||
} else {
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
if (isMainOnly()) {
|
||||
UI_PrintString(String, 32, 0, line, 8);
|
||||
UI_PrintStringSmallBold(String, 40, 0, line /*, 8 */);
|
||||
} else {
|
||||
if (activeTxVFO == vfo_num) {
|
||||
UI_PrintStringSmallBold(String, 32 + 4, 0, line);
|
||||
UI_PrintStringSmallBold(String, 40 + 4, 0, line);
|
||||
} else {
|
||||
UI_PrintStringSmallNormal(String, 32 + 4, 0, line);
|
||||
UI_PrintStringSmallNormal(String, 40 + 4, 0, line);
|
||||
}
|
||||
}
|
||||
#else
|
||||
UI_PrintStringSmallBold(String, 32 + 4, 0, line);
|
||||
UI_PrintStringSmallBold(String, 20 + 4, 0, line);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
@@ -936,19 +890,19 @@ void UI_DisplayMain(void) {
|
||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 4);
|
||||
String[7] = 0;
|
||||
// show the main large frequency digits
|
||||
//UI_DisplayFrequency(String, 32, line + 3, false);
|
||||
UI_PrintStringSmallNormal(String, 0, 20, line + 3);
|
||||
//UI_DisplayFrequency(String, 20, line + 3, false);
|
||||
UI_PrintStringSmallBold(String, 20, 20, line + 3);
|
||||
} else {
|
||||
// show the frequency in the main font
|
||||
UI_PrintString(String, 32, 0, line + 3, 8);
|
||||
UI_PrintString(String, 40, 0, line + 3 /*, 8 */);
|
||||
}
|
||||
} else {
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
@@ -963,12 +917,12 @@ void UI_DisplayMain(void) {
|
||||
UI_PrintStringSmallNormal(String + 7, 113, 0, line + 1);
|
||||
String[7] = 0;
|
||||
// show the main large frequency digits
|
||||
UI_DisplayFrequency(String, 32, line, false);
|
||||
UI_DisplayFrequency(String, 20, line, false);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
// 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
|
||||
@@ -1075,13 +1029,11 @@ void UI_DisplayMain(void) {
|
||||
shift = -10;
|
||||
}
|
||||
|
||||
if (gSetting_set_gui) {
|
||||
UI_PrintStringSmallNormal(s, LCD_WIDTH + 22, 0, line + 1);
|
||||
UI_PrintStringSmallNormal(t, LCD_WIDTH + 2, 0, line + 1);
|
||||
UI_PrintStringSmallNormal(s, 50, 0, line + 2);
|
||||
UI_PrintStringSmallNormal(t, 2, 0, line + 2);
|
||||
|
||||
if (isMainOnly() && !gDTMF_InputMode) {
|
||||
if (shift == 0) {
|
||||
UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
UI_PrintStringSmallNormal(String, 65, 0, line + 2);
|
||||
}
|
||||
|
||||
if ((vfoInfo->StepFrequency / 100) < 100) {
|
||||
@@ -1089,56 +1041,16 @@ void UI_DisplayMain(void) {
|
||||
} 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);
|
||||
}
|
||||
UI_PrintStringSmallNormal(String, 55, 0, line + 1);
|
||||
#else
|
||||
UI_PrintStringSmallNormal(s, LCD_WIDTH + 24, 0, line + 1);
|
||||
#endif
|
||||
|
||||
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM) { // show the TX power
|
||||
uint8_t currentPower = vfoInfo->OUTPUT_POWER % 8;
|
||||
uint8_t arrowPos = 19;
|
||||
bool userPower = false;
|
||||
|
||||
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));
|
||||
}
|
||||
const char pwr_short[][3] = {"L1", "L2", "L3", "L4", "L5", "ME",
|
||||
"HI"};
|
||||
UI_PrintStringSmallNormal(pwr_short[currentPower], LCD_WIDTH + 25, 0, line + 1);
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
#if ENABLE_FEAT_F4HWN
|
||||
if (gSetting_set_gui) {
|
||||
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
|
||||
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 54, 0, line + 1);
|
||||
#endif
|
||||
@@ -1181,11 +1078,7 @@ void UI_DisplayMain(void) {
|
||||
if (vfoInfo->FrequencyReverse)
|
||||
#if ENABLE_FEAT_F4HWN
|
||||
{
|
||||
if (gSetting_set_gui) {
|
||||
UI_PrintStringSmallNormal("R", LCD_WIDTH + 68, 0, line + 1);
|
||||
} else {
|
||||
GUI_DisplaySmallest("R", 51, line == 0 ? 17 : 49, false, true);
|
||||
}
|
||||
}
|
||||
#else
|
||||
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) {
|
||||
narrower = 1;
|
||||
}
|
||||
|
||||
if (gSetting_set_gui) {
|
||||
const char *bandWidthNames[] = {"W", "N", "N+"};
|
||||
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);
|
||||
}
|
||||
const char *bandWidthNames[] = {"WID", "NAR", "NR+"};
|
||||
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], LCD_WIDTH + 30, 0,
|
||||
line);
|
||||
#else
|
||||
if (gSetting_set_gui)
|
||||
{
|
||||
@@ -1232,49 +1118,21 @@ void UI_DisplayMain(void) {
|
||||
#endif
|
||||
|
||||
// show the audio scramble symbol
|
||||
if (vfoInfo->SCRAMBLING_TYPE > 0)
|
||||
UI_PrintStringSmallNormal("S", LCD_WIDTH + 106, 0, line);
|
||||
if (vfoInfo->SCRAMBLING_TYPE > 0) {
|
||||
sprintf(String, "S%d", vfoInfo->SCRAMBLING_TYPE + 25);
|
||||
UI_PrintStringSmallNormal(String, 105, 0, line + 2);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
/*
|
||||
if(isMainVFO)
|
||||
{
|
||||
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) {
|
||||
if (isMainVFO && gMonitor) {
|
||||
strcpy(String, "MONI");
|
||||
|
||||
} else {
|
||||
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
|
||||
}
|
||||
|
||||
if (gSetting_set_gui) {
|
||||
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1);
|
||||
} else {
|
||||
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
|
||||
}
|
||||
}
|
||||
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line);
|
||||
|
||||
#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
|
||||
|
||||
if (gScreenToDisplay != DISPLAY_MAIN
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
|| gDTMF_CallState != DTMF_CALL_STATE_NONE
|
||||
#endif
|
||||
)
|
||||
|
177
ui/menu.c
177
ui/menu.c
@@ -54,7 +54,6 @@ const t_menu_item MenuList[] =
|
||||
{"COMP", MENU_COMPAND},
|
||||
{"Mod", MENU_AM}, // was "AM"
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
{"TXLck", MENU_TX_LOCK},
|
||||
#endif
|
||||
{"ScAdd1", MENU_S_ADD1},
|
||||
{"ScAdd2", MENU_S_ADD2},
|
||||
@@ -131,15 +130,12 @@ const t_menu_item MenuList[] =
|
||||
{"RxMode", MENU_TDR},
|
||||
{"Sql", MENU_SQL},
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
{"SPwr", MENU_SET_PWR},
|
||||
{"SPTT", MENU_SET_PTT},
|
||||
{"STOT", MENU_SET_TOT},
|
||||
{"SEOT", MENU_SET_EOT},
|
||||
{"SCtr", MENU_SET_CTR},
|
||||
{"SInv", MENU_SET_INV},
|
||||
{"SLck", MENU_SET_LCK},
|
||||
//{"SMet", MENU_SET_MET},
|
||||
//{"SGUI", MENU_SET_GUI},
|
||||
{"STmr", MENU_SET_TMR},
|
||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||
{"SOff", MENU_SET_OFF},
|
||||
@@ -160,13 +156,6 @@ const t_menu_item MenuList[] =
|
||||
// hidden menu items from here on
|
||||
// enabled if pressing both the PTT and upper side button at power-on
|
||||
{"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
|
||||
{"FrCali", MENU_F_CALI}, // reference xtal calibration
|
||||
#endif
|
||||
@@ -177,18 +166,15 @@ const t_menu_item MenuList[] =
|
||||
{"", 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[][6] =
|
||||
const char gSubMenu_TXP[][5] =
|
||||
{
|
||||
"USR",
|
||||
"L1",
|
||||
"L2",
|
||||
"L3",
|
||||
"L4",
|
||||
"L5",
|
||||
"M",
|
||||
"H"
|
||||
"<.02",
|
||||
".125",
|
||||
".25",
|
||||
".5",
|
||||
"1",
|
||||
"2",
|
||||
"5"
|
||||
};
|
||||
|
||||
const char gSubMenu_SFT_D[][4] =
|
||||
@@ -333,32 +319,7 @@ const char gSubMenu_BATTYP[][9] =
|
||||
"35"
|
||||
};
|
||||
|
||||
const char gSubMenu_SCRAMBLER[][7] =
|
||||
{
|
||||
"OFF",
|
||||
"26K",
|
||||
"27K",
|
||||
"28K",
|
||||
"29K",
|
||||
"30K",
|
||||
"31K",
|
||||
"32K",
|
||||
"33K",
|
||||
"34K",
|
||||
"35K"
|
||||
};
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
const char gSubMenu_SET_PWR[][6] =
|
||||
{
|
||||
"<.02",
|
||||
".125",
|
||||
".25",
|
||||
".5",
|
||||
"1",
|
||||
"2",
|
||||
"5"
|
||||
};
|
||||
|
||||
const char gSubMenu_SET_PTT[][8] =
|
||||
{
|
||||
@@ -374,12 +335,6 @@ const char gSubMenu_SET_TOT[][7] = // Use by SET_EOT too
|
||||
"ALL"
|
||||
};
|
||||
|
||||
const char gSubMenu_SET_LCK[][9] =
|
||||
{
|
||||
"KEY",
|
||||
"KEY+PTT"
|
||||
};
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
const char gSubMenu_SET_NFM[][9] =
|
||||
{
|
||||
@@ -500,7 +455,7 @@ void UI_DisplayMenu(void) {
|
||||
for (i = 0; i < 3; i++)
|
||||
if (gMenuCursor > 0 || i > 0)
|
||||
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
|
||||
for (i = 0; i < (8 * menu_list_width); i++)
|
||||
@@ -525,14 +480,17 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
#else
|
||||
{ // new menu layout .. experimental & unfinished
|
||||
const int menu_index = gMenuCursor; // current selected menu item
|
||||
i = 1;
|
||||
i = 0;
|
||||
|
||||
if (!gIsInSubMenu) {
|
||||
while (i < 2) { // leading menu items - small text
|
||||
const int k = menu_index + i - 2;
|
||||
if (k < 0)
|
||||
UI_PrintStringSmallNormal(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round
|
||||
else if (k >= 0 && k < (int) gMenuListCount)
|
||||
UI_PrintStringSmallNormal(MenuList[(gMenuListCount + k) % gMenuListCount].name, 0, 0,
|
||||
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);
|
||||
i++;
|
||||
}
|
||||
@@ -546,10 +504,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
|
||||
while (i < 5) { // trailing menu item - small text
|
||||
const int k = menu_index + i - 2;
|
||||
if (k >= 0 && k < (int) gMenuListCount)
|
||||
UI_PrintStringSmallNormal(MenuList[k].name, 0, 0, i);
|
||||
if (k < 0)
|
||||
UI_PrintStringSmallNormal(MenuList[(gMenuListCount + k) % gMenuListCount].name, 0, 0,
|
||||
i); // wrap-around
|
||||
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++;
|
||||
}
|
||||
|
||||
@@ -560,7 +521,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
#endif
|
||||
} else if (menu_index >= 0 && menu_index < (int) gMenuListCount) { // current menu item
|
||||
// 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);
|
||||
}
|
||||
|
||||
@@ -615,11 +576,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
}
|
||||
|
||||
case MENU_TXP:
|
||||
if (gSubMenuSelection == 0) {
|
||||
strcpy(String, gSubMenu_TXP[gSubMenuSelection]);
|
||||
} else {
|
||||
sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection], gSubMenu_SET_PWR[gSubMenuSelection - 1]);
|
||||
}
|
||||
sprintf(String, "%sW", gSubMenu_TXP[gSubMenuSelection]);
|
||||
break;
|
||||
|
||||
case MENU_R_DCS:
|
||||
@@ -649,14 +606,14 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
case MENU_OFFSET:
|
||||
if (!gIsInSubMenu || gInputBoxIndex == 0) {
|
||||
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 {
|
||||
const char *ascii = INPUTBOX_GetAscii();
|
||||
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;
|
||||
break;
|
||||
@@ -666,11 +623,13 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
break;
|
||||
|
||||
case MENU_SCR:
|
||||
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
|
||||
if (gSubMenuSelection > 0)
|
||||
if (gSubMenuSelection > 0) {
|
||||
sprintf(String, "%d00", gSubMenuSelection + 25);
|
||||
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||
else
|
||||
} else {
|
||||
strcpy(String, "OFF");
|
||||
BK4819_DisableScramble();
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_VOX:
|
||||
@@ -757,13 +716,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
#ifdef ENABLE_NOAA
|
||||
case MENU_NOAA_S:
|
||||
#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
|
||||
case MENU_SET_TMR:
|
||||
#endif
|
||||
@@ -776,16 +728,16 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
|
||||
|
||||
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
|
||||
const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection);
|
||||
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);
|
||||
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;
|
||||
break;
|
||||
}
|
||||
@@ -794,7 +746,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
const bool valid = RADIO_CheckValidChannel(gSubMenuSelection, false, 0);
|
||||
|
||||
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) {
|
||||
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
|
||||
SETTINGS_FetchChannelName(String, gSubMenuSelection);
|
||||
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
|
||||
//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, 0, 2 /*, 8 */);
|
||||
UI_PrintString(edit, menu_item_x1, menu_item_x2, 2 /*, 8 */);
|
||||
if (edit_index < 10)
|
||||
//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 + (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
|
||||
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 */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1006,10 +958,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
#endif
|
||||
|
||||
#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:
|
||||
strcpy(String, gSubMenu_SET_PTT[gSubMenuSelection]);
|
||||
break;
|
||||
@@ -1038,23 +986,6 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
#endif
|
||||
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
|
||||
case MENU_SET_NFM:
|
||||
strcpy(String, gSubMenu_SET_NFM[gSubMenuSelection]);
|
||||
@@ -1092,11 +1023,11 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
|
||||
}
|
||||
|
||||
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||
if (gaugeLine != 0) {
|
||||
ST7565_Gauge(gaugeLine, gaugeMin, gaugeMax, gSubMenuSelection);
|
||||
}
|
||||
#endif
|
||||
//#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
|
||||
// if (gaugeLine != 0) {
|
||||
// ST7565_Gauge(gaugeLine, gaugeMin, gaugeMax, gSubMenuSelection);
|
||||
// }
|
||||
//#endif
|
||||
|
||||
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)
|
||||
UI_PrintStringSmallNormal(String + i, menu_item_x1, menu_item_x2, y);
|
||||
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
|
||||
while (i < len && String[i] >= 32)
|
||||
@@ -1164,21 +1095,21 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
}
|
||||
|
||||
// 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);
|
||||
pPrintStr = String[0] ? String : "--";
|
||||
|
||||
// channel name and scan-list
|
||||
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 {
|
||||
/*
|
||||
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
|
||||
|
||||
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
|
||||
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])) {
|
||||
@@ -1194,7 +1125,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
|
||||
if (IS_MR_CHANNEL(channel)) {
|
||||
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)
|
||||
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
|
||||
if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid) {
|
||||
Contact[11] = 0;
|
||||
memcpy(&gDTMF_ID, Contact + 8, 4);
|
||||
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
|
||||
|
||||
@@ -1230,7 +1161,7 @@ UI_PrintStringSmallNormal(String, 2, 0, 6);
|
||||
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME ||
|
||||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation) { // display confirmation
|
||||
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();
|
||||
|
21
ui/menu.h
21
ui/menu.h
@@ -42,9 +42,6 @@ enum {
|
||||
MENU_W_N,
|
||||
MENU_SCR,
|
||||
MENU_BCL,
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
MENU_TX_LOCK,
|
||||
#endif
|
||||
MENU_MEM_CH,
|
||||
MENU_DEL_CH,
|
||||
MENU_MEM_NAME,
|
||||
@@ -110,13 +107,6 @@ enum {
|
||||
#endif
|
||||
MENU_RESET,
|
||||
MENU_F_LOCK,
|
||||
#ifndef ENABLE_FEAT_F4HWN
|
||||
MENU_200TX,
|
||||
MENU_350TX,
|
||||
MENU_500TX,
|
||||
MENU_SCREN,
|
||||
#endif
|
||||
MENU_350EN,
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
MENU_F_CALI, // reference xtal calibration
|
||||
#endif
|
||||
@@ -124,15 +114,12 @@ enum {
|
||||
MENU_SET_OFF,
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN
|
||||
MENU_SET_PWR,
|
||||
MENU_SET_PTT,
|
||||
MENU_SET_TOT,
|
||||
MENU_SET_EOT,
|
||||
MENU_SET_CTR,
|
||||
MENU_SET_INV,
|
||||
MENU_SET_LCK,
|
||||
MENU_SET_MET,
|
||||
MENU_SET_GUI,
|
||||
MENU_SET_TMR,
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
MENU_SET_NFM,
|
||||
@@ -156,10 +143,9 @@ enum {
|
||||
MENU_BATTYP
|
||||
};
|
||||
|
||||
extern const uint8_t FIRST_HIDDEN_MENU_ITEM;
|
||||
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_W_N[2][7];
|
||||
extern const char gSubMenu_OFF_ON[2][4];
|
||||
@@ -179,11 +165,8 @@ extern const char gSubMenu_D_RSP[4][11];
|
||||
#endif
|
||||
|
||||
#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_TOT[4][7];
|
||||
extern const char gSubMenu_SET_LCK[2][9];
|
||||
extern const char gSubMenu_SET_MET[2][8];
|
||||
#ifdef ENABLE_FEAT_F4HWN_NARROWER
|
||||
extern const char gSubMenu_SET_NFM[2][9];
|
||||
#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_BATTYP[3][9];
|
||||
|
||||
extern const char gSubMenu_SCRAMBLER[11][7];
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
uint8_t id;
|
||||
|
16
ui/scanner.c
16
ui/scanner.c
@@ -40,7 +40,7 @@ void UI_DisplayScanner(void)
|
||||
pPrintStr = "FREQ:**.*****";
|
||||
}
|
||||
|
||||
UI_PrintString(pPrintStr, 2, 0, 1, 8);
|
||||
UI_PrintString(pPrintStr, 2, 0, 1 /*, 8 */);
|
||||
|
||||
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) {
|
||||
pPrintStr = "CTC:******";
|
||||
@@ -52,10 +52,10 @@ void UI_DisplayScanner(void)
|
||||
pPrintStr = String;
|
||||
}
|
||||
|
||||
UI_PrintString(pPrintStr, 2, 0, 3, 8);
|
||||
UI_PrintString(pPrintStr, 2, 0, 3 /*, 8 */);
|
||||
memset(String, 0, sizeof(String));
|
||||
if (gScannerSaveState == SCAN_SAVE_CHANNEL) {
|
||||
pPrintStr = "SAVE?";
|
||||
pPrintStr = "SAV?";
|
||||
Start = 0;
|
||||
bCentered = 1;
|
||||
} else {
|
||||
@@ -63,21 +63,21 @@ void UI_DisplayScanner(void)
|
||||
bCentered = 0;
|
||||
|
||||
if (gScannerSaveState == SCAN_SAVE_CHAN_SEL) {
|
||||
strcpy(String, "SAVE:");
|
||||
strcpy(String, "SAV:");
|
||||
UI_GenerateChannelStringEx(String + 5, gShowChPrefix, gScanChannel);
|
||||
pPrintStr = String;
|
||||
} else if (gScanCssState < SCAN_CSS_STATE_FOUND) {
|
||||
strcpy(String, "SCAN");
|
||||
strcpy(String, "SCN");
|
||||
memset(String + 4, '.', (gScanProgressIndicator & 7) + 1);
|
||||
pPrintStr = String;
|
||||
} else if (gScanCssState == SCAN_CSS_STATE_FOUND) {
|
||||
pPrintStr = "SCAN CMP.";
|
||||
pPrintStr = "SCN CMP.";
|
||||
} 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();
|
||||
}
|
||||
|
@@ -35,8 +35,7 @@ void UI_DisplayReleaseKeys(void) {
|
||||
#endif
|
||||
UI_DisplayClear();
|
||||
|
||||
UI_PrintString("RELEASE", 0, 127, 1, 10);
|
||||
UI_PrintString("ALL KEYS", 0, 127, 3, 10);
|
||||
UI_PrintString("RELEASE KEYS", 0, 127, 1 /*, 10 */);
|
||||
|
||||
ST7565_BlitStatusLine(); // blank status line
|
||||
ST7565_BlitFullScreen();
|
||||
|
Reference in New Issue
Block a user