From 9c1b1cb063f008536587b7f2db44bb345e85a676 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 6 Jul 2026 15:25:29 +0200 Subject: [PATCH] Remove unused REGA emergency alarm feature (ENABLE_REGA) --- App/CMakeLists.txt | 4 - App/app/action.c | 7 -- App/app/app.c | 5 -- App/app/rega.c | 187 --------------------------------------------- App/app/rega.h | 65 ---------------- App/settings.h | 4 - App/ui/menu.c | 4 - App/ui/ui.c | 7 -- App/ui/ui.h | 4 - CMakePresets.json | 1 - 10 files changed, 288 deletions(-) delete mode 100644 App/app/rega.c delete mode 100644 App/app/rega.h diff --git a/App/CMakeLists.txt b/App/CMakeLists.txt index d5350fac..4fc9cde4 100644 --- a/App/CMakeLists.txt +++ b/App/CMakeLists.txt @@ -171,10 +171,6 @@ enable_feature(ENABLE_SCAN_RANGES) # ---- CONTRIB MODS ---- -# Thank you @markusb -enable_feature(ENABLE_REGA - app/rega.c -) # Thank you @reppad enable_feature(ENABLE_EXTRA_UART_CMD) diff --git a/App/app/action.c b/App/app/action.c index 9715f43f..bc8893a5 100644 --- a/App/app/action.c +++ b/App/app/action.c @@ -42,9 +42,6 @@ #include "ui/inputbox.h" #include "ui/main.h" #include "ui/ui.h" -#ifdef ENABLE_REGA - #include "app/rega.h" -#endif #ifdef ENABLE_FEAT_F4HWN_BEAM #include "app/beam.h" #endif @@ -134,10 +131,6 @@ void (*action_opt_table[])(void) = { #else [ACTION_OPT_RXMODE] = &FUNCTION_NOP, #endif -#ifdef ENABLE_REGA - [ACTION_OPT_REGA_ALARM] = &ACTION_RegaAlarm, - [ACTION_OPT_REGA_TEST] = &ACTION_RegaTest, -#endif #ifdef ENABLE_FEAT_F4HWN_BEAM [ACTION_OPT_BEAM] = &ACTION_Beam, #endif diff --git a/App/app/app.c b/App/app/app.c index 8a73eafe..84890f2a 100644 --- a/App/app/app.c +++ b/App/app/app.c @@ -125,12 +125,7 @@ void (*ProcessKeysFunctions[])(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) #endif }; -#ifdef ENABLE_REGA -// This is a hack for REGA as I need a special display element only for it with no key -static_assert(ARRAY_SIZE(ProcessKeysFunctions) == DISPLAY_N_ELEM-1); -#else static_assert(ARRAY_SIZE(ProcessKeysFunctions) == DISPLAY_N_ELEM); -#endif #ifdef ENABLE_FEAT_F4HWN_LOGO_SAV static uint8_t ScreenSaverRandom(void) diff --git a/App/app/rega.c b/App/app/rega.c deleted file mode 100644 index c01470d0..00000000 --- a/App/app/rega.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * REGA Alam and Test - * ================== - * - * This bit of code is to implement the REGA test and alarm functions. - * This function sends out a fixed ZVEI tone sequence for testing or alarm purposes. - * Further information: https://www.rega.ch/en/our-missions/sites-and-infrastructure/emergency-radio - * - * There are two REGA ACTIONS: Test and Alarm. - * The Test action sends out a fixed ZVEI tone sequence for testing purposes. - * The Alarm action sends out a fixed ZVEI tone sequence for alarm purposes. - * - * These actions can be assigned to a key in the settings menu. - * - * The Test/Alarm function will perform the following actions: - * - Set the radio to transmit mode - * - Wait 100ms to allow the radio to switch to transmit mode and stabilize the tramsmitter - * - Send out the ZVEI tone sequence - * - Wait 100ms to allow the radio to finish transmitting - * - Set the radio back to receive mode - * - * The ZVEI tone squence for alarm is: 21414 - * The ZVEI tone squence for test is: 21301 - * - * To save space the two tone sequences are stored as precalculated register values. - * This avoids the need to calculate the register values at runtime. - * They are hardcoded as array of 32bit integers in the rega.h file. - * - * Copyright 2025 Markus Bärtschi - * https://github.com/markusb - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include - -#include "rega.h" -#include "radio.h" -#include "action.h" -#include "misc.h" -#include "settings.h" -#include "functions.h" -#include "driver/bk4819.h" -#include "driver/st7565.h" -#include "driver/system.h" -#include "driver/gpio.h" -#include "bsp/dp32g030/gpio.h" -#include "ui/helper.h" -#include "ui/ui.h" - - -const uint16_t rega_alarm_tones[5] = { - 1160, // 2 1160Hz - 1060, // 1 1060Hz - 1400, // 4 1400Hz - 1060, // 1 1060Hz - 1400, // 4 1400Hz -}; -const uint16_t rega_test_tones[5] = { - 1160, // 2 1160Hz - 1060, // 1 1060Hz - 1260, // 3 1260Hz - 2400, // 0 2400Hz - 1060, // 1 1060Hz -}; - -// Global variable to pass the message to the display -char rega_message[16]; - -// Transmit the ZVEI tone sequence for alarm -void ACTION_RegaAlarm() -{ - const char message[16] = "REGA Alarm"; - REGA_TransmitZvei(rega_alarm_tones,message); -} - -// Tranmit the ZVEI tone sequence for test -void ACTION_RegaTest() -{ - const char message[16] = "REGA Test"; - REGA_TransmitZvei(rega_test_tones,message); -} - -// Display the REGA message on the screen -void UI_DisplayREGA() -{ - UI_DisplayClear(); - UI_DisplayPopup(rega_message); - ST7565_BlitFullScreen(); -} - -// Transmit a ZVEI tone sequence on the REGA frequency -// Configures the radio on VFO A with the required parameters -// tones: array of 5 ZVEI tones -// message: message to display on the screen -void REGA_TransmitZvei(const uint16_t tones[],const char message[]) -{ - // Copy the message text - strncpy(rega_message,message,16); - // Trigger the display - gScreenToDisplay = DISPLAY_REGA; - - // Flash the green LED twice - BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true); - SYSTEM_DelayMs(70); - BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false); - SYSTEM_DelayMs(50); - BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true); - SYSTEM_DelayMs(70); - BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false); - - // Select VFO A - gEeprom.TX_VFO = 0; - gEeprom.ScreenChannel[gEeprom.TX_VFO] = gEeprom.FreqChannel[gEeprom.TX_VFO]; - gRxVfo = gTxVfo; - gRequestSaveVFO = true; - gVfoConfigureMode = VFO_CONFIGURE_RELOAD; - - // Set the REGA frequency, no offset - gTxVfo->freq_config_RX.Frequency = REGA_FREQUENCY; - gTxVfo->freq_config_TX = gTxVfo->freq_config_RX; - gTxVfo->TX_OFFSET_FREQUENCY = 0; - - // Set the modulation to FM narrow - gTxVfo->Modulation = MODULATION_FM; - gTxVfo->CHANNEL_BANDWIDTH = BK4819_FILTER_BW_NARROW; - - // Set Tx Squelch Tone - gTxVfo->freq_config_TX.CodeType = CODE_TYPE_CONTINUOUS_TONE; - gTxVfo->freq_config_TX.Code = REGA_CTCSS_FREQ_INDEX; - BK4819_SetCTCSSFrequency(CTCSS_Options[gTxVfo->freq_config_TX.Code]); - // Turn Rx squelch tone off - gTxVfo->freq_config_RX.CodeType = CODE_TYPE_OFF; - - // Set the transmit power to high - gTxVfo->OUTPUT_POWER = OUTPUT_POWER_HIGH; - - // Lock the keyboard - gEeprom.KEY_LOCK = true; - - gRequestSaveChannel = 1; - gRequestSaveSettings = true; - - // Configure the receiver - BK4819_RX_TurnOn(); - - // Set the radio to transmit mode - RADIO_PrepareCssTX(); - FUNCTION_Select(FUNCTION_TRANSMIT); - - // Wait to allow the radio to switch to transmit mode and stabilize the transmitter - SYSTEM_DelayMs(ZVEI_PRE_LENGTH_MS); - - // Send out the ZVEI2 tone sequence - for (int i = 0; i < ZVEI_NUM_TONES; i++) - { - BK4819_PlaySingleTone(tones[i], ZVEI_TONE_LENGTH_MS, 100, true); - SYSTEM_DelayMs(ZVEI_PAUSE_LENGTH_MS); - } - - // Wait to allow the radio to finish transmitting - SYSTEM_DelayMs(ZVEI_POST_LENGTH_MS); - - // Flash the green LED twice - BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true); - SYSTEM_DelayMs(70); - BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false); - SYSTEM_DelayMs(70); - BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, true); - SYSTEM_DelayMs(70); - BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false); - - // Display the normal screen - gRequestDisplayScreen = DISPLAY_MAIN; -} diff --git a/App/app/rega.h b/App/app/rega.h deleted file mode 100644 index 68f53c14..00000000 --- a/App/app/rega.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * REGA Alam and Test - * ================== - * - * This function sends out a fixed ZVEI tone sequence for testing or alarm purposes for the Alpine REGA alarm channel. - * Further information: https://www.rega.ch/en/our-missions/sites-and-infrastructure/emergency-radio - * - * There are two REGA ACTIONS: Test and Alarm. - * The Test action sends out a fixed ZVEI tone sequence for testing purposes. - * The Alarm action sends out a fixed ZVEI tone sequence for alarm purposes. - * - * These actions can be assigned to a key in the settings menu. - * - * The Test/Alarm function will perform the following actions: - * - Set the radio configuration to the REGA frequency, CTCSS, FM, full power etc. - * - Start transmitting - * - Wait 100ms to allow the radio to switch to transmit mode and stabilize the transmitter - * - Send out the ZVEI tone sequence - * - Wait 100ms to allow the radio to finish transmitting - * - Set the radio back to receive mode - * - * The REGA frequency is 161.300 Mhz - * - * The ZVEI tone squence for alarm is: 21414 - * The ZVEI tone squence for test is: 21301 - * - * The two tone sequences are hardcoded in two arrays - * - * Copyright 2025 Markus Bärtschi - * - * https://github.com/markusb - * - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef REGA_H -#define REGA_H - -#include - -#define ZVEI_NUM_TONES 5 -#define ZVEI_TONE_LENGTH_MS 70 // 70 -#define ZVEI_PAUSE_LENGTH_MS 10 // 10 -#define ZVEI_PRE_LENGTH_MS 300 -#define ZVEI_POST_LENGTH_MS 100 -#define REGA_CTCSS_FREQ_INDEX 18 // dcs.c: CTCSS_Options[18] = 1230 -#define REGA_FREQUENCY 16130000 // 43370000 16130000 - -void ACTION_RegaAlarm(void); -void ACTION_RegaTest(void); -void UI_DisplayREGA(void); -void REGA_TransmitZvei(const uint16_t[], const char[]); - -#endif diff --git a/App/settings.h b/App/settings.h index e5bff534..da1b04fd 100644 --- a/App/settings.h +++ b/App/settings.h @@ -127,10 +127,6 @@ enum ACTION_OPT_t { ACTION_OPT_REMOVE_OFFSET, #endif #endif -#ifdef ENABLE_REGA - ACTION_OPT_REGA_ALARM, - ACTION_OPT_REGA_TEST, -#endif #ifdef ENABLE_FEAT_F4HWN_BEAM ACTION_OPT_BEAM, #endif diff --git a/App/ui/menu.c b/App/ui/menu.c index a1bcae5b..445e4ebd 100644 --- a/App/ui/menu.c +++ b/App/ui/menu.c @@ -496,10 +496,6 @@ const t_sidefunction gSubMenu_SIDEFUNCTIONS[] = #endif #ifdef ENABLE_TX1750 {"1750Hz", ACTION_OPT_1750}, -#endif -#ifdef ENABLE_REGA - {"REGA\nALARM", ACTION_OPT_REGA_ALARM}, - {"REGA\nTEST", ACTION_OPT_REGA_TEST}, #endif {"LOCK\nKEYPAD", ACTION_OPT_KEYLOCK}, {"VFO A\nVFO B", ACTION_OPT_A_B}, diff --git a/App/ui/ui.c b/App/ui/ui.c index 33d3d9e4..116fa962 100644 --- a/App/ui/ui.c +++ b/App/ui/ui.c @@ -30,9 +30,6 @@ #ifdef ENABLE_FMRADIO #include "ui/fmradio.h" #endif -#ifdef ENABLE_REGA - #include "app/rega.h" -#endif #ifdef ENABLE_FEAT_F4HWN_RXTX_LOG #include "app/rxtx_log.h" #endif @@ -67,10 +64,6 @@ void (*UI_DisplayFunctions[])(void) = { #ifdef ENABLE_FEAT_F4HWN_RXTX_LOG [DISPLAY_RXTX_LOG] = &UI_DisplayRxTxLog, #endif - -#ifdef ENABLE_REGA - [DISPLAY_REGA] = &UI_DisplayREGA, -#endif }; static_assert(ARRAY_SIZE(UI_DisplayFunctions) == DISPLAY_N_ELEM); diff --git a/App/ui/ui.h b/App/ui/ui.h index c8d0f646..94b1ede1 100644 --- a/App/ui/ui.h +++ b/App/ui/ui.h @@ -38,10 +38,6 @@ enum GUI_DisplayType_t DISPLAY_RXTX_LOG, #endif -#ifdef ENABLE_REGA - DISPLAY_REGA, -#endif - DISPLAY_N_ELEM, DISPLAY_INVALID = 0xFFu }; diff --git a/CMakePresets.json b/CMakePresets.json index 7730dee5..cf7a5797 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -44,7 +44,6 @@ "ENABLE_BYP_RAW_DEMODULATORS": false, "ENABLE_BLMIN_TMP_OFF": false, "ENABLE_SCAN_RANGES": true, - "ENABLE_REGA": false, "ENABLE_EXTRA_UART_CMD": false, "ENABLE_FEAT_F4HWN": true, "ENABLE_FEAT_F4HWN_GAME": false,