From 0793b68971b395958e2456ad951558e823486405 Mon Sep 17 00:00:00 2001 From: Krzysiek Egzmont Date: Thu, 7 Dec 2023 22:50:23 +0100 Subject: [PATCH] Write build options to EEPROM for CHIRP to use. --- main.c | 2 +- settings.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ settings.h | 1 + 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 5938f475c..55dde81bd 100644 --- a/main.c +++ b/main.c @@ -84,7 +84,7 @@ void Main(void) BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent); SETTINGS_InitEEPROM(); - + SETTINGS_WriteBuildOptions(); SETTINGS_LoadCalibration(); RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD); diff --git a/settings.c b/settings.c index 4ca3bf4a6..d98171015 100644 --- a/settings.c +++ b/settings.c @@ -711,3 +711,50 @@ void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep) } } } + +void SETTINGS_WriteBuildOptions(void) +{ + uint8_t buf[8]= {}; +buf[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_ALARM + | (1 << 4) +#endif +#ifdef ENABLE_TX1750 + | (1 << 5) +#endif +#ifdef ENABLE_PWRON_PASSWORD + | (1 << 6) +#endif +#ifdef ENABLE_DTMF_CALLING + | (1 << 7) +#endif +; + +buf[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_BLMIN_TMP_OFF + | (1 << 3) +#endif +; + EEPROM_WriteBuffer(0x1FF0, buf); +} \ No newline at end of file diff --git a/settings.h b/settings.h index 20949f1f2..862151dea 100644 --- a/settings.h +++ b/settings.h @@ -267,5 +267,6 @@ void SETTINGS_SaveChannelName(uint8_t channel, const char * name); void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode); void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration); void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep); +void SETTINGS_WriteBuildOptions(void); #endif