Skip to content

Commit ba5257f

Browse files
authored
Merge pull request #367 from armel/feature_update_v4
Feature update v4
2 parents d365896 + aee4406 commit ba5257f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+894
-239
lines changed

.github/workflows/main.yml

+16-41
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,24 @@
1+
name: Build Firmware
2+
13
on:
24
push:
5+
branches: [ main ]
36

47
jobs:
58
build:
6-
runs-on: ubuntu-22.04
7-
container:
8-
image: archlinux:latest
9-
steps:
10-
- name: base-devel
11-
run: pacman -Syyu base-devel --noconfirm
12-
- name: arm-none-eabi-gcc
13-
run: pacman -Syyu arm-none-eabi-gcc --noconfirm
14-
- name: arm-none-eabi-newlib
15-
run: pacman -Syyu arm-none-eabi-newlib --noconfirm
16-
- name: git
17-
run: pacman -Syyu git --noconfirm
18-
- name: python-pip
19-
run: pacman -Syyu python-pip --noconfirm
20-
- name: python-crcmod
21-
run: pacman -Syyu python-crcmod --noconfirm
9+
runs-on: ubuntu-latest
2210

23-
- name: Checkout
24-
uses: actions/checkout@v3
25-
26-
- name: safe.directory
27-
run: git config --global --add safe.directory /__w/uv-k5-firmware-custom/uv-k5-firmware-custom
28-
- name: Make
29-
run: make
30-
- name: size
31-
run: arm-none-eabi-size firmware
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
3214

33-
- name: 'Upload Artifact'
34-
uses: actions/upload-artifact@v3
35-
with:
36-
name: firmware
37-
path: firmware*.bin
15+
- name: Compile firmware
16+
run: |
17+
chmod +x compile-with-docker.sh
18+
./compile-with-docker.sh
3819
39-
- name: Upload binaries to release
40-
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
41-
uses: svenstaro/upload-release-action@v2
42-
with:
43-
repo_token: ${{ secrets.GITHUB_TOKEN }}
44-
file: firmware.packed.bin
45-
asset_name: egzumer_$tag.packed.bin
46-
tag: ${{ github.ref }}
47-
overwrite: true
48-
release_name: release ${{ github.ref_name }}
49-
20+
- name: Upload firmware artifact
21+
uses: actions/upload-artifact@v4
22+
with:
23+
name: firmware-artifact
24+
path: compiled-firmware/f4hwn.packed.bin

Makefile

+23-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# 0 = disable
44
# 1 = enable
55

6-
# ---- STOCK QUANSHENG FERATURES ----
6+
# ---- STOCK QUANSHENG FEATURES ----
77
ENABLE_FMRADIO ?= 0
88
ENABLE_UART ?= 1
99
ENABLE_AIRCOPY ?= 0
@@ -46,15 +46,18 @@ ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
4646
ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 1
4747
ENABLE_FEAT_F4HWN_CHARGING_C ?= 0
4848
ENABLE_FEAT_F4HWN_SLEEP ?= 1
49-
ENABLE_FEAT_F4HWN_RESTORE_SCAN ?= 1
49+
ENABLE_FEAT_F4HWN_RESUME_STATE ?= 1
5050
ENABLE_FEAT_F4HWN_NARROWER ?= 1
51-
ENABLE_FEAT_F4HWN_CONTRAST ?= 1
51+
ENABLE_FEAT_F4HWN_INV ?= 1
52+
ENABLE_FEAT_F4HWN_CTR ?= 1
5253
ENABLE_FEAT_F4HWN_RESCUE_OPS ?= 0
5354
ENABLE_FEAT_F4HWN_VOL ?= 0
5455
ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0
5556
ENABLE_FEAT_F4HWN_PMR ?= 0
5657
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 0
5758
ENABLE_FEAT_F4HWN_CA ?= 1
59+
ENABLE_FEAT_F4HWN_DEBUG ?= 0
60+
ENABLE_REGA ?= 0
5861

