Skip to content

Commit c749923

Browse files
Zero-fill tile buffer on fetch failure to avoid ghosting (#102)
1 parent fc7d84f commit c749923

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/OpenStreetMap-esp32.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,11 @@ void OpenStreetMap::tileFetcherTask(void *param)
477477

478478
String result;
479479
if (!osm->fetchTile(*job.tile, job.x, job.y, job.z, result))
480+
{
481+
const size_t tileByteCount = osm->currentProvider->tileSize * osm->currentProvider->tileSize * 2;
482+
memset(job.tile->buffer, 0, tileByteCount);
480483
log_e("Tile fetch failed: %s", result.c_str());
484+
}
481485
else
482486
log_d("core %i fetched tile z=%u x=%lu, y=%lu in %lu ms", xPortGetCoreID(), job.z, job.x, job.y, millis() - startMS);
483487
--osm->pendingJobs;

0 commit comments

Comments
 (0)