RTFM :(
This commit is contained in:
rusefillc 2023-06-28 16:24:37 -04:00
parent 0202c893cc
commit 515b05d103
1 changed files with 5 additions and 4 deletions

View File

@ -36,6 +36,10 @@ static size_t GetConfigurationSize() {
return sizeof(TestConfiguration); return sizeof(TestConfiguration);
} }
static bool isMfsOkIsh(mfs_error_t state) {
return state == MFS_NO_ERROR || state == MFS_WARN_REPAIR || state == MFS_WARN_GC;
}
mfs_error_t flashState; mfs_error_t flashState;
int InitConfiguration() { int InitConfiguration() {
@ -52,13 +56,10 @@ int InitConfiguration() {
} else { } else {
flashState = mfsStart(&mfs1, &mfscfg_2k); flashState = mfsStart(&mfs1, &mfscfg_2k);
} }
if (flashState != MFS_NO_ERROR) {
return -1;
}
size_t size = GetConfigurationSize(); size_t size = GetConfigurationSize();
flashState = mfsReadRecord(&mfs1, MFS_CONFIGURATION_RECORD_ID, &size, GetConfigurationPtr()); flashState = mfsReadRecord(&mfs1, MFS_CONFIGURATION_RECORD_ID, &size, GetConfigurationPtr());
if ((flashState != MFS_NO_ERROR) || size != GetConfigurationSize() || !configuration.IsValid()) { if (!isMfsOkIsh(flashState) || size != GetConfigurationSize() || !configuration.IsValid()) {
/* load defaults */ /* load defaults */
configuration.resetToDefaults(); configuration.resetToDefaults();
} else { } else {