5962
# ---- DEBUGGING ----
6063
ENABLE_AM_FIX_SHOW_DATA ?= 0
@@ -135,6 +138,9 @@ OBJS += app/app.o
135138
OBJS += app/chFrScanner.o
136139
OBJS += app/common.o
137140
OBJS += app/dtmf.o
141+
ifeq ($(ENABLE_REGA),1)
142+
OBJS += app/rega.o
143+
endif
138144
ifeq ($(ENABLE_FLASHLIGHT),1)
139145
OBJS += app/flashlight.o
140146
endif
@@ -224,7 +230,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1)
224230
VERSION_STRING_1 ?= v0.22
225231

226232
AUTHOR_STRING_2 ?= F4HWN
227-
VERSION_STRING_2 ?= v3.9
233+
VERSION_STRING_2 ?= v4.0
228234

229235
EDITION_STRING ?= Custom
230236

@@ -399,6 +405,9 @@ endif
399405
ifeq ($(ENABLE_DTMF_CALLING),1)
400406
CFLAGS += -DENABLE_DTMF_CALLING
401407
endif
408+
ifeq ($(ENABLE_REGA),1)
409+
CFLAGS += -DENABLE_REGA
410+
endif
402411
ifeq ($(ENABLE_AGC_SHOW_DATA),1)
403412
CFLAGS += -DENABLE_AGC_SHOW_DATA
404413
endif
@@ -436,14 +445,17 @@ endif
436445
ifeq ($(ENABLE_FEAT_F4HWN_SLEEP),1)
437446
CFLAGS += -DENABLE_FEAT_F4HWN_SLEEP
438447
endif
439-
ifeq ($(ENABLE_FEAT_F4HWN_RESTORE_SCAN),1)
440-
CFLAGS += -DENABLE_FEAT_F4HWN_RESTORE_SCAN
448+
ifeq ($(ENABLE_FEAT_F4HWN_RESUME_STATE),1)
449+
CFLAGS += -DENABLE_FEAT_F4HWN_RESUME_STATE
441450
endif
442451
ifeq ($(ENABLE_FEAT_F4HWN_NARROWER),1)
443452
CFLAGS += -DENABLE_FEAT_F4HWN_NARROWER
444453
endif
445-
ifeq ($(ENABLE_FEAT_F4HWN_CONTRAST),1)
446-
CFLAGS += -DENABLE_FEAT_F4HWN_CONTRAST
454+
ifeq ($(ENABLE_FEAT_F4HWN_INV),1)
455+
CFLAGS += -DENABLE_FEAT_F4HWN_INV
456+
endif
457+
ifeq ($(ENABLE_FEAT_F4HWN_CTR),1)
458+
CFLAGS += -DENABLE_FEAT_F4HWN_CTR
447459
endif
448460
ifneq ($(filter $(ENABLE_FEAT_F4HWN_RESCUE_OPS),1 2),)
449461
CFLAGS += -DENABLE_FEAT_F4HWN_RESCUE_OPS=$(ENABLE_FEAT_F4HWN_RESCUE_OPS)
@@ -463,6 +475,9 @@ endif
463475
ifeq ($(ENABLE_FEAT_F4HWN_CA),1)
464476
CFLAGS += -DENABLE_FEAT_F4HWN_CA
465477
endif
478+
ifeq ($(ENABLE_FEAT_F4HWN_DEBUG),1)
479+
CFLAGS += -DENABLE_FEAT_F4HWN_DEBUG
480+
endif
466481

467482
LDFLAGS =
468483
LDFLAGS += -z noexecstack -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld -Wl,--gc-sections

README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Anyway, have fun.
2626
2727
# Donations
2828

29-
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). That’s so kind of them. Thanks so much 🙏🏻
29+
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). That’s so kind of them. Thanks so much 🙏🏻
3030

3131
## Table of Contents
3232

@@ -97,6 +97,8 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC
9797
* improve ScnRev menu (CARRIER from 250ms to 20s, STOP, TIMEOUT from 5s to 2m)
9898
* improve KeyLck menu (OFF, delay from 15s to 10m)
9999
* add HAM CA F Lock band (for Canadian zone),
100+
* add PMR 446 F Lock band,
101+
* add FRS/GMRS/MURS F Lock band,
100102
* remove blink and SOS functionality,
101103
* remove AM Fix menu (AM Fix is ENABLED by default),
102104
* add support of 3500mAh battery,
@@ -116,13 +118,14 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC
116118
* scan lists [1, 2, 3],
117119
* scan all (all channels with ou without list),
118120
* add scan list shortcuts,
119-
* add scan resume mode on startup,
121+
* add resume mode on startup (scan, bandscope and broadcast FM),
120122
* new actions:
121123
* RX MODE,
122124
* MAIN ONLY,
123125
* PTT,
124126
* WIDE NARROW,
125127
* 1750Hz,
128+
* MUTE,
126129
* POWER HIGH (RescueOps),
127130
* REMOVE OFFSET (RescueOps),
128131
* new key combinations:
@@ -238,7 +241,10 @@ This is the least demanding option as you don't have to install enything on your
238241

