void setmovePopCallback(void *ptr) { memset(buffer, 0, sizeof(buffer)); movecmd.getText(buffer, sizeof(buffer)); enqueue_and_echo_commands_P(PSTR("G91")); enqueue_and_echo_commands_P(buffer); enqueue_and_echo_commands_P(PSTR("G90")); }
void CardReader::printingHasFinished() { st_synchronize(); file.close(); sdprinting = false; if (SD_FINISHED_STEPPERRELEASE) { enqueue_and_echo_commands_P(PSTR(SD_FINISHED_RELEASECOMMAND)); print_job_counter.stop(); enqueue_and_echo_commands_P(PSTR("M31")); } }
void CardReader::openAndPrintFile(const char *name) { char cmd[4 + strlen(name) + 1]; // Room for "M23 ", filename, and null sprintf_P(cmd, PSTR("M23 %s"), name); for (char *c = &cmd[4]; *c; c++) *c = tolower(*c); enqueue_and_echo_command(cmd); enqueue_and_echo_commands_P(PSTR("M24")); }
void CardReader::printingHasFinished() { stepper.synchronize(); file.close(); if (file_subcall_ctr > 0) { // Heading up to a parent file that called current as a procedure. file_subcall_ctr--; openFile(proc_filenames[file_subcall_ctr], true, true); setIndex(filespos[file_subcall_ctr]); startFileprint(); } else { sdprinting = false; if (SD_FINISHED_STEPPERRELEASE) enqueue_and_echo_commands_P(PSTR(SD_FINISHED_RELEASECOMMAND)); print_job_timer.stop(); if (print_job_timer.duration() > 60) enqueue_and_echo_commands_P(PSTR("M31")); } }
static void menu_action_sdfile(const char* filename) { char cmd[30]; char* c; sprintf_P(cmd, PSTR("M23 %s"), filename); for(c = &cmd[4]; *c; c++) *c = tolower(*c); enqueue_and_echo_command(cmd); enqueue_and_echo_commands_P(PSTR("M24")); setpageInfo(); }
/** * Check for Print Job Recovery during setup() * * If a saved state exists send 'M1000 S' to initiate job recovery. */ void PrintJobRecovery::check() { if (enabled) { if (!card.isDetected()) card.initsd(); if (card.isDetected()) { load(); if (!valid()) return purge(); enqueue_and_echo_commands_P(PSTR("M1000 S")); } } }
void CardReader::closeFile(bool store_location /*=false*/) { file.sync(); file.close(); saving = false; if (store_location) { char bufferFilerestart[50]; char bufferX[11]; char bufferY[11]; char bufferZ[11]; char bufferE[11]; char bufferCoord[50]; char bufferCoord1[50]; char bufferCoord2[50]; char bufferSdpos[11]; char nameFile[15]; snprintf(bufferSdpos, sizeof bufferSdpos, "%lu", (unsigned long)sdpos); strcpy(nameFile, "restart.gcode"); if (!fileRestart.exists(nameFile)) { fileRestart.createContiguous(&workDir, nameFile, 1); fileRestart.close(); } fileRestart.open(&workDir, nameFile, O_WRITE); fileRestart.truncate(0); dtostrf(current_position[X_AXIS], 1, 3, bufferX); dtostrf(current_position[Y_AXIS], 1, 3, bufferY); dtostrf(current_position[Z_AXIS], 1, 3, bufferZ); dtostrf(current_position[E_AXIS], 1, 3, bufferE); #if MECH(DELTA) strcpy(bufferCoord1, "G1 Z"); strcat(bufferCoord1, bufferZ); strcat(bufferCoord1, " F8000"); #else strcpy(bufferCoord1, "G92 Z"); strcat(bufferCoord1, bufferZ); #endif strcpy(bufferCoord, "G1 X"); strcat(bufferCoord, bufferX); strcat(bufferCoord, " Y"); strcat(bufferCoord, bufferY); strcat(bufferCoord, " Z"); strcat(bufferCoord, bufferZ); strcat(bufferCoord, " F3600"); strcpy(bufferCoord2, "G92 E"); strcat(bufferCoord2, bufferE); for (int8_t i = 0; i < (int8_t)strlen(fullName); i++) fullName[i] = tolower(fullName[i]); strcpy(bufferFilerestart, "M34 S"); strcat(bufferFilerestart, bufferSdpos); strcat(bufferFilerestart, " @"); strcat(bufferFilerestart, fullName); #if MECH(DELTA) fileRestart.write("G28\n"); #else fileRestart.write(bufferCoord1); fileRestart.write("\n"); fileRestart.write("G28 X Y\n"); #endif if (degTargetBed() > 0) { char Bedtemp[15]; sprintf(Bedtemp, "M190 S%i\n", (int)degTargetBed()); fileRestart.write(Bedtemp); } char CurrHotend[10]; sprintf(CurrHotend, "T%i\n", active_extruder); fileRestart.write(CurrHotend); for (uint8_t h = 0; h < HOTENDS; h++) { if (degTargetHotend(h) > 0) { char Hotendtemp[15]; sprintf(Hotendtemp, "M109 T%i S%i\n", h, (int)degTargetHotend(h)); fileRestart.write(Hotendtemp); } } #if MECH(DELTA) fileRestart.write(bufferCoord1); fileRestart.write("\n"); #endif fileRestart.write(bufferCoord); fileRestart.write("\n"); if (fanSpeed > 0) { char fanSp[15]; sprintf(fanSp, "M106 S%i\n", fanSpeed); fileRestart.write(fanSp); } fileRestart.write(bufferCoord2); fileRestart.write("\n"); fileRestart.write(bufferFilerestart); fileRestart.write("\n"); fileRestart.sync(); fileRestart.close(); HAL::delayMilliseconds(200); #if MECH(DELTA) enqueue_and_echo_commands_P(PSTR("G28")); #else enqueue_and_echo_commands_P(PSTR("G28 X0 Y0")); #endif disable_all_heaters(); disable_all_coolers(); fanSpeed = 0; } }
void setgcodePopCallback(void *ptr) { memset(buffer, 0, sizeof(buffer)); Tgcode.getText(buffer, sizeof(buffer)); enqueue_and_echo_commands_P(buffer); Pmenu.show(); }
void sethotPopCallback(void *ptr) { memset(buffer, 0, sizeof(buffer)); set1.getText(buffer, sizeof(buffer)); enqueue_and_echo_commands_P(buffer); setpageInfo(); }