def task_erase(self, state): sector = state["sector"] sector_offset = state["sector_offset"] state["bar"].set_fraction((sector-sector_offset+1)/float(FLASH_SECTOR_END-sector_offset+1)) state["bar"].set_text("Erasing sector %d/%d"%((sector-sector_offset+1), FLASH_SECTOR_END-sector_offset+1)) openmv.flash_erase(sector) sector += 1 if (sector == FLASH_SECTOR_END+1): state["next"] = self.task_upload state["sector"] = sector return True