239242
### Docker build method
240243

241-
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.
244+
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.
245+
246+
> [!TIP]
247+
> 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.
242248
243249
### Windows environment build method
244250

app/action.c

+35-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
#include "settings.h"
4343
#include "ui/inputbox.h"
4444
#include "ui/ui.h"
45+
#ifdef ENABLE_REGA
46+
#include "app/rega.h"
47+
#endif
4548

4649
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
4750
#include "screenshot.h"
@@ -111,13 +114,22 @@ void (*action_opt_table[])(void) = {
111114
[ACTION_OPT_PTT] = &ACTION_Ptt,
112115
[ACTION_OPT_WN] = &ACTION_Wn,
113116
[ACTION_OPT_BACKLIGHT] = &ACTION_BackLight,
117+
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
118+
[ACTION_OPT_MUTE] = &ACTION_Mute,
119+
#else
120+
[ACTION_OPT_MUTE] = &FUNCTION_NOP,
121+
#endif
114122
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
115123
[ACTION_OPT_POWER_HIGH] = &ACTION_Power_High,
116124
[ACTION_OPT_REMOVE_OFFSET] = &ACTION_Remove_Offset,
117125
#endif
118126
#else
119127
[ACTION_OPT_RXMODE] = &FUNCTION_NOP,
120128
#endif
129+
#ifdef ENABLE_REGA
130+
[ACTION_OPT_REGA_ALARM] = &ACTION_RegaAlarm,
131+
[ACTION_OPT_REGA_TEST] = &ACTION_RegaTest,
132+
#endif
121133
};
122134

123135
static_assert(ARRAY_SIZE(action_opt_table) == ACTION_OPT_LEN);
@@ -224,7 +236,7 @@ void ACTION_Scan(bool bRestart)
224236

225237
// channel mode. Keep scanning but toggle between scan lists
226238
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 6;
227-
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
239+
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
228240
SETTINGS_WriteCurrentState();
229241
#endif
230242

