mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-30 07:17:59 +00:00
🧑💻 Clarify media "mounted"
This commit is contained in:
parent
2d78a80cf6
commit
521e7eafce
@ -18,30 +18,30 @@ extern "C" {
|
||||
void sd_mmc_spi_mem_init() {
|
||||
}
|
||||
|
||||
Ctrl_status sd_mmc_spi_test_unit_ready() {
|
||||
#ifdef DISABLE_DUE_SD_MMC
|
||||
return CTRL_NO_PRESENT;
|
||||
#endif
|
||||
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
|
||||
return CTRL_NO_PRESENT;
|
||||
return CTRL_GOOD;
|
||||
}
|
||||
|
||||
// NOTE: This function is defined as returning the address of the last block
|
||||
// in the card, which is cardSize() - 1
|
||||
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
|
||||
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
|
||||
return CTRL_NO_PRESENT;
|
||||
*nb_sector = card.diskIODriver()->cardSize() - 1;
|
||||
return CTRL_GOOD;
|
||||
inline bool media_ready() {
|
||||
return IS_SD_INSERTED() && !IS_SD_PRINTING() && !IS_SD_FILE_OPEN() && card.isMounted();
|
||||
}
|
||||
|
||||
bool sd_mmc_spi_unload(bool) { return true; }
|
||||
|
||||
bool sd_mmc_spi_wr_protect() { return false; }
|
||||
|
||||
bool sd_mmc_spi_removal() {
|
||||
return (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted());
|
||||
bool sd_mmc_spi_removal() { return !media_ready(); }
|
||||
|
||||
Ctrl_status sd_mmc_spi_test_unit_ready() {
|
||||
#ifdef DISABLE_DUE_SD_MMC
|
||||
return CTRL_NO_PRESENT;
|
||||
#endif
|
||||
if (!media_ready()) return CTRL_NO_PRESENT;
|
||||
return CTRL_GOOD;
|
||||
}
|
||||
|
||||
// NOTE: This function is defined as returning the address of the last block
|
||||
// in the card, which is cardSize() - 1
|
||||
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
|
||||
if (!media_ready()) return CTRL_NO_PRESENT;
|
||||
*nb_sector = card.diskIODriver()->cardSize() - 1;
|
||||
return CTRL_GOOD;
|
||||
}
|
||||
|
||||
#if ACCESS_USB == true
|
||||
@ -61,8 +61,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
|
||||
#ifdef DISABLE_DUE_SD_MMC
|
||||
return CTRL_NO_PRESENT;
|
||||
#endif
|
||||
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
|
||||
return CTRL_NO_PRESENT;
|
||||
if (!media_ready()) return CTRL_NO_PRESENT;
|
||||
|
||||
#ifdef DEBUG_MMC
|
||||
{
|
||||
@ -101,8 +100,7 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
|
||||
#ifdef DISABLE_DUE_SD_MMC
|
||||
return CTRL_NO_PRESENT;
|
||||
#endif
|
||||
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
|
||||
return CTRL_NO_PRESENT;
|
||||
if (!media_ready()) return CTRL_NO_PRESENT;
|
||||
|
||||
#ifdef DEBUG_MMC
|
||||
{
|
||||
|
@ -74,7 +74,7 @@
|
||||
//!
|
||||
//! @brief This function initializes the hw/sw resources required to drive the SD_MMC_SPI.
|
||||
//!/
|
||||
extern void sd_mmc_spi_mem_init(void);
|
||||
void sd_mmc_spi_mem_init();
|
||||
|
||||
//!
|
||||
//! @brief This function tests the state of the SD_MMC memory and sends it to the Host.
|
||||
@ -87,7 +87,7 @@ extern void sd_mmc_spi_mem_init(void);
|
||||
//! Media not present -> CTRL_NO_PRESENT
|
||||
//! Media has changed -> CTRL_BUSY
|
||||
//!/
|
||||
extern Ctrl_status sd_mmc_spi_test_unit_ready(void);
|
||||
Ctrl_status sd_mmc_spi_test_unit_ready();
|
||||
|
||||
//!
|
||||
//! @brief This function gives the address of the last valid sector.
|
||||
@ -98,7 +98,7 @@ extern Ctrl_status sd_mmc_spi_test_unit_ready(void);
|
||||
//! Media ready -> CTRL_GOOD
|
||||
//! Media not present -> CTRL_NO_PRESENT
|
||||
//!/
|
||||
extern Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
|
||||
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
|
||||
|
||||
/*! \brief Unload/Load the SD/MMC card selected
|
||||
*
|
||||
@ -109,7 +109,7 @@ extern Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
|
||||
*
|
||||
* \return \c true if unload/load done success.
|
||||
*/
|
||||
extern bool sd_mmc_spi_unload(bool unload);
|
||||
bool sd_mmc_spi_unload(bool unload);
|
||||
|
||||
//!
|
||||
//! @brief This function returns the write protected status of the memory.
|
||||
@ -120,14 +120,14 @@ extern bool sd_mmc_spi_unload(bool unload);
|
||||
//!
|
||||
//! @return false -> the memory is not write-protected (always)
|
||||
//!/
|
||||
extern bool sd_mmc_spi_wr_protect(void);
|
||||
bool sd_mmc_spi_wr_protect();
|
||||
|
||||
//!
|
||||
//! @brief This function tells if the memory has been removed or not.
|
||||
//!
|
||||
//! @return false -> The memory isn't removed
|
||||
//!
|
||||
extern bool sd_mmc_spi_removal(void);
|
||||
bool sd_mmc_spi_removal();
|
||||
|
||||
//---- ACCESS DATA FUNCTIONS ----
|
||||
|
||||
@ -147,7 +147,7 @@ extern bool sd_mmc_spi_removal(void);
|
||||
//! It is ready -> CTRL_GOOD
|
||||
//! A error occur -> CTRL_FAIL
|
||||
//!
|
||||
extern 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);
|
||||
|
||||
//! This function initializes the SD/MMC memory for a write operation
|
||||
//!
|
||||
@ -161,7 +161,7 @@ extern Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector);
|
||||
//! It is ready -> CTRL_GOOD
|
||||
//! An error occurs -> CTRL_FAIL
|
||||
//!
|
||||
extern 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);
|
||||
|
||||
#endif // #if ACCESS_USB == true
|
||||
|
||||
|
@ -53,6 +53,7 @@
|
||||
inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
|
||||
|
||||
void _rx_complete_irq(serial_t *obj);
|
||||
FORCE_INLINE static uint8_t buffer_overruns() { return 0; } // Not implemented. Void to avoid platform-dependent code.
|
||||
|
||||
protected:
|
||||
usart_rx_callback_t _rx_callback;
|
||||
|
@ -65,8 +65,8 @@ namespace ExtUI {
|
||||
void onIdle() {}
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) {}
|
||||
|
||||
void onMediaInserted() {}
|
||||
void onMediaError() {}
|
||||
void onMediaMounted() {}
|
||||
void onMediaError() {}
|
||||
void onMediaRemoved() {}
|
||||
|
||||
void onHeatingError(const heater_id_t heater_id) {
|
||||
|
@ -45,9 +45,9 @@ namespace ExtUI {
|
||||
chiron.printerKilled(error, component);
|
||||
}
|
||||
|
||||
void onMediaInserted() { chiron.mediaEvent(AC_media_inserted); }
|
||||
void onMediaError() { chiron.mediaEvent(AC_media_error); }
|
||||
void onMediaRemoved() { chiron.mediaEvent(AC_media_removed); }
|
||||
void onMediaMounted() { chiron.mediaEvent(AC_media_inserted); }
|
||||
void onMediaError() { chiron.mediaEvent(AC_media_error); }
|
||||
void onMediaRemoved() { chiron.mediaEvent(AC_media_removed); }
|
||||
|
||||
void onHeatingError(const heater_id_t header_id) {}
|
||||
void onMinTempError(const heater_id_t header_id) {}
|
||||
|
@ -564,8 +564,8 @@ void ChironTFT::panelInfo(uint8_t req) {
|
||||
} break;
|
||||
|
||||
case 8: // A8 Get SD Card list A8 S0
|
||||
if (!isMediaInserted()) safe_delay(500);
|
||||
if (!isMediaInserted()) // Make sure the card is removed
|
||||
if (!isMediaMounted()) safe_delay(500);
|
||||
if (!isMediaMounted()) // Make sure the card is removed
|
||||
tftSendLn(AC_msg_no_sd_card);
|
||||
else if (panel_command[3] == 'S')
|
||||
sendFileList( atoi( &panel_command[4] ) );
|
||||
|
@ -39,7 +39,7 @@ namespace ExtUI {
|
||||
void onIdle() { anycubicTFT.onCommandScan(); }
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) { anycubicTFT.onKillTFT(); }
|
||||
|
||||
void onMediaInserted() { anycubicTFT.onSDCardStateChange(true); }
|
||||
void onMediaMounted() { anycubicTFT.onSDCardStateChange(true); }
|
||||
void onMediaError() { anycubicTFT.onSDCardError(); }
|
||||
void onMediaRemoved() { anycubicTFT.onSDCardStateChange(false); }
|
||||
|
||||
|
@ -138,8 +138,8 @@ void AnycubicTFT::onKillTFT() {
|
||||
SENDLINE_DBG_PGM("J11", "TFT Serial Debug: Kill command... J11");
|
||||
}
|
||||
|
||||
void AnycubicTFT::onSDCardStateChange(bool isInserted) {
|
||||
DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardStateChange event triggered...", isInserted);
|
||||
void AnycubicTFT::onSDCardStateChange(bool isMounted) {
|
||||
DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardStateChange event triggered...", isMounted);
|
||||
doSDCardStateCheck();
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ void AnycubicTFT::renderCurrentFileList() {
|
||||
|
||||
SENDLINE_PGM("FN "); // Filelist start
|
||||
|
||||
if (!isMediaInserted() && !specialMenu) {
|
||||
if (!isMediaMounted() && !specialMenu) {
|
||||
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to render Current File List... J02");
|
||||
|
||||
SENDLINE_PGM("<SPECI~1.GCO");
|
||||
@ -579,7 +579,7 @@ void AnycubicTFT::getCommandFromTFT() {
|
||||
#if HAS_MEDIA
|
||||
if (isPrintingFromMedia()) {
|
||||
SEND_PGM("A6V ");
|
||||
if (isMediaInserted())
|
||||
if (isMediaMounted())
|
||||
SENDLINE(ui8tostr3rj(getProgress_percent()));
|
||||
else
|
||||
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to return printing status... J02");
|
||||
@ -632,7 +632,7 @@ void AnycubicTFT::getCommandFromTFT() {
|
||||
|
||||
case 13: // A13 SELECTION FILE
|
||||
#if HAS_MEDIA
|
||||
if (isMediaInserted()) {
|
||||
if (isMediaMounted()) {
|
||||
starpos = (strchr(tftStrchrPtr + 4, '*'));
|
||||
if (tftStrchrPtr[4] == '/') {
|
||||
strcpy(selectedDirectory, tftStrchrPtr + 5);
|
||||
@ -831,7 +831,7 @@ void AnycubicTFT::getCommandFromTFT() {
|
||||
|
||||
case 26: // A26 refresh SD
|
||||
#if HAS_MEDIA
|
||||
if (isMediaInserted()) {
|
||||
if (isMediaMounted()) {
|
||||
if (strlen(selectedDirectory) > 0) {
|
||||
FileList currentFileList;
|
||||
if ((selectedDirectory[0] == '.') && (selectedDirectory[1] == '.')) {
|
||||
@ -883,12 +883,12 @@ void AnycubicTFT::getCommandFromTFT() {
|
||||
}
|
||||
|
||||
void AnycubicTFT::doSDCardStateCheck() {
|
||||
#if ALL(HAS_MEDIA, HAS_SD_DETECT)
|
||||
bool isInserted = isMediaInserted();
|
||||
if (isInserted)
|
||||
SENDLINE_DBG_PGM("J00", "TFT Serial Debug: SD card state changed... isInserted");
|
||||
#if HAS_MEDIA
|
||||
const bool isMounted = isMediaMounted();
|
||||
if (isMounted)
|
||||
SENDLINE_DBG_PGM("J00", "TFT Serial Debug: SD card state changed... isMounted");
|
||||
else
|
||||
SENDLINE_DBG_PGM("J01", "TFT Serial Debug: SD card state changed... !isInserted");
|
||||
SENDLINE_DBG_PGM("J01", "TFT Serial Debug: SD card state changed... !isMounted");
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -1268,7 +1268,7 @@ namespace Anycubic {
|
||||
break;
|
||||
|
||||
case 4: // page refresh
|
||||
if (!isMediaInserted()) safe_delay(500);
|
||||
if (!isMediaMounted()) safe_delay(500);
|
||||
|
||||
filenavigator.reset();
|
||||
|
||||
|
@ -45,9 +45,9 @@ namespace ExtUI {
|
||||
dgus.printerKilled(error, component);
|
||||
}
|
||||
|
||||
void onMediaInserted() { dgus.mediaEvent(AC_media_inserted); }
|
||||
void onMediaError() { dgus.mediaEvent(AC_media_error); }
|
||||
void onMediaRemoved() { dgus.mediaEvent(AC_media_removed); }
|
||||
void onMediaMounted() { dgus.mediaEvent(AC_media_inserted); }
|
||||
void onMediaError() { dgus.mediaEvent(AC_media_error); }
|
||||
void onMediaRemoved() { dgus.mediaEvent(AC_media_removed); }
|
||||
|
||||
void onHeatingError(const heater_id_t header_id) {}
|
||||
void onMinTempError(const heater_id_t header_id) {}
|
||||
|
@ -264,7 +264,7 @@ void DGUSScreenHandler::sendHeaterStatusToDisplay(DGUS_VP_Variable &var) {
|
||||
|
||||
void DGUSScreenHandler::screenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
// default action executed when there is a SD card, but not printing
|
||||
if (ExtUI::isMediaInserted() && !ExtUI::isPrintingFromMedia()) {
|
||||
if (ExtUI::isMediaMounted() && !ExtUI::isPrintingFromMedia()) {
|
||||
screenChangeHook(var, val_ptr);
|
||||
dgus.requestScreen(current_screenID);
|
||||
return;
|
||||
@ -279,7 +279,7 @@ void DGUSScreenHandler::sendHeaterStatusToDisplay(DGUS_VP_Variable &var) {
|
||||
}
|
||||
|
||||
// Don't let the user in the dark why there is no reaction.
|
||||
if (!ExtUI::isMediaInserted()) {
|
||||
if (!ExtUI::isMediaMounted()) {
|
||||
setStatusMessage(GET_TEXT_F(MSG_NO_MEDIA));
|
||||
return;
|
||||
}
|
||||
|
@ -48,9 +48,9 @@ namespace ExtUI {
|
||||
while (!screen.loop()); // Wait while anything is left to be sent
|
||||
}
|
||||
|
||||
void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); }
|
||||
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
|
||||
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
|
||||
void onMediaMounted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); }
|
||||
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
|
||||
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
|
||||
|
||||
void onHeatingError(const heater_id_t header_id) {}
|
||||
void onMinTempError(const heater_id_t header_id) {}
|
||||
|
@ -72,7 +72,7 @@ void DGUSReturnKeyCodeHandler::Command_MenuSelect(DGUS_VP &vp, void *data) {
|
||||
break;
|
||||
|
||||
case DGUS_Data::MenuSelectCommand::Print:
|
||||
if (ExtUI::isMediaInserted()) {
|
||||
if (ExtUI::isMediaMounted()) {
|
||||
dgus_sdcard_handler.Reset();
|
||||
screen.triggerScreenChange(DGUS_ScreenID::FILE1);
|
||||
}
|
||||
@ -241,7 +241,7 @@ void DGUSReturnKeyCodeHandler::Command_CheckOK(DGUS_VP &vp, void *data) {
|
||||
#endif // HAS_FILAMENT_SENSOR
|
||||
|
||||
case DGUS_Data::CheckOKCommand::SDCardCheck_Yes:
|
||||
if (ExtUI::isMediaInserted()) {
|
||||
if (ExtUI::isMediaMounted()) {
|
||||
dgus_sdcard_handler.Reset();
|
||||
screen.triggerScreenChange(DGUS_ScreenID::FILE1);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ void DGUSTxHandler::levelingProgressIcon(DGUS_VP &vp) {
|
||||
#endif
|
||||
|
||||
void DGUSTxHandler::sdCardInsertionStatus(DGUS_VP &vp) {
|
||||
const uint16_t data = ExtUI::isMediaInserted() ? 1 : 0;
|
||||
const uint16_t data = ExtUI::isMediaMounted() ? 1 : 0;
|
||||
dgus.write((uint16_t)vp.addr, Endianness::toBE(data));
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,9 @@ namespace ExtUI {
|
||||
screen.printerKilled(error, component);
|
||||
}
|
||||
|
||||
void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); }
|
||||
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
|
||||
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
|
||||
void onMediaMounted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); }
|
||||
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
|
||||
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
|
||||
|
||||
void onHeatingError(const heater_id_t header_id) {}
|
||||
void onMinTempError(const heater_id_t header_id) {}
|
||||
|
@ -49,7 +49,7 @@ void DGUSRxHandler::screenChange(DGUS_VP &vp, void *data_ptr) {
|
||||
#if HAS_MEDIA
|
||||
IF_DISABLED(HAS_SD_DETECT, card.mount());
|
||||
|
||||
if (!ExtUI::isMediaInserted()) {
|
||||
if (!ExtUI::isMediaMounted()) {
|
||||
screen.setStatusMessage(GET_TEXT_F(MSG_NO_MEDIA));
|
||||
return;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace ExtUI {
|
||||
screen.printerKilled(error, component);
|
||||
}
|
||||
|
||||
void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); }
|
||||
void onMediaMounted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); }
|
||||
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
|
||||
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace ExtUI {
|
||||
void onIdle() {}
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) {}
|
||||
|
||||
void onMediaInserted() {}
|
||||
void onMediaMounted() {}
|
||||
void onMediaError() {}
|
||||
void onMediaRemoved() {}
|
||||
|
||||
|
@ -244,7 +244,7 @@ void StatusScreen::draw_overlay_icons(draw_mode_t what) {
|
||||
void StatusScreen::draw_buttons(draw_mode_t what) {
|
||||
int16_t x, y, h, v;
|
||||
|
||||
const bool has_media = isMediaInserted() && !isPrintingFromMedia();
|
||||
const bool has_media = isMediaMounted() && !isPrintingFromMedia();
|
||||
|
||||
CommandProcessor cmd;
|
||||
PolyUI ui(cmd, what);
|
||||
|
@ -227,8 +227,8 @@ void StatusScreen::draw_buttons(draw_mode_t what) {
|
||||
if (what & FOREGROUND) {
|
||||
int16_t x, y, w, h;
|
||||
|
||||
const bool can_print = !isPrinting() && isMediaInserted() && isFileSelected();
|
||||
const bool can_select = !isPrinting() && isMediaInserted();
|
||||
const bool can_print = !isPrinting() && isMediaMounted() && isFileSelected();
|
||||
const bool can_select = !isPrinting() && isMediaMounted();
|
||||
const bool sdOrHostPrinting = ExtUI::isPrinting();
|
||||
const bool sdOrHostPaused = ExtUI::isPrintingPaused();
|
||||
|
||||
@ -284,7 +284,7 @@ void StatusScreen::draw_file(draw_mode_t what) {
|
||||
.cmd (BITMAP_SIZE (File_Icon_Info))
|
||||
.icon(ICON_POS(x, y, w, h), File_Icon_Info, icon_scale);
|
||||
|
||||
if (!isMediaInserted())
|
||||
if (!isMediaMounted())
|
||||
draw_text_with_ellipsis(cmd, TEXT_POS(x, y, w, h), F("No media present"), OPT_CENTERY, font_small);
|
||||
else if (isFileSelected()) {
|
||||
FileList list;
|
||||
@ -311,7 +311,7 @@ void StatusScreen::draw_message(draw_mode_t what, const char *message) {
|
||||
}
|
||||
|
||||
bool StatusScreen::isFileSelected() {
|
||||
if (!isMediaInserted()) return false;
|
||||
if (!isMediaMounted()) return false;
|
||||
FileList list;
|
||||
if (list.isDir()) return false;
|
||||
const char *filename = list.filename();
|
||||
@ -431,7 +431,7 @@ void StatusScreen::onIdle() {
|
||||
}
|
||||
}
|
||||
|
||||
void StatusScreen::onMediaInserted() {
|
||||
void StatusScreen::onMediaMounted() {
|
||||
if (AT_SCREEN(StatusScreen))
|
||||
setStatusMessage(GET_TEXT_F(MSG_MEDIA_INSERTED));
|
||||
}
|
||||
|
@ -58,6 +58,6 @@ class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE,
|
||||
static bool onTouchHeld(uint8_t tag);
|
||||
static bool onTouchEnd(uint8_t tag);
|
||||
static void onIdle();
|
||||
static void onMediaInserted();
|
||||
static void onMediaMounted();
|
||||
static void onMediaRemoved();
|
||||
};
|
||||
|
@ -44,10 +44,10 @@ namespace ExtUI {
|
||||
KillScreen::show(str);
|
||||
}
|
||||
|
||||
void onMediaInserted() {
|
||||
void onMediaMounted() {
|
||||
#if HAS_MEDIA
|
||||
sound.play(media_inserted, PLAY_ASYNCHRONOUS);
|
||||
StatusScreen::onMediaInserted();
|
||||
StatusScreen::onMediaMounted();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ void StatusScreen::draw_interaction_buttons(draw_mode_t what) {
|
||||
#define MENU_BTN_POS BTN_POS(3,13), BTN_SIZE(2,4)
|
||||
#endif
|
||||
|
||||
const bool has_media = isMediaInserted() && !isPrintingFromMedia();
|
||||
const bool has_media = isMediaMounted() && !isPrintingFromMedia();
|
||||
|
||||
CommandProcessor cmd;
|
||||
cmd.colors(normal_btn)
|
||||
@ -453,7 +453,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void StatusScreen::onMediaInserted() {
|
||||
void StatusScreen::onMediaMounted() {
|
||||
if (AT_SCREEN(StatusScreen))
|
||||
setStatusMessage(GET_TEXT_F(MSG_MEDIA_INSERTED));
|
||||
}
|
||||
|
@ -42,6 +42,6 @@ class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE,
|
||||
static void onEntry();
|
||||
static void onIdle();
|
||||
static bool onTouchEnd(uint8_t tag);
|
||||
static void onMediaInserted();
|
||||
static void onMediaMounted();
|
||||
static void onMediaRemoved();
|
||||
};
|
||||
|
@ -59,7 +59,7 @@ void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
|
||||
delay_ms(10);
|
||||
}
|
||||
|
||||
void onMediaInserted() {
|
||||
void onMediaMounted() {
|
||||
filenavigator.reset();
|
||||
filenavigator.getFiles(0);
|
||||
fileIndex = 0;
|
||||
|
@ -251,8 +251,8 @@ void RTS::onIdle() {
|
||||
delay_ms(3000); // Delay to show bootscreen
|
||||
}
|
||||
else if (startprogress < 250) {
|
||||
if (isMediaInserted()) // Re init media as it happens too early on STM32 boards often
|
||||
onMediaInserted();
|
||||
if (isMediaMounted()) // Re init media as it happens too early on STM32 boards often
|
||||
onMediaMounted();
|
||||
else
|
||||
injectCommands(F("M22\nM21"));
|
||||
startprogress = 254;
|
||||
@ -375,7 +375,7 @@ void RTS::onIdle() {
|
||||
if (++autoHomeIconNum > 9) autoHomeIconNum = 0;
|
||||
}
|
||||
|
||||
if (isMediaInserted()) {
|
||||
if (isMediaMounted()) {
|
||||
const uint16_t currPage = fileIndex == 0 ? 1 : CEIL(float(fileIndex) / float(DISPLAY_FILES)) + 1,
|
||||
maxPageAdd = filenavigator.folderdepth ? 1 : 0,
|
||||
maxPages = CEIL(float(filenavigator.maxFiles() + maxPageAdd) / float(DISPLAY_FILES) );
|
||||
@ -1488,7 +1488,7 @@ void RTS::handleData() {
|
||||
} break;
|
||||
|
||||
case Filename: {
|
||||
if (isMediaInserted() && recdat.addr == FilenameChs) {
|
||||
if (isMediaMounted() && recdat.addr == FilenameChs) {
|
||||
|
||||
recordcount = recdat.data[0] - 1;
|
||||
if (filenavigator.currentindex == 0 && filenavigator.folderdepth > 0 && (fileIndex + recordcount) == 0) {
|
||||
@ -1521,7 +1521,7 @@ void RTS::handleData() {
|
||||
}
|
||||
}
|
||||
else if (recdat.addr == FilenamePlay) {
|
||||
if (recdat.data[0] == 1 && isMediaInserted()) { // for sure
|
||||
if (recdat.data[0] == 1 && isMediaMounted()) { // for sure
|
||||
printFile(filenavigator.getIndexName(fileIndex + recordcount));
|
||||
|
||||
for (int16_t j = 0; j < 10; j++) // clean screen.
|
||||
|
@ -141,7 +141,7 @@ namespace ExtUI {
|
||||
// Not needed for Malyan LCD
|
||||
void onStatusChanged(const char * const) {}
|
||||
|
||||
void onMediaInserted() {}
|
||||
void onMediaMounted() {}
|
||||
void onMediaError() {}
|
||||
void onMediaRemoved() {}
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace ExtUI {
|
||||
void onIdle() { nextion.idleLoop(); }
|
||||
void onPrinterKilled(FSTR_P const error, FSTR_P const component) { nextion.printerKilled(error, component); }
|
||||
|
||||
void onMediaInserted() {}
|
||||
void onMediaMounted() {}
|
||||
void onMediaError() {}
|
||||
void onMediaRemoved() {}
|
||||
|
||||
|
@ -210,8 +210,8 @@ void NextionTFT::panelInfo(uint8_t req) {
|
||||
|
||||
case 1: // Get SD Card list
|
||||
if (!isPrinting()) {
|
||||
if (!isMediaInserted()) safe_delay(500);
|
||||
if (!isMediaInserted()) { // Make sure the card is removed
|
||||
if (!isMediaMounted()) safe_delay(500);
|
||||
if (!isMediaMounted()) { // Make sure the card is removed
|
||||
//SEND_TXT("tmppage.M117", msg_no_sd_card);
|
||||
}
|
||||
else if (nextion_command[3] == 'S')
|
||||
|
@ -1169,7 +1169,7 @@ namespace ExtUI {
|
||||
return isPrinting() && (isPrintingFromMediaPaused() || print_job_timer.isPaused());
|
||||
}
|
||||
|
||||
bool isMediaInserted() { return TERN0(HAS_MEDIA, IS_SD_INSERTED()); }
|
||||
bool isMediaMounted() { return TERN0(HAS_MEDIA, card.isMounted()); }
|
||||
|
||||
// Pause/Resume/Stop are implemented in MarlinUI
|
||||
void pausePrint() { ui.pause_print(); }
|
||||
|
@ -100,7 +100,7 @@ namespace ExtUI {
|
||||
|
||||
/**
|
||||
* The Extensible UI API is a utility class that can be used to implement:
|
||||
* - An LCD view that responds to standard events, e.g., onMediaInserted(...)
|
||||
* - An LCD view that responds to standard events, e.g., onMediaMounted(...)
|
||||
* - An LCD that polls firmware states and settings in a standard manner.
|
||||
* (e.g., With tool indexes and extruder indexes).
|
||||
* - Standard hooks to send data to a serial-based controller.
|
||||
@ -451,7 +451,7 @@ namespace ExtUI {
|
||||
* Media access routines
|
||||
* Use these to operate on files
|
||||
*/
|
||||
bool isMediaInserted();
|
||||
bool isMediaMounted();
|
||||
bool isPrintingFromMediaPaused();
|
||||
bool isPrintingFromMedia();
|
||||
bool isPrinting();
|
||||
@ -486,7 +486,7 @@ namespace ExtUI {
|
||||
void onStartup();
|
||||
void onIdle();
|
||||
|
||||
void onMediaInserted();
|
||||
void onMediaMounted();
|
||||
void onMediaError();
|
||||
void onMediaRemoved();
|
||||
|
||||
|
@ -1835,7 +1835,7 @@ void MarlinUI::host_notify(const char * const cstr) {
|
||||
if (status) {
|
||||
if (old_status < 2) {
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onMediaInserted();
|
||||
ExtUI::onMediaMounted();
|
||||
#elif ENABLED(BROWSE_MEDIA_ON_INSERT)
|
||||
clear_menu_history();
|
||||
quick_feedback();
|
||||
|
Loading…
Reference in New Issue
Block a user