Merge branch 'feature_update_v4' into REGA

This commit is contained in:
Armel FAUVEAU
2025-02-12 02:43:31 +01:00
committed by GitHub
30 changed files with 350 additions and 128 deletions

View File

@@ -1,49 +1,24 @@
name: Build Firmware
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-22.04
container:
image: archlinux:latest
runs-on: ubuntu-latest
steps:
- name: base-devel
run: pacman -Syyu base-devel --noconfirm
- name: arm-none-eabi-gcc
run: pacman -Syyu arm-none-eabi-gcc --noconfirm
- name: arm-none-eabi-newlib
run: pacman -Syyu arm-none-eabi-newlib --noconfirm
- name: git
run: pacman -Syyu git --noconfirm
- name: python-pip
run: pacman -Syyu python-pip --noconfirm
- name: python-crcmod
run: pacman -Syyu python-crcmod --noconfirm
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
- name: safe.directory
run: git config --global --add safe.directory /__w/uv-k5-firmware-custom/uv-k5-firmware-custom
- name: Make
run: make
- name: size
run: arm-none-eabi-size firmware
- name: Compile firmware
run: |
chmod +x compile-with-docker.sh
./compile-with-docker.sh
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: firmware
path: firmware*.bin
- name: Upload binaries to release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: firmware.packed.bin
asset_name: egzumer_$tag.packed.bin
tag: ${{ github.ref }}
overwrite: true
release_name: release ${{ github.ref_name }}
- name: Upload firmware artifact
uses: actions/upload-artifact@v4
with:
name: firmware-artifact
path: compiled-firmware/f4hwn.packed.bin

View File