@@ -233,7 +245,7 @@ void ACTION_Scan(bool bRestart)
233245
gScanPauseDelayIn_10ms = 1;
234246
gScheduleScanListen = false;
235247
} else {
236-
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
248+
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
237249
if(gScanRangeStart == 0) // No ScanRange
238250
{
239251
gEeprom.CURRENT_STATE = 1;
@@ -625,6 +637,27 @@ void ACTION_BackLightOnDemand(void)
625637
BACKLIGHT_TurnOn();
626638
}
627639

640+
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
641+
void ACTION_Mute(void)
642+
{
643+
// Toggle mute state
644+
gMute = !gMute;
645+
646+
// Update the registers
647+
#ifdef ENABLE_FMRADIO
648+
BK1080_WriteRegister(BK1080_REG_05_SYSTEM_CONFIGURATION2, gMute ? 0x0A10 : 0x0A1F);
649+
#endif
650+
gEeprom.VOLUME_GAIN = gMute ? 0 : gEeprom.VOLUME_GAIN_BACKUP;
651+
BK4819_WriteRegister(BK4819_REG_48,
652+
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
653+
(0u << 10) | // AF Rx Gain-1
654+
(gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2
655+
(gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2)
656+
657+
gUpdateStatus = true;
658+
}
659+
#endif
660+
628661
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
629662
void ACTION_Power_High(void)
630663
{

app/action.h

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ void ACTION_SwitchDemodul(void);
4242
void ACTION_Wn(void);
4343
void ACTION_BackLightOnDemand(void);
4444
void ACTION_BackLight(void);
45+
#if !defined(ENABLE_SPECTRUM) || !defined(ENABLE_FMRADIO)
46+
void ACTION_Mute(void);
47+
#endif
4548
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
4649
void ACTION_Power_High(void);
4750
void ACTION_Remove_Offset(void);

app/app.c

+12-14
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ void (*ProcessKeysFunctions[])(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
9696
#endif
9797
};
9898

99+
#ifdef ENABLE_REGA
100+
// This is a hack for REGA as I need a special display element only for it with no key
101+
static_assert(ARRAY_SIZE(ProcessKeysFunctions) == DISPLAY_N_ELEM-1);
102+
#else
99103
static_assert(ARRAY_SIZE(ProcessKeysFunctions) == DISPLAY_N_ELEM);
100-
101-
104+
#endif
102105

103106
static void CheckForIncoming(void)
104107
{
@@ -966,19 +969,10 @@ void APP_Update(void)
966969
//if (gKeyReading1 != KEY_INVALID)
967970
// gPttWasReleased = true;
968971
}
972+
#if defined(ENABLE_FEAT_F4HWN_CTR) || defined(ENABLE_FEAT_F4HWN_INV)
969973
ST7565_ContrastAndInv();
974+
#endif
970975
}
971-
/*
972-
if (gSetting_set_ptt_session) // Improve OnePush if TOT
973-
{
974-
ProcessKey(KEY_PTT, false, false);
975-
gPttIsPressed = false;
976-
gPttOnePushCounter = 0;
977-
if (gKeyReading1 != KEY_INVALID)
978-
gPttWasReleased = true;
979-
ST7565_ContrastAndInv();
980-
}
981-
*/
982976
#endif
983977

984978
APP_EndTransmission();
@@ -1213,7 +1207,9 @@ static void CheckKeys(void)
12131207
if (gKeyReading1 != KEY_INVALID)
12141208
gPttWasReleased = true;
12151209
gPttOnePushCounter = 0;
1216-
ST7565_ContrastAndInv();
1210+
#if defined(ENABLE_FEAT_F4HWN_CTR) || defined(ENABLE_FEAT_F4HWN_INV)
1211+
ST7565_ContrastAndInv();
1212+
#endif
12171213
}
12181214
}
12191215
else
@@ -1233,7 +1229,9 @@ static void CheckKeys(void)
12331229
gPttIsPressed = false;
12341230
if (gKeyReading1 != KEY_INVALID)
12351231
gPttWasReleased = true;
1232+
#if defined(ENABLE_FEAT_F4HWN_CTR) || defined(ENABLE_FEAT_F4HWN_INV)
12361233
ST7565_ContrastAndInv();
1234+
#endif
12371235
}
12381236
}
12391237
else

app/chFrScanner.c

+20-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ void CHFRSCANNER_Start(const bool storeBackupSettings, const int8_t scan_directi
7878
gScanPauseMode = false;
7979
}
8080

81+
/*
8182
void CHFRSCANNER_ContinueScanning(void)
8283
{
8384
if (IS_FREQ_CHANNEL(gNextMrChannel))
@@ -99,6 +100,24 @@ void CHFRSCANNER_ContinueScanning(void)
99100
gRxReceptionMode = RX_MODE_NONE;
100101
gScheduleScanListen = false;
101102
}
103+
*/
104+
105+
void CHFRSCANNER_ContinueScanning(void)
106+
{
107+
if (gCurrentFunction == FUNCTION_INCOMING &&
108+
(IS_FREQ_CHANNEL(gNextMrChannel) || gCurrentCodeType == CODE_TYPE_OFF))
109+
{
110+
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE);
111+
}
112+
else
113+
{
114+
IS_FREQ_CHANNEL(gNextMrChannel) ? NextFreqChannel() : NextMemChannel();
115+
}
116+
117+
gScanPauseMode = false;
118+
gRxReceptionMode = RX_MODE_NONE;
119+
gScheduleScanListen = false;
120+
}
102121

103122
void CHFRSCANNER_Found(void)
104123
{
@@ -196,7 +215,7 @@ void CHFRSCANNER_Stop(void)
196215
}
197216
}
198217

199-
#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN
218+
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
200219
gEeprom.CURRENT_STATE = 0;
201220
SETTINGS_WriteCurrentState();
202221
#endif

0 commit comments

Comments
 (0)