mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
Preserve RescueOps settings across presets
This commit is contained in:
1 parent
751c6064d1
commit
4315b98aec
3 files changed
+8
-20
No files matched your search
@@ -119,7 +119,6 @@ void Main(void)
|
||||
gCB = gEeprom.CROSS_BAND_RX_TX;
|
||||
#endif
|
||||
|
||||
SETTINGS_WriteChirpCapabilities();
|
||||
SETTINGS_LoadCalibration();
|
||||
|
||||
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
||||
|
||||
+8
-18
@@ -152,7 +152,9 @@ void SETTINGS_InitEEPROM(void)
|
||||
gEeprom.SET_KEY = ((Data[4] >> 2) & 0x0F) > 4 ? 0 : (Data[4] >> 2) & 0x0F;
|
||||
gEeprom.SET_NAV = (Data[4] & 0x40) != 0;
|
||||
#else
|
||||
gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false;
|
||||
// RescueOps fields can be present in a config bank shared with another
|
||||
// preset. Read only KEY_LOCK here and leave the other bits untouched.
|
||||
gEeprom.KEY_LOCK = (Data[4] & 0x01) != 0;
|
||||
#endif
|
||||
#ifdef ENABLE_VOX
|
||||
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
||||
@@ -896,7 +898,11 @@ void SETTINGS_SaveSettings(void)
|
||||
((gEeprom.SET_KEY & 0x0F) << 2) |
|
||||
(gEeprom.SET_NAV ? 0x40 : 0);
|
||||
#else
|
||||
State[4] = gEeprom.KEY_LOCK;
|
||||
// A non-RescueOps preset owns KEY_LOCK only. Preserve Set RescueOps,
|
||||
// SetKEY, SetNav and reserved bits from a config created by another
|
||||
// preset while updating bit 0.
|
||||
PY25Q16_ReadBuffer(0x00A004, &State[4], 1);
|
||||
State[4] = (State[4] & 0xFEu) | (gEeprom.KEY_LOCK ? 0x01u : 0u);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
@@ -1251,22 +1257,6 @@ void SETTINGS_UpdateChannel(uint16_t channel, const VFO_Info_t *pVFO, bool keep)
|
||||
SETTINGS_SaveChannelName(channel, "");
|
||||
}
|
||||
|
||||
void SETTINGS_WriteChirpCapabilities(void)
|
||||
{
|
||||
enum {
|
||||
CHIRP_CAP_RESCUE_OPS = 1u << 0,
|
||||
};
|
||||
|
||||
uint8_t capabilities[2] = {0};
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||
capabilities[0] |= CHIRP_CAP_RESCUE_OPS;
|
||||
#endif
|
||||
|
||||
// 0xA158..0xA159 are reserved for the firmware/CHIRP capability contract.
|
||||
PY25Q16_WriteBuffer(0x00A158, capabilities, sizeof(capabilities), false);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||
void SETTINGS_WriteCurrentState(void)
|
||||
{
|
||||
|
||||
@@ -329,7 +329,6 @@ 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_WriteChirpCapabilities(void);
|
||||
#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE
|
||||
void SETTINGS_WriteCurrentState(void);
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user