@@ -3,7 +3,7 @@
# 0 = disable
# 1 = enable
# ---- STOCK QUANSHENG FERATURES ----
# ---- STOCK QUANSHENG FEATURES ----
ENABLE_FMRADIO ?= 0
ENABLE_UART ?= 1
ENABLE_AIRCOPY ?= 0
@@ -228,7 +228,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1)
VERSION_STRING_1 ?= v0.22
AUTHOR_STRING_2 ?= F4HWN
VERSION_STRING_2 ?= v3.9
VERSION_STRING_2 ?= v4.0
EDITION_STRING ?= Custom

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 (4 times), 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), Mike DL2MF, Eric KI1C (2 times), Phil G0ELM, Jérôme Lambert, Meinhard Frank Günther and Eliot Vedel for their [donations](https://www.paypal.com/paypalme/F4HWN). Thats so kind of them. Thanks so much 🙏🏻
Special thanks to Jean-Cyrille F6IWW (2 times), Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas (4 times), Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern (3 times), 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), Mike DL2MF, Eric KI1C (2 times), Phil G0ELM, Jérôme Lambert, Meinhard Frank Günther, Eliot Vedel, Alfonso EA7KDF, Jean-François F1EVM and Robert DC1RDB for their [donations](https://www.paypal.com/paypalme/F4HWN). Thats so kind of them. Thanks so much 🙏🏻
## Table of Contents
@@ -238,7 +238,10 @@ This is the least demanding option as you don't have to install enything on your
### Docker build method
If you have docker installed you can use [compile-with-docker.bat](./compile-with-docker.bat) (Windows) or [compile-with-docker.sh](./compile-with-docker.sh) (Linux/Mac), the output files are created in `compiled-firmware` folder. This method gives significantly smaller binaries, I've seen differences up to 1kb, so it can fit more functionalities this way. The challenge can be (or not) installing docker itself. You may need to uncomment and customize the DOCKER_NETWORK environment variable in the script.
If you have docker installed you can use [compile-with-docker.bat](./compile-with-docker.bat) (Windows) or [compile-with-docker.sh](./compile-with-docker.sh) (Linux/Mac), the output files are created in `compiled-firmware` folder. This method gives significantly smaller binaries, I've seen differences up to 1kb, so it can fit more functionalities this way. The challenge can be (or not) installing docker itself.
> [!TIP]
> On Linux/Mac, you may need to uncomment and customize the DOCKER_NETWORK environment variable at the beginning of the [compile-with-docker.sh](./compile-with-docker.sh) script. Note: this can introduce security risks by removing network isolation. However, if you encounter issues and are using a specific network environment (with a proxy or a firewall), this may help.
### Windows environment build method

View File

@@ -114,6 +114,11 @@ void (*action_opt_table[])(void) = {
[ACTION_OPT_PTT] = &ACTION_Ptt,
[ACTION_OPT_WN] = &ACTION_Wn,
[ACTION_OPT_BACKLIGHT] = &ACTION_BackLight,
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
[ACTION_OPT_MUTE] = &ACTION_Mute,
#else
[ACTION_OPT_MUTE] = &FUNCTION_NOP,
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
[ACTION_OPT_POWER_HIGH] = &ACTION_Power_High,
[ACTION_OPT_REMOVE_OFFSET] = &ACTION_Remove_Offset,
@@ -632,6 +637,27 @@ void ACTION_BackLightOnDemand(void)
BACKLIGHT_TurnOn();
}
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
void ACTION_Mute(void)
{
// Toggle mute state
gMute = !gMute;
// Update the registers
#ifdef ENABLE_FMRADIO
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, gMute ? 0x0A10 : 0x0A1F);
#endif
gEeprom.VOLUME_GAIN = gMute ? 0 : gEeprom.VOLUME_GAIN_BACKUP;
BK4819_WriteRegister(BK4819_REG_48,
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
(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)
gUpdateStatus = true;
}
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
void ACTION_Power_High(void)
{

View File

@@ -42,6 +42,9 @@ void ACTION_SwitchDemodul(void);
void ACTION_Wn(void);
void ACTION_BackLightOnDemand(void);
void ACTION_BackLight(void);
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
void ACTION_Mute(void);
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
void ACTION_Power_High(void);
void ACTION_Remove_Offset(void);

View File

@@ -103,7 +103,6 @@ static_assert(ARRAY_SIZE(ProcessKeysFunctions) == DISPLAY_N_ELEM-1);
static_assert(ARRAY_SIZE(ProcessKeysFunctions) == DISPLAY_N_ELEM);
#endif
static void CheckForIncoming(void)
{
if (!g_SquelchLost)

View File

@@ -78,6 +78,7 @@ void CHFRSCANNER_Start(const bool storeBackupSettings, const int8_t scan_directi
gScanPauseMode = false;
}
/*
void CHFRSCANNER_ContinueScanning(void)
{
if (IS_FREQ_CHANNEL(gNextMrChannel))
@@ -99,6 +100,24 @@ void CHFRSCANNER_ContinueScanning(void)
gRxReceptionMode = RX_MODE_NONE;
gScheduleScanListen = false;
}
*/
void CHFRSCANNER_ContinueScanning(void)
{
if (gCurrentFunction == FUNCTION_INCOMING &&
(IS_FREQ_CHANNEL(gNextMrChannel) || gCurrentCodeType == CODE_TYPE_OFF))
{
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE);
}
else
{
IS_FREQ_CHANNEL(gNextMrChannel) ? NextFreqChannel() : NextMemChannel();
}
gScanPauseMode = false;
gRxReceptionMode = RX_MODE_NONE;
gScheduleScanListen = false;
}
void CHFRSCANNER_Found(void)
{

View File

@@ -363,6 +363,7 @@ void channelMoveSwitch(void) {
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // user is entering channel number
uint16_t Channel = 0;
/*
switch (gInputBoxIndex)
{
case 1:
@@ -375,6 +376,11 @@ void channelMoveSwitch(void) {
Channel = (gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2];
break;
}
*/
for (uint8_t i = 0; i < gInputBoxIndex; i++) {
Channel = (Channel * 10) + gInputBox[i];
}
if ((Channel == 0) && (gInputBoxIndex != 3)) {
return;

View File

@@ -1567,6 +1567,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
Offset = (Max >= 100) ? 3 : (Max >= 10) ? 2 : 1;
/*
switch (gInputBoxIndex)
{
case 1:
@@ -1579,6 +1580,11 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
Value = (gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2];
break;
}
*/
for (uint8_t i = 0; i < gInputBoxIndex; i++) {
Value = (Value * 10) + gInputBox[i];
}
if (Offset == gInputBoxIndex)
gInputBoxIndex = 0;
@@ -1937,8 +1943,8 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
VFO = 2;
break;
case MENU_SLIST1:
VFO = 1;
bCheckScanList = true;
VFO = 1;
break;
default:

View File

@@ -870,13 +870,20 @@ uint8_t Rssi2Y(uint16_t rssi)
#ifdef ENABLE_FEAT_F4HWN_SPECTRUM
static void DrawSpectrum()
{
uint16_t steps = GetStepsCount();
// max bars at 128 to correctly draw larger numbers of samples
uint8_t bars = (steps > 128) ? 128 : steps;
// shift to center bar on freq marker
uint8_t shift_graph = 64 / steps + 1;
uint8_t ox = 0;
for (uint8_t i = 0; i < 128; ++i)
{
uint16_t rssi = rssiHistory[i >> settings.stepsCount];
if (rssi != RSSI_MAX_VALUE)
{
uint8_t x = i * 128 / GetStepsCount();
// stretch bars to fill the screen width
uint8_t x = i * 128 / bars + shift_graph;
for (uint8_t xx = ox; xx < x; xx++)
{
DrawVLine(Rssi2Y(rssi), DrawingEndY, xx, true);

View File

@@ -210,29 +210,26 @@ static void SendVersion(void)
SendReply(&Reply, sizeof(Reply));
}
#ifndef ENABLE_FEAT_F4HWN
static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse)
{
#ifdef ENABLE_FEAT_F4HWN
UNUSED(pKey);
UNUSED(pIn);
UNUSED(pResponse);
#else
unsigned int i;
uint32_t IV[4];
unsigned int i;
uint32_t IV[4];
IV[0] = 0;
IV[1] = 0;
IV[2] = 0;
IV[3] = 0;
IV[0] = 0;
IV[1] = 0;
IV[2] = 0;
IV[3] = 0;
AES_Encrypt(pKey, IV, pIn, IV, true);
AES_Encrypt(pKey, IV, pIn, IV, true);
for (i = 0; i < 4; i++)
if (IV[i] != pResponse[i])
return true;
for (i = 0; i < 4; i++)
if (IV[i] != pResponse[i])
return true;
#endif
return false;
}
#endif
// session init, sends back version info and state
// timestamp is a session id really
@@ -360,6 +357,7 @@ static void CMD_0529(void)
SendReply(&Reply, sizeof(Reply));
}
#ifndef ENABLE_FEAT_F4HWN
static void CMD_052D(const uint8_t *pBuffer)
{
const CMD_052D_t *pCmd = (const CMD_052D_t *)pBuffer;
@@ -400,6 +398,7 @@ static void CMD_052D(const uint8_t *pBuffer)
SendReply(&Reply, sizeof(Reply));
}
#endif
// session init, sends back version info and state
// timestamp is a session id really
@@ -600,10 +599,12 @@ void UART_HandleCommand(void)
case 0x0529:
CMD_0529();
break;
case 0x052D:
CMD_052D(UART_Command.Buffer);
break;
#ifndef ENABLE_FEAT_F4HWN
case 0x052D:
CMD_052D(UART_Command.Buffer);
break;
#endif
case 0x052F:
CMD_052F(UART_Command.Buffer);

View File

@@ -57,6 +57,22 @@ const uint8_t gFontLight[9] =
0b00001100,
};
const uint8_t gFontMute[12] =
{
0b00011100,
0b00011100,
0b00010100,
0b00100010,
0b01000001,
0b01111111,
0b00000000,
0b00100010,
0b00010100,
0b00001000,
0b00010100,
0b00100010,
};
const uint8_t gFontXB[2][6] =
{ // "XB"
{0x00, 0x63, 0x14, 0x8, 0x14, 0x63},
@@ -240,7 +256,7 @@ const uint8_t BITMAP_ScanListE[7] =
const uint8_t BITMAP_ScanList123[19] =
{
// 'All' symbol
// '123' symbol
0b01111111,
0b01111111,
0b01111011,

View File

@@ -12,6 +12,7 @@ extern const uint8_t gFontS[6];
extern const uint8_t gFontKeyLock[9];
extern const uint8_t gFontLight[9];
extern const uint8_t gFontMute[12];
extern const uint8_t gFontXB[2][6];
extern const uint8_t gFontMO[2][6];

View File

@@ -36,6 +36,8 @@ bandscope() {
ENABLE_SPECTRUM=1 \
ENABLE_FMRADIO=0 \
ENABLE_AIRCOPY=1 \
ENABLE_FEAT_F4HWN_PMR=0 \
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=0 \
ENABLE_NOAA=0 \
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
EDITION_STRING=Bandscope \
@@ -49,6 +51,8 @@ broadcast() {
ENABLE_SPECTRUM=0 \
ENABLE_FMRADIO=1 \
ENABLE_AIRCOPY=1 \
ENABLE_FEAT_F4HWN_PMR=0 \
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=0 \
ENABLE_NOAA=0 \
EDITION_STRING=Broadcast \
ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \
@@ -65,6 +69,8 @@ voxless() {
ENABLE_AIRCOPY=0 \
ENABLE_AUDIO_BAR=0 \
ENABLE_FEAT_F4HWN_SPECTRUM=0 \
ENABLE_FEAT_F4HWN_PMR=0 \
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=0 \
ENABLE_NOAA=0 \
ENABLE_FEAT_F4HWN_RESTORE_SCAN=0 \
ENABLE_FEAT_F4HWN_CHARGING_C=0 \
@@ -81,6 +87,8 @@ rescueops() {
ENABLE_SPECTRUM=0 \
ENABLE_FMRADIO=0 \
ENABLE_AIRCOPY=1 \
ENABLE_FEAT_F4HWN_PMR=0 \
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=0 \
ENABLE_NOAA=1 \
ENABLE_FEAT_F4HWN_RESCUE_OPS=1 \
EDITION_STRING=RescueOps \
@@ -111,6 +119,7 @@ case "$1" in
bandscope
broadcast
rescueops
voxless
;;
*)
echo "Usage: $0 {custom|bandscope|broadcast|voxless|standard|all}"

View File

@@ -68,7 +68,11 @@ void BK1080_Init(uint16_t freq, uint8_t band/*, uint8_t space*/)
BK1080_WriteRegister(BK1080_REG_02_POWER_CONFIGURATION, 0x0201);
}
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, 0x0A1F);
#ifdef ENABLE_FEAT_F4HWN
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, gMute ? 0x0A10 : 0x0A1F);
#else
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, 0x0A1F);
#endif
BK1080_SetFrequency(freq, band/*, space*/);
}
else {

View File

@@ -620,7 +620,6 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
// with weak RX signals the RX bandwidth is reduced
val = 0x3428; // Old value 0x45a8 < v3.6
}
break;
case BK4819_FILTER_BW_NARROW: // 12.5kHz
@@ -631,7 +630,6 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
// with weak RX signals the RX bandwidth is reduced
val = 0x3448; // Old value 0x4408 < v3.6
}
break;
case BK4819_FILTER_BW_NARROWER: // 6.25kHz
@@ -653,7 +651,6 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b
// with weak RX signals the RX bandwidth is reduced
val = 0x4458;
}
break;
*/
}

View File

@@ -224,6 +224,7 @@ 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;
@@ -238,6 +239,7 @@ uint8_t cmds[] = {
gFrameBuffer[line][i] = (i <= filled) ? 0x2d : 0x21;
}
}
#endif
#endif
void ST7565_Init(void)

View File

@@ -43,7 +43,9 @@ void ST7565_WriteByte(uint8_t Value);
#ifdef ENABLE_FEAT_F4HWN
void ST7565_ContrastAndInv(void);
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
void ST7565_Gauge(uint8_t line, uint8_t min, uint8_t max, uint8_t value);
#endif
int16_t map(int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max);
#endif

View File

@@ -255,6 +255,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
UI_DisplayStatus();
}
/*
switch (Function) {
case FUNCTION_FOREGROUND:
FUNCTION_Foreground(PreviousFunction);
@@ -278,6 +279,23 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
default:
break;
}
*/
if (Function == FUNCTION_FOREGROUND) {
FUNCTION_Foreground(PreviousFunction);
return;
}
if (Function == FUNCTION_POWER_SAVE) {
FUNCTION_PowerSave();
return;
}
if (Function == FUNCTION_TRANSMIT) {
FUNCTION_Transmit();
} else if (Function == FUNCTION_MONITOR) {
gMonitor = true;
}
gBatterySaveCountdown_10ms = battery_save_count_10ms;
gSchedulePowerSave = false;

