Skip to content

Commit d248bcc

Browse files
committed
Load block table only one time
1 parent 85a5153 commit d248bcc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

envie/ota.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#define ALL_IN_SD 1
2424

25+
static bool BlockTableLoaded = false;
2526
static BlockTableData block_info[2];
2627

2728
static void loadOTAData(void) {
@@ -367,7 +368,10 @@ static void initBlockTable(void) {
367368
*/
368369
mbed::BlockDevice* get_secondary_bd(void) {
369370

370-
initBlockTable();
371+
if(!BlockTableLoaded) {
372+
initBlockTable();
373+
BlockTableLoaded = true;
374+
}
371375

372376
if(block_info[SECONDARY_BLOCK_DEVICE].raw_flag) {
373377
return block_info[SECONDARY_BLOCK_DEVICE].log_bd;

0 commit comments

Comments
 (0)