diff --git a/lib/IconTextLampPlugin/src/IconTextLampPlugin.cpp b/lib/IconTextLampPlugin/src/IconTextLampPlugin.cpp index 7ea183ce..451e27b8 100644 --- a/lib/IconTextLampPlugin/src/IconTextLampPlugin.cpp +++ b/lib/IconTextLampPlugin/src/IconTextLampPlugin.cpp @@ -445,18 +445,20 @@ void IconTextLampPlugin::start(uint16_t width, uint16_t height) void IconTextLampPlugin::stop() { - MutexGuard guard(m_mutex); + String bitmapFullPath = getFileName(FILE_EXT_BITMAP); + String spriteSheetFullPath = getFileName(FILE_EXT_SPRITE_SHEET); + MutexGuard guard(m_mutex); /* Remove icon which is specific for the plugin instance. */ - if (false != FILESYSTEM.remove(getFileName(FILE_EXT_BITMAP))) + if (false != FILESYSTEM.remove(bitmapFullPath)) { - LOG_INFO("File %s removed", getFileName(FILE_EXT_BITMAP).c_str()); + LOG_INFO("File %s removed", bitmapFullPath.c_str()); } /* Remove spritesheet which is specific for the plugin instance. */ - if (false != FILESYSTEM.remove(getFileName(FILE_EXT_SPRITE_SHEET))) + if (false != FILESYSTEM.remove(spriteSheetFullPath)) { - LOG_INFO("File %s removed", getFileName(FILE_EXT_SPRITE_SHEET).c_str()); + LOG_INFO("File %s removed", spriteSheetFullPath.c_str()); } } diff --git a/lib/IconTextPlugin/src/IconTextPlugin.cpp b/lib/IconTextPlugin/src/IconTextPlugin.cpp index 0a72427f..440e2a25 100644 --- a/lib/IconTextPlugin/src/IconTextPlugin.cpp +++ b/lib/IconTextPlugin/src/IconTextPlugin.cpp @@ -322,18 +322,20 @@ void IconTextPlugin::start(uint16_t width, uint16_t height) void IconTextPlugin::stop() { - MutexGuard guard(m_mutex); + String bitmapFullPath = getFileName(FILE_EXT_BITMAP); + String spriteSheetFullPath = getFileName(FILE_EXT_SPRITE_SHEET); + MutexGuard guard(m_mutex); /* Remove icon which is specific for the plugin instance. */ - if (false != FILESYSTEM.remove(getFileName(FILE_EXT_BITMAP))) + if (false != FILESYSTEM.remove(bitmapFullPath)) { - LOG_INFO("File %s removed", getFileName(FILE_EXT_BITMAP).c_str()); + LOG_INFO("File %s removed", bitmapFullPath.c_str()); } /* Remove spritesheet which is specific for the plugin instance. */ - if (false != FILESYSTEM.remove(getFileName(FILE_EXT_SPRITE_SHEET))) + if (false != FILESYSTEM.remove(spriteSheetFullPath)) { - LOG_INFO("File %s removed", getFileName(FILE_EXT_SPRITE_SHEET).c_str()); + LOG_INFO("File %s removed", spriteSheetFullPath.c_str()); } } diff --git a/lib/ThreeIconPlugin/src/ThreeIconPlugin.cpp b/lib/ThreeIconPlugin/src/ThreeIconPlugin.cpp index 0744de01..9527df5e 100644 --- a/lib/ThreeIconPlugin/src/ThreeIconPlugin.cpp +++ b/lib/ThreeIconPlugin/src/ThreeIconPlugin.cpp @@ -352,7 +352,9 @@ void ThreeIconPlugin::start(uint16_t width, uint16_t height) for(iconId = 0U; iconId < MAX_ICONS; ++iconId) { - int16_t x = (ICON_WIDTH + DISTANCE) * iconId + DISTANCE; + int16_t x = (ICON_WIDTH + DISTANCE) * iconId + DISTANCE; + String bitmapFullPath = getFileName(iconId, FILE_EXT_BITMAP); + String spriteSheetFullPath = getFileName(iconId, FILE_EXT_SPRITE_SHEET); (void)m_threeIconCanvas.addWidget(m_bitmapWidgets[iconId]); m_bitmapWidgets[iconId].move(x, 0); @@ -364,17 +366,17 @@ void ThreeIconPlugin::start(uint16_t width, uint16_t height) m_iconPaths[iconId].clear(); m_spriteSheetPaths[iconId].clear(); - if (false == m_bitmapWidgets[iconId].loadSpriteSheet(FILESYSTEM, getFileName(iconId, FILE_EXT_SPRITE_SHEET), getFileName(iconId, FILE_EXT_BITMAP))) + if (false == m_bitmapWidgets[iconId].loadSpriteSheet(FILESYSTEM, spriteSheetFullPath, bitmapFullPath)) { - if (true == m_bitmapWidgets[iconId].load(FILESYSTEM, getFileName(iconId, FILE_EXT_BITMAP))) + if (true == m_bitmapWidgets[iconId].load(FILESYSTEM, bitmapFullPath)) { - m_iconPaths[iconId] = getFileName(iconId, FILE_EXT_BITMAP); + m_iconPaths[iconId] = bitmapFullPath; } } else { - m_iconPaths[iconId] = getFileName(iconId, FILE_EXT_BITMAP); - m_spriteSheetPaths[iconId] = getFileName(iconId, FILE_EXT_SPRITE_SHEET); + m_iconPaths[iconId] = bitmapFullPath; + m_spriteSheetPaths[iconId] = spriteSheetFullPath; } } } @@ -385,15 +387,18 @@ void ThreeIconPlugin::stop() MutexGuard guard(m_mutex); for(iconId = 0U; iconId < MAX_ICONS; ++iconId) - { - if (false != FILESYSTEM.remove(getFileName(iconId, FILE_EXT_BITMAP))) + { + String bitmapFullPath = getFileName(iconId, FILE_EXT_BITMAP); + String spriteSheetFullPath = getFileName(iconId, FILE_EXT_SPRITE_SHEET); + + if (false != FILESYSTEM.remove(bitmapFullPath)) { - LOG_INFO("File %s removed", getFileName(iconId, FILE_EXT_BITMAP).c_str()); + LOG_INFO("File %s removed", bitmapFullPath.c_str()); } - if (false != FILESYSTEM.remove(getFileName(iconId, FILE_EXT_SPRITE_SHEET))) + if (false != FILESYSTEM.remove(spriteSheetFullPath)) { - LOG_INFO("File %s removed", getFileName(iconId, FILE_EXT_SPRITE_SHEET).c_str()); + LOG_INFO("File %s removed", spriteSheetFullPath.c_str()); } } }