2
main.c
View File

@@ -164,7 +164,7 @@ void Main(void)
gEeprom.KEY_LOCK = 0;
SETTINGS_SaveSettings();
#ifndef ENABLE_VOX
gMenuCursor = 65; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
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

1
misc.c
View File

@@ -308,6 +308,7 @@ uint8_t gIsLocked = 0xFF;
#ifdef ENABLE_FEAT_F4HWN
bool gK5startup = true;
bool gBackLight = false;
bool gMute = false;
uint8_t gBacklightTimeOriginal;
uint8_t gBacklightBrightnessOld;
uint8_t gPttOnePushCounter = 0;

1
misc.h
View File

@@ -377,6 +377,7 @@ extern volatile uint8_t boot_counter_10ms;
#ifdef ENABLE_FEAT_F4HWN
extern bool gK5startup;
extern bool gBackLight;
extern bool gMute;
extern uint8_t gBacklightTimeOriginal;
extern uint8_t gBacklightBrightnessOld;
extern uint8_t gPttOnePushCounter;

16
radio.c
View File

@@ -572,6 +572,7 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
}
*/
/*
for(uint8_t p = 0; p < 3; p++)
{
switch (currentPower)
@@ -599,6 +600,21 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
break;
}
}
*/
static const uint8_t dividers[6] = { 25, 19, 13, 10, 7, 4};
for (uint8_t p = 0; p < 3; p++)
{
if (currentPower < 6)
{
Txp[p] = (Txp[p] * (currentPower == 5 ? 3 : 4)) / dividers[currentPower];
}
else // case 6
{
Txp[p] += 30;
}
}
#else
#ifdef ENABLE_REDUCE_LOW_MID_TX_POWER
// make low and mid even lower

