Skip to content

Commit

Permalink
fix(stdlcd): Model copy going to wrong slot, refresh model headers (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelcoeffic authored Oct 29, 2023
1 parent 9dd4a1e commit b026757
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion radio/src/storage/sdcard_yaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,13 @@ bool copyModel(uint8_t dst, uint8_t src)
GET_FILENAME(fname_src, MODELS_PATH, model_idx_src, YAML_EXT);
GET_FILENAME(fname_dst, MODELS_PATH, model_idx_dst, YAML_EXT);

return sdCopyFile(fname_src, fname_dst);
if (sdCopyFile(fname_src, fname_dst) == nullptr) {
// update headers
memcpy(&modelHeaders[dst], &modelHeaders[src], sizeof(ModelHeader));
return true;
}

return false;
}

static void swapModelHeaders(uint8_t id1, uint8_t id2)
Expand Down

0 comments on commit b026757

Please sign in to comment.