Added SETTINGS_SaveSettings.

This commit is contained in:
Dual Tachyon 2023-08-27 00:15:34 +01:00
parent 6082f15e61
commit 57eca39fa2
3 changed files with 107 additions and 2 deletions

5
app.c
View File

@ -89,7 +89,7 @@ void FUN_00007fd0(void)
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 9, true)) {
if (gEeprom.PERMIT_REMOTE_KILL) {
gSetting_KILLED = true;
//SETTINGS_SaveSettings();
SETTINGS_SaveSettings();
g_200003BE = 2;
if (gFmMute == true) {
FM_TurnOff();
@ -106,7 +106,7 @@ void FUN_00007fd0(void)
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
if (DTMF_CompareMessage(gDTMF_Received + Offset, String, 9, true)) {
gSetting_KILLED = false;
//SETTINGS_SaveSettings();
SETTINGS_SaveSettings();
g_200003BE = 2;
g_200003BC = 0;
gUpdateDisplay = true;
@ -1379,6 +1379,7 @@ static void APP_ProcessKey(KEY_Code_t CurrentKey, bool bKeyPressed, bool bKeyHel
g_200003A5 = 0;
}
if (gFlagSaveSettings) {
SETTINGS_SaveSettings();
gFlagSaveSettings = false;
}
if (gFlagSaveFM) {

View File

@ -18,6 +18,7 @@
#include "driver/eeprom.h"
#include "driver/uart.h"
#include "fm.h"
#include "misc.h"
#include "settings.h"
EEPROM_Config_t gEeprom;
@ -63,3 +64,105 @@ void SETTINGS_SaveVfoIndices(void)
EEPROM_WriteBuffer(0x0E80, State);
}
void SETTINGS_SaveSettings(void)
{
uint8_t State[8];
uint32_t Password[2];
UART_LogSend("spub\r\n", 6);
State[0] = gEeprom.CHAN_1_CALL;
State[1] = gEeprom.SQUELCH_LEVEL;
State[2] = gEeprom.TX_TIMEOUT_TIMER;
State[3] = gEeprom.NOAA_AUTO_SCAN;
State[4] = gEeprom.KEY_LOCK;
State[5] = gEeprom.VOX_SWITCH;
State[6] = gEeprom.VOX_LEVEL;
State[7] = gEeprom.MIC_SENSITIVITY;
EEPROM_WriteBuffer(0x0E70, State);
State[0] = 0xFF;
State[1] = gEeprom.CHANNEL_DISPLAY_MODE;
State[2] = gEeprom.CROSS_BAND_RX_TX;
State[3] = gEeprom.BATTERY_SAVE;
State[4] = gEeprom.DUAL_WATCH;
State[5] = gEeprom.BACKLIGHT;
State[6] = gEeprom.TAIL_NOTE_ELIMINATION;
State[7] = gEeprom.VFO_OPEN;
EEPROM_WriteBuffer(0x0E78, State);
State[0] = gEeprom.BEEP_CONTROL;
State[1] = gEeprom.KEY_1_SHORT_PRESS_ACTION;
State[2] = gEeprom.KEY_1_LONG_PRESS_ACTION;
State[3] = gEeprom.KEY_2_SHORT_PRESS_ACTION;
State[4] = gEeprom.KEY_2_LONG_PRESS_ACTION;
State[5] = gEeprom.SCAN_RESUME_MODE;
State[6] = gEeprom.AUTO_KEYPAD_LOCK;
State[7] = gEeprom.POWER_ON_DISPLAY_MODE;
EEPROM_WriteBuffer(0x0E90, State);
memset(Password, 0xFF, sizeof(Password));
Password[0] = gEeprom.POWER_ON_PASSWORD;
EEPROM_WriteBuffer(0x0E98, State);
memset(State, 0xFF, sizeof(State));
State[0] = gEeprom.VOICE_PROMPT;
EEPROM_WriteBuffer(0x0EA0, State);
State[0] = gEeprom.ALARM_MODE;
State[1] = gEeprom.ROGER;
State[2] = gEeprom.REPEATER_TAIL_TONE_ELIMINATION;
State[3] = gEeprom.TX_CHANNEL;
EEPROM_WriteBuffer(0x0EA8, State);
State[0] = gEeprom.DTMF_SIDE_TONE;
State[1] = gEeprom.DTMF_SEPARATE_CODE;
State[2] = gEeprom.DTMF_GROUP_CALL_CODE;
State[3] = gEeprom.DTMF_DECODE_RESPONSE;
State[4] = gEeprom.DTMF_AUTO_RESET_TIME;
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
EEPROM_WriteBuffer(0x0ED0, State);
memset(State, 0xFF, sizeof(State));
State[0] = gEeprom.DTMF_CODE_PERSIST_TIME / 10U;
State[1] = gEeprom.DTMF_CODE_INTERVAL_TIME / 10U;
State[2] = gEeprom.PERMIT_REMOTE_KILL;
EEPROM_WriteBuffer(0x0ED8, State);
State[0] = gEeprom.SCAN_LIST_DEFAULT;
State[1] = gEeprom.SCAN_LIST_ENABLED[0];
State[2] = gEeprom.SCANLIST_PRIORITY_CH1[0];
State[3] = gEeprom.SCANLIST_PRIORITY_CH2[0];
State[4] = gEeprom.SCAN_LIST_ENABLED[1];
State[5] = gEeprom.SCANLIST_PRIORITY_CH1[1];
State[6] = gEeprom.SCANLIST_PRIORITY_CH2[1];
State[7] = 0xFF;
EEPROM_WriteBuffer(0x0F18, State);
memset(State, 0xFF, sizeof(State));
State[0] = gSetting_F_LOCK;
State[1] = gSetting_350TX;
State[2] = gSetting_KILLED;
State[3] = gSetting_200TX;
State[4] = gSetting_500TX;
State[5] = gSetting_350EN;
State[6] = gSetting_ScrambleEnable;
EEPROM_WriteBuffer(0x0F40, State);
}

View File

@ -170,6 +170,7 @@ extern EEPROM_Config_t gEeprom;
void SETTINGS_SaveFM(void);
void SETTINGS_SaveVfoIndices(void);
void SETTINGS_SaveSettings(void);
#endif