View File

@@ -77,8 +77,8 @@ void SETTINGS_InitEEPROM(void)
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
gEeprom.BACKLIGHT_TIME = (Data[5] < 62) ? Data[5] : 12;
#ifdef ENABLE_FEAT_F4HWN_NARROWER
gEeprom.TAIL_TONE_ELIMINATION = ((Data[6] & 0x01) < 2) ? (Data[6] & 0x01) : false;
gSetting_set_nfm = (((Data[6] >> 1) & 0x03) < 3) ? ((Data[6] >> 1) & 0x03) : 0;
gEeprom.TAIL_TONE_ELIMINATION = Data[6] & 0x01;
gSetting_set_nfm = (Data[6] >> 1) & 0x01;
#else
gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
#endif
@@ -326,17 +326,19 @@ void SETTINGS_InitEEPROM(void)
gMR_ChannelExclude[i] = false;
}
// 0F30..0F3F
EEPROM_ReadBuffer(0x0F30, gCustomAesKey, sizeof(gCustomAesKey));
bHasCustomAesKey = false;
for (unsigned int i = 0; i < ARRAY_SIZE(gCustomAesKey); i++)
{
if (gCustomAesKey[i] != 0xFFFFFFFFu)
{
bHasCustomAesKey = true;
return;
}
}
// 0F30..0F3F
EEPROM_ReadBuffer(0x0F30, gCustomAesKey, sizeof(gCustomAesKey));
bHasCustomAesKey = false;
#ifndef ENABLE_FEAT_F4HWN
for (unsigned int i = 0; i < ARRAY_SIZE(gCustomAesKey); i++)
{
if (gCustomAesKey[i] != 0xFFFFFFFFu)
{
bHasCustomAesKey = true;
return;
}
}
#endif
#ifdef ENABLE_FEAT_F4HWN
// 1FF0..0x1FF7
@@ -434,6 +436,10 @@ void SETTINGS_LoadCalibration(void)
gEeprom.VOLUME_GAIN = (Misc.VOLUME_GAIN < 64) ? Misc.VOLUME_GAIN : 58;
gEeprom.DAC_GAIN = (Misc.DAC_GAIN < 16) ? Misc.DAC_GAIN : 8;
#ifdef ENABLE_FEAT_F4HWN
gEeprom.VOLUME_GAIN_BACKUP = gEeprom.VOLUME_GAIN;
#endif
BK4819_WriteRegister(BK4819_REG_3B, 22656 + gEeprom.BK4819_XTAL_FREQ_LOW);
// BK4819_WriteRegister(BK4819_REG_3C, gEeprom.BK4819_XTAL_FREQ_HIGH);
}

