From 3828b014f7c10953e0905bb8a51d6f79b7fa082b Mon Sep 17 00:00:00 2001 From: Victor Mateus Oliveira Date: Wed, 28 Oct 2020 21:41:44 -0300 Subject: [PATCH 1/7] Overwrite DiskIO functions from LPC framework to use Marlin Sd2Card API --- Marlin/src/HAL/LPC1768/HAL.cpp | 110 +++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/Marlin/src/HAL/LPC1768/HAL.cpp b/Marlin/src/HAL/LPC1768/HAL.cpp index 3614e953851c..e76e2e2c9f6c 100644 --- a/Marlin/src/HAL/LPC1768/HAL.cpp +++ b/Marlin/src/HAL/LPC1768/HAL.cpp @@ -74,4 +74,114 @@ uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } +// Overwrite DiskIO functions from LPC framework to use Marlin Sd2Card API. +// TODO: need a define to enable/disable it... maybe a file only for this code! + +#include +#include "../../sd/cardreader.h" + +DRESULT disk_read ( + BYTE drv, /* Physical drive number (0) */ + BYTE *buff, /* Pointer to the data buffer to store read data */ + DWORD sector, /* Start sector number (LBA) */ + UINT count /* Number of sectors to read (1..128) */ +) +{ + auto sd2card = card.getSd2Card(); + if (count == 1) { + sd2card.readBlock(sector, buff); + return RES_OK; + } + + sd2card.readStart(sector); + while (count--) { + sd2card.readData(buff); + buff += 512; + } + sd2card.readStop(); + return RES_OK; +} + +DSTATUS disk_status ( + BYTE drv /* Physical drive number (0) */ +) +{ + return 0; +} + +DSTATUS disk_initialize ( + BYTE drv /* Physical drive number (0) */ +) { + //if already mounted, its already initialized! + if (card.isMounted()) { + return RES_OK; + } + + auto sd2card = card.getSd2Card(); + if (!sd2card.init(SPI_SPEED, SDSS) + #if defined(LCD_SDSS) && (LCD_SDSS != SDSS) + && !sd2card.init(SPI_SPEED, LCD_SDSS) + #endif + ) { + return RES_ERROR; + } + + return RES_OK; +} + +#if _DISKIO_WRITE + DRESULT disk_write ( + BYTE drv, /* Physical drive number (0) */ + const BYTE *buff, /* Ponter to the data to write */ + DWORD sector, /* Start sector number (LBA) */ + UINT count /* Number of sectors to write (1..128) */ + ) + { + auto sd2card = card.getSd2Card(); + if (count == 1) { + sd2card.writeBlock(sector, buff); + return RES_OK; + } + + sd2card.writeStart(sector, count); + while (count--) + { + sd2card.writeData(buff); + buff += 512; + } + sd2card.writeStop(); + return RES_OK; + } +#endif // _DISKIO_WRITE + +#if _DISKIO_IOCTL + +DRESULT disk_ioctl ( + BYTE drv, /* Physical drive number (0) */ + BYTE cmd, /* Control command code */ + void *buff /* Pointer to the conrtol data */ +) +{ + DWORD *dp, st, ed; + + auto sd2card = card.getSd2Card(); + switch (cmd) { + case CTRL_SYNC: /* Wait for end of internal write process of the drive */ + break; + case GET_SECTOR_COUNT: /* Get drive capacity in unit of sector (DWORD) */ + *(int32_t*)buff = sd2card.cardSize(); + break; + case GET_BLOCK_SIZE: /* Get erase block size in unit of sector (DWORD) */ + break; + case CTRL_TRIM: /* Erase a block of sectors (used when _USE_TRIM in ffconf.h is 1) */ + dp = (DWORD*)buff; st = dp[0]; ed = dp[1]; /* Load sector block */ + sd2card.erase(st, ed); + break; + } + + return RES_OK; +} + +#endif // _DISKIO_IOCTL + #endif // TARGET_LPC1768 From fcfe64b9c67571347af76543989ebfdb7f1ee2ee Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 29 Oct 2020 00:46:28 -0500 Subject: [PATCH 2/7] Tweaky cleanup, no fixes --- Marlin/src/HAL/LPC1768/HAL.cpp | 110 +++++++++++++++------------------ 1 file changed, 51 insertions(+), 59 deletions(-) diff --git a/Marlin/src/HAL/LPC1768/HAL.cpp b/Marlin/src/HAL/LPC1768/HAL.cpp index e76e2e2c9f6c..09d647f83a8d 100644 --- a/Marlin/src/HAL/LPC1768/HAL.cpp +++ b/Marlin/src/HAL/LPC1768/HAL.cpp @@ -39,7 +39,7 @@ extern "C" { void u8g_Delay(uint16_t val) { delay(val); } } -//************************// +//************************ // return free heap space int freeMemory() { @@ -52,9 +52,9 @@ int freeMemory() { return result; } -// scan command line for code -// return index into pin map array if found and the pin is valid. -// return dval if not found or not a valid pin. +// Scan command line for code +// Return index into pin map array if found and the pin is valid. +// Return dval if not found or not a valid pin. int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) { const uint16_t val = (uint16_t)parser.intval(code, -1), port = val / 100, pin = val % 100; const int16_t ind = (port < ((NUM_DIGITAL_PINS) >> 5) && pin < 32) ? ((port << 5) | pin) : -2; @@ -81,12 +81,11 @@ uint8_t HAL_get_reset_source(void) { #include "../../sd/cardreader.h" DRESULT disk_read ( - BYTE drv, /* Physical drive number (0) */ - BYTE *buff, /* Pointer to the data buffer to store read data */ - DWORD sector, /* Start sector number (LBA) */ - UINT count /* Number of sectors to read (1..128) */ -) -{ + BYTE drv, // Physical drive number (0) + BYTE *buff, // Pointer to the data buffer to store read data + DWORD sector, // Start sector number (LBA) + UINT count // Number of sectors to read (1..128) +) { auto sd2card = card.getSd2Card(); if (count == 1) { sd2card.readBlock(sector, buff); @@ -102,41 +101,34 @@ DRESULT disk_read ( return RES_OK; } -DSTATUS disk_status ( - BYTE drv /* Physical drive number (0) */ -) -{ +DSTATUS disk_status(BYTE drv) { // Physical drive number (0) return 0; } -DSTATUS disk_initialize ( - BYTE drv /* Physical drive number (0) */ -) { - //if already mounted, its already initialized! - if (card.isMounted()) { - return RES_OK; - } - - auto sd2card = card.getSd2Card(); - if (!sd2card.init(SPI_SPEED, SDSS) - #if defined(LCD_SDSS) && (LCD_SDSS != SDSS) - && !sd2card.init(SPI_SPEED, LCD_SDSS) - #endif - ) { - return RES_ERROR; +DSTATUS disk_initialize(BYTE drv) { // Physical drive number (0) + // If already mounted, it's already initialized! + if (!card.isMounted()) { + auto sd2card = card.getSd2Card(); + if (!sd2card.init(SPI_SPEED, SDSS) + #if defined(LCD_SDSS) && (LCD_SDSS != SDSS) + && !sd2card.init(SPI_SPEED, LCD_SDSS) + #endif + ) { + return RES_ERROR; + } } return RES_OK; } #if _DISKIO_WRITE - DRESULT disk_write ( - BYTE drv, /* Physical drive number (0) */ - const BYTE *buff, /* Ponter to the data to write */ - DWORD sector, /* Start sector number (LBA) */ - UINT count /* Number of sectors to write (1..128) */ - ) - { + + DRESULT disk_write( + BYTE drv, // Physical drive number (0) + const BYTE *buff, // Ponter to the data to write + DWORD sector, // Start sector number (LBA) + UINT count // Number of sectors to write (1..128) + ) { auto sd2card = card.getSd2Card(); if (count == 1) { sd2card.writeBlock(sector, buff); @@ -152,35 +144,35 @@ DSTATUS disk_initialize ( sd2card.writeStop(); return RES_OK; } + #endif // _DISKIO_WRITE #if _DISKIO_IOCTL -DRESULT disk_ioctl ( - BYTE drv, /* Physical drive number (0) */ - BYTE cmd, /* Control command code */ - void *buff /* Pointer to the conrtol data */ -) -{ - DWORD *dp, st, ed; + DRESULT disk_ioctl( + BYTE drv, // Physical drive number (0) + BYTE cmd, // Control command code + void *buff // Pointer to the conrtol data + ) { + DWORD *dp, st, ed; - auto sd2card = card.getSd2Card(); - switch (cmd) { - case CTRL_SYNC: /* Wait for end of internal write process of the drive */ - break; - case GET_SECTOR_COUNT: /* Get drive capacity in unit of sector (DWORD) */ - *(int32_t*)buff = sd2card.cardSize(); - break; - case GET_BLOCK_SIZE: /* Get erase block size in unit of sector (DWORD) */ - break; - case CTRL_TRIM: /* Erase a block of sectors (used when _USE_TRIM in ffconf.h is 1) */ - dp = (DWORD*)buff; st = dp[0]; ed = dp[1]; /* Load sector block */ - sd2card.erase(st, ed); - break; - } + auto sd2card = card.getSd2Card(); + switch (cmd) { + case CTRL_SYNC: // Wait for end of internal write process of the drive + break; + case GET_SECTOR_COUNT: // Get drive capacity in unit of sector (DWORD) + *(int32_t*)buff = sd2card.cardSize(); + break; + case GET_BLOCK_SIZE: // Get erase block size in unit of sector (DWORD) + break; + case CTRL_TRIM: // Erase a block of sectors (used when _USE_TRIM in ffconf.h is 1) + dp = (DWORD*)buff; st = dp[0]; ed = dp[1]; // Load sector block + sd2card.erase(st, ed); + break; + } - return RES_OK; -} + return RES_OK; + } #endif // _DISKIO_IOCTL From 9f5b03106b062e102992d0ab9320063fdfa9c03b Mon Sep 17 00:00:00 2001 From: Victor Mateus Oliveira Date: Sun, 20 Dec 2020 21:25:48 -0300 Subject: [PATCH 3/7] separated in a different file and added a config to enable/disable it --- Marlin/Configuration_adv.h | 9 ++ Marlin/src/HAL/LPC1768/HAL.cpp | 102 ----------------------- Marlin/src/HAL/LPC1768/diskio.cpp | 131 ++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+), 102 deletions(-) create mode 100644 Marlin/src/HAL/LPC1768/diskio.cpp diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 51c2b8f99419..9d00c2d0dd18 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1375,6 +1375,15 @@ */ //#define NO_SD_HOST_DRIVE // Disable SD Card access over USB (for security). +/** + * By default the framework is responsible by the IO on the shared media. + * Turn this on if you need that Marlin take care of the shared media IO. + * It is usefull if shared media isn't working fine for some boards. + */ +#if ENABLED(SDSUPPORT) && DISABLED(NO_SD_HOST_DRIVE) + #define USE_MARLIN_DISKIO_FOR_HOST_DRIVE +#endif + /** * Additional options for Graphical Displays * diff --git a/Marlin/src/HAL/LPC1768/HAL.cpp b/Marlin/src/HAL/LPC1768/HAL.cpp index 09d647f83a8d..c2e5f22fb627 100644 --- a/Marlin/src/HAL/LPC1768/HAL.cpp +++ b/Marlin/src/HAL/LPC1768/HAL.cpp @@ -74,106 +74,4 @@ uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } -// Overwrite DiskIO functions from LPC framework to use Marlin Sd2Card API. -// TODO: need a define to enable/disable it... maybe a file only for this code! - -#include -#include "../../sd/cardreader.h" - -DRESULT disk_read ( - BYTE drv, // Physical drive number (0) - BYTE *buff, // Pointer to the data buffer to store read data - DWORD sector, // Start sector number (LBA) - UINT count // Number of sectors to read (1..128) -) { - auto sd2card = card.getSd2Card(); - if (count == 1) { - sd2card.readBlock(sector, buff); - return RES_OK; - } - - sd2card.readStart(sector); - while (count--) { - sd2card.readData(buff); - buff += 512; - } - sd2card.readStop(); - return RES_OK; -} - -DSTATUS disk_status(BYTE drv) { // Physical drive number (0) - return 0; -} - -DSTATUS disk_initialize(BYTE drv) { // Physical drive number (0) - // If already mounted, it's already initialized! - if (!card.isMounted()) { - auto sd2card = card.getSd2Card(); - if (!sd2card.init(SPI_SPEED, SDSS) - #if defined(LCD_SDSS) && (LCD_SDSS != SDSS) - && !sd2card.init(SPI_SPEED, LCD_SDSS) - #endif - ) { - return RES_ERROR; - } - } - - return RES_OK; -} - -#if _DISKIO_WRITE - - DRESULT disk_write( - BYTE drv, // Physical drive number (0) - const BYTE *buff, // Ponter to the data to write - DWORD sector, // Start sector number (LBA) - UINT count // Number of sectors to write (1..128) - ) { - auto sd2card = card.getSd2Card(); - if (count == 1) { - sd2card.writeBlock(sector, buff); - return RES_OK; - } - - sd2card.writeStart(sector, count); - while (count--) - { - sd2card.writeData(buff); - buff += 512; - } - sd2card.writeStop(); - return RES_OK; - } - -#endif // _DISKIO_WRITE - -#if _DISKIO_IOCTL - - DRESULT disk_ioctl( - BYTE drv, // Physical drive number (0) - BYTE cmd, // Control command code - void *buff // Pointer to the conrtol data - ) { - DWORD *dp, st, ed; - - auto sd2card = card.getSd2Card(); - switch (cmd) { - case CTRL_SYNC: // Wait for end of internal write process of the drive - break; - case GET_SECTOR_COUNT: // Get drive capacity in unit of sector (DWORD) - *(int32_t*)buff = sd2card.cardSize(); - break; - case GET_BLOCK_SIZE: // Get erase block size in unit of sector (DWORD) - break; - case CTRL_TRIM: // Erase a block of sectors (used when _USE_TRIM in ffconf.h is 1) - dp = (DWORD*)buff; st = dp[0]; ed = dp[1]; // Load sector block - sd2card.erase(st, ed); - break; - } - - return RES_OK; - } - -#endif // _DISKIO_IOCTL - #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/LPC1768/diskio.cpp b/Marlin/src/HAL/LPC1768/diskio.cpp new file mode 100644 index 000000000000..908fcc2f5452 --- /dev/null +++ b/Marlin/src/HAL/LPC1768/diskio.cpp @@ -0,0 +1,131 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifdef TARGET_LPC1768 + +#include "../../inc/MarlinConfig.h" + +#if BOTH(SDSUPPORT, USE_MARLIN_DISKIO_FOR_HOST_DRIVE) + +// Overwrite DiskIO functions from LPC framework to use Marlin Sd2Card API. +#include +#include "../../sd/cardreader.h" + +DRESULT disk_read ( + BYTE drv, // Physical drive number (0) + BYTE *buff, // Pointer to the data buffer to store read data + DWORD sector, // Start sector number (LBA) + UINT count // Number of sectors to read (1..128) +) { + auto sd2card = card.getSd2Card(); + if (count == 1) { + sd2card.readBlock(sector, buff); + return RES_OK; + } + + sd2card.readStart(sector); + while (count--) { + sd2card.readData(buff); + buff += 512; + } + sd2card.readStop(); + return RES_OK; +} + +DSTATUS disk_status(BYTE drv) { // Physical drive number (0) + return 0; +} + +DSTATUS disk_initialize(BYTE drv) { // Physical drive number (0) + // If already mounted, it's already initialized! + if (!card.isMounted()) { + auto sd2card = card.getSd2Card(); + if (!sd2card.init(SPI_SPEED, SDSS) + #if defined(LCD_SDSS) && (LCD_SDSS != SDSS) + && !sd2card.init(SPI_SPEED, LCD_SDSS) + #endif + ) { + return RES_ERROR; + } + } + + return RES_OK; +} + +#if _DISKIO_WRITE + + DRESULT disk_write( + BYTE drv, // Physical drive number (0) + const BYTE *buff, // Ponter to the data to write + DWORD sector, // Start sector number (LBA) + UINT count // Number of sectors to write (1..128) + ) { + auto sd2card = card.getSd2Card(); + if (count == 1) { + sd2card.writeBlock(sector, buff); + return RES_OK; + } + + sd2card.writeStart(sector, count); + while (count--) + { + sd2card.writeData(buff); + buff += 512; + } + sd2card.writeStop(); + return RES_OK; + } + +#endif // _DISKIO_WRITE + +#if _DISKIO_IOCTL + + DRESULT disk_ioctl( + BYTE drv, // Physical drive number (0) + BYTE cmd, // Control command code + void *buff // Pointer to the conrtol data + ) { + DWORD *dp, st, ed; + + auto sd2card = card.getSd2Card(); + switch (cmd) { + case CTRL_SYNC: // Wait for end of internal write process of the drive + break; + case GET_SECTOR_COUNT: // Get drive capacity in unit of sector (DWORD) + *(int32_t*)buff = sd2card.cardSize(); + break; + case GET_BLOCK_SIZE: // Get erase block size in unit of sector (DWORD) + break; + case CTRL_TRIM: // Erase a block of sectors (used when _USE_TRIM in ffconf.h is 1) + dp = (DWORD*)buff; st = dp[0]; ed = dp[1]; // Load sector block + sd2card.erase(st, ed); + break; + } + + return RES_OK; + } + +#endif // _DISKIO_IOCTL + +#endif // BOTH(SDSUPPORT, USE_MARLIN_DISKIO_FOR_HOST_DRIVE) + +#endif // TARGET_LPC1768 From 85f3ee2ca1da54c36c37de266c2103253bd87b4d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 5 Feb 2022 14:59:58 -0600 Subject: [PATCH 4/7] misc --- Marlin/src/HAL/LPC1768/diskio.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Marlin/src/HAL/LPC1768/diskio.cpp b/Marlin/src/HAL/LPC1768/diskio.cpp index 908fcc2f5452..8fa3df7e30cd 100644 --- a/Marlin/src/HAL/LPC1768/diskio.cpp +++ b/Marlin/src/HAL/LPC1768/diskio.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm @@ -86,8 +86,7 @@ DSTATUS disk_initialize(BYTE drv) { // Physical drive number (0) } sd2card.writeStart(sector, count); - while (count--) - { + while (count--) { sd2card.writeData(buff); buff += 512; } @@ -126,6 +125,6 @@ DSTATUS disk_initialize(BYTE drv) { // Physical drive number (0) #endif // _DISKIO_IOCTL -#endif // BOTH(SDSUPPORT, USE_MARLIN_DISKIO_FOR_HOST_DRIVE) +#endif // SDSUPPORT && USE_MARLIN_DISKIO_FOR_HOST_DRIVE #endif // TARGET_LPC1768 From b499eea155934b37405f983653dff5f394d91a28 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 5 Feb 2022 15:06:35 -0600 Subject: [PATCH 5/7] desc. --- Marlin/Configuration_adv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 8092c18de562..747a3b861632 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1644,9 +1644,9 @@ //#define NO_SD_HOST_DRIVE // Disable SD Card access over USB (for security). /** - * By default the framework is responsible by the IO on the shared media. - * Turn this on if you need that Marlin take care of the shared media IO. - * It is usefull if shared media isn't working fine for some boards. + * By default the framework is responsible for the shared media I/O. + * Enable this if you need Marlin to take care of the shared media IO. + * Useful if shared media isn't working properly on some boards. */ #if ENABLED(SDSUPPORT) && DISABLED(NO_SD_HOST_DRIVE) #define USE_MARLIN_DISKIO_FOR_HOST_DRIVE From 75244a09059a9d68dc377fd2ca25e52976262abd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 5 Feb 2022 15:11:40 -0600 Subject: [PATCH 6/7] disable by default --- Marlin/Configuration_adv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 747a3b861632..88a84e07e921 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1645,11 +1645,11 @@ /** * By default the framework is responsible for the shared media I/O. - * Enable this if you need Marlin to take care of the shared media IO. + * Enable this if you need Marlin to take care of the shared media I/O. * Useful if shared media isn't working properly on some boards. */ #if ENABLED(SDSUPPORT) && DISABLED(NO_SD_HOST_DRIVE) - #define USE_MARLIN_DISKIO_FOR_HOST_DRIVE + //#define USE_MARLIN_DISKIO_FOR_HOST_DRIVE #endif /** From 833d7b35f348baedc045b7cf433ffe621961b250 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 5 Feb 2022 15:33:07 -0600 Subject: [PATCH 7/7] rename --- Marlin/Configuration_adv.h | 2 +- Marlin/src/HAL/LPC1768/diskio.cpp | 4 ++-- Marlin/src/inc/SanityCheck.h | 18 +++++++++++------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 88a84e07e921..eb838d3049e3 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1649,7 +1649,7 @@ * Useful if shared media isn't working properly on some boards. */ #if ENABLED(SDSUPPORT) && DISABLED(NO_SD_HOST_DRIVE) - //#define USE_MARLIN_DISKIO_FOR_HOST_DRIVE + //#define DISKIO_HOST_DRIVE #endif /** diff --git a/Marlin/src/HAL/LPC1768/diskio.cpp b/Marlin/src/HAL/LPC1768/diskio.cpp index 8fa3df7e30cd..93ee40fc16c4 100644 --- a/Marlin/src/HAL/LPC1768/diskio.cpp +++ b/Marlin/src/HAL/LPC1768/diskio.cpp @@ -24,7 +24,7 @@ #include "../../inc/MarlinConfig.h" -#if BOTH(SDSUPPORT, USE_MARLIN_DISKIO_FOR_HOST_DRIVE) +#if BOTH(SDSUPPORT, DISKIO_HOST_DRIVE) // Overwrite DiskIO functions from LPC framework to use Marlin Sd2Card API. #include @@ -125,6 +125,6 @@ DSTATUS disk_initialize(BYTE drv) { // Physical drive number (0) #endif // _DISKIO_IOCTL -#endif // SDSUPPORT && USE_MARLIN_DISKIO_FOR_HOST_DRIVE +#endif // SDSUPPORT && DISKIO_HOST_DRIVE #endif // TARGET_LPC1768 diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 1177cbcd14ee..14f775d1d359 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -780,13 +780,17 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #endif -#if !defined(TARGET_LPC1768) && ANY( \ - ENDSTOPPULLDOWNS, \ - ENDSTOPPULLDOWN_XMAX, ENDSTOPPULLDOWN_YMAX, \ - ENDSTOPPULLDOWN_ZMAX, ENDSTOPPULLDOWN_XMIN, \ - ENDSTOPPULLDOWN_YMIN, ENDSTOPPULLDOWN_ZMIN \ - ) - #error "PULLDOWN pin mode is not available on the selected board." +#ifndef TARGET_LPC1768 + #if ANY( \ + ENDSTOPPULLDOWNS, \ + ENDSTOPPULLDOWN_XMAX, ENDSTOPPULLDOWN_YMAX, \ + ENDSTOPPULLDOWN_ZMAX, ENDSTOPPULLDOWN_XMIN, \ + ENDSTOPPULLDOWN_YMIN, ENDSTOPPULLDOWN_ZMIN \ + ) + #error "PULLDOWN pin mode is not available on the selected board." + #elif BOTH(SDSUPPORT, DISKIO_HOST_DRIVE) + #error "DISKIO_HOST_DRIVE is not available on the selected board." + #endif #endif #if BOTH(ENDSTOPPULLUPS, ENDSTOPPULLDOWNS)