From db575da2bc7dd8a996a1ddad07b41092baa1df9b Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 26 Dec 2024 00:00:08 +0100 Subject: [PATCH 01/50] Let's go to 4.0 (and deleting Aircopy in the Bandscope edition) --- Makefile | 2 +- compile-with-docker.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0c3e3ed..f1721dc 100644 --- a/Makefile +++ b/Makefile @@ -224,7 +224,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 diff --git a/compile-with-docker.sh b/compile-with-docker.sh index eaa6061..463984b 100755 --- a/compile-with-docker.sh +++ b/compile-with-docker.sh @@ -29,7 +29,7 @@ bandscope() { docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \ ENABLE_SPECTRUM=1 \ ENABLE_FMRADIO=0 \ - ENABLE_AIRCOPY=1 \ + ENABLE_AIRCOPY=0 \ ENABLE_NOAA=0 \ ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \ EDITION_STRING=Bandscope \ From 9309cfaba7c6420293fd944eb2e261abc3d2a41d Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 26 Dec 2024 04:52:43 +0100 Subject: [PATCH 02/50] Update donors --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4faa1c..40bd039 100644 --- a/README.md +++ b/README.md @@ -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). That’s 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 (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, Eliot Vedel and Alfonso EA7KDF for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻 ## Table of Contents From d0da9ac73c45089d5f4e6d30a82a33a813a9b56c Mon Sep 17 00:00:00 2001 From: John Flinchbaugh Date: Tue, 7 Jan 2025 23:10:48 -0500 Subject: [PATCH 03/50] fix #322: scale bandscope for any number of samples retain stretch of bars for short ranges, but after 128, scale 1:1 to always fill the width of the screen. --- app/spectrum.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/spectrum.c b/app/spectrum.c index 57a7647..93fedeb 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -870,13 +870,14 @@ uint8_t Rssi2Y(uint16_t rssi) #ifdef ENABLE_FEAT_F4HWN_SPECTRUM static void DrawSpectrum() { + uint16_t steps = GetStepsCount(); 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(); + uint8_t x = i * 128 / ((steps > 128) ? 128 : steps) + 1; for (uint8_t xx = ox; xx < x; xx++) { DrawVLine(Rssi2Y(rssi), DrawingEndY, xx, true); From bc1a765c685d9b0ae09499809bf25f8a144fdd1b Mon Sep 17 00:00:00 2001 From: John Flinchbaugh Date: Wed, 8 Jan 2025 08:00:53 -0500 Subject: [PATCH 04/50] shift the graph to center large bars --- app/spectrum.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/spectrum.c b/app/spectrum.c index 93fedeb..369b2be 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -871,13 +871,15 @@ uint8_t Rssi2Y(uint16_t rssi) static void DrawSpectrum() { uint16_t steps = GetStepsCount(); + uint16_t scale = ((steps > 128) ? 128 : steps); + uint16_t shift = 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 / ((steps > 128) ? 128 : steps) + 1; + uint8_t x = i * 128 / scale + shift; for (uint8_t xx = ox; xx < x; xx++) { DrawVLine(Rssi2Y(rssi), DrawingEndY, xx, true); From 7bcb372f5c50183b13dde49ed164583fed525b6c Mon Sep 17 00:00:00 2001 From: John Flinchbaugh Date: Wed, 8 Jan 2025 08:02:53 -0500 Subject: [PATCH 05/50] indent --- app/spectrum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/spectrum.c b/app/spectrum.c index 369b2be..bc20851 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -879,7 +879,7 @@ uint8_t Rssi2Y(uint16_t rssi) uint16_t rssi = rssiHistory[i >> settings.stepsCount]; if (rssi != RSSI_MAX_VALUE) { - uint8_t x = i * 128 / scale + shift; + uint8_t x = i * 128 / scale + shift; for (uint8_t xx = ox; xx < x; xx++) { DrawVLine(Rssi2Y(rssi), DrawingEndY, xx, true); From 911200d0a04eec33c6746a1a1d513cad473ff248 Mon Sep 17 00:00:00 2001 From: John Flinchbaugh Date: Wed, 8 Jan 2025 08:04:07 -0500 Subject: [PATCH 06/50] unneeded parens --- app/spectrum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/spectrum.c b/app/spectrum.c index bc20851..79bab35 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -871,7 +871,7 @@ uint8_t Rssi2Y(uint16_t rssi) static void DrawSpectrum() { uint16_t steps = GetStepsCount(); - uint16_t scale = ((steps > 128) ? 128 : steps); + uint16_t scale = (steps > 128) ? 128 : steps; uint16_t shift = 64 / steps + 1; uint8_t ox = 0; for (uint8_t i = 0; i < 128; ++i) From be7d229b3d2ea1452db3203d23466ef698109f26 Mon Sep 17 00:00:00 2001 From: John Flinchbaugh Date: Wed, 8 Jan 2025 08:12:36 -0500 Subject: [PATCH 07/50] better var names + comment --- app/spectrum.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/spectrum.c b/app/spectrum.c index 79bab35..568ea0c 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -871,15 +871,15 @@ uint8_t Rssi2Y(uint16_t rssi) static void DrawSpectrum() { uint16_t steps = GetStepsCount(); - uint16_t scale = (steps > 128) ? 128 : steps; - uint16_t shift = 64 / steps + 1; + uint16_t bars = (steps > 128) ? 128 : steps; + uint16_t shift_graph = 64 / steps + 1; // to center bar on freq marker 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 / scale + shift; + uint8_t x = i * 128 / bars + shift_graph; for (uint8_t xx = ox; xx < x; xx++) { DrawVLine(Rssi2Y(rssi), DrawingEndY, xx, true); From 87c354a2eeee0af623bda2123354e49f3cec4670 Mon Sep 17 00:00:00 2001 From: John Flinchbaugh Date: Wed, 8 Jan 2025 08:17:44 -0500 Subject: [PATCH 08/50] smaller? types. it didn't change image size --- app/spectrum.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/spectrum.c b/app/spectrum.c index 568ea0c..b1b4826 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -871,8 +871,8 @@ uint8_t Rssi2Y(uint16_t rssi) static void DrawSpectrum() { uint16_t steps = GetStepsCount(); - uint16_t bars = (steps > 128) ? 128 : steps; - uint16_t shift_graph = 64 / steps + 1; // to center bar on freq marker + uint8_t bars = (steps > 128) ? 128 : steps; + uint8_t shift_graph = 64 / steps + 1; // to center bar on freq marker uint8_t ox = 0; for (uint8_t i = 0; i < 128; ++i) { From f75f65f6c28f28548ceccdbe84ebe9b44e033320 Mon Sep 17 00:00:00 2001 From: John Flinchbaugh Date: Wed, 8 Jan 2025 08:25:17 -0500 Subject: [PATCH 09/50] comments --- app/spectrum.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/spectrum.c b/app/spectrum.c index b1b4826..602e06c 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -871,8 +871,11 @@ uint8_t Rssi2Y(uint16_t rssi) static void DrawSpectrum() { uint16_t steps = GetStepsCount(); + // for larger numbers of samples, max at 128 to correctly draw uint8_t bars = (steps > 128) ? 128 : steps; - uint8_t shift_graph = 64 / steps + 1; // to center bar on freq marker + // 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) { From b8900863e60179daabd9df3590939d331db12fbc Mon Sep 17 00:00:00 2001 From: John Flinchbaugh Date: Wed, 8 Jan 2025 08:27:10 -0500 Subject: [PATCH 10/50] comments --- app/spectrum.c | 1 + 1 file changed, 1 insertion(+) diff --git a/app/spectrum.c b/app/spectrum.c index 602e06c..08e340f 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -882,6 +882,7 @@ uint8_t Rssi2Y(uint16_t rssi) uint16_t rssi = rssiHistory[i >> settings.stepsCount]; if (rssi != RSSI_MAX_VALUE) { + // stretch bars to fill the screen width uint8_t x = i * 128 / bars + shift_graph; for (uint8_t xx = ox; xx < x; xx++) { From 85bdc60c5b1638e0364ab27156ca6753b7a8d521 Mon Sep 17 00:00:00 2001 From: John Flinchbaugh Date: Wed, 8 Jan 2025 08:29:04 -0500 Subject: [PATCH 11/50] samples --- app/spectrum.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/spectrum.c b/app/spectrum.c index 08e340f..6a0e799 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -871,9 +871,9 @@ uint8_t Rssi2Y(uint16_t rssi) static void DrawSpectrum() { uint16_t steps = GetStepsCount(); - // for larger numbers of samples, max at 128 to correctly draw + // max bars at 128 to correctly draw larger numbers of samples uint8_t bars = (steps > 128) ? 128 : steps; - // to center bar on freq marker + // shift to center bar on freq marker uint8_t shift_graph = 64 / steps + 1; uint8_t ox = 0; From 5817da80c7d30da7bcf391b864d3568700804018 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 9 Jan 2025 15:39:38 +0100 Subject: [PATCH 12/50] Update donors --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 40bd039..52149df 100644 --- a/README.md +++ b/README.md @@ -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, Eliot Vedel and Alfonso EA7KDF for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s 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, 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 and Alfonso EA7KDF for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻 ## Table of Contents From 2b799c4cba6b70bfadc79780e46f416830da1d3d Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sat, 11 Jan 2025 19:04:50 +0100 Subject: [PATCH 13/50] Update donors --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 52149df..9d2f2a5 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Anyway, have fun. # Donations -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, 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 and Alfonso EA7KDF for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s 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, 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 and Jean-François F1EVM for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻 ## Table of Contents From 94169ef83fdad5d6759fba1a157093730b5bd943 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 16 Jan 2025 03:05:24 +0100 Subject: [PATCH 14/50] Add gauge --- ui/menu.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui/menu.c b/ui/menu.c index f78a007..bc5d80f 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -1087,7 +1087,15 @@ void UI_DisplayMenu(void) #ifdef ENABLE_FEAT_F4HWN_VOL case MENU_SET_VOL: - sprintf(String, gSubMenuSelection == 0 ? "OFF" : "%02u", gSubMenuSelection); + if(gSubMenuSelection == 0) + { + sprintf(String, "%s", "OFF"); + } + else if(gSubMenuSelection < 64) + { + sprintf(String, "%02u", gSubMenuSelection); + ST7565_Gauge(4, 1, 63, gSubMenuSelection); + } gEeprom.VOLUME_GAIN = gSubMenuSelection; BK4819_WriteRegister(BK4819_REG_48, (11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference From 4cb633541395014a6414dddf926948d72f33e185 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sun, 19 Jan 2025 05:44:13 +0100 Subject: [PATCH 15/50] Update README --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ee0fda2..0e513a6 100644 --- a/README.md +++ b/README.md @@ -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 From c27c02eaef0afaba1278904d969ffbbefb33e559 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 21 Jan 2025 15:43:49 +0100 Subject: [PATCH 16/50] Update donors --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e513a6..536d316 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Anyway, have fun. # Donations -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, 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 and Jean-François F1EVM for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s 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, 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 🙏🏻 ## Table of Contents From e35eac68350d9ae26983cf7325343159d174c364 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Fri, 24 Jan 2025 03:54:26 +0100 Subject: [PATCH 17/50] Add Mute action --- app/action.c | 20 ++++++++++++++++++++ app/action.h | 1 + bitmaps.c | 16 ++++++++++++++++ bitmaps.h | 1 + driver/bk1080.c | 6 +++++- misc.c | 1 + misc.h | 1 + settings.c | 4 ++++ settings.h | 4 ++++ ui/menu.c | 1 + ui/status.c | 43 ++++++++++++++++++++++++++++++------------- 11 files changed, 84 insertions(+), 14 deletions(-) diff --git a/app/action.c b/app/action.c index 08a3540..fdf32c5 100644 --- a/app/action.c +++ b/app/action.c @@ -111,6 +111,7 @@ void (*action_opt_table[])(void) = { [ACTION_OPT_PTT] = &ACTION_Ptt, [ACTION_OPT_WN] = &ACTION_Wn, [ACTION_OPT_BACKLIGHT] = &ACTION_BackLight, + [ACTION_OPT_MUTE] = &ACTION_Mute, #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS [ACTION_OPT_POWER_HIGH] = &ACTION_Power_High, [ACTION_OPT_REMOVE_OFFSET] = &ACTION_Remove_Offset, @@ -625,6 +626,25 @@ void ACTION_BackLightOnDemand(void) BACKLIGHT_TurnOn(); } +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; +} + #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS void ACTION_Power_High(void) { diff --git a/app/action.h b/app/action.h index 735c1c3..d4dad6f 100644 --- a/app/action.h +++ b/app/action.h @@ -42,6 +42,7 @@ void ACTION_SwitchDemodul(void); void ACTION_Wn(void); void ACTION_BackLightOnDemand(void); void ACTION_BackLight(void); + void ACTION_Mute(void); #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS void ACTION_Power_High(void); void ACTION_Remove_Offset(void); diff --git a/bitmaps.c b/bitmaps.c index 305ab8f..9ae0aa1 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -57,6 +57,22 @@ const uint8_t gFontLight[9] = 0b00001100, }; +const uint8_t gFontSound[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}, diff --git a/bitmaps.h b/bitmaps.h index 040b997..565dd35 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -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 gFontSound[12]; extern const uint8_t gFontXB[2][6]; extern const uint8_t gFontMO[2][6]; diff --git a/driver/bk1080.c b/driver/bk1080.c index 3c8e921..151bea6 100644 --- a/driver/bk1080.c +++ b/driver/bk1080.c @@ -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 { diff --git a/misc.c b/misc.c index 3fa47e0..5cd0809 100644 --- a/misc.c +++ b/misc.c @@ -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; diff --git a/misc.h b/misc.h index b6c1811..5654740 100644 --- a/misc.h +++ b/misc.h @@ -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; diff --git a/settings.c b/settings.c index efd78af..f036076 100644 --- a/settings.c +++ b/settings.c @@ -434,6 +434,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); } diff --git a/settings.h b/settings.h index 8947379..b0f3d88 100644 --- a/settings.h +++ b/settings.h @@ -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, @@ -272,6 +273,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]; diff --git a/ui/menu.c b/ui/menu.c index bc5d80f..730a799 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -451,6 +451,7 @@ const t_sidefunction gSubMenu_SIDEFUNCTIONS[] = {"MAIN ONLY", ACTION_OPT_MAINONLY}, {"PTT", ACTION_OPT_PTT}, {"WIDE\nNARROW", ACTION_OPT_WN}, + {"MUTE", ACTION_OPT_MUTE}, #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS {"POWER\nHIGH", ACTION_OPT_POWER_HIGH}, {"REMOVE\nOFFSET", ACTION_OPT_REMOVE_OFFSET}, diff --git a/ui/status.c b/ui/status.c index 6ba6747..7f05e65 100644 --- a/ui/status.c +++ b/ui/status.c @@ -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 = gFontSound; + size = sizeof(gFontSound); + } + #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; From bdef2e3a8cb63257139fa4aaf410719eba55a4bf Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sun, 26 Jan 2025 00:50:44 +0100 Subject: [PATCH 18/50] Update donors --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 536d316..16eaae8 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Anyway, have fun. # Donations -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, 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 🙏🏻 +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 🙏🏻 ## Table of Contents From 93da383e2e55355b1844a387cd90a9d08a4c4313 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 4 Feb 2025 01:08:35 +0100 Subject: [PATCH 19/50] Rename var --- bitmaps.c | 2 +- bitmaps.h | 2 +- ui/status.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bitmaps.c b/bitmaps.c index 9ae0aa1..657729b 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -57,7 +57,7 @@ const uint8_t gFontLight[9] = 0b00001100, }; -const uint8_t gFontSound[12] = +const uint8_t gFontMute[12] = { 0b00011100, 0b00011100, diff --git a/bitmaps.h b/bitmaps.h index 565dd35..2b468ff 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -12,7 +12,7 @@ extern const uint8_t gFontS[6]; extern const uint8_t gFontKeyLock[9]; extern const uint8_t gFontLight[9]; -extern const uint8_t gFontSound[12]; +extern const uint8_t gFontMute[12]; extern const uint8_t gFontXB[2][6]; extern const uint8_t gFontMO[2][6]; diff --git a/ui/status.c b/ui/status.c index 7f05e65..f2ce468 100644 --- a/ui/status.c +++ b/ui/status.c @@ -233,8 +233,8 @@ void UI_DisplayStatus() } #ifdef ENABLE_FEAT_F4HWN else if (gMute) { - src = gFontSound; - size = sizeof(gFontSound); + src = gFontMute; + size = sizeof(gFontMute); } #endif else if (gBackLight) { From 3a36c68cde1b371aedd66e202adec0221b812a3e Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 4 Feb 2025 01:10:37 +0100 Subject: [PATCH 20/50] Fix comment --- bitmaps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitmaps.c b/bitmaps.c index 657729b..0889687 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -256,7 +256,7 @@ const uint8_t BITMAP_ScanListE[7] = const uint8_t BITMAP_ScanList123[19] = { - // 'All' symbol + // '123' symbol 0b01111111, 0b01111111, 0b01111011, From 33e63e89591b1edafddbf7c6c9ccc8bb9adcffcd Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Wed, 5 Feb 2025 04:40:21 +0100 Subject: [PATCH 21/50] Update condition --- settings.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.c b/settings.c index f036076..f9bb641 100644 --- a/settings.c +++ b/settings.c @@ -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 From 7ae85bdb2a602587893c58dc103ec6281403db27 Mon Sep 17 00:00:00 2001 From: Sarah <83782422+Louis454545@users.noreply.github.com> Date: Wed, 5 Feb 2025 21:32:16 +0100 Subject: [PATCH 22/50] Update main.yml --- .github/workflows/main.yml | 57 +++++++++++--------------------------- 1 file changed, 16 insertions(+), 41 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5dc6430..924a63a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 From 94bf455a575cdada058ac8d7ccf7aa3d4becfee5 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 6 Feb 2025 03:26:09 +0100 Subject: [PATCH 23/50] Save 8 bytes --- functions.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/functions.c b/functions.c index 35709d7..d09abbd 100644 --- a/functions.c +++ b/functions.c @@ -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; From 6e793a5737f762e16d65f67b128976d24bed169b Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 6 Feb 2025 04:14:15 +0100 Subject: [PATCH 24/50] Save 12 bytes --- ui/helper.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/ui/helper.c b/ui/helper.c index c42c445..d90d770 100644 --- a/ui/helper.c +++ b/ui/helper.c @@ -145,6 +145,7 @@ void UI_PrintStringSmallBufferBold(const char *pString, uint8_t * buffer) UI_PrintStringBuffer(pString, buffer, char_width, font); } +/* void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center) { const unsigned int char_width = 13; @@ -179,6 +180,46 @@ void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center) pFb1 += char_width; } } +*/ + +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++; // Ignore les espaces pour le centrage + + X -= (len * char_width) / 2; // Ajustement pour le centrage + pFb0 = gFrameBuffer[Y] + X; + pFb1 = pFb0 + 128; + } + + for (; *string; string++) { + char c = *string; + if (c == '-') c = '9' + 1; // Remap du symbole '-' + + 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); // Remplace les trois affectations + 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) { From 36ee73af356527be46f688ea1915e65458812c39 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 6 Feb 2025 04:33:49 +0100 Subject: [PATCH 25/50] Save 8 bytes --- ui/helper.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ui/helper.c b/ui/helper.c index d90d770..39d0e35 100644 --- a/ui/helper.c +++ b/ui/helper.c @@ -230,6 +230,7 @@ void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black buffer[y/8][x] &= ~pattern; } +/* static void sort(int16_t *a, int16_t *b) { if(*a > *b) { @@ -238,6 +239,7 @@ static void sort(int16_t *a, int16_t *b) *b = t; } } +*/ #ifdef ENABLE_FEAT_F4HWN /* @@ -297,8 +299,17 @@ static void sort(int16_t *a, int16_t *b) void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black) { - if(x2==x1) { - sort(&y1, &y2); + // Swap x1 and x2 if x1 > x2 + if (x1 > x2) { + int16_t tmp = x1; x1 = x2; x2 = tmp; + int16_t tmpY = y1; y1 = y2; y2 = tmpY; // Swap corresponding y-values as well + } + + if(x1==x2) { + // Ensure y1 <= y2 + if (y1 > y2) { + int16_t tmp = y1; y1 = y2; y2 = tmp; + } for(int16_t i = y1; i <= y2; i++) { UI_DrawPixelBuffer(buffer, x1, i, black); } @@ -307,7 +318,6 @@ void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x int a = (y2-y1)*multipl / (x2-x1); int b = y1 - a * x1 / multipl; - sort(&x1, &x2); for(int i = x1; i<= x2; i++) { UI_DrawPixelBuffer(buffer, i, i*a/multipl +b, black); From e762e8b3d18fe3a4243b0e1e5831b99a4f7e8c8a Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 6 Feb 2025 04:46:41 +0100 Subject: [PATCH 26/50] Revert "Save 8 bytes" This reverts commit 36ee73af356527be46f688ea1915e65458812c39. --- ui/helper.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/ui/helper.c b/ui/helper.c index 39d0e35..d90d770 100644 --- a/ui/helper.c +++ b/ui/helper.c @@ -230,7 +230,6 @@ void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black buffer[y/8][x] &= ~pattern; } -/* static void sort(int16_t *a, int16_t *b) { if(*a > *b) { @@ -239,7 +238,6 @@ static void sort(int16_t *a, int16_t *b) *b = t; } } -*/ #ifdef ENABLE_FEAT_F4HWN /* @@ -299,17 +297,8 @@ static void sort(int16_t *a, int16_t *b) void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black) { - // Swap x1 and x2 if x1 > x2 - if (x1 > x2) { - int16_t tmp = x1; x1 = x2; x2 = tmp; - int16_t tmpY = y1; y1 = y2; y2 = tmpY; // Swap corresponding y-values as well - } - - if(x1==x2) { - // Ensure y1 <= y2 - if (y1 > y2) { - int16_t tmp = y1; y1 = y2; y2 = tmp; - } + if(x2==x1) { + sort(&y1, &y2); for(int16_t i = y1; i <= y2; i++) { UI_DrawPixelBuffer(buffer, x1, i, black); } @@ -318,6 +307,7 @@ void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x int a = (y2-y1)*multipl / (x2-x1); int b = y1 - a * x1 / multipl; + sort(&x1, &x2); for(int i = x1; i<= x2; i++) { UI_DrawPixelBuffer(buffer, i, i*a/multipl +b, black); From 860c260c32679404bbab45c161d974bab8b8bbe5 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Fri, 7 Feb 2025 03:11:10 +0100 Subject: [PATCH 27/50] Fix newline --- app/app.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/app.c b/app/app.c index afbad11..5f057d8 100644 --- a/app/app.c +++ b/app/app.c @@ -98,8 +98,6 @@ void (*ProcessKeysFunctions[])(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) static_assert(ARRAY_SIZE(ProcessKeysFunctions) == DISPLAY_N_ELEM); - - static void CheckForIncoming(void) { if (!g_SquelchLost) From b915ef98c42ff4f6d781ac357ee3f0a633f7b361 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Fri, 7 Feb 2025 04:36:31 +0100 Subject: [PATCH 28/50] Save 28 bytes --- app/menu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/menu.c b/app/menu.c index 07b07b8..bdfe683 100644 --- a/app/menu.c +++ b/app/menu.c @@ -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; From 0634d2ba2b8213540bef7952d6f7d1b9a23398ec Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Fri, 7 Feb 2025 04:42:53 +0100 Subject: [PATCH 29/50] Fix line --- app/menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/menu.c b/app/menu.c index bdfe683..d7de178 100644 --- a/app/menu.c +++ b/app/menu.c @@ -1943,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: From c164b6fd42c9a03af7258e826f8093def9716d41 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Fri, 7 Feb 2025 04:53:50 +0100 Subject: [PATCH 30/50] Save 16 bytes --- app/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/main.c b/app/main.c index 3e4a115..8bd1419 100644 --- a/app/main.c +++ b/app/main.c @@ -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; From f2f9c070a71507197ca1265360c6544be3d76ea7 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Fri, 7 Feb 2025 05:42:58 +0100 Subject: [PATCH 31/50] Save 4 bytes --- ui/menu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ui/menu.c b/ui/menu.c index 730a799..1e82b6e 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -1215,6 +1215,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])) { @@ -1226,6 +1227,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)) { + snprintf(String, sizeof(String), "PRI%d:%u", pri, channel + 1); + UI_PrintString(String, menu_item_x1, menu_item_x2, pri * 2 + 1, 8); + } + } + } } From f0dc9613a116ba8bf2cff7f4a45e0e17bc7596a8 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Fri, 7 Feb 2025 05:46:08 +0100 Subject: [PATCH 32/50] Save 8 bytes --- ui/menu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/menu.c b/ui/menu.c index 1e82b6e..1744880 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -1143,10 +1143,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) From aa5b927cd403703c6d15279981a9fa6d7d33392f Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Fri, 7 Feb 2025 06:01:17 +0100 Subject: [PATCH 33/50] Use snprintf is here a bad idea... --- ui/menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/menu.c b/ui/menu.c index 1744880..095d134 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -1239,7 +1239,7 @@ void UI_DisplayMenu(void) uint8_t channel = (pri == 1) ? gEeprom.SCANLIST_PRIORITY_CH1[i] : gEeprom.SCANLIST_PRIORITY_CH2[i]; if (IS_MR_CHANNEL(channel)) { - snprintf(String, sizeof(String), "PRI%d:%u", pri, channel + 1); + sprintf(String, "PRI%d:%u", pri, channel + 1); UI_PrintString(String, menu_item_x1, menu_item_x2, pri * 2 + 1, 8); } } From 28b26264be76010bba068cfc6ec61134c851e54e Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sat, 8 Feb 2025 03:13:35 +0100 Subject: [PATCH 34/50] Save 40 bytes --- radio.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/radio.c b/radio.c index 170083e..d4c16b9 100644 --- a/radio.c +++ b/radio.c @@ -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 From fed607d272ca9d91a23b6c7d3e64731ac0901bac Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sun, 9 Feb 2025 03:46:19 +0100 Subject: [PATCH 35/50] Save 8 bytes --- ui/menu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/menu.c b/ui/menu.c index 095d134..e760f55 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -702,7 +702,7 @@ void UI_DisplayMenu(void) case MENU_ABR: if(gSubMenuSelection == 0) { - sprintf(String, "%s", "OFF"); + strcpy(String, "OFF"); } else if(gSubMenuSelection < 61) { @@ -711,7 +711,7 @@ void UI_DisplayMenu(void) } else { - sprintf(String, "%s", "ON"); + strcpy(String, "ON"); } // Obsolete ??? @@ -1023,7 +1023,7 @@ void UI_DisplayMenu(void) case MENU_SET_OFF: if(gSubMenuSelection == 0) { - sprintf(String, "%s", "OFF"); + strcpy(String, "OFF"); } else if(gSubMenuSelection < 121) { @@ -1090,7 +1090,7 @@ void UI_DisplayMenu(void) case MENU_SET_VOL: if(gSubMenuSelection == 0) { - sprintf(String, "%s", "OFF"); + strcpy(String, "OFF"); } else if(gSubMenuSelection < 64) { From 60bdac6a7397b5976f4c7fb73ba72b820074680f Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sun, 9 Feb 2025 03:53:55 +0100 Subject: [PATCH 36/50] Fix tab --- ui/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/main.c b/ui/main.c index ea8fc91..a60eff8 100644 --- a/ui/main.c +++ b/ui/main.c @@ -1364,9 +1364,9 @@ 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) { From d5639ef5599d94d32260785c6974b645f2a4ec9c Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sun, 9 Feb 2025 03:54:12 +0100 Subject: [PATCH 37/50] Fix tab --- ui/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/main.c b/ui/main.c index a60eff8..43d226a 100644 --- a/ui/main.c +++ b/ui/main.c @@ -1370,9 +1370,9 @@ void UI_DisplayMain(void) } 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 From b044fb523b1a38bc5c153e640721f4b79b0acb77 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sun, 9 Feb 2025 04:07:55 +0100 Subject: [PATCH 38/50] Comment refactoring --- ui/helper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/helper.c b/ui/helper.c index d90d770..9caa788 100644 --- a/ui/helper.c +++ b/ui/helper.c @@ -192,16 +192,16 @@ void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center) if (center) { uint8_t len = 0; for (const char *ptr = string; *ptr; ptr++) - if (*ptr != ' ') len++; // Ignore les espaces pour le centrage + if (*ptr != ' ') len++; // Ignores spaces for centering - X -= (len * char_width) / 2; // Ajustement pour le centrage + 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 du symbole '-' + if (c == '-') c = '9' + 1; // Remap of '-' symbol if (bCanDisplay || c != ' ') { bCanDisplay = true; @@ -209,7 +209,7 @@ void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center) 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); // Remplace les trois affectations + memset(pFb1, 0x60, 3); // Replaces the three assignments pFb0 += 3; pFb1 += 3; continue; From 89a19f9fb8f39ac915b9c92194147b4d8015df85 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sun, 9 Feb 2025 04:27:59 +0100 Subject: [PATCH 39/50] Save 4 bytes --- app/chFrScanner.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/chFrScanner.c b/app/chFrScanner.c index f326c4d..9112276 100644 --- a/app/chFrScanner.c +++ b/app/chFrScanner.c @@ -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) { From 26f4d7b4ecdce8249e87fb8992979a2596ea609f Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 10 Feb 2025 01:36:30 +0100 Subject: [PATCH 40/50] Save 28 bytes --- ui/main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ui/main.c b/ui/main.c index 43d226a..26496b5 100644 --- a/ui/main.c +++ b/ui/main.c @@ -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) From d87e20186c8e1f928a0476d9ffd8dcb624beb0e1 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 10 Feb 2025 02:28:35 +0100 Subject: [PATCH 41/50] Refactoring Mute and Gauge conditions --- app/action.c | 40 +++++++++++++++++++++++----------------- app/action.h | 2 ++ compile-with-docker.sh | 4 ++++ driver/st7565.c | 2 ++ driver/st7565.h | 2 ++ ui/menu.c | 16 ++++++++++++++++ 6 files changed, 49 insertions(+), 17 deletions(-) diff --git a/app/action.c b/app/action.c index fdf32c5..9d0d580 100644 --- a/app/action.c +++ b/app/action.c @@ -111,7 +111,11 @@ void (*action_opt_table[])(void) = { [ACTION_OPT_PTT] = &ACTION_Ptt, [ACTION_OPT_WN] = &ACTION_Wn, [ACTION_OPT_BACKLIGHT] = &ACTION_BackLight, - [ACTION_OPT_MUTE] = &ACTION_Mute, + #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, @@ -626,24 +630,26 @@ void ACTION_BackLightOnDemand(void) BACKLIGHT_TurnOn(); } -void ACTION_Mute(void) -{ - // Toggle mute state - gMute = !gMute; + #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); + // 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 - 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; -} #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS void ACTION_Power_High(void) diff --git a/app/action.h b/app/action.h index d4dad6f..39b177a 100644 --- a/app/action.h +++ b/app/action.h @@ -42,7 +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); diff --git a/compile-with-docker.sh b/compile-with-docker.sh index 33d53ea..ae2b0ed 100755 --- a/compile-with-docker.sh +++ b/compile-with-docker.sh @@ -36,6 +36,7 @@ bandscope() { ENABLE_SPECTRUM=1 \ ENABLE_FMRADIO=0 \ ENABLE_AIRCOPY=0 \ + ENABLE_FEAT_F4HWN_PMR=1 \ ENABLE_NOAA=0 \ ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \ EDITION_STRING=Bandscope \ @@ -49,6 +50,7 @@ broadcast() { ENABLE_SPECTRUM=0 \ ENABLE_FMRADIO=1 \ ENABLE_AIRCOPY=1 \ + ENABLE_FEAT_F4HWN_PMR=1 \ ENABLE_NOAA=0 \ EDITION_STRING=Broadcast \ ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \ @@ -65,6 +67,7 @@ voxless() { ENABLE_AIRCOPY=0 \ ENABLE_AUDIO_BAR=0 \ ENABLE_FEAT_F4HWN_SPECTRUM=0 \ + ENABLE_FEAT_F4HWN_PMR=1 \ ENABLE_NOAA=0 \ ENABLE_FEAT_F4HWN_RESTORE_SCAN=0 \ ENABLE_FEAT_F4HWN_CHARGING_C=0 \ @@ -81,6 +84,7 @@ rescueops() { ENABLE_SPECTRUM=0 \ ENABLE_FMRADIO=0 \ ENABLE_AIRCOPY=1 \ + ENABLE_FEAT_F4HWN_PMR=1 \ ENABLE_NOAA=1 \ ENABLE_FEAT_F4HWN_RESCUE_OPS=1 \ EDITION_STRING=RescueOps \ diff --git a/driver/st7565.c b/driver/st7565.c index 5e49e49..80670cb 100644 --- a/driver/st7565.c +++ b/driver/st7565.c @@ -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) diff --git a/driver/st7565.h b/driver/st7565.h index 42c69e4..8d4a6e8 100644 --- a/driver/st7565.h +++ b/driver/st7565.h @@ -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 diff --git a/ui/menu.c b/ui/menu.c index e760f55..83f95a3 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -451,7 +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}, @@ -707,7 +709,9 @@ void UI_DisplayMenu(void) 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 { @@ -739,7 +743,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; @@ -854,7 +860,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 @@ -871,12 +879,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; @@ -1028,7 +1040,9 @@ void UI_DisplayMenu(void) 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 @@ -1095,7 +1109,9 @@ void UI_DisplayMenu(void) 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, From 7df26c44e80ba206328b5c973f3c9eebcbf79ecd Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 10 Feb 2025 05:03:03 +0100 Subject: [PATCH 42/50] Fix newline --- driver/bk4819.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/driver/bk4819.c b/driver/bk4819.c index cb6aa2f..ae3b8db 100644 --- a/driver/bk4819.c +++ b/driver/bk4819.c @@ -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; */ } From b8b652b10ed25d4f36f869444ff652073e0df803 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 11 Feb 2025 01:16:54 +0100 Subject: [PATCH 43/50] Save 52 bytes --- app/uart.c | 4 ++++ compile-with-docker.sh | 2 +- settings.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/uart.c b/app/uart.c index b878d1d..3daaa06 100644 --- a/app/uart.c +++ b/app/uart.c @@ -276,8 +276,10 @@ static void CMD_051B(const uint8_t *pBuffer) Reply.Data.Offset = pCmd->Offset; Reply.Data.Size = pCmd->Size; + /* if (bHasCustomAesKey) bLocked = gIsLocked; + */ if (!bLocked) EEPROM_ReadBuffer(pCmd->Offset, Reply.Data.Data, pCmd->Size); @@ -374,8 +376,10 @@ static void CMD_052D(const uint8_t *pBuffer) bIsLocked = bHasCustomAesKey; + /* if (!bIsLocked) bIsLocked = IsBadChallenge(gCustomAesKey, gChallenge, pCmd->Response); + */ if (!bIsLocked) { diff --git a/compile-with-docker.sh b/compile-with-docker.sh index ae2b0ed..2bc24de 100755 --- a/compile-with-docker.sh +++ b/compile-with-docker.sh @@ -36,7 +36,7 @@ bandscope() { ENABLE_SPECTRUM=1 \ ENABLE_FMRADIO=0 \ ENABLE_AIRCOPY=0 \ - ENABLE_FEAT_F4HWN_PMR=1 \ + ENABLE_FEAT_F4HWN_PMR=0 \ ENABLE_NOAA=0 \ ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \ EDITION_STRING=Bandscope \ diff --git a/settings.c b/settings.c index f9bb641..d131521 100644 --- a/settings.c +++ b/settings.c @@ -329,6 +329,8 @@ void SETTINGS_InitEEPROM(void) // 0F30..0F3F EEPROM_ReadBuffer(0x0F30, gCustomAesKey, sizeof(gCustomAesKey)); bHasCustomAesKey = false; + + /* for (unsigned int i = 0; i < ARRAY_SIZE(gCustomAesKey); i++) { if (gCustomAesKey[i] != 0xFFFFFFFFu) @@ -337,6 +339,7 @@ void SETTINGS_InitEEPROM(void) return; } } + */ #ifdef ENABLE_FEAT_F4HWN // 1FF0..0x1FF7 From 3ab1f8ac3e0750caf6ed7634e8400f5e8cd3a143 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 11 Feb 2025 02:19:54 +0100 Subject: [PATCH 44/50] Revert "Save 52 bytes" This reverts commit b8b652b10ed25d4f36f869444ff652073e0df803. --- app/uart.c | 4 ---- compile-with-docker.sh | 2 +- settings.c | 3 --- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/app/uart.c b/app/uart.c index 3daaa06..b878d1d 100644 --- a/app/uart.c +++ b/app/uart.c @@ -276,10 +276,8 @@ static void CMD_051B(const uint8_t *pBuffer) Reply.Data.Offset = pCmd->Offset; Reply.Data.Size = pCmd->Size; - /* if (bHasCustomAesKey) bLocked = gIsLocked; - */ if (!bLocked) EEPROM_ReadBuffer(pCmd->Offset, Reply.Data.Data, pCmd->Size); @@ -376,10 +374,8 @@ static void CMD_052D(const uint8_t *pBuffer) bIsLocked = bHasCustomAesKey; - /* if (!bIsLocked) bIsLocked = IsBadChallenge(gCustomAesKey, gChallenge, pCmd->Response); - */ if (!bIsLocked) { diff --git a/compile-with-docker.sh b/compile-with-docker.sh index 2bc24de..ae2b0ed 100755 --- a/compile-with-docker.sh +++ b/compile-with-docker.sh @@ -36,7 +36,7 @@ bandscope() { ENABLE_SPECTRUM=1 \ ENABLE_FMRADIO=0 \ ENABLE_AIRCOPY=0 \ - ENABLE_FEAT_F4HWN_PMR=0 \ + ENABLE_FEAT_F4HWN_PMR=1 \ ENABLE_NOAA=0 \ ENABLE_FEAT_F4HWN_RESCUE_OPS=0 \ EDITION_STRING=Bandscope \ diff --git a/settings.c b/settings.c index d131521..f9bb641 100644 --- a/settings.c +++ b/settings.c @@ -329,8 +329,6 @@ void SETTINGS_InitEEPROM(void) // 0F30..0F3F EEPROM_ReadBuffer(0x0F30, gCustomAesKey, sizeof(gCustomAesKey)); bHasCustomAesKey = false; - - /* for (unsigned int i = 0; i < ARRAY_SIZE(gCustomAesKey); i++) { if (gCustomAesKey[i] != 0xFFFFFFFFu) @@ -339,7 +337,6 @@ void SETTINGS_InitEEPROM(void) return; } } - */ #ifdef ENABLE_FEAT_F4HWN // 1FF0..0x1FF7 From 75a78e46f6ef9f20fb31c793788eeed2471101de Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 11 Feb 2025 02:25:32 +0100 Subject: [PATCH 45/50] Update compilation options --- compile-with-docker.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/compile-with-docker.sh b/compile-with-docker.sh index ae2b0ed..a8b51cd 100755 --- a/compile-with-docker.sh +++ b/compile-with-docker.sh @@ -36,7 +36,8 @@ bandscope() { ENABLE_SPECTRUM=1 \ ENABLE_FMRADIO=0 \ ENABLE_AIRCOPY=0 \ - ENABLE_FEAT_F4HWN_PMR=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 \ @@ -50,7 +51,8 @@ broadcast() { ENABLE_SPECTRUM=0 \ ENABLE_FMRADIO=1 \ ENABLE_AIRCOPY=1 \ - ENABLE_FEAT_F4HWN_PMR=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 \ @@ -67,7 +69,8 @@ voxless() { ENABLE_AIRCOPY=0 \ ENABLE_AUDIO_BAR=0 \ ENABLE_FEAT_F4HWN_SPECTRUM=0 \ - ENABLE_FEAT_F4HWN_PMR=1 \ + 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 \ @@ -84,7 +87,8 @@ rescueops() { ENABLE_SPECTRUM=0 \ ENABLE_FMRADIO=0 \ ENABLE_AIRCOPY=1 \ - ENABLE_FEAT_F4HWN_PMR=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 \ From 367d9d46834787b2123bdb450fbf499686f7af64 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 11 Feb 2025 02:25:55 +0100 Subject: [PATCH 46/50] Update compilation options --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f1721dc..cc08c24 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # 0 = disable # 1 = enable -# ---- STOCK QUANSHENG FERATURES ---- +# ---- STOCK QUANSHENG FEATURES ---- ENABLE_FMRADIO ?= 0 ENABLE_UART ?= 1 ENABLE_AIRCOPY ?= 0 From 7558d952673deed86f8897989bf05bc02198b4d0 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 11 Feb 2025 02:51:16 +0100 Subject: [PATCH 47/50] Remove strange CMD_052D (and save 148 bytes) --- app/uart.c | 41 +++++++++++++++++++++-------------------- settings.c | 24 +++++++++++++----------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/app/uart.c b/app/uart.c index b878d1d..87aba88 100644 --- a/app/uart.c +++ b/app/uart.c @@ -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); diff --git a/settings.c b/settings.c index f9bb641..beb582e 100644 --- a/settings.c +++ b/settings.c @@ -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 From 615e57388797e69d5a113d6314fd42e85679b458 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 11 Feb 2025 03:03:35 +0100 Subject: [PATCH 48/50] Enable AIRCOPY --- compile-with-docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile-with-docker.sh b/compile-with-docker.sh index a8b51cd..2aab0ec 100755 --- a/compile-with-docker.sh +++ b/compile-with-docker.sh @@ -35,7 +35,7 @@ bandscope() { docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \ ENABLE_SPECTRUM=1 \ ENABLE_FMRADIO=0 \ - ENABLE_AIRCOPY=0 \ + ENABLE_AIRCOPY=1 \ ENABLE_FEAT_F4HWN_PMR=0 \ ENABLE_FEAT_F4HWN_GMRS_FRS_MURS=0 \ ENABLE_NOAA=0 \ From f2996f2430eef75a63141824e56195b2915cc3da Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 11 Feb 2025 03:39:06 +0100 Subject: [PATCH 49/50] Revert refactoring on UI_DisplayFrequency --- ui/helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/helper.c b/ui/helper.c index 9caa788..cf63819 100644 --- a/ui/helper.c +++ b/ui/helper.c @@ -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); @@ -145,7 +146,6 @@ void UI_PrintStringSmallBufferBold(const char *pString, uint8_t * buffer) UI_PrintStringBuffer(pString, buffer, char_width, font); } -/* void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center) { const unsigned int char_width = 13; @@ -180,8 +180,8 @@ void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center) pFb1 += char_width; } } -*/ +/* void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center) { const unsigned int char_width = 13; @@ -219,7 +219,7 @@ void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center) pFb1 += char_width; } } - +*/ void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black) { From c384a682bbb461d4b9b92c4f478338be51f59d4b Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Wed, 12 Feb 2025 02:13:55 +0100 Subject: [PATCH 50/50] Fix Voxless not functional menus --- compile-with-docker.sh | 1 + main.c | 2 +- ui/menu.c | 24 ++++++++++++------------ ui/menu.h | 4 ---- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/compile-with-docker.sh b/compile-with-docker.sh index 2aab0ec..e47359d 100755 --- a/compile-with-docker.sh +++ b/compile-with-docker.sh @@ -119,6 +119,7 @@ case "$1" in bandscope broadcast rescueops + voxless ;; *) echo "Usage: $0 {custom|bandscope|broadcast|voxless|standard|all}" diff --git a/main.c b/main.c index aae3477..18de500 100644 --- a/main.c +++ b/main.c @@ -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 diff --git a/ui/menu.c b/ui/menu.c index 83f95a3..ef0e0e8 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -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 @@ -614,11 +610,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)]; @@ -695,11 +693,13 @@ 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) diff --git a/ui/menu.h b/ui/menu.h index 4b106aa..733f396 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -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,