fix NVM bug

This bug prevented the user from saving the configuration more than
twice without rebooting.
This commit is contained in:
Samuel Sadok
2019-08-13 14:02:57 +02:00
parent b7a830d53f
commit 2658e9f053
+4 -2
View File
@@ -362,10 +362,12 @@ int NVM_commit(void) {
read_sector_ = 1 - read_sector_;
// invalidate the other sector
if (read_sector->index < read_sector->n_data)
if (read_sector->index < read_sector->n_data) {
status = set_allocation_state(read_sector, read_sector->index, 1, INVALID);
else
read_sector->index += 1;
} else {
status = erase(read_sector);
}
return status;
}