@@ -45,8 +45,8 @@ OpenStreetMap::~OpenStreetMap()
4545
4646 freeTilesCache ();
4747
48- if (cacheSemaphore )
49- vSemaphoreDelete (cacheSemaphore );
48+ if (cacheMutex )
49+ vSemaphoreDelete (cacheMutex );
5050
5151 if (pngCore0)
5252 {
@@ -312,15 +312,15 @@ bool OpenStreetMap::composeMap(LGFX_Sprite &mapSprite, const tileList &requiredT
312312
313313bool OpenStreetMap::fetchMap (LGFX_Sprite &mapSprite, double longitude, double latitude, uint8_t zoom)
314314{
315- if (!cacheSemaphore )
315+ if (!cacheMutex )
316316 {
317- cacheSemaphore = xSemaphoreCreateBinary ();
318- if (!cacheSemaphore )
317+ cacheMutex = xSemaphoreCreateBinary ();
318+ if (!cacheMutex )
319319 {
320320 log_e (" could not init cache mutex" );
321321 return false ;
322322 }
323- xSemaphoreGive (cacheSemaphore );
323+ xSemaphoreGive (cacheMutex );
324324 }
325325
326326 if (!tasksStarted && !startTileWorkerTasks ())
@@ -525,13 +525,6 @@ bool OpenStreetMap::fetchTile(CachedTile &tile, uint32_t x, uint32_t y, uint8_t
525525 return true ;
526526}
527527
528- void OpenStreetMap::decrementActiveJobs ()
529- {
530- log_d (" pending jobs: %d" , pendingJobs.load ());
531- if (--pendingJobs == 0 )
532- log_v (" jobs done" );
533- }
534-
535528void OpenStreetMap::tileFetcherTask (void *param)
536529{
537530 OpenStreetMap *osm = static_cast <OpenStreetMap *>(param);
@@ -540,27 +533,27 @@ void OpenStreetMap::tileFetcherTask(void *param)
540533 TileJob job;
541534 unsigned long startMS;
542535 {
543- ScopedMutex lock (osm->cacheSemaphore );
536+ ScopedMutex lock (osm->cacheMutex );
544537 BaseType_t received = xQueueReceive (osm->jobQueue , &job, portMAX_DELAY);
545538 startMS = millis ();
546539
547540 if (received != pdTRUE)
548541 continue ;
549542
550- if (job.z == 255 ) // poison pill: absolved by dtor
543+ if (job.z == 255 )
551544 break ;
552545
553546 if (!job.tile )
554547 continue ;
555548
556549 {
557- ScopedMutex lock (job.tile ->mutex ); // protect tile fields
550+ ScopedMutex lock (job.tile ->mutex );
558551 if (job.tile ->valid &&
559552 job.tile ->x == job.x &&
560553 job.tile ->y == job.y &&
561554 job.tile ->z == job.z )
562555 {
563- continue ; // Already fetched
556+ continue ;
564557 }
565558
566559 job.tile ->x = job.x ;
0 commit comments