View File

@@ -117,6 +117,7 @@ enum ACTION_OPT_t {
ACTION_OPT_PTT,
ACTION_OPT_WN,
ACTION_OPT_BACKLIGHT,
ACTION_OPT_MUTE,
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
ACTION_OPT_POWER_HIGH,
ACTION_OPT_REMOVE_OFFSET,
@@ -276,6 +277,9 @@ typedef struct {
bool NOAA_AUTO_SCAN;
#endif
uint8_t VOLUME_GAIN;
#ifdef ENABLE_FEAT_F4HWN
uint8_t VOLUME_GAIN_BACKUP;
#endif
uint8_t DAC_GAIN;
VFO_Info_t VfoInfo[2];

View File

@@ -110,6 +110,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
UI_PrintStringBuffer(pString, gFrameBuffer[Line] + Start, char_width, font);
}
void UI_PrintStringSmallNormal(const char *pString, uint8_t Start, uint8_t End, uint8_t Line)
{
UI_PrintStringSmall(pString, Start, End, Line, ARRAY_SIZE(gFontSmall[0]), (const uint8_t *)gFontSmall);
@@ -180,6 +181,46 @@ void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center)
}
}
/*
void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center)
{
const unsigned int char_width = 13;
uint8_t *pFb0 = gFrameBuffer[Y] + X;
uint8_t *pFb1 = pFb0 + 128;
bool bCanDisplay = false;
if (center) {
uint8_t len = 0;
for (const char *ptr = string; *ptr; ptr++)
if (*ptr != ' ') len++; // Ignores spaces for centering
X -= (len * char_width) / 2; // Centering adjustment
pFb0 = gFrameBuffer[Y] + X;
pFb1 = pFb0 + 128;
}
for (; *string; string++) {
char c = *string;
if (c == '-') c = '9' + 1; // Remap of '-' symbol
if (bCanDisplay || c != ' ') {
bCanDisplay = true;
if (c >= '0' && c <= '9' + 1) {
memcpy(pFb0 + 2, gFontBigDigits[c - '0'], char_width - 3);
memcpy(pFb1 + 2, gFontBigDigits[c - '0'] + char_width - 3, char_width - 3);
} else if (c == '.') {
memset(pFb1, 0x60, 3); // Replaces the three assignments
pFb0 += 3;
pFb1 += 3;
continue;
}
}
pFb0 += char_width;
pFb1 += char_width;
}
}
*/
void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black)
{
const uint8_t pattern = 1 << (y % 8);

View File

@@ -1213,15 +1213,18 @@ void UI_DisplayMain(void)
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);
//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);
//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)
@@ -1364,15 +1367,15 @@ void UI_DisplayMain(void)
*/
if (isMainVFO) {
if (gMonitor) {
sprintf(String, "MONI");
strcpy(String, "MONI");
} else {
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
sprintf(String, "SQL%d", gEeprom.SQUELCH_LEVEL);
}
if (gSetting_set_gui) {
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1);
UI_PrintStringSmallNormal(String, LCD_WIDTH + 98, 0, line + 1);
} else {
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
GUI_DisplaySmallest(String, 110, line == 0 ? 17 : 49, false, true);
}
}
#endif

