mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-08-30 09:39:49 +02:00
Updates to SD reporting
- ? now reports the name of the file printing - Minor cleanup of spindle direction
This commit is contained in:
@@ -31,6 +31,7 @@ File myFile;
|
||||
char fileTypes[FILE_TYPE_COUNT][8] = {".NC", ".TXT", ".GCODE"}; // filter out files not of these types (s/b UPPERCASE)
|
||||
bool SD_ready_next = false; // Grbl has processed a line and is waiting for another
|
||||
|
||||
|
||||
// attempt to mount the SD card
|
||||
bool sd_mount() {
|
||||
if(!SD.begin()){
|
||||
@@ -82,6 +83,7 @@ void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
|
||||
|
||||
boolean openFile(fs::FS &fs, const char * path){
|
||||
myFile = fs.open(path);
|
||||
|
||||
if(!myFile){
|
||||
report_status_message(STATUS_SD_FAILED_READ, CLIENT_SERIAL);
|
||||
return false;
|
||||
@@ -209,4 +211,14 @@ uint8_t set_sd_state(uint8_t flag){
|
||||
return sd_state;
|
||||
}
|
||||
|
||||
void sd_get_current_filename(char* name) {
|
||||
|
||||
if (myFile != NULL)
|
||||
{
|
||||
strcpy(name, myFile.name());
|
||||
}
|
||||
else
|
||||
name[0] = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -47,4 +47,6 @@ boolean readFileLine(char *line);
|
||||
void readFile(fs::FS &fs, const char * path);
|
||||
float sd_report_perc_complete();
|
||||
|
||||
void sd_get_current_filename(char* name);
|
||||
|
||||
#endif
|
||||
|
@@ -710,7 +710,10 @@ void report_realtime_status(uint8_t client)
|
||||
|
||||
#ifdef ENABLE_SD_CARD
|
||||
if (get_sd_state(false) == SDCARD_BUSY_PRINTING) {
|
||||
sprintf(temp, "|SD:%4.2f", sd_report_perc_complete());
|
||||
sprintf(temp, "|SD:%4.2f,", sd_report_perc_complete());
|
||||
strcat(status, temp);
|
||||
|
||||
sd_get_current_filename(temp);
|
||||
strcat(status, temp);
|
||||
}
|
||||
#endif
|
||||
|
@@ -94,16 +94,9 @@ void spindle_set_state(uint8_t state, float rpm)
|
||||
} else {
|
||||
|
||||
// TODO ESP32 Enable and direction control
|
||||
#ifdef SPINDLE_DIR_PIN
|
||||
if (state == SPINDLE_ENABLE_CW) {
|
||||
digitalWrite(SPINDLE_DIR_PIN, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
digitalWrite(SPINDLE_DIR_PIN, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SPINDLE_DIR_PIN
|
||||
digitalWrite(SPINDLE_DIR_PIN, state == SPINDLE_ENABLE_CW);
|
||||
#endif
|
||||
|
||||
// NOTE: Assumes all calls to this function is when Grbl is not moving or must remain off.
|
||||
if (settings.flags & BITFLAG_LASER_MODE) {
|
||||
|
Reference in New Issue
Block a user