Merge pull request #323 from armel/feature_update_v3

Feature update v3
This commit is contained in:
Armel FAUVEAU
2024-12-01 01:19:59 +01:00
committed by GitHub
34 changed files with 330 additions and 200 deletions

View File

@@ -49,7 +49,7 @@ ENABLE_FEAT_F4HWN_SLEEP ?= 1
ENABLE_FEAT_F4HWN_RESTORE_SCAN ?= 1
ENABLE_FEAT_F4HWN_NARROWER ?= 1
ENABLE_FEAT_F4HWN_CONTRAST ?= 1
ENABLE_FEAT_F4HWN_MENU_LOCK ?= 0
ENABLE_FEAT_F4HWN_RESCUE_OPS ?= 0
ENABLE_FEAT_F4HWN_VOL ?= 0
ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0
ENABLE_FEAT_F4HWN_PMR ?= 0
@@ -224,7 +224,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1)
VERSION_STRING_1 ?= v0.22
AUTHOR_STRING_2 ?= F4HWN
VERSION_STRING_2 ?= v3.7
VERSION_STRING_2 ?= v3.8
EDITION_STRING ?= Custom
@@ -443,8 +443,8 @@ endif
ifeq ($(ENABLE_FEAT_F4HWN_CONTRAST),1)
CFLAGS += -DENABLE_FEAT_F4HWN_CONTRAST
endif
ifneq ($(filter $(ENABLE_FEAT_F4HWN_MENU_LOCK),1 2),)
CFLAGS += -DENABLE_FEAT_F4HWN_MENU_LOCK=$(ENABLE_FEAT_F4HWN_MENU_LOCK)
ifneq ($(filter $(ENABLE_FEAT_F4HWN_RESCUE_OPS),1 2),)
CFLAGS += -DENABLE_FEAT_F4HWN_RESCUE_OPS=$(ENABLE_FEAT_F4HWN_RESCUE_OPS)
endif
ifeq ($(ENABLE_FEAT_F4HWN_VOL),1)
CFLAGS += -DENABLE_FEAT_F4HWN_VOL

View File

