Merge pull request #9977 from thinkyhead/bf1_auto_report_sd_status
[1.1.x] Add AUTO_REPORT_SD_STATUS feature
This commit is contained in:
commit
4dd612a68d
@ -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
|
||||
*/
|
||||
|
@ -89,7 +89,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) Or, 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"
|
||||
@ -6886,9 +6886,17 @@ inline void gcode_M17() {
|
||||
}
|
||||
|
||||
/**
|
||||
* M27: Get SD Card status
|
||||
* M27: Get SD Card status or set the SD status auto-report interval.
|
||||
|
||||
*/
|
||||
inline void gcode_M27() { card.getStatus(); }
|
||||
inline void gcode_M27() {
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
if (parser.seenval('S'))
|
||||
card.set_auto_report_interval(parser.value_byte());
|
||||
else
|
||||
#endif
|
||||
card.getStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* M28: Start SD Write
|
||||
@ -8636,6 +8644,13 @@ inline void gcode_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
|
||||
}
|
||||
|
||||
@ -13467,6 +13482,10 @@ void idle(
|
||||
i2cpem_next_update_ms = millis() + I2CPE_MIN_UPD_TIME_MS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
card.auto_report_sd_status();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -911,4 +911,17 @@ void CardReader::printingHasFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
uint8_t CardReader::auto_report_sd_interval = 0;
|
||||
millis_t CardReader::next_sd_report_ms;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
#endif // AUTO_REPORT_SD_STATUS
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
@ -90,10 +90,19 @@ public:
|
||||
FORCE_INLINE uint8_t percentDone() { return (isFileOpen() && filesize) ? sdpos / ((filesize + 99) / 100) : 0; }
|
||||
FORCE_INLINE char* getWorkDirName() { workDir.getFilename(filename); return filename; }
|
||||
|
||||
public:
|
||||
#if ENABLED(AUTO_REPORT_SD_STATUS)
|
||||
void auto_report_sd_status(void);
|
||||
FORCE_INLINE void set_auto_report_interval(uint8_t v) {
|
||||
NOMORE(v, 60);
|
||||
auto_report_sd_interval = v;
|
||||
next_sd_report_ms = millis() + 1000UL * v;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool saving, logging, sdprinting, cardOK, filenameIsDir;
|
||||
char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH];
|
||||
int autostart_index;
|
||||
|
||||
private:
|
||||
SdFile root, *curDir, workDir, workDirParents[MAX_DIR_DEPTH];
|
||||
uint8_t workDirDepth;
|
||||
@ -170,6 +179,11 @@ 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;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if PIN_EXISTS(SD_DETECT)
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -1408,6 +1408,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
|
||||
*/
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user