From 140c700e1e7690068ec2a89f3b87a0921899d955 Mon Sep 17 00:00:00 2001 From: philmoz Date: Sun, 7 May 2023 11:09:20 +1000 Subject: [PATCH] fix(color): 'lastopened' value not loaded on startup if stored hash not up to date (#3521) --- radio/src/storage/yaml/yaml_labelslist.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/radio/src/storage/yaml/yaml_labelslist.cpp b/radio/src/storage/yaml/yaml_labelslist.cpp index 3fae65b37..abecf1d01 100644 --- a/radio/src/storage/yaml/yaml_labelslist.cpp +++ b/radio/src/storage/yaml/yaml_labelslist.cpp @@ -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")) {