@@ -26,7 +26,7 @@ Anyway, have fun.
# Donations
Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas, Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern, Joseph Roth, Pierre-Yves Colin, Frank DJ7FG, Marcel Testaz, Brian Frobisher, Yannick F4JFO, Paolo Bussola, Dirk DL8DF, Levente Szőke (2 times), Bernard-Michel Herrera, Jérôme Saintespes, Paul Davies, RS, Johan F4WAT, Robert Wörle and Rafael Sundorf for their [donations](https://www.paypal.com/paypalme/F4HWN). Thats so kind of them. Thanks so much 🙏🏻
Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas, Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern, Joseph Roth, Pierre-Yves Colin, Frank DJ7FG, Marcel Testaz, Brian Frobisher, Yannick F4JFO, Paolo Bussola, Dirk DL8DF, Levente Szőke (2 times), Bernard-Michel Herrera, Jérôme Saintespes, Paul Davies, RS, Johan F4WAT, Robert Wörle, Rafael Sundorf, Paul Harker, Peter Fintl, Pascal F4ICR (2 times) and Mike DL2MF for their [donations](https://www.paypal.com/paypalme/F4HWN). Thats so kind of them. Thanks so much 🙏🏻
## Table of Contents
@@ -43,6 +43,10 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC
## Main features and improvements from F4HWN:
* several firmware versions:
* Bandscope (with spectrum analyzer made by Fagci),
* Broadcast (with commercial FM radio support),
* RescueOps (specifically designed for first responders: firefighters, sea rescue, mountain rescue),
* improve default power settings level:
* Low1 to Low5 (<~20mW, ~125mW, ~250mW, ~500mW, ~1W),
* Mid ~2W,
@@ -119,6 +123,8 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC
* PTT,
* WIDE NARROW,
* 1750Hz,
* POWER HIGH (RescueOps),
* REMOVE OFFSET (RescueOps),
* new key combinations:
* add the F + UP or F + DOWN key combination to dynamically change the Squelch level,
* add the F + F1 or F + F2 key combination to dynamically change the Step,

View File

@@ -111,6 +111,10 @@ void (*action_opt_table[])(void) = {
[ACTION_OPT_PTT] = &ACTION_Ptt,
[ACTION_OPT_WN] = &ACTION_Wn,
[ACTION_OPT_BACKLIGHT] = &ACTION_BackLight,
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
[ACTION_OPT_POWER_HIGH] = &ACTION_Power_High,
[ACTION_OPT_REMOVE_OFFSET] = &ACTION_Remove_Offset,
#endif
#else
[ACTION_OPT_RXMODE] = &FUNCTION_NOP,
#endif
@@ -613,4 +617,18 @@ void ACTION_BackLightOnDemand(void)
BACKLIGHT_TurnOn();
}
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
void ACTION_Power_High(void)
{
gPowerHigh = !gPowerHigh;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
}
void ACTION_Remove_Offset(void)
{
gRemoveOffset = !gRemoveOffset;
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
}
#endif
#endif

View File

@@ -42,6 +42,10 @@ void ACTION_SwitchDemodul(void);
void ACTION_Wn(void);
void ACTION_BackLightOnDemand(void);
void ACTION_BackLight(void);
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
void ACTION_Power_High(void);
void ACTION_Remove_Offset(void);
#endif
#endif
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);

View File

@@ -1398,7 +1398,7 @@ void APP_TimeSlice10ms(void)
return;
#endif
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_MENU_LOCK)
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
#ifdef ENABLE_FLASHLIGHT
FlashlightTimeSlice();
#endif
@@ -1618,7 +1618,7 @@ void APP_TimeSlice500ms(void)
PWM_PLUS0_CH0_COMP = 0;
ST7565_ShutDown();
}
else if(gSleepModeCountdown_500ms != 0 && gSleepModeCountdown_500ms < 61 && gSetting_set_off != 0)
else if(gSleepModeCountdown_500ms != 0 && gSleepModeCountdown_500ms < 21 && gSetting_set_off != 0)
{
if(gSleepModeCountdown_500ms % 4 == 0)
{
@@ -1825,6 +1825,25 @@ static void ALARM_Off(void)
static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
{
#ifdef ENABLE_FEAT_F4HWN_SLEEP
if(gWakeUp)
{
if(!bKeyPressed || Key == KEY_PTT)
{
BACKLIGHT_TurnOn();
if(Key != KEY_PTT)
{
Key = KEY_INVALID;
}
}
else
{
return;
}
}
#endif
if (Key == KEY_EXIT && !BACKLIGHT_IsOn() && gEeprom.BACKLIGHT_TIME > 0)
{ // just turn the light on for now so the user can see what's what
BACKLIGHT_TurnOn();

View File

@@ -5,7 +5,7 @@
#include "flashlight.h"
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_MENU_LOCK)
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
enum FlashlightMode_t gFlashLightState;
void FlashlightTimeSlice()

View File

@@ -5,7 +5,7 @@
#include <stdint.h>
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_MENU_LOCK)
#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
enum FlashlightMode_t {
FLASHLIGHT_OFF = 0,
FLASHLIGHT_ON,

View File

@@ -39,6 +39,22 @@
void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
{
#ifdef ENABLE_F4HWN_FEAT_MENU_LOCK
if(gEeprom.MENU_LOCK == true)
{
if (bKeyHeld || !bKeyPressed) { // held or released
if (bKeyHeld || bKeyPressed) { // held or pressed (cannot be held and not pressed I guess, so it checks only if HELD?)
if (!bKeyHeld) // won't ever pass
return;
if (!bKeyPressed) // won't ever pass
return;
COMMON_KeypadLockToggle();
}
}
}
#else
if (gInputBoxIndex > 0) {
if (!bKeyHeld && bKeyPressed) // short pressed
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
@@ -94,6 +110,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
gBeepToPlay = BEEP_440HZ_500MS;
gPttWasReleased = true;
}
#endif
}
void GENERIC_Key_PTT(bool bKeyPressed)

View File

@@ -84,8 +84,15 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
{
uint8_t Vfo = gEeprom.TX_VFO;
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(gEeprom.MENU_LOCK == true) {
if(Key == 2) { // Enable A/B only
gVfoConfigureMode = VFO_CONFIGURE;
COMMON_SwitchVFOs();
if (beep)
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
}
return; // prevent F function if MENU LOCK is true
}
#endif
@@ -686,7 +693,7 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
return;
}
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(gEeprom.MENU_LOCK == false) {
#endif
@@ -696,7 +703,7 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
gAnotherVoiceID = VOICE_ID_MENU;
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
}
#endif
}
@@ -709,7 +716,7 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
{
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(gEeprom.MENU_LOCK == true) {
return; // prevent F function if MENU LOCK is true
}
@@ -948,13 +955,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
MAIN_Key_STAR(bKeyPressed, bKeyHeld);
break;
case KEY_F:
#ifndef ENABLE_FEAT_F4HWN_MENU_LOCK
GENERIC_Key_F(bKeyPressed, bKeyHeld);
#else
if(gEeprom.MENU_LOCK == false) {
GENERIC_Key_F(bKeyPressed, bKeyHeld);
}
#endif
break;
case KEY_PTT:
GENERIC_Key_PTT(bKeyPressed);

View File

@@ -432,7 +432,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
*pMax = 63;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
case MENU_SET_KEY:
//*pMin = 0;
*pMax = 4;
@@ -951,7 +951,7 @@ void MENU_AcceptSetting(void)
gEeprom.VOLUME_GAIN = gSubMenuSelection;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
case MENU_SET_KEY:
gEeprom.SET_KEY = gSubMenuSelection;
break;
@@ -1402,7 +1402,7 @@ void MENU_ShowCurrentSetting(void)
gSubMenuSelection = gEeprom.VOLUME_GAIN;
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
case MENU_SET_KEY:
gSubMenuSelection = gEeprom.SET_KEY;
break;

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -34,20 +34,6 @@ const uint8_t gFontF[8] =
0b01111111
};
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
const uint8_t gFontR[8] =
{
0b01111111,
0b00000000,
0b01110110,
0b01110110,
0b01100110,
0b01010110,
0b00111001,
0b01111111
};
#endif
const uint8_t gFontS[6] =
{
0x26, 0x49, 0x49, 0x49, 0x49, 0x32 // 'S'
@@ -77,6 +63,7 @@ const uint8_t gFontXB[2][6] =
{0x00, 0x7f, 0x49, 0x49, 0x49, 0x36},
};
const uint8_t gFontMO[2][6] =
{ // "MO"
{0x00, 0x7f, 0x2, 0x1c, 0x2, 0x7f},
@@ -91,6 +78,14 @@ const uint8_t gFontDWR[3][6] =
{0x00, 0x7f, 0x9, 0x19, 0x29, 0x46},
};
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
const uint8_t gFontRO[2][6] =
{ // "RO"
{0x00, 0x7f, 0x9, 0x19, 0x29, 0x46},
{0x00, 0x3e, 0x41, 0x41, 0x41, 0x3e},
};
#endif
const uint8_t gFontHold[2][5] =
{ // "><" .. DW on hold
{0x00, 0x41, 0x22, 0x14, 0x8},

View File

@@ -8,11 +8,6 @@ extern const uint8_t gFontPowerSave[2][6];
extern const uint8_t gFontPttOnePush[2][6];
extern const uint8_t gFontPttClassic[2][6];
extern const uint8_t gFontF[8];
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
extern const uint8_t gFontR[8];
#endif
extern const uint8_t gFontS[6];
extern const uint8_t gFontKeyLock[9];
@@ -21,6 +16,9 @@ extern const uint8_t gFontLight[9];
extern const uint8_t gFontXB[2][6];
extern const uint8_t gFontMO[2][6];
extern const uint8_t gFontDWR[3][6];
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
extern const uint8_t gFontRO[2][6];
#endif
extern const uint8_t gFontHold[2][5];
extern const uint8_t BITMAP_BatteryLevel[2];

View File

@@ -31,7 +31,7 @@ bandscope() {
ENABLE_FMRADIO=0 \
ENABLE_AIRCOPY=1 \
ENABLE_NOAA=0 \
ENABLE_FEAT_F4HWN_MENU_LOCK=0 \
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
EDITION_STRING=Bandscope \
TARGET=f4hwn.bandscope \
&& cp f4hwn.bandscope* compiled-firmware/"
@@ -45,7 +45,7 @@ broadcast() {
ENABLE_AIRCOPY=1 \
ENABLE_NOAA=0 \
EDITION_STRING=Broadcast \
ENABLE_FEAT_F4HWN_MENU_LOCK=0 \
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
TARGET=f4hwn.broadcast \
&& cp f4hwn.broadcast* compiled-firmware/"
}
@@ -63,7 +63,7 @@ voxless() {
ENABLE_FEAT_F4HWN_RESTORE_SCAN=0 \
ENABLE_FEAT_F4HWN_CHARGING_C=0 \
ENABLE_FEAT_F4HWN_NARROWER=0 \
ENABLE_FEAT_F4HWN_MENU_LOCK=0 \
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
EDITION_STRING=Voxless \
TARGET=f4hwn.voxless \
&& cp f4hwn.voxless* compiled-firmware/"
@@ -76,7 +76,7 @@ rescueops() {
ENABLE_FMRADIO=0 \
ENABLE_AIRCOPY=1 \
ENABLE_NOAA=1 \
ENABLE_FEAT_F4HWN_MENU_LOCK=1 \
ENABLE_FEAT_F4HWN_RESCUE_OPS=1 \
EDITION_STRING=RescueOps \
TARGET=f4hwn.rescueops \
&& cp f4hwn.rescueops* compiled-firmware/"
@@ -104,7 +104,6 @@ case "$1" in
all)
bandscope
broadcast
voxless
rescueops
;;
*)

View File

@@ -121,7 +121,7 @@ void FUNCTION_PowerSave() {
#ifdef ENABLE_FEAT_F4HWN_SLEEP
if(gWakeUp)
{
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 250; // deep sleep now indexed on BatSav
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 200; // deep sleep now indexed on BatSav
}
else
{

View File

@@ -44,10 +44,10 @@ BOOT_Mode_t BOOT_GetMode(void)
SYSTEM_DelayMs(20);
}
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if (Keys[0] == (10 + gEeprom.SET_KEY))
{
return BOOT_MODE_MENU_LOCK; // Secret KEY pressed
return BOOT_MODE_RESCUE_OPS; // Secret KEY pressed
}
#endif
@@ -111,6 +111,10 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
gEeprom.BACKLIGHT_TIME = 61;
gEeprom.KEY_LOCK = 0;
#ifdef ENABLE_FEAT_F4HWN
gEeprom.CURRENT_STATE = 0; // Don't scan if scan resume is active...
#endif
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
}
#endif

View File

@@ -24,8 +24,8 @@ enum BOOT_Mode_t
{
BOOT_MODE_NORMAL = 0,
BOOT_MODE_F_LOCK,
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
BOOT_MODE_MENU_LOCK,
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
BOOT_MODE_RESCUE_OPS,
#endif
#ifdef ENABLE_AIRCOPY
BOOT_MODE_AIRCOPY

20
main.c
View File

@@ -131,13 +131,14 @@ void Main(void)
BOOT_Mode_t BootMode = BOOT_GetMode();
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
if (BootMode == BOOT_MODE_MENU_LOCK)
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if (BootMode == BOOT_MODE_RESCUE_OPS)
{
gEeprom.MENU_LOCK = !gEeprom.MENU_LOCK;
SETTINGS_SaveSettings();
}
/*
if(gEeprom.MENU_LOCK == true) // Force Main Only
{
gEeprom.DUAL_WATCH = 0;
@@ -145,9 +146,10 @@ void Main(void)
//gFlagReconfigureVfos = true;
//gUpdateStatus = true;
}
*/
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if (BootMode == BOOT_MODE_F_LOCK && gEeprom.MENU_LOCK == true)
{
BootMode = BOOT_MODE_NORMAL;
@@ -170,7 +172,7 @@ void Main(void)
#ifdef ENABLE_NOAA
gMenuCursor += 1; // move to hidden section, fix me if change... !!!
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
gMenuCursor += 1; // move to hidden section, fix me if change... !!!
#endif
gSubMenuSelection = gSetting_F_LOCK;
@@ -245,6 +247,16 @@ void Main(void)
bIsInLockScreen = true;
UI_DisplayLock();
bIsInLockScreen = false;
// 500ms
for (int i = 0; i < 50;)
{
i = (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && KEYBOARD_Poll() == KEY_INVALID) ? i + 1 : 0;
SYSTEM_DelayMs(10);
}
gKeyReading0 = KEY_INVALID;
gKeyReading1 = KEY_INVALID;
gDebounceCounter = 0;
}
#endif

4
misc.c
View File

@@ -137,6 +137,10 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
uint8_t crc[15] = { 0 };
uint8_t lErrorsDuringAirCopy = 0;
uint8_t gAircopyStep = 0;
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
bool gPowerHigh = false;
bool gRemoveOffset = false;
#endif
#endif
#ifdef ENABLE_AUDIO_BAR

4
misc.h
View File

@@ -190,6 +190,10 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
extern uint8_t crc[15];
extern uint8_t lErrorsDuringAirCopy;
extern uint8_t gAircopyStep;
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
extern bool gPowerHigh;
extern bool gRemoveOffset;
#endif
#endif
#ifdef ENABLE_AUDIO_BAR

14
radio.c
View File

@@ -428,6 +428,20 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
pVfo->Compander = att.compander;
RADIO_ConfigureSquelchAndOutputPower(pVfo);
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(gRemoveOffset)
{
pVfo->pTX = &pVfo->freq_config_RX;
gRequestSaveChannel = 1;
}
if(gPowerHigh)
{
pVfo->OUTPUT_POWER = OUTPUT_POWER_HIGH;
gRequestSaveChannel = 1;
}
#endif
}
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)

View File

@@ -51,7 +51,7 @@ void SETTINGS_InitEEPROM(void)
#ifdef ENABLE_NOAA
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
gEeprom.KEY_LOCK = (Data[4] & 0x01) != 0;
gEeprom.MENU_LOCK = (Data[4] & 0x02) != 0;
gEeprom.SET_KEY = ((Data[4] >> 2) & 0x0F) > 4 ? 0 : (Data[4] >> 2) & 0x0F;
@@ -597,7 +597,7 @@ void SETTINGS_SaveSettings(void)
State[3] = false;
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
State[4] = (gEeprom.KEY_LOCK ? 0x01 : 0) | (gEeprom.MENU_LOCK ? 0x02 :0) | ((gEeprom.SET_KEY & 0x0F) << 2);
#else
State[4] = gEeprom.KEY_LOCK;
@@ -999,7 +999,7 @@ State[1] = 0
#ifdef ENABLE_SPECTRUM
| (1 << 5)
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
| (1 << 6)
#endif
;

View File

@@ -117,6 +117,10 @@ enum ACTION_OPT_t {
ACTION_OPT_PTT,
ACTION_OPT_WN,
ACTION_OPT_BACKLIGHT,
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
ACTION_OPT_POWER_HIGH,
ACTION_OPT_REMOVE_OFFSET,
#endif
#endif
ACTION_OPT_LEN
};
@@ -186,7 +190,7 @@ typedef struct {
#ifdef ENABLE_FEAT_F4HWN
bool KEY_LOCK_PTT;
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
bool MENU_LOCK;
uint8_t SET_KEY;
#endif

View File

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

110
ui/main.c
View File

@@ -57,23 +57,13 @@ center_line_t center_line = CENTER_LINE_NONE;
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
static bool isMainOnly(bool checkGui)
{
if(checkGui)
{
if(((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0) || gSetting_set_gui)
return true;
else
return false;
}
else
static bool isMainOnly()
{
if((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
return true;
else
return false;
}
}
#endif
const int8_t dBmCorrTable[7] = {
@@ -204,7 +194,7 @@ void UI_DisplayAudioBar(void)
RxBlinkLedCounter = 0;
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
unsigned int line;
if (isMainOnly(false))
if (isMainOnly())
{
line = 5;
}
@@ -276,7 +266,7 @@ void DisplayRSSIBar(const bool now)
*/
unsigned int line;
if (isMainOnly(false))
if (isMainOnly())
{
line = 5;
}
@@ -383,7 +373,7 @@ void DisplayRSSIBar(const bool now)
#endif
#ifdef ENABLE_FEAT_F4HWN
if (isMainOnly(true))
if (gSetting_set_gui)
{
sprintf(str, "%3d", -rssi_dBm);
UI_PrintStringSmallNormal(str, LCD_WIDTH + 8, 0, line - 1);
@@ -391,6 +381,9 @@ void DisplayRSSIBar(const bool now)
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);
}
@@ -581,7 +574,7 @@ void UI_DisplayMain(void)
SYSTEM_DelayMs(50);
*/
if(isMainOnly(false))
if(isMainOnly())
{
shift = 5;
}
@@ -606,7 +599,7 @@ void UI_DisplayMain(void)
const unsigned int line0 = 0; // text screen line
const unsigned int line1 = 4;
unsigned int line;
if (isMainOnly(false))
if (isMainOnly())
{
line = 0;
}
@@ -629,7 +622,7 @@ void UI_DisplayMain(void)
#endif
#ifdef ENABLE_FEAT_F4HWN
if (isMainOnly(false))
if (isMainOnly())
{
if (activeTxVFO != vfo_num)
{
@@ -639,7 +632,7 @@ void UI_DisplayMain(void)
#endif
#ifdef ENABLE_FEAT_F4HWN
if (activeTxVFO != vfo_num || isMainOnly(false))
if (activeTxVFO != vfo_num || isMainOnly())
#else
if (activeTxVFO != vfo_num) // this is not active TX VFO
#endif
@@ -653,7 +646,7 @@ void UI_DisplayMain(void)
uint8_t shift = 0;
if (isMainOnly(false))
if (isMainOnly())
{
shift = 3;
}
@@ -664,7 +657,7 @@ void UI_DisplayMain(void)
sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000);
UI_PrintStringSmallNormal(String, 56, 0, line + shift + 1);
if (!isMainOnly(false))
if (!isMainOnly())
continue;
}
else
@@ -723,7 +716,7 @@ void UI_DisplayMain(void)
}
#ifdef ENABLE_FEAT_F4HWN
if (isMainOnly(false))
if (isMainOnly())
{
UI_PrintString(pPrintStr, 2, 0, 5, 8);
isMainOnlyInputDTMF = true;
@@ -759,7 +752,7 @@ void UI_DisplayMain(void)
if(TX_freq_check(frequency) != 0 && gEeprom.VfoInfo[vfo_num].TX_LOCK == true)
{
if(isMainOnly(false))
if(isMainOnly())
memcpy(p_line0 + 14, BITMAP_VFO_Lock, sizeof(BITMAP_VFO_Lock));
else
memcpy(p_line0 + 24, BITMAP_VFO_Lock, sizeof(BITMAP_VFO_Lock));
@@ -806,7 +799,7 @@ void UI_DisplayMain(void)
#ifdef ENABLE_FEAT_F4HWN
else
{
if(RxOnVfofrequency == frequency && !isMainOnly(false))
if(RxOnVfofrequency == frequency && !isMainOnly())
{
UI_PrintStringSmallNormal(">>", 8, 0, line);
//memcpy(p_line0 + 14, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
@@ -899,6 +892,9 @@ void UI_DisplayMain(void)
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num]))
{ // it's a channel
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(gEeprom.MENU_LOCK == false) {
#endif
uint8_t countList = 0;
uint8_t shiftList = 0;
@@ -938,14 +934,11 @@ void UI_DisplayMain(void)
memcpy(p_line0 + 127 - (1 * 6), BITMAP_ScanListE, sizeof(BITMAP_ScanListE));
}
/*
if (att.scanlist1)
memcpy(p_line0 + 107, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
if (att.scanlist2)
memcpy(p_line0 + 114, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
if (att.scanlist3)
memcpy(p_line0 + 121, BITMAP_ScanList3, sizeof(BITMAP_ScanList3));
*/
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
{
}
}
#endif
// compander symbol
#ifndef ENABLE_BIG_FREQ
@@ -995,7 +988,7 @@ void UI_DisplayMain(void)
}
else {
#ifdef ENABLE_FEAT_F4HWN
if (isMainOnly(false))
if (isMainOnly())
{
UI_PrintString(String, 32, 0, line, 8);
}
@@ -1014,7 +1007,7 @@ void UI_DisplayMain(void)
#endif
#ifdef ENABLE_FEAT_F4HWN
if (isMainOnly(false))
if (isMainOnly())
{
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
if(frequency < _1GHz_in_KHz) {
@@ -1161,12 +1154,12 @@ void UI_DisplayMain(void)
shift = -10;
}
if (isMainOnly(true))
if (gSetting_set_gui)
{
UI_PrintStringSmallNormal(s, LCD_WIDTH + 22, 0, line + 1);
UI_PrintStringSmallNormal(t, LCD_WIDTH + 2, 0, line + 1);
if (isMainOnly(false) && !gDTMF_InputMode)
if (isMainOnly() && !gDTMF_InputMode)
{
if(shift == 0)
{
@@ -1220,7 +1213,7 @@ void UI_DisplayMain(void)
userPower = false;
}
if (isMainOnly(true))
if (gSetting_set_gui)
{
const char pwr_short[][3] = {"L1", "L2", "L3", "L4", "L5", "M", "H"};
sprintf(String, "%s", pwr_short[currentPower]);
@@ -1242,16 +1235,38 @@ void UI_DisplayMain(void)
if (vfoInfo->freq_config_RX.Frequency != vfoInfo->freq_config_TX.Frequency)
{ // show the TX offset symbol
const char dir_list[][2] = {"", "+", "-"};
int i = vfoInfo->TX_OFFSET_FREQUENCY_DIRECTION % 3;
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
const char dir_list[][2] = {"", "+", "-", "D"};
if(gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION != 0 && gTxVfo->pTX == &gTxVfo->freq_config_RX && !vfoInfo->FrequencyReverse)
{
i = 3;
}
#else
const char dir_list[][2] = {"", "+", "-"};
#endif
#if ENABLE_FEAT_F4HWN
if (isMainOnly(true))
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);
@@ -1262,7 +1277,7 @@ void UI_DisplayMain(void)
if (vfoInfo->FrequencyReverse)
#if ENABLE_FEAT_F4HWN
{
if (isMainOnly(true))
if (gSetting_set_gui)
{
UI_PrintStringSmallNormal("R", LCD_WIDTH + 68, 0, line + 1);
}
@@ -1284,7 +1299,7 @@ void UI_DisplayMain(void)
narrower = 1;
}
if (isMainOnly(true))
if (gSetting_set_gui)
{
const char *bandWidthNames[] = {"W", "N", "N+"};
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], LCD_WIDTH + 80, 0, line + 1);
@@ -1295,7 +1310,7 @@ void UI_DisplayMain(void)
GUI_DisplaySmallest(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], 91, line == 0 ? 17 : 49, false, true);
}
#else
if (isMainOnly(true))
if (gSetting_set_gui)
{
const char *bandWidthNames[] = {"W", "N"};
UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], LCD_WIDTH + 80, 0, line + 1);
@@ -1331,7 +1346,7 @@ void UI_DisplayMain(void)
sprintf(String, "%s", "MONI");
}
if (isMainOnly(true))
if (gSetting_set_gui)
{
if(!gMonitor)
{
@@ -1412,7 +1427,7 @@ void UI_DisplayMain(void)
sprintf(String, "DTMF %s", gDTMF_RX_live + idx);
#ifdef ENABLE_FEAT_F4HWN
if (isMainOnly(false))
if (isMainOnly())
{
UI_PrintStringSmallNormal(String, 2, 0, 5);
}
@@ -1464,7 +1479,11 @@ void UI_DisplayMain(void)
}
#ifdef ENABLE_FEAT_F4HWN
if (isMainOnly(false) && !gDTMF_InputMode)
//#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
//if(gEeprom.MENU_LOCK == false)
//{
//#endif
if (isMainOnly() && !gDTMF_InputMode)
{
sprintf(String, "VFO %s", activeTxVFO ? "B" : "A");
UI_PrintStringSmallBold(String, 92, 0, 6);
@@ -1473,6 +1492,9 @@ void UI_DisplayMain(void)
gFrameBuffer[6][i] ^= 0x7F;
}
}
//#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
//}
//#endif
#endif
ST7565_BlitFullScreen();

View File

@@ -158,7 +158,7 @@ const t_menu_item MenuList[] =
#ifdef ENABLE_FEAT_F4HWN_VOL
{"SetVol", MENU_SET_VOL },
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
{"SetKey", MENU_SET_KEY },
#endif
#endif
@@ -401,7 +401,7 @@ const char gSubMenu_SCRAMBLER[][7] =
};
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
const char gSubMenu_SET_KEY[][9] =
{
"KEY_MENU",
@@ -446,6 +446,10 @@ const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
{"MAIN ONLY", ACTION_OPT_MAINONLY},
{"PTT", ACTION_OPT_PTT},
{"WIDE\nNARROW", ACTION_OPT_WN},
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
{"POWER\nHIGH", ACTION_OPT_POWER_HIGH},
{"REMOVE\nOFFSET", ACTION_OPT_REMOVE_OFFSET},
#endif
#endif
};
@@ -1080,7 +1084,7 @@ void UI_DisplayMenu(void)
break;
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
case MENU_SET_KEY:
strcpy(String, gSubMenu_SET_KEY[gSubMenuSelection]);
break;
@@ -1132,12 +1136,14 @@ void UI_DisplayMenu(void)
UI_PrintStringSmallNormal(edit, 54, 127, 1);
#ifdef ENABLE_SPECTRUM
#ifndef ENABLE_FMRADIO
#if defined(ENABLE_SPECTRUM) && defined(ENABLE_FMRADIO)
UI_PrintStringSmallNormal("Voxless", 54, 127, 6);
#elif defined(ENABLE_SPECTRUM)
UI_PrintStringSmallNormal("Bandscope", 54, 127, 6);
#endif
#else
#elif defined(ENABLE_FMRADIO)
UI_PrintStringSmallNormal("Broadcast", 54, 127, 6);
#elif defined(ENABLE_FEAT_F4HWN_RESCUE_OPS)
UI_PrintStringSmallNormal("RescueOps", 54, 127, 6);
#endif
y = 2;

View File

@@ -147,7 +147,7 @@ enum
#ifdef ENABLE_FEAT_F4HWN_VOL
MENU_SET_VOL,
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
MENU_SET_KEY,
#endif
#endif
@@ -190,7 +190,7 @@ extern const char gSubMenu_D_RSP[4][11];
#ifdef ENABLE_FEAT_F4HWN_NARROWER
extern const char gSubMenu_SET_NFM[2][9];
#endif
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
extern const char gSubMenu_SET_KEY[][9];
#endif
#endif

View File

@@ -154,6 +154,13 @@ void UI_DisplayStatus()
else
#endif
{
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(gEeprom.MENU_LOCK == true) {
memcpy(line + x + 2, gFontRO, sizeof(gFontRO));
}
else
{
#endif
uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
if(dw == 1 || dw == 3) { // DWR - dual watch + respond
if(gDualWatchActive)
@@ -168,6 +175,9 @@ void UI_DisplayStatus()
{
memcpy(line + x + 2, gFontMO, sizeof(gFontMO));
}
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
}
#endif
}
}
x += sizeof(gFontDWR) + 3;
@@ -203,21 +213,14 @@ void UI_DisplayStatus()
memcpy(line + x + 1, gFontKeyLock, sizeof(gFontKeyLock));
}
else if (gWasFKeyPressed) {
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(gEeprom.MENU_LOCK == false) {
memcpy(line + x + 1, gFontF, sizeof(gFontF));
/*
UI_PrintStringSmallBufferNormal("F", line + x + 1);
for (uint8_t i = 71; i < 79; i++)
{
gStatusLine[i] ^= 0x7F;
}
*/
}
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
else if(gEeprom.MENU_LOCK == true) {
memcpy(line + x + 1, gFontR, sizeof(gFontR));
}
#else
memcpy(line + x + 1, gFontF, sizeof(gFontF));
#endif
}
else if (gBackLight)
{
memcpy(line + x + 1, gFontLight, sizeof(gFontLight));

View File

@@ -134,8 +134,8 @@ void UI_DisplayWelcome(void)
UI_PrintStringSmallNormal(WelcomeString3, 0, 127, 6);
/*
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#if ENABLE_FEAT_F4HWN_MENU_LOCK > 1
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
#if ENABLE_FEAT_F4HWN_RESCUE_OPS > 1
UI_PrintStringSmallNormal(Edition, 18, 0, 6);
if(gEeprom.MENU_LOCK == true) {
memcpy(gFrameBuffer[6] + 103, BITMAP_Ready, sizeof(BITMAP_Ready));
@@ -148,7 +148,7 @@ void UI_DisplayWelcome(void)
UI_PrintStringSmallNormal(Edition, 18, 0, 5);
memcpy(gFrameBuffer[5] + 103, BITMAP_Ready, sizeof(BITMAP_Ready));
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
UI_PrintStringSmallNormal("RescueOps", 18, 0, 6);
if(gEeprom.MENU_LOCK == true) {
memcpy(gFrameBuffer[6] + 103, BITMAP_Ready, sizeof(BITMAP_Ready));
@@ -174,7 +174,7 @@ void UI_DisplayWelcome(void)
UI_PrintStringSmallNormal("Bandscope ", 0, 127, 5);
memcpy(gFrameBuffer[5] + 95, BITMAP_Ready, sizeof(BITMAP_Ready));
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
UI_PrintStringSmallNormal("RescueOps ", 0, 127, 6);
if(gEeprom.MENU_LOCK == true) {
memcpy(gFrameBuffer[6] + 95, BITMAP_Ready, sizeof(BITMAP_Ready));
@@ -184,7 +184,7 @@ void UI_DisplayWelcome(void)
#endif
#endif
#else
#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
UI_PrintStringSmallNormal("RescueOps ", 0, 127, 5);
if(gEeprom.MENU_LOCK == true) {
memcpy(gFrameBuffer[5] + 95, BITMAP_Ready, sizeof(BITMAP_Ready));