View File

@@ -86,9 +86,7 @@ const t_menu_item MenuList[] =
{"BatSav", MENU_SAVE }, // was "SAVE"
{"BatTxt", MENU_BAT_TXT },
{"Mic", MENU_MIC },
#ifdef ENABLE_AUDIO_BAR
{"MicBar", MENU_MIC_BAR },
#endif
{"ChDisp", MENU_MDF }, // was "MDF"
{"POnMsg", MENU_PONMSG },
{"BLTime", MENU_ABR }, // was "ABR"
@@ -128,9 +126,7 @@ const t_menu_item MenuList[] =
{"AM Fix", MENU_AM_FIX },
#endif
#endif
#ifdef ENABLE_VOX
{"VOX", MENU_VOX },
#endif
#ifdef ENABLE_FEAT_F4HWN
{"SysInf", MENU_VOL }, // was "VOL"
#else
@@ -455,6 +451,9 @@ const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
{"MAIN ONLY", ACTION_OPT_MAINONLY},
{"PTT", ACTION_OPT_PTT},
{"WIDE\nNARROW", ACTION_OPT_WN},
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
{"MUTE", ACTION_OPT_MUTE},
#endif
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
{"POWER\nHIGH", ACTION_OPT_POWER_HIGH},
{"REMOVE\nOFFSET", ACTION_OPT_REMOVE_OFFSET},
@@ -615,11 +614,13 @@ void UI_DisplayMenu(void)
}
break;
#ifdef ENABLE_AUDIO_BAR
case MENU_MIC_BAR:
case MENU_MIC_BAR:
#ifdef ENABLE_AUDIO_BAR
strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]);
break;
#endif
#else
strcpy(String, gSubMenu_OFF_ON[0]);
#endif
break;
case MENU_STEP: {
uint16_t step = gStepFrequencyTable[FREQUENCY_GetStepIdxFromSortedIdx(gSubMenuSelection)];
@@ -696,25 +697,29 @@ void UI_DisplayMenu(void)
break;
#endif
#ifdef ENABLE_VOX
case MENU_VOX:
case MENU_VOX:
#ifdef ENABLE_VOX
sprintf(String, gSubMenuSelection == 0 ? "OFF" : "%u", gSubMenuSelection);
break;
#endif
#else
strcpy(String, gSubMenu_OFF_ON[0]);
#endif
break;
case MENU_ABR:
if(gSubMenuSelection == 0)
{
sprintf(String, "%s", "OFF");
strcpy(String, "OFF");
}
else if(gSubMenuSelection < 61)
{
sprintf(String, "%02dm:%02ds", (((gSubMenuSelection) * 5) / 60), (((gSubMenuSelection) * 5) % 60));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(4, 1, 60, gSubMenuSelection);
#endif
}
else
{
sprintf(String, "%s", "ON");
strcpy(String, "ON");
}
// Obsolete ???
@@ -742,7 +747,9 @@ void UI_DisplayMenu(void)
else
{
sprintf(String, "%02dm:%02ds", ((gSubMenuSelection * 15) / 60), ((gSubMenuSelection * 15) % 60));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(4, 1, 40, gSubMenuSelection);
#endif
}
break;
@@ -857,7 +864,9 @@ void UI_DisplayMenu(void)
case MENU_TOT:
sprintf(String, "%02dm:%02ds", (((gSubMenuSelection + 1) * 5) / 60), (((gSubMenuSelection + 1) * 5) % 60));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(4, 5, 179, gSubMenuSelection);
#endif
break;
#ifdef ENABLE_VOICE
@@ -874,12 +883,16 @@ void UI_DisplayMenu(void)
else if(gSubMenuSelection < 81)
{
sprintf(String, "CARRIER\n%02ds:%03dms", ((gSubMenuSelection * 250) / 1000), ((gSubMenuSelection * 250) % 1000));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(5, 1, 80, gSubMenuSelection);
#endif
}
else
{
sprintf(String, "TIMEOUT\n%02dm:%02ds", (((gSubMenuSelection - 80) * 5) / 60), (((gSubMenuSelection - 80) * 5) % 60));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(5, 80, 104, gSubMenuSelection);
#endif
}
break;
@@ -1026,12 +1039,14 @@ void UI_DisplayMenu(void)
case MENU_SET_OFF:
if(gSubMenuSelection == 0)
{
sprintf(String, "%s", "OFF");
strcpy(String, "OFF");
}
else if(gSubMenuSelection < 121)
{
sprintf(String, "%dh:%02dm", (gSubMenuSelection / 60), (gSubMenuSelection % 60));
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(4, 1, 120, gSubMenuSelection);
#endif
}
break;
#endif
@@ -1091,7 +1106,17 @@ void UI_DisplayMenu(void)
#ifdef ENABLE_FEAT_F4HWN_VOL
case MENU_SET_VOL:
sprintf(String, gSubMenuSelection == 0 ? "OFF" : "%02u", gSubMenuSelection);
if(gSubMenuSelection == 0)
{
strcpy(String, "OFF");
}
else if(gSubMenuSelection < 64)
{
sprintf(String, "%02u", gSubMenuSelection);
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
ST7565_Gauge(4, 1, 63, gSubMenuSelection);
#endif
}
gEeprom.VOLUME_GAIN = gSubMenuSelection;
BK4819_WriteRegister(BK4819_REG_48,
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
@@ -1138,10 +1163,14 @@ void UI_DisplayMenu(void)
}
// center vertically'ish
/*
if (small)
y = 3 - ((lines + 0) / 2); // untested
else
y = 2 - ((lines + 0) / 2);
*/
y = (small ? 3 : 2) - (lines / 2);
// only for SysInf
if(UI_MENU_GetCurrentMenuId() == MENU_VOL)
@@ -1210,6 +1239,7 @@ void UI_DisplayMenu(void)
if (gSubMenuSelection < 0 || !gEeprom.SCAN_LIST_ENABLED[i]) {
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])) {
@@ -1221,6 +1251,19 @@ void UI_DisplayMenu(void)
sprintf(String, "PRI%d:%u", 2, gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
}
*/
UI_PrintStringSmallNormal(pPrintStr, menu_item_x1, menu_item_x2, 2);
for (uint8_t pri = 1; pri <= 2; pri++) {
uint8_t channel = (pri == 1) ? gEeprom.SCANLIST_PRIORITY_CH1[i] : gEeprom.SCANLIST_PRIORITY_CH2[i];
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);
}
}
}
}

