data_flash: ensure data is flushed when there is more than PAGE_SIZE available
@@ -247,10 +247,6 @@ flash_do_more:
break;
case STATE_IDLE:
- if (to_write >= PAGE_SIZE) {
- state = STATE_START_WRITE;
- goto flash_do_more;
- }
if (should_flush == 1) {
if (to_write > 0 && offset < bounds.total_size) {
state = STATE_START_WRITE;
@@ -260,6 +256,10 @@ flash_do_more:
}
goto flash_do_more;
}
+ if (to_write >= PAGE_SIZE) {
+ state = STATE_START_WRITE;
+ goto flash_do_more;
+ }
break;
case STATE_START_WRITE: {
