From 6759aff22036a9fd4ae9f9398cd6e142a31ebd3b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 10 Sep 2020 17:34:41 -0500 Subject: [PATCH] Clean up W25QXXFlash class --- Marlin/src/gcode/control/M993_M994.cpp | 4 ---- Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp | 2 -- Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp | 1 - Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h | 2 -- Marlin/src/libs/W25Qxx.cpp | 3 ++- Marlin/src/libs/W25Qxx.h | 10 ++-------- 6 files changed, 4 insertions(+), 18 deletions(-) diff --git a/Marlin/src/gcode/control/M993_M994.cpp b/Marlin/src/gcode/control/M993_M994.cpp index 4e13aa9d77..ddc95238bf 100644 --- a/Marlin/src/gcode/control/M993_M994.cpp +++ b/Marlin/src/gcode/control/M993_M994.cpp @@ -41,8 +41,6 @@ void GcodeSuite::M993() { return; } - W25QXXFlash W25QXX; - uint8_t buf[1024]; uint32_t addr = 0; W25QXX.init(SPI_QUARTER_SPEED); @@ -71,8 +69,6 @@ void GcodeSuite::M994() { return; } - W25QXXFlash W25QXX; - uint8_t buf[1024]; uint32_t addr = 0; W25QXX.init(SPI_QUARTER_SPEED); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp b/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp index 979c916e5c..9d3adc1bab 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp @@ -27,8 +27,6 @@ #include "../../../../inc/MarlinConfig.h" #include "SPIFlashStorage.h" -extern W25QXXFlash W25QXX; - uint8_t SPIFlashStorage::m_pageData[SPI_FLASH_PageSize]; uint32_t SPIFlashStorage::m_currentPage; uint16_t SPIFlashStorage::m_pageDataUsed; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp index ff9d0518d3..6bdea3fd21 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp @@ -49,7 +49,6 @@ #include "../../../../feature/pause.h" #endif -W25QXXFlash W25QXX; CFG_ITMES gCfgItems; UI_CFG uiCfg; DISP_STATE_STACK disp_state_stack; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h b/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h index 4d9d08a9b4..f1086fd1b9 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h @@ -156,8 +156,6 @@ extern void spi_flash_read_test(); extern void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize); extern void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize); -extern W25QXXFlash W25QXX; - #ifdef __cplusplus } /* C-declarations for C++ */ #endif diff --git a/Marlin/src/libs/W25Qxx.cpp b/Marlin/src/libs/W25Qxx.cpp index d51dfb819d..9abe45fbaf 100644 --- a/Marlin/src/libs/W25Qxx.cpp +++ b/Marlin/src/libs/W25Qxx.cpp @@ -24,9 +24,10 @@ #if HAS_SPI_FLASH +#include "W25Qxx.h" #include -#include "W25Qxx.h" +W25QXXFlash W25QXX; #ifndef SPI_FLASH_MISO_PIN #define SPI_FLASH_MISO_PIN W25QXX_MISO_PIN diff --git a/Marlin/src/libs/W25Qxx.h b/Marlin/src/libs/W25Qxx.h index 81e9643450..ac3e8a169b 100644 --- a/Marlin/src/libs/W25Qxx.h +++ b/Marlin/src/libs/W25Qxx.h @@ -1,4 +1,4 @@ -/** +/** * Marlin 3D Printer Firmware * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * @@ -21,10 +21,6 @@ */ #pragma once -//#ifdef __cplusplus -//extern "C" { /* C-declarations for C++ */ -//#endif - #include #define W25X_WriteEnable 0x06 @@ -71,6 +67,4 @@ public: static void SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead); }; -//#ifdef __cplusplus -//} /* C-declarations for C++ */ -//#endif +extern W25QXXFlash W25QXX;