This commit is contained in:
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)
|
||||
|
40
app/main.c
40
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,23 +965,27 @@ 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);
|
||||
AUDIO_AudioPathOff();
|
||||
gEnableSpeaker = false;
|
||||
RADIO_PrepareTX();
|
||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
|
||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
MSG_FSKSendData();
|
||||
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);
|
||||
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
|
||||
: gEeprom.TX_VFO;
|
||||
if (VfoState[vfo] == VFO_STATE_NORMAL && !TX_freq_check(gCurrentVfo->freq_config_TX.Frequency)) {
|
||||
AUDIO_AudioPathOff();
|
||||
gEnableSpeaker = false;
|
||||
RADIO_PrepareTX();
|
||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0)
|
||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||
MSG_FSKSendData();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||
AUDIO_AudioPathOn();
|
||||
gEnableSpeaker = true;
|
||||
BK4819_ExitTxMute();
|
||||
MSG_EnableRX(true);
|
||||
gVfoConfigureMode = VFO_CONFIGURE;
|
||||
dataPTR = dataPacket.data;
|
||||
memset(dataPacket.data, 0, DataPacketDataSize);
|
||||
}
|
||||
gEnteringSMS = SMS_NOT_ENTERING;
|
||||
}
|
||||
}
|
||||
|
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;
|
||||
|
||||
|
Reference in New Issue
Block a user