fix(color): 'lastopened' value not loaded on startup if stored hash not up to date (#3521)

This commit is contained in:
philmoz
2023-05-07 11:09:20 +10:00
committed by GitHub
parent ee6563e33f
commit 140c700e1e
+9 -7
View File
@@ -194,18 +194,20 @@ static void set_attr(void* ctx, char* buf, uint16_t len)
}
}
// Don't bother filling in values below if hash didn't match
if(mi->modeldatavalid) {
// Last Opened
// Hack: Always load this as the hash value is (currently) not in synch with the saved model file
// TODO: Ensure stored hash is up to date.
if (!strcasecmp(mi->current_attr, "lastopen")) {
mi->curmodel->lastOpened = (gtime_t)strtol(value, NULL, 0);
TRACE_LABELS_YAML(" Last Opened %lu", value);
} else if (mi->modeldatavalid) {
// Don't bother filling in values below if hash didn't match
// Model Name
if(!strcasecmp(mi->current_attr, "name")) {
mi->curmodel->setModelName(value);
TRACE_LABELS_YAML(" Set the models name");
// Last Opened
} else if(!strcasecmp(mi->current_attr, "lastopen")) {
mi->curmodel->lastOpened = (gtime_t)strtol(value, NULL, 0);
TRACE_LABELS_YAML(" Last Opened %lu", value);
// Model Bitmap
#if LEN_BITMAP_NAME > 0
} else if(!strcasecmp(mi->current_attr, "bitmap")) {