Browse Source
Fix broken POWER_LOSS_RECOVERY prompt (#18557)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
vanilla_fb_2.0.x
Jason Smith
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
7 additions and
11 deletions
-
Marlin/src/HAL/LPC1768/main.cpp
-
Marlin/src/HAL/STM32F1/HAL.cpp
-
Marlin/src/HAL/STM32F1/onboard_sd.cpp
-
Marlin/src/inc/Conditionals_post.h
-
Marlin/src/sd/cardreader.cpp
|
|
@ -122,7 +122,7 @@ void HAL_init() { |
|
|
|
delay(1000); // Give OS time to notice
|
|
|
|
USB_Connect(TRUE); |
|
|
|
|
|
|
|
#if !BOTH(SHARED_SD_CARD, INIT_SDCARD_ON_BOOT) && DISABLED(NO_SD_HOST_DRIVE) |
|
|
|
#if DISABLED(NO_SD_HOST_DRIVE) |
|
|
|
MSC_SD_Init(0); // Enable USB SD card access
|
|
|
|
#endif |
|
|
|
|
|
|
@ -140,7 +140,7 @@ void HAL_init() { |
|
|
|
|
|
|
|
// HAL idle task
|
|
|
|
void HAL_idletask() { |
|
|
|
#if ENABLED(SHARED_SD_CARD) |
|
|
|
#if HAS_SHARED_MEDIA |
|
|
|
// If Marlin is using the SD card we need to lock it to prevent access from
|
|
|
|
// a PC via USB.
|
|
|
|
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
|
|
|
|
|
|
@ -258,7 +258,7 @@ void HAL_init() { |
|
|
|
// HAL idle task
|
|
|
|
void HAL_idletask() { |
|
|
|
#ifdef USE_USB_COMPOSITE |
|
|
|
#if ENABLED(SHARED_SD_CARD) |
|
|
|
#if HAS_SHARED_MEDIA |
|
|
|
// If Marlin is using the SD card we need to lock it to prevent access from
|
|
|
|
// a PC via USB.
|
|
|
|
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
|
|
|
@ -266,7 +266,7 @@ void HAL_idletask() { |
|
|
|
// the disk if Marlin has it mounted. Unfortunately there is currently no way
|
|
|
|
// to unmount the disk from the LCD menu.
|
|
|
|
// if (IS_SD_PRINTING() || IS_SD_FILE_OPEN())
|
|
|
|
/* copy from lpc1768 framework, should be fixed later for process SHARED_SD_CARD*/ |
|
|
|
/* copy from lpc1768 framework, should be fixed later for process HAS_SHARED_MEDIA*/ |
|
|
|
#endif |
|
|
|
// process USB mass storage device class loop
|
|
|
|
MarlinMSC.loop(); |
|
|
|
|
|
@ -20,7 +20,7 @@ |
|
|
|
#include "SPI.h" |
|
|
|
#include "fastio.h" |
|
|
|
|
|
|
|
#if ENABLED(SHARED_SD_CARD) |
|
|
|
#if HAS_SHARED_MEDIA |
|
|
|
#ifndef ON_BOARD_SPI_DEVICE |
|
|
|
#define ON_BOARD_SPI_DEVICE SPI_DEVICE |
|
|
|
#endif |
|
|
|
|
|
@ -353,11 +353,7 @@ |
|
|
|
// mount/unmount the card and refresh it. So we disable card detect.
|
|
|
|
//
|
|
|
|
#undef SD_DETECT_PIN |
|
|
|
#define SHARED_SD_CARD |
|
|
|
#endif |
|
|
|
|
|
|
|
#if DISABLED(SHARED_SD_CARD) |
|
|
|
#define INIT_SDCARD_ON_BOOT |
|
|
|
#define HAS_SHARED_MEDIA 1 |
|
|
|
#endif |
|
|
|
|
|
|
|
#if PIN_EXISTS(SD_DETECT) |
|
|
|
|
|
@ -389,7 +389,7 @@ void CardReader::mount() { |
|
|
|
#endif |
|
|
|
|
|
|
|
void CardReader::manage_media() { |
|
|
|
static uint8_t prev_stat = TERN(INIT_SDCARD_ON_BOOT, 2, 0); |
|
|
|
static uint8_t prev_stat = 2; // First call, no prior state
|
|
|
|
uint8_t stat = uint8_t(IS_SD_INSERTED()); |
|
|
|
if (stat == prev_stat) return; |
|
|
|
|
|
|
|