Улучшение структуры с флагами
This commit is contained in:
@@ -112,37 +112,37 @@ void Settings_WriteSettings(SettingsTypeDef *settings)
|
||||
settings->setarr[i].real_ptr,
|
||||
settings->setarr[i].length) != 0)
|
||||
{
|
||||
settings->update_settings_flag = 1;
|
||||
settings->f.settings_need_to_update = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(settings->update_settings_flag)
|
||||
{
|
||||
// if(GPIO_Read_Switch(&MZKT_DISCIN.err_24V))
|
||||
// if(settings->f.settings_need_to_update)
|
||||
// {
|
||||
//// if(GPIO_Read_Switch(&MZKT_DISCIN.err_24V))
|
||||
//// {
|
||||
//// printf_memspi_err("Power Err, cancel writing");
|
||||
//// settings->f.settings_need_to_update = 0;
|
||||
//// update_start = 0;
|
||||
//// return;
|
||||
//// }
|
||||
// if(msDelayDone(1000, &update_request_tick))
|
||||
// {
|
||||
// printf_memspi_err("Power Err, cancel writing");
|
||||
// settings->update_settings_flag = 0;
|
||||
// update_start = 0;
|
||||
// return;
|
||||
// }
|
||||
if(msDelayDone(1000, &update_request_tick))
|
||||
{
|
||||
update_start = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
msDelayStart(&update_request_tick);
|
||||
update_start = 0;
|
||||
}
|
||||
// update_start = 1;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// msDelayStart(&update_request_tick);
|
||||
// update_start = 0;
|
||||
// }
|
||||
|
||||
|
||||
if(update_start)
|
||||
settings->f.settings_is_updated = 0;
|
||||
if(settings->f.settings_need_to_update)
|
||||
{
|
||||
// Сбрасываем флаг обновления
|
||||
settings->update_settings_flag = 0;
|
||||
settings->f.settings_need_to_update = 0;
|
||||
update_start = 0;
|
||||
|
||||
#ifdef SETTINGS_USE_SETTINGS_FROM_BUFFER
|
||||
@@ -158,7 +158,9 @@ void Settings_WriteSettings(SettingsTypeDef *settings)
|
||||
// Записываем настройки в память
|
||||
WriteSettingsToMem(settings);
|
||||
|
||||
Settings_ReadSettings(settings);
|
||||
Settings_CheckSettings(settings);
|
||||
settings->f.settings_is_updated = 1;
|
||||
__enable_irq();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user