From d922c002ca3d5de89f4ae2f309d1713100bec977 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Thu, 6 Aug 2020 00:40:08 -0300 Subject: [PATCH] Followup to LVGL patch (#18920) --- Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp | 11 ++++++----- Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.h | 2 +- Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp b/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp index da87ce976..9d3adc1ba 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp @@ -24,12 +24,13 @@ #if HAS_TFT_LVGL_UI +#include "../../../../inc/MarlinConfig.h" #include "SPIFlashStorage.h" -uint8_t SPIFlashStorage::::m_pageData[SPI_FLASH_PageSize]; -uint32_t SPIFlashStorage::::m_currentPage; -uint16_t SPIFlashStorage::::m_pageDataUsed; -uint32_t SPIFlashStorage::::m_startAddress; +uint8_t SPIFlashStorage::m_pageData[SPI_FLASH_PageSize]; +uint32_t SPIFlashStorage::m_currentPage; +uint16_t SPIFlashStorage::m_pageDataUsed; +uint32_t SPIFlashStorage::m_startAddress; #if HAS_SPI_FLASH_COMPRESSION @@ -291,7 +292,7 @@ void SPIFlashStorage::beginRead(uint32_t startAddress) { uint16_t SPIFlashStorage::outData(uint8_t* data, uint16_t size) { // Don't read more than we have - NOMORE(size > pageDataFree()); + NOMORE(size, pageDataFree()); memcpy(data, m_pageData + m_pageDataUsed, size); m_pageDataUsed += size; return size; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.h b/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.h index c806068dd..5a1241370 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.h @@ -79,7 +79,7 @@ public: static void endWrite(); static void writeData(uint8_t* data, uint16_t size); - static // Read operation + // Read operation static void beginRead(uint32_t startAddress); static void readData(uint8_t* data, uint16_t size); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp b/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp index 771e3e062..3f87c5183 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp @@ -482,7 +482,7 @@ uint8_t public_buf[512]; if (card.longFilename[0] == '.') continue; int8_t a = arrayFindStr(assets, COUNT(assets), card.longFilename); - if (a >= 0 && a < COUNT(assets)) { + if (a >= 0 && a < (int8_t)COUNT(assets)) { uint8_t assetType = ASSET_TYPE_ICON; if (strstr(assets[a], "_logo")) assetType = ASSET_TYPE_LOGO; @@ -498,7 +498,7 @@ uint8_t public_buf[512]; #if HAS_SPI_FLASH_FONT a = arrayFindStr(fonts, COUNT(fonts), card.longFilename); - if (a >= 0 && a < COUNT(fonts)) + if (a >= 0 && a < (int8_t)COUNT(fonts)) loadAsset(dir, d, fonts[a], ASSET_TYPE_FONT); #endif }