Skip to content

Commit

Permalink
写入keymap的时候判断是否需要gc并执行gc
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-kirisame committed Jul 25, 2019
1 parent d425092 commit b5adaa3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions application/main/src/keyboard/keymap_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,15 @@ static void keymap_read(void)
static void keymap_update(void)
{
// record_desc was create by fds_record_find or fds_record_write
ret_code_t code = fds_record_update(&record_desc, &record);
APP_ERROR_CHECK(code);
ret_code_t err_code = fds_record_update(&record_desc, &record);

// space full, gc
if (err_code == FDS_ERR_NO_SPACE_IN_FLASH)
{
err_code = fds_gc();
APP_ERROR_CHECK(err_code);
fds_record_update(&record_desc, &record);
}
}

/**
Expand Down

0 comments on commit b5adaa3

Please sign in to comment.