mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-07-06 22:47:27 -06:00
🩹 Misc. HAL, flag fixes
This commit is contained in:
parent
e0d8ea57a8
commit
f60bc278fa
10 changed files with 22 additions and 24 deletions
|
@ -29,11 +29,10 @@ bool sd_mmc_spi_wr_protect() { return false; }
|
||||||
bool sd_mmc_spi_removal() { return !media_ready(); }
|
bool sd_mmc_spi_removal() { return !media_ready(); }
|
||||||
|
|
||||||
Ctrl_status sd_mmc_spi_test_unit_ready() {
|
Ctrl_status sd_mmc_spi_test_unit_ready() {
|
||||||
#ifdef DISABLE_DUE_SD_MMC
|
#if ENABLED(DISABLE_DUE_SD_MMC)
|
||||||
return CTRL_NO_PRESENT;
|
return CTRL_NO_PRESENT;
|
||||||
#endif
|
#endif
|
||||||
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT;
|
return sd_mmc_spi_removal() ? CTRL_NO_PRESENT : CTRL_GOOD;
|
||||||
return CTRL_GOOD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: This function is defined as returning the address of the last block
|
// NOTE: This function is defined as returning the address of the last block
|
||||||
|
@ -58,9 +57,10 @@ uint8_t sector_buf[SD_MMC_BLOCK_SIZE];
|
||||||
// #define DEBUG_MMC
|
// #define DEBUG_MMC
|
||||||
|
|
||||||
Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
|
Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
|
||||||
#ifdef DISABLE_DUE_SD_MMC
|
#if ENABLED(DISABLE_DUE_SD_MMC)
|
||||||
return CTRL_NO_PRESENT;
|
return CTRL_NO_PRESENT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT;
|
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT;
|
||||||
|
|
||||||
#ifdef DEBUG_MMC
|
#ifdef DEBUG_MMC
|
||||||
|
@ -97,9 +97,10 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
|
Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
|
||||||
#ifdef DISABLE_DUE_SD_MMC
|
#if ENABLED(DISABLE_DUE_SD_MMC)
|
||||||
return CTRL_NO_PRESENT;
|
return CTRL_NO_PRESENT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT;
|
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT;
|
||||||
|
|
||||||
#ifdef DEBUG_MMC
|
#ifdef DEBUG_MMC
|
||||||
|
|
|
@ -173,13 +173,8 @@ void MarlinHAL::init() {
|
||||||
// HAL idle task
|
// HAL idle task
|
||||||
void MarlinHAL::idletask() {
|
void MarlinHAL::idletask() {
|
||||||
#if HAS_SHARED_MEDIA
|
#if HAS_SHARED_MEDIA
|
||||||
// If Marlin is using the SD card we need to lock it to prevent access from
|
// When Marlin is using the SD Card it must be locked to prevent PC access via USB.
|
||||||
// a PC via USB.
|
// For maximum safety we lock the disk if Marlin has it mounted for any reason.
|
||||||
// Other HALs use card.isStillPrinting() and card.isFileOpen() to check for access but
|
|
||||||
// this will not reliably detect delete operations. To be safe we will lock
|
|
||||||
// the disk if Marlin has it mounted. Unfortunately there is currently no way
|
|
||||||
// to unmount the disk from the LCD menu.
|
|
||||||
// if (card.isStillPrinting() || card.isFileOpen())
|
|
||||||
if (card.isMounted())
|
if (card.isMounted())
|
||||||
MSC_Aquire_Lock();
|
MSC_Aquire_Lock();
|
||||||
else
|
else
|
||||||
|
|
|
@ -52,7 +52,6 @@ bool eeprom_file_open = false;
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
const char eeprom_erase_value = 0xFF;
|
|
||||||
MSC_Aquire_Lock();
|
MSC_Aquire_Lock();
|
||||||
if (f_mount(&fat_fs, "", 1)) {
|
if (f_mount(&fat_fs, "", 1)) {
|
||||||
MSC_Release_Lock();
|
MSC_Release_Lock();
|
||||||
|
@ -65,6 +64,7 @@ bool PersistentStore::access_start() {
|
||||||
UINT bytes_written;
|
UINT bytes_written;
|
||||||
FSIZE_t file_size = f_size(&eeprom_file);
|
FSIZE_t file_size = f_size(&eeprom_file);
|
||||||
f_lseek(&eeprom_file, file_size);
|
f_lseek(&eeprom_file, file_size);
|
||||||
|
const char eeprom_erase_value = 0xFF;
|
||||||
while (file_size < capacity() && res == FR_OK) {
|
while (file_size < capacity() && res == FR_OK) {
|
||||||
res = f_write(&eeprom_file, &eeprom_erase_value, 1, &bytes_written);
|
res = f_write(&eeprom_file, &eeprom_erase_value, 1, &bytes_written);
|
||||||
file_size++;
|
file_size++;
|
||||||
|
|
|
@ -77,7 +77,7 @@ void MarlinHAL::init() {
|
||||||
|
|
||||||
HAL_timer_init();
|
HAL_timer_init();
|
||||||
|
|
||||||
#if ENABLED(EMERGENCY_PARSER) && USBD_USE_CDC
|
#if ALL(EMERGENCY_PARSER, USBD_USE_CDC)
|
||||||
USB_Hook_init();
|
USB_Hook_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ void MarlinHAL::init() {
|
||||||
|
|
||||||
SetTimerInterruptPriorities();
|
SetTimerInterruptPriorities();
|
||||||
|
|
||||||
#if ENABLED(EMERGENCY_PARSER) && (USBD_USE_CDC || USBD_USE_CDC_MSC)
|
#if ENABLED(EMERGENCY_PARSER) && ANY(USBD_USE_CDC, USBD_USE_CDC_MSC)
|
||||||
USB_Hook_init();
|
USB_Hook_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "../../inc/MarlinConfigPre.h"
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(EMERGENCY_PARSER) && (USBD_USE_CDC || USBD_USE_CDC_MSC)
|
#if ENABLED(EMERGENCY_PARSER) && ANY(USBD_USE_CDC, USBD_USE_CDC_MSC)
|
||||||
|
|
||||||
#include "usb_serial.h"
|
#include "usb_serial.h"
|
||||||
#include "../../feature/e_parser.h"
|
#include "../../feature/e_parser.h"
|
||||||
|
@ -56,5 +56,5 @@ void USB_Hook_init() {
|
||||||
USBD_CDC_fops.Receive = USBD_CDC_Receive_hook;
|
USBD_CDC_fops.Receive = USBD_CDC_Receive_hook;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // EMERGENCY_PARSER && USBD_USE_CDC
|
#endif // EMERGENCY_PARSER && (USBD_USE_CDC || USBD_USE_CDC_MSC)
|
||||||
#endif // HAL_STM32
|
#endif // HAL_STM32
|
||||||
|
|
|
@ -65,7 +65,8 @@ uint16_t adc_results[ADC_COUNT];
|
||||||
emergency_parser.update(MSerial0.emergency_state, buf[i + total - len]);
|
emergency_parser.update(MSerial0.emergency_state, buf[i + total - len]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
#endif // SERIAL_USB && !HAS_SD_HOST_DRIVE
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Watchdog Timer
|
// Watchdog Timer
|
||||||
|
|
|
@ -109,7 +109,7 @@ bool MAX3421e::start() {
|
||||||
// Initialize pins and SPI bus
|
// Initialize pins and SPI bus
|
||||||
|
|
||||||
SET_OUTPUT(USB_CS_PIN);
|
SET_OUTPUT(USB_CS_PIN);
|
||||||
SET_INPUT_PULLUP(USB_INTR_PIN);
|
SET_INPUT_PULLUP(USB_INTR_PIN); // Active LOW
|
||||||
ncs();
|
ncs();
|
||||||
spiBegin();
|
spiBegin();
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ board_build.address = 0x08010000
|
||||||
board_build.rename = project.bin
|
board_build.rename = project.bin
|
||||||
board_build.ldscript = STM32F103VE_longer.ld
|
board_build.ldscript = STM32F103VE_longer.ld
|
||||||
build_flags = ${STM32F1_maple.build_flags}
|
build_flags = ${STM32F1_maple.build_flags}
|
||||||
-DMCU_STM32F103VE -DSTM32F1xx -USERIAL_USB -DU20 -DTS_V12
|
-DMCU_STM32F103VE -DSTM32F1xx -DSERIAL_USB -DU20 -DTS_V12
|
||||||
build_unflags = ${STM32F1_maple.build_unflags}
|
build_unflags = ${STM32F1_maple.build_unflags}
|
||||||
-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6
|
-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6
|
||||||
|
|
||||||
|
|
|
@ -65,12 +65,13 @@ board_upload.offset_address = 0x08007000
|
||||||
|
|
||||||
[USBD_CDC_MSC]
|
[USBD_CDC_MSC]
|
||||||
build_flags = -DUSE_USB_FS -DUSBD_USE_CDC_MSC -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6
|
build_flags = -DUSE_USB_FS -DUSBD_USE_CDC_MSC -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6
|
||||||
|
build_unflags = -DUSBD_USE_CDC
|
||||||
|
|
||||||
[env:STM32F103RC_btt_USB]
|
[env:STM32F103RC_btt_USB]
|
||||||
extends = env:STM32F103RC_btt
|
extends = env:STM32F103RC_btt
|
||||||
platform_packages = ${stm_flash_drive.platform_packages}
|
platform_packages = ${stm_flash_drive.platform_packages}
|
||||||
build_flags = ${env:STM32F103RC_btt.build_flags} ${USBD_CDC_MSC.build_flags}
|
build_flags = ${env:STM32F103RC_btt.build_flags} ${USBD_CDC_MSC.build_flags}
|
||||||
build_unflags = ${env:STM32F103RC_btt.build_unflags} -DUSBD_USE_CDC
|
build_unflags = ${env:STM32F103RC_btt.build_unflags} ${USBD_CDC_MSC.build_unflags}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Panda Pi V2.9 - Standalone (STM32F103RC)
|
# Panda Pi V2.9 - Standalone (STM32F103RC)
|
||||||
|
@ -227,7 +228,7 @@ upload_protocol = jlink
|
||||||
extends = env:STM32F103RE_btt
|
extends = env:STM32F103RE_btt
|
||||||
platform_packages = ${stm_flash_drive.platform_packages}
|
platform_packages = ${stm_flash_drive.platform_packages}
|
||||||
build_flags = ${env:STM32F103RE_btt.build_flags} ${USBD_CDC_MSC.build_flags}
|
build_flags = ${env:STM32F103RE_btt.build_flags} ${USBD_CDC_MSC.build_flags}
|
||||||
build_unflags = ${env:STM32F103RE_btt.build_unflags} -DUSBD_USE_CDC
|
build_unflags = ${env:STM32F103RE_btt.build_unflags} ${USBD_CDC_MSC.build_unflags}
|
||||||
|
|
||||||
#
|
#
|
||||||
# ZNP Robin Nano V1.2
|
# ZNP Robin Nano V1.2
|
||||||
|
@ -473,7 +474,7 @@ board_upload.maximum_size = 237568
|
||||||
extra_scripts = ${stm32_variant.extra_scripts}
|
extra_scripts = ${stm32_variant.extra_scripts}
|
||||||
build_flags = ${stm32_variant.build_flags} ${USBD_CDC_MSC.build_flags}
|
build_flags = ${stm32_variant.build_flags} ${USBD_CDC_MSC.build_flags}
|
||||||
-DSS_TIMER=4 -DTIMER_SERVO=TIM5
|
-DSS_TIMER=4 -DTIMER_SERVO=TIM5
|
||||||
build_unflags = ${stm32_variant.build_unflags} -DUSBD_USE_CDC
|
build_unflags = ${stm32_variant.build_unflags} ${USBD_CDC_MSC.build_unflags}
|
||||||
|
|
||||||
[env:STM32F103RC_ZM3E2_USB]
|
[env:STM32F103RC_ZM3E2_USB]
|
||||||
extends = ZONESTAR_ZM3E
|
extends = ZONESTAR_ZM3E
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue