diff --git a/App/settings.c b/App/settings.c index cca89b4e..afad532f 100644 --- a/App/settings.c +++ b/App/settings.c @@ -1127,15 +1127,31 @@ State[1] = 0 #ifdef ENABLE_FEAT_F4HWN_RESUME_STATE void SETTINGS_WriteCurrentState(void) { - uint8_t State[0x10]; - // 0x0E78 - PY25Q16_ReadBuffer(0x00A000, State, sizeof(State)); - //State[11] = (gEeprom.CURRENT_STATE << 4) | (gEeprom.BATTERY_SAVE & 0x0F); - //State[15] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) | ((gEeprom.SCAN_LIST_DEFAULT & 0x07) << 4); - State[15] = + uint8_t State[0x08]; + + PY25Q16_ReadBuffer(0x00A008, State, sizeof(State)); + State[7] = (gEeprom.CURRENT_STATE & 0x07) | ((gEeprom.SCAN_LIST_DEFAULT & 0x1F) << 3); - PY25Q16_WriteBuffer(0x00A000, State, sizeof(State), false); + PY25Q16_WriteBuffer(0x00A008, State, sizeof(State), false); + + // + + PY25Q16_ReadBuffer(0x00A130, State, sizeof(State)); + + State[0] = (gEeprom.SCAN_LIST_DEFAULT & 0x7F) + | ((gEeprom.SCAN_LIST_ENABLED & 0x01) << 7); + + State[1] = (uint8_t)(gEeprom.SCANLIST_PRIORITY_CH[0] & 0xFF); + State[2] = (uint8_t)(gEeprom.SCANLIST_PRIORITY_CH[0] >> 8); + + State[3] = (uint8_t)(gEeprom.SCANLIST_PRIORITY_CH[1] & 0xFF); + State[4] = (uint8_t)(gEeprom.SCANLIST_PRIORITY_CH[1] >> 8); + + State[5] = (uint8_t)(gEeprom.CHAN_1_CALL & 0xFF); + State[6] = (uint8_t)(gEeprom.CHAN_1_CALL >> 8); + + PY25Q16_WriteBuffer(0x00A130, State, sizeof(State), false); } #endif