fix(config): make cv_ver atomic commit marker in config_save_tuning
This commit is contained in:
@@ -89,7 +89,12 @@ bool config_save_tuning(const CVTuning& tuning) {
|
|||||||
size_t r3 = prefs.putFloat("cv_move", tuning.max_move);
|
size_t r3 = prefs.putFloat("cv_move", tuning.max_move);
|
||||||
size_t r4 = prefs.putUInt("cv_miss", (uint32_t)tuning.max_missed);
|
size_t r4 = prefs.putUInt("cv_miss", (uint32_t)tuning.max_missed);
|
||||||
size_t r5 = prefs.putUInt("cv_line", (uint32_t)tuning.line_offset);
|
size_t r5 = prefs.putUInt("cv_line", (uint32_t)tuning.line_offset);
|
||||||
|
if (!(r1 > 0 && r2 > 0 && r3 > 0 && r4 > 0 && r5 > 0)) {
|
||||||
|
prefs.end();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// cv_ver is the atomic commit marker: only written after all tunables succeed.
|
||||||
size_t r6 = prefs.putUInt("cv_ver", tuning.cfg_version);
|
size_t r6 = prefs.putUInt("cv_ver", tuning.cfg_version);
|
||||||
prefs.end();
|
prefs.end();
|
||||||
return (r1 > 0) && (r2 > 0) && (r3 > 0) && (r4 > 0) && (r5 > 0) && (r6 > 0);
|
return r6 > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user