mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-12-02 08:09:36 +00:00
🧑💻 Quieter AUTO_REPORT_SD_STATUS option (#27391)
This commit is contained in:
parent
8c15a093fd
commit
56e2b60e6d
@ -1465,3 +1465,13 @@
|
|||||||
#if !HAS_ROTATIONAL_AXES
|
#if !HAS_ROTATIONAL_AXES
|
||||||
#undef MANUAL_MOVE_DISTANCE_DEG
|
#undef MANUAL_MOVE_DISTANCE_DEG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Only report "Not SD printing" when the state changes
|
||||||
|
// To get legacy behavior define AUTO_REPORT_SD_STATUS 2
|
||||||
|
#ifdef AUTO_REPORT_SD_STATUS
|
||||||
|
#if ENABLED(AUTO_REPORT_SD_STATUS) // Not blank, 1, or true
|
||||||
|
#define QUIETER_AUTO_REPORT_SD_STATUS
|
||||||
|
#endif
|
||||||
|
#undef AUTO_REPORT_SD_STATUS
|
||||||
|
#define AUTO_REPORT_SD_STATUS
|
||||||
|
#endif
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
|
|
||||||
#include "../inc/MarlinConfig.h"
|
#include "../inc/MarlinConfig.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cardreader.cpp - SD card / USB flash drive file handling interface
|
||||||
|
*/
|
||||||
|
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
|
|
||||||
//#define DEBUG_CARDREADER
|
//#define DEBUG_CARDREADER
|
||||||
@ -827,8 +831,17 @@ void CardReader::removeFile(const char * const name) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardReader::report_status() {
|
void CardReader::report_status(TERN_(QUIETER_AUTO_REPORT_SD_STATUS, const bool isauto/*=false*/)) {
|
||||||
if (isPrinting() || isPaused()) {
|
const bool has_job = isStillPrinting() || isPaused();
|
||||||
|
|
||||||
|
#if ENABLED(QUIETER_AUTO_REPORT_SD_STATUS)
|
||||||
|
static uint32_t old_sdpos = 0;
|
||||||
|
if (!has_job) old_sdpos = 0;
|
||||||
|
if (isauto && sdpos == old_sdpos) return;
|
||||||
|
if (has_job) old_sdpos = sdpos;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (has_job) {
|
||||||
SERIAL_ECHOPGM(STR_SD_PRINTING_BYTE, sdpos);
|
SERIAL_ECHOPGM(STR_SD_PRINTING_BYTE, sdpos);
|
||||||
SERIAL_CHAR('/');
|
SERIAL_CHAR('/');
|
||||||
SERIAL_ECHOLN(filesize);
|
SERIAL_ECHOLN(filesize);
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cardreader.h - SD card / USB flash drive file handling interface
|
||||||
|
*/
|
||||||
|
|
||||||
#include "../inc/MarlinConfig.h"
|
#include "../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
@ -162,7 +166,7 @@ public:
|
|||||||
static void selectFileByName(const char * const match); // (working directory only)
|
static void selectFileByName(const char * const match); // (working directory only)
|
||||||
|
|
||||||
// Print job
|
// Print job
|
||||||
static void report_status();
|
static void report_status(TERN_(QUIETER_AUTO_REPORT_SD_STATUS, const bool isauto=false));
|
||||||
static void getAbsFilenameInCWD(char *dst);
|
static void getAbsFilenameInCWD(char *dst);
|
||||||
static void printSelectedFilename();
|
static void printSelectedFilename();
|
||||||
static void openAndPrintFile(const char *name); // (working directory or full path)
|
static void openAndPrintFile(const char *name); // (working directory or full path)
|
||||||
@ -249,7 +253,7 @@ public:
|
|||||||
//
|
//
|
||||||
// SD Auto Reporting
|
// SD Auto Reporting
|
||||||
//
|
//
|
||||||
struct AutoReportSD { static void report() { report_status(); } };
|
struct AutoReportSD { static void report() { report_status(TERN_(QUIETER_AUTO_REPORT_SD_STATUS, true)); } };
|
||||||
static AutoReporter<AutoReportSD> auto_reporter;
|
static AutoReporter<AutoReportSD> auto_reporter;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user