From 751c6064d1479772c5ef2cbaf0d1b58b0eeda729 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sat, 22 Aug 2026 15:55:32 +0200 Subject: [PATCH] Replace build options with CHIRP capabilities --- App/main.c | 2 +- App/settings.c | 59 ++++++++------------------------------------------ App/settings.h | 2 +- 3 files changed, 11 insertions(+), 52 deletions(-) diff --git a/App/main.c b/App/main.c index c5d95d0e..90b28c1f 100644 --- a/App/main.c +++ b/App/main.c @@ -119,7 +119,7 @@ void Main(void) gCB = gEeprom.CROSS_BAND_RX_TX; #endif - SETTINGS_WriteBuildOptions(); + SETTINGS_WriteChirpCapabilities(); SETTINGS_LoadCalibration(); RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD); diff --git a/App/settings.c b/App/settings.c index 41f2e548..330feb59 100644 --- a/App/settings.c +++ b/App/settings.c @@ -1251,61 +1251,20 @@ void SETTINGS_UpdateChannel(uint16_t channel, const VFO_Info_t *pVFO, bool keep) SETTINGS_SaveChannelName(channel, ""); } -void SETTINGS_WriteBuildOptions(void) +void SETTINGS_WriteChirpCapabilities(void) { - uint8_t State[8]; + enum { + CHIRP_CAP_RESCUE_OPS = 1u << 0, + }; -#ifdef ENABLE_FEAT_F4HWN - // 0x1FF0 - PY25Q16_ReadBuffer(0x00A158, State, sizeof(State)); -#endif - -State[0] = 0 -#ifdef ENABLE_FMRADIO - | (1 << 0) -#endif -#ifdef ENABLE_NOAA - | (1 << 1) -#endif -#ifdef ENABLE_VOICE - | (1 << 2) -#endif -#ifdef ENABLE_VOX - | (1 << 3) -#endif -#ifdef ENABLE_TX1750 - | (1 << 5) -#endif -#ifdef ENABLE_PWRON_PASSWORD - | (1 << 6) -#endif -#ifdef ENABLE_DTMF_CALLING - | (1 << 7) -#endif -; + uint8_t capabilities[2] = {0}; -State[1] = 0 -#ifdef ENABLE_FLASHLIGHT - | (1 << 0) -#endif -#ifdef ENABLE_WIDE_RX - | (1 << 1) -#endif -#ifdef ENABLE_BYP_RAW_DEMODULATORS - | (1 << 2) -#endif -#ifdef ENABLE_FEAT_F4HWN_GAME - | (1 << 3) -#endif -// Bit 4 is reserved (legacy ENABLE_AM_FIX). -#ifdef ENABLE_SPECTRUM - | (1 << 5) -#endif #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS - | (1 << 6) + capabilities[0] |= CHIRP_CAP_RESCUE_OPS; #endif -; - PY25Q16_WriteBuffer(0x00A158, State, sizeof(State), false); + + // 0xA158..0xA159 are reserved for the firmware/CHIRP capability contract. + PY25Q16_WriteBuffer(0x00A158, capabilities, sizeof(capabilities), false); } #ifdef ENABLE_FEAT_F4HWN_RESUME_STATE diff --git a/App/settings.h b/App/settings.h index b1176484..791d0556 100644 --- a/App/settings.h +++ b/App/settings.h @@ -329,7 +329,7 @@ void SETTINGS_SaveChannelName(uint16_t channel, const char * name); void SETTINGS_SaveChannel(uint16_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode); void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration); void SETTINGS_UpdateChannel(uint16_t channel, const VFO_Info_t *pVFO, bool keep); -void SETTINGS_WriteBuildOptions(void); +void SETTINGS_WriteChirpCapabilities(void); #ifdef ENABLE_FEAT_F4HWN_RESUME_STATE void SETTINGS_WriteCurrentState(void); #endif