Commit 9e3e6335 authored by Franco (nextime) Lanza's avatar Franco (nextime) Lanza

Merge branch 'master' into nextime

parents a8aec1a8 d868a7aa
Pipeline #101 skipped
......@@ -45,6 +45,8 @@
* M30 - Delete file from SD (M30 filename.g)
* M31 - Output time since last M109 or SD card start to serial
* M32 - Make directory
* M33 - Stop printing, close file and save restart.gcode
* M34 - Open file and start print
* M35 - Upload Firmware to Nextion from SD
* M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
* M48 - Measure Z_Probe repeatability. M48 [P # of points] [X position] [Y position] [V_erboseness #] [E_ngage Probe] [L # of legs of travel]
......
### Version 4.2.85
* Add Stop and Save for Restart (SSR)
### Version 4.2.84
* Add Mesh Bed Level (MBL)
......
......@@ -14,6 +14,7 @@
// The following define to use the new HakanBasted laser_pulse method to fire laser. It should be more efficient, but it's less tested.
// Thanks for it to HakanBastedt that has implemented it for Marlin at https://github.com/HakanBastedt/Marlin
// Uncomment to enable it *USE AT YOUR OWN RISK*, it should work but it's *NOT WELL TESTED YET*
// Only for MEGA. On DUE processor is automatic.
//#define LASER_PULSE_METHOD
// If your machine has laser focuser, set this to true and it will use Z axis for focus or disable it.
......
......@@ -24,7 +24,7 @@
#define CONFIGURATION_VERSION_H
#define FIRMWARE_NAME "MK"
#define SHORT_BUILD_VERSION "4.2.84_dev"
#define SHORT_BUILD_VERSION "4.2.85_dev"
#define BUILD_VERSION FIRMWARE_NAME "_" SHORT_BUILD_VERSION
#define STRING_DISTRIBUTION_DATE __DATE__ " " __TIME__ // build date and time
// It might also be appropriate to define a location where additional information can be found
......
......@@ -81,6 +81,8 @@
* M30 - Delete file from SD (M30 filename.g)
* M31 - Output time since last M109 or SD card start to serial
* M32 - Make directory
* M33 - Stop printing, close file and save restart.gcode
* M34 - Open file and start print
* M35 - Upload Firmware to Nextion from SD
* M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
* M48 - Measure Z_Probe repeatability. M48 [P # of points] [X position] [Y position] [V_erboseness #] [E_ngage Probe] [L # of legs of travel]
......
......@@ -5350,6 +5350,46 @@ inline void gcode_M17() {
}
}
/**
* M33: Close File and save restart.gcode
*/
inline void gcode_M33() {
if (card.cardOK) {
ECHO_LM(DB, "Close file and save restart.gcode");
card.closeFile(true);
}
}
/**
* M34: Select file and start SD print
*/
inline void gcode_M34() {
if (card.sdprinting)
st_synchronize();
if( card.cardOK ) {
char* namestartpos = (strchr(current_command_args, '@'));
if(namestartpos == NULL) {
namestartpos = current_command_args ; // default name position
}
else
namestartpos++; // to skip the '@'
ECHO_SMT(DB, "Open file: ", namestartpos);
ECHO_EM(" and start print.");
card.selectFile(namestartpos);
if(code_seen('S')) card.setIndex(code_value_long());
feedrate = 1200.0; // 20 mm/sec
feedrate_multiplier = 100; // 100% feedrate
card.startPrint();
print_job_counter.start();
#if HAS(POWER_CONSUMPTION_SENSOR)
startpower = power_consumption_hour;
#endif
}
}
#if ENABLED(NEXTION)
/**
* M35: Upload Firmware to Nextion from SD
......@@ -8707,6 +8747,10 @@ void process_next_command() {
gcode_M31(); break;
case 32: // M32 - Make directory
gcode_M32(); break;
case 33: // M33 - Stop printing, close file and save restart.gcode
gcode_M33(); break;
case 34: // M34 - Select file and start SD print
gcode_M34(); break;
#if ENABLED(NEXTION)
case 35: // M35 - Upload Firmware to Nextion from SD
gcode_M35(); break;
......
......@@ -145,6 +145,7 @@
#define MSG_PAUSE_PRINT "Pause print"
#define MSG_RESUME_PRINT "Resume print"
#define MSG_STOP_PRINT "Stop print"
#define MSG_STOP_SAVE_PRINT "Stop and Save"
#define MSG_CARD_MENU "Print from " MSG_SD
#define MSG_NO_CARD "No " MSG_SD
#define MSG_DWELL "Sleep..."
......@@ -245,6 +246,8 @@
#define MSG_HEATING_COMPLETE "Heating done."
#define MSG_BED_HEATING "Bed Heating."
#define MSG_BED_DONE "Bed done."
#define MSG_CHAMBER_HEATING "Chamber Heating."
#define MSG_CHAMBER_DONE "Chamber done."
#define MSG_COOLER_COOLING "Cooling..."
#define MSG_COOLER_DONE "Cooling done."
......
......@@ -141,6 +141,7 @@
#define MSG_PAUSE_PRINT "Pausa"
#define MSG_RESUME_PRINT "Riprendi stampa"
#define MSG_STOP_PRINT "Arresta stampa"
#define MSG_STOP_SAVE_PRINT "Arresta e Salva"
#define MSG_CARD_MENU "SD Card Menu"
#define MSG_NO_CARD "No SD Card"
#define MSG_DWELL "Sospensione..."
......@@ -241,6 +242,8 @@
#define MSG_HEATING_COMPLETE "Riscaldamento finito."
#define MSG_BED_HEATING "Riscaldamento piatto."
#define MSG_BED_DONE "Piatto riscaldato."
#define MSG_CHAMBER_HEATING "Riscaldamento camera."
#define MSG_CHAMBER_DONE "Camera riscaldata."
#define MSG_COOLER_COOLING "Raffreddamento..."
#define MSG_COOLER_DONE "Raffreddamento finito."
......
......@@ -568,6 +568,15 @@ inline void line_to_current(AxisEnum axis) {
lcd_setstatus(MSG_PRINT_ABORTED, true);
}
static void lcd_sdcard_stop_save() {
card.sdprinting = false;
print_job_counter.stop();
quickStop();
card.closeFile(true);
autotempShutdown();
cancel_heatup = true;
}
#endif // SDSUPPORT
/**
......@@ -606,6 +615,7 @@ static void lcd_main_menu() {
else
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume);
MENU_ITEM(function, MSG_STOP_PRINT, lcd_sdcard_stop);
MENU_ITEM(function, MSG_STOP_SAVE_PRINT, lcd_sdcard_stop_save);
}
else {
MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
......
......@@ -230,14 +230,15 @@
#include "../Configuration_Pins.h"
/****************************************************************************************/
#if X_HOME_DIR > 0 // Home X to MAX
#undef X_MIN_PIN
#define X_MIN_PIN -1
#elif X_HOME_DIR < 0 // Home X to MIN
#undef X_MAX_PIN
#define X_MAX_PIN -1
#endif //X_HOME_DIR > 0
#if DISABLED(DUAL_X_CARRIAGE)
#if X_HOME_DIR > 0 // Home X to MAX
#undef X_MIN_PIN
#define X_MIN_PIN -1
#elif X_HOME_DIR < 0 // Home X to MIN
#undef X_MAX_PIN
#define X_MAX_PIN -1
#endif // X_HOME_DIR > 0
#endif // DISABLED(DUAL_X_CARRIAGE)
#if Y_HOME_DIR > 0 // Home Y to MAX
#undef Y_MIN_PIN
......@@ -245,7 +246,7 @@
#elif Y_HOME_DIR < 0 // Home Y to MIN
#undef Y_MAX_PIN
#define Y_MAX_PIN -1
#endif //Y_HOME_DIR > 0
#endif // Y_HOME_DIR > 0
#if Z_HOME_DIR > 0 // Home Z to MAX
#undef Z_MIN_PIN
......@@ -253,7 +254,7 @@
#elif Z_HOME_DIR < 0 // Home Z to MIN
#undef Z_MAX_PIN
#define Z_MAX_PIN -1
#endif //Z_HOME_DIR > 0
#endif // Z_HOME_DIR > 0
#if DISABLED(Z_PROBE_ENDSTOP) // Allow code to compile regardless of Z_PROBE_ENDSTOP setting.
#define Z_PROBE_PIN -1
......
......@@ -24,7 +24,9 @@
#if ENABLED(SDSUPPORT)
#include "cardreader.h"
#ifdef __SAM3X8E__
#include <avr/dtostrf.h>
#endif
char tempLongFilename[LONG_FILENAME_LENGTH + 1];
char fullName[LONG_FILENAME_LENGTH * SD_MAX_FOLDER_DEPTH + SD_MAX_FOLDER_DEPTH + 1];
......@@ -183,6 +185,11 @@ bool CardReader::selectFile(const char* filename, bool silent/*=false*/) {
file.close();
if (!file.exists("restart.gcode")) {
file.createContiguous(&workDir, "restart.gcode", 1);
file.close();
}
if (file.open(curDir, filename, O_READ)) {
if ((oldP = strrchr(filename, '/')) != NULL)
oldP++;
......@@ -192,6 +199,11 @@ bool CardReader::selectFile(const char* filename, bool silent/*=false*/) {
ECHO_MT(SERIAL_SD_FILE_OPENED, oldP);
ECHO_EMV(SERIAL_SD_SIZE, file.fileSize());
}
for (int c = 0; c <= sizeof(fullName); c++)
const_cast<char&>(fullName[c]) = '\0';
strncpy(fullName, filename, strlen(filename));
#if ENABLED(JSON_OUTPUT)
parsejson(file);
#endif
......@@ -316,8 +328,114 @@ void CardReader::closeFile(bool store_location /*=false*/) {
saving = false;
if (store_location) {
//future: store printer state, filename and position for continuing a stopped print
// so one can unplug the printer and continue printing the next day.
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", degTargetBed());
fileRestart.write(Bedtemp);
}
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;
}
}
......
......@@ -44,6 +44,7 @@ class CardReader {
public:
SdFat fat;
SdFile file;
SdFile fileRestart;
CardReader();
void initsd();
......
......@@ -887,7 +887,7 @@ float get_pid_output(int h) {
pid_output = constrain(target_temperature_chamber, 0, MAX_CHAMBER_POWER);
#else
pid_error_chamber = target_temperature_chamber - current_temperature_chamber;
pTerm_chamber = bedKp * pid_error_chamber;
pTerm_chamber = chamberKp * pid_error_chamber;
temp_iState_chamber += pid_error_chamber;
temp_iState_chamber = constrain(temp_iState_chamber, temp_iState_min_chamber, temp_iState_max_chamber);
iTerm_chamber = chamberKi * temp_iState_chamber;
......
<img align="right" src="Documentation/Logo/MarlinKimbra%20Logo%20GitHub.png" />
# MarlinKimbra 3D Printer Firmware for Arduino
## Version 4.2.84 Laser dev
## Version 4.2.85 Laser dev
This is the Laser enhananced version with the patches from Franco (nextime) Lanza.
......@@ -65,6 +65,7 @@ The new features are:
- Added Cooler and Hot Chamber
- Added Laser beam and raster base64
- Added Mesh Bed Level (MBL)
- Added Stop and Save for Restart (SSR)
## Credits
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment