mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 13:56:24 +00:00
* SD Status auto-report feature Feature Request #9751
This commit is contained in:
parent
7bdb98c946
commit
eb079959fb
@ -547,6 +547,10 @@ void idle(
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
card.auto_report_sd_status();
|
||||
#endif
|
||||
|
||||
#ifdef HAL_IDLETASK
|
||||
HAL_idletask();
|
||||
#endif
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1414,6 +1414,11 @@
|
||||
*/
|
||||
#define EXTENDED_CAPABILITIES_REPORT
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Disable all Volumetric extrusion options
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1412,6 +1412,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
//#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1410,6 +1410,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1417,6 +1417,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1422,6 +1422,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1411,6 +1411,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1411,6 +1411,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1411,6 +1411,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1411,6 +1411,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1411,6 +1411,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1411,6 +1411,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1416,6 +1416,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1411,6 +1411,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1409,6 +1409,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -1410,6 +1410,11 @@
|
||||
*/
|
||||
#define AUTO_REPORT_TEMPERATURES
|
||||
|
||||
/**
|
||||
* Auto-report SdCard status with M27 S<seconds>
|
||||
*/
|
||||
//#define AUTO_REPORT_SD_STATUS
|
||||
|
||||
/**
|
||||
* Include capabilities in M115 output
|
||||
*/
|
||||
|
@ -85,7 +85,7 @@
|
||||
* M24 - Start/resume SD print. (Requires SDSUPPORT)
|
||||
* M25 - Pause SD print. (Requires SDSUPPORT)
|
||||
* M26 - Set SD position in bytes: "M26 S12345". (Requires SDSUPPORT)
|
||||
* M27 - Report SD print status. (Requires SDSUPPORT)
|
||||
* M27 - Report SD print status. (Requires SDSUPPORT) With 'S<seconds>' sets the SD status auto-report interval. (Requires AUTO_REPORT_SD_STATUS)
|
||||
* M28 - Start SD write: "M28 /path/file.gco". (Requires SDSUPPORT)
|
||||
* M29 - Stop SD write. (Requires SDSUPPORT)
|
||||
* M30 - Delete file from SD: "M30 /path/file.gco"
|
||||
|
@ -139,5 +139,12 @@ void GcodeSuite::M115() {
|
||||
#endif
|
||||
);
|
||||
|
||||
// AUTOREPORT_SD_STATUS (M27 extension)
|
||||
cap_line(PSTR("AUTOREPORT_SD_STATUS")
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
, true
|
||||
#endif
|
||||
);
|
||||
|
||||
#endif // EXTENDED_CAPABILITIES_REPORT
|
||||
}
|
||||
|
@ -115,6 +115,14 @@ void GcodeSuite::M27() {
|
||||
command_queue_port[cmd_queue_index_r]
|
||||
#endif
|
||||
);
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
if (parser.seenval('S'))
|
||||
card.set_auto_report_interval(parser.value_byte()
|
||||
#if NUM_SERIAL > 1
|
||||
, command_queue_port[cmd_queue_index_r]
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2603,7 +2603,7 @@ void kill_screen(const char* lcd_msg) {
|
||||
_lcd_goto_ubl_level_bed
|
||||
#else
|
||||
_lcd_ubl_level_bed
|
||||
#endif
|
||||
#endif
|
||||
);
|
||||
#elif ENABLED(LCD_BED_LEVELING)
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
|
@ -536,7 +536,7 @@ void CardReader::getStatus(
|
||||
const int8_t port/*= -1*/
|
||||
#endif
|
||||
) {
|
||||
if (cardOK) {
|
||||
if (cardOK && sdprinting) {
|
||||
SERIAL_PROTOCOLPGM_P(port, MSG_SD_PRINTING_BYTE);
|
||||
SERIAL_PROTOCOL_P(port, sdpos);
|
||||
SERIAL_PROTOCOLCHAR_P(port, '/');
|
||||
@ -947,4 +947,24 @@ void CardReader::printingHasFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
uint8_t CardReader::auto_report_sd_interval = 0;
|
||||
millis_t CardReader::next_sd_report_ms;
|
||||
#if NUM_SERIAL > 1
|
||||
int8_t CardReader::serialport;
|
||||
#endif
|
||||
|
||||
void CardReader::auto_report_sd_status() {
|
||||
millis_t current_ms = millis();
|
||||
if (auto_report_sd_interval && ELAPSED(current_ms, next_sd_report_ms)) {
|
||||
next_sd_report_ms = current_ms + 1000UL * auto_report_sd_interval;
|
||||
getStatus(
|
||||
#if NUM_SERIAL > 1
|
||||
serialport
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
#endif // AUTO_REPORT_SD_STATUS
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
@ -99,6 +99,23 @@ public:
|
||||
FORCE_INLINE char* getWorkDirName() { workDir.getFilename(filename); return filename; }
|
||||
|
||||
Sd2Card& getSd2Card() { return card; }
|
||||
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
void auto_report_sd_status(void);
|
||||
FORCE_INLINE void set_auto_report_interval(uint8_t v
|
||||
#if NUM_SERIAL > 1
|
||||
, int8_t port
|
||||
#endif
|
||||
) {
|
||||
#if NUM_SERIAL > 1
|
||||
serialport = port;
|
||||
#endif
|
||||
NOMORE(v, 60);
|
||||
auto_report_sd_interval = v;
|
||||
next_sd_report_ms = millis() + 1000UL * v;
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
bool saving, logging, sdprinting, cardOK, filenameIsDir;
|
||||
char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH];
|
||||
@ -183,6 +200,14 @@ private:
|
||||
#if ENABLED(SDCARD_SORT_ALPHA)
|
||||
void flush_presort();
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
static uint8_t auto_report_sd_interval;
|
||||
static millis_t next_sd_report_ms;
|
||||
#if NUM_SERIAL > 1
|
||||
static int8_t serialport;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#if PIN_EXISTS(SD_DETECT)
|
||||
|
Loading…
Reference in New Issue
Block a user