View File

@@ -53,9 +53,7 @@ enum
MENU_MEM_NAME,
MENU_MDF,
MENU_SAVE,
#ifdef ENABLE_VOX
MENU_VOX,
#endif
MENU_ABR,
MENU_ABR_ON_TX_RX,
MENU_ABR_MIN,
@@ -73,9 +71,7 @@ enum
MENU_STE,
MENU_RP_STE,
MENU_MIC,
#ifdef ENABLE_AUDIO_BAR
MENU_MIC_BAR,
#endif
MENU_COMPAND,
MENU_1_CALL,
MENU_S_LIST,

View File

@@ -212,30 +212,47 @@ void UI_DisplayStatus()
x = MAX(x1, 69u);
// KEY-LOCK indicator
const void *src = NULL; // Pointer to the font/bitmap to copy
size_t size = 0; // Size of the font/bitmap
// Determine the source and size based on conditions
if (gEeprom.KEY_LOCK) {
memcpy(line + x + 1, gFontKeyLock, sizeof(gFontKeyLock));
src = gFontKeyLock;
size = sizeof(gFontKeyLock);
}
else if (gWasFKeyPressed) {
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
if(gEeprom.MENU_LOCK == false) {
memcpy(line + x + 1, gFontF, sizeof(gFontF));
}
if (!gEeprom.MENU_LOCK) {
src = gFontF;
size = sizeof(gFontF);
}
#else
memcpy(line + x + 1, gFontF, sizeof(gFontF));
src = gFontF;
size = sizeof(gFontF);
#endif
}
else if (gBackLight)
{
memcpy(line + x + 1, gFontLight, sizeof(gFontLight));
#ifdef ENABLE_FEAT_F4HWN
else if (gMute) {
src = gFontMute;
size = sizeof(gFontMute);
}
#endif
else if (gBackLight) {
src = gFontLight;
size = sizeof(gFontLight);
}
#ifdef ENABLE_FEAT_F4HWN_CHARGING_C
else if (gChargingWithTypeC)
{
memcpy(line + x + 1, BITMAP_USB_C, sizeof(BITMAP_USB_C));
else if (gChargingWithTypeC) {
src = BITMAP_USB_C;
size = sizeof(BITMAP_USB_C);
}
#endif
// Perform the memcpy if a source was selected
if (src) {
memcpy(line + x + 1, src, size);
}
// Battery
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 0;