|
@@ -43,8 +43,10 @@
|
|
|
*
|
|
|
*/
|
|
|
|
|
|
+//-//
|
|
|
+#include "Configuration.h"
|
|
|
#include "Marlin.h"
|
|
|
-
|
|
|
+
|
|
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
|
|
#include "vector_3.h"
|
|
|
#ifdef AUTO_BED_LEVELING_GRID
|
|
@@ -354,7 +356,6 @@ unsigned long starttime=0;
|
|
|
unsigned long stoptime=0;
|
|
|
unsigned long _usb_timer = 0;
|
|
|
|
|
|
-
|
|
|
bool extruder_under_pressure = true;
|
|
|
|
|
|
|
|
@@ -410,6 +411,24 @@ void serial_echopair_P(const char *s_P, double v)
|
|
|
void serial_echopair_P(const char *s_P, unsigned long v)
|
|
|
{ serialprintPGM(s_P); SERIAL_ECHO(v); }
|
|
|
|
|
|
+/*FORCE_INLINE*/ void serialprintPGM(const char *str)
|
|
|
+{
|
|
|
+#if 0
|
|
|
+ char ch=pgm_read_byte(str);
|
|
|
+ while(ch)
|
|
|
+ {
|
|
|
+ MYSERIAL.write(ch);
|
|
|
+ ch=pgm_read_byte(++str);
|
|
|
+ }
|
|
|
+#else
|
|
|
+ // hmm, same size as the above version, the compiler did a good job optimizing the above
|
|
|
+ while( uint8_t ch = pgm_read_byte(str) ){
|
|
|
+ MYSERIAL.write((char)ch);
|
|
|
+ ++str;
|
|
|
+ }
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
#ifdef SDSUPPORT
|
|
|
#include "SdFatUtil.h"
|
|
|
int freeMemory() { return SdFatUtil::FreeRam(); }
|
|
@@ -657,19 +676,13 @@ static void factory_reset(char level)
|
|
|
|
|
|
// Level 0: Language reset
|
|
|
case 0:
|
|
|
-if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
- WRITE(BEEPER, HIGH);
|
|
|
- _delay_ms(100);
|
|
|
- WRITE(BEEPER, LOW);
|
|
|
+ Sound_MakeCustom(100,0,false);
|
|
|
lang_reset();
|
|
|
break;
|
|
|
|
|
|
//Level 1: Reset statistics
|
|
|
case 1:
|
|
|
-if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
- WRITE(BEEPER, HIGH);
|
|
|
- _delay_ms(100);
|
|
|
- WRITE(BEEPER, LOW);
|
|
|
+ Sound_MakeCustom(100,0,false);
|
|
|
eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, 0);
|
|
|
eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, 0);
|
|
|
|
|
@@ -724,11 +737,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
fsensor_enable();
|
|
|
fsensor_autoload_set(true);
|
|
|
#endif //FILAMENT_SENSOR
|
|
|
-
|
|
|
-if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
- WRITE(BEEPER, HIGH);
|
|
|
- _delay_ms(100);
|
|
|
- WRITE(BEEPER, LOW);
|
|
|
+ Sound_MakeCustom(100,0,false);
|
|
|
//_delay_ms(2000);
|
|
|
break;
|
|
|
|
|
@@ -738,11 +747,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
lcd_puts_P(PSTR("Factory RESET"));
|
|
|
lcd_puts_at_P(1, 2, PSTR("ERASING all data"));
|
|
|
|
|
|
-if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
- WRITE(BEEPER, HIGH);
|
|
|
- _delay_ms(100);
|
|
|
- WRITE(BEEPER, LOW);
|
|
|
-
|
|
|
+ Sound_MakeCustom(100,0,false);
|
|
|
er_progress = 0;
|
|
|
lcd_puts_at_P(3, 3, PSTR(" "));
|
|
|
lcd_set_cursor(3, 3);
|
|
@@ -788,12 +793,8 @@ int uart_putchar(char c, FILE *)
|
|
|
|
|
|
void lcd_splash()
|
|
|
{
|
|
|
-// lcd_puts_at_P(0, 1, PSTR(" Original Prusa "));
|
|
|
-// lcd_puts_at_P(0, 2, PSTR(" 3D Printers "));
|
|
|
-// lcd_puts_P(PSTR("\x1b[1;3HOriginal Prusa\x1b[2;4H3D Printers"));
|
|
|
-// fputs_P(PSTR(ESC_2J ESC_H(1,1) "Original Prusa i3" ESC_H(3,2) "Prusa Research"), lcdout);
|
|
|
- lcd_puts_P(PSTR(ESC_2J ESC_H(1,1) "Original Prusa i3" ESC_H(3,2) "Prusa Research"));
|
|
|
-// lcd_printf_P(_N(ESC_2J "x:%.3f\ny:%.3f\nz:%.3f\ne:%.3f"), _x, _y, _z, _e);
|
|
|
+ lcd_clear(); // clears display and homes screen
|
|
|
+ lcd_puts_P(PSTR("\n Original Prusa i3\n Prusa Research"));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -812,7 +813,7 @@ void factory_reset()
|
|
|
|
|
|
|
|
|
SET_OUTPUT(BEEPER);
|
|
|
-if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
+ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
WRITE(BEEPER, HIGH);
|
|
|
|
|
|
while (!READ(BTN_ENC));
|
|
@@ -923,7 +924,7 @@ void update_sec_lang_from_external_flash()
|
|
|
uint32_t src_addr;
|
|
|
if (lang_get_header(lang, &header, &src_addr))
|
|
|
{
|
|
|
- fputs_P(PSTR(ESC_H(1,3) "Language update."), lcdout);
|
|
|
+ lcd_puts_at_P(1,3,PSTR("Language update."));
|
|
|
for (uint8_t i = 0; i < state; i++) fputc('.', lcdout);
|
|
|
_delay(100);
|
|
|
boot_reserved = (state + 1) | (lang << 4);
|
|
@@ -997,8 +998,8 @@ void list_sec_lang_from_external_flash()
|
|
|
|
|
|
static void w25x20cl_err_msg()
|
|
|
{
|
|
|
- lcd_puts_P(_n(ESC_2J ESC_H(0,0) "External SPI flash" ESC_H(0,1) "W25X20CL is not res-"
|
|
|
- ESC_H(0,2) "ponding. Language" ESC_H(0,3) "switch unavailable."));
|
|
|
+ lcd_clear();
|
|
|
+ lcd_puts_P(_n("External SPI flash\nW25X20CL is not res-\nponding. Language\nswitch unavailable."));
|
|
|
}
|
|
|
|
|
|
// "Setup" function is called by the Arduino framework on startup.
|
|
@@ -1076,6 +1077,7 @@ void setup()
|
|
|
SERIAL_ECHO_START;
|
|
|
printf_P(PSTR(" " FW_VERSION_FULL "\n"));
|
|
|
|
|
|
+ //SERIAL_ECHOPAIR("Active sheet before:", static_cast<unsigned long int>(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))));
|
|
|
|
|
|
#ifdef DEBUG_SEC_LANG
|
|
|
lang_table_header_t header;
|
|
@@ -1310,6 +1312,9 @@ void setup()
|
|
|
update_mode_profile();
|
|
|
tmc2130_init();
|
|
|
#endif //TMC2130
|
|
|
+#ifdef PSU_Delta
|
|
|
+ init_force_z(); // ! important for correct Z-axis initialization
|
|
|
+#endif // PSU_Delta
|
|
|
|
|
|
setup_photpin();
|
|
|
|
|
@@ -1347,7 +1352,7 @@ void setup()
|
|
|
}
|
|
|
#endif //TMC2130
|
|
|
|
|
|
-#if defined(Z_AXIS_ALWAYS_ON)
|
|
|
+#if defined(Z_AXIS_ALWAYS_ON) && !defined(PSU_Delta)
|
|
|
enable_z();
|
|
|
#endif
|
|
|
farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE);
|
|
@@ -1424,20 +1429,7 @@ void setup()
|
|
|
printf_P(PSTR("Card NG!\n"));
|
|
|
#endif //DEBUG_SD_SPEED_TEST
|
|
|
|
|
|
- if (eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_POWER_COUNT, 0);
|
|
|
- if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_X, 0);
|
|
|
- if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_Y) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_Y, 0);
|
|
|
- if (eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_FERROR_COUNT, 0);
|
|
|
- if (eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_POWER_COUNT_TOT, 0);
|
|
|
- if (eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT, 0);
|
|
|
- if (eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT, 0);
|
|
|
- if (eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, 0);
|
|
|
-
|
|
|
- if (eeprom_read_word((uint16_t*)EEPROM_MMU_FAIL_TOT) == 0xffff) eeprom_update_word((uint16_t *)EEPROM_MMU_FAIL_TOT, 0);
|
|
|
- if (eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT) == 0xffff) eeprom_update_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT, 0);
|
|
|
- if (eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_FAIL, 0);
|
|
|
- if (eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0);
|
|
|
-
|
|
|
+ eeprom_init();
|
|
|
#ifdef SNMM
|
|
|
if (eeprom_read_dword((uint32_t*)EEPROM_BOWDEN_LENGTH) == 0x0ffffffff) { //bowden length used for SNMM
|
|
|
int _z = BOWDEN_LENGTH;
|
|
@@ -1504,7 +1496,6 @@ void setup()
|
|
|
SilentModeMenu_MMU = 1;
|
|
|
eeprom_write_byte((uint8_t*)EEPROM_MMU_STEALTH, SilentModeMenu_MMU);
|
|
|
}
|
|
|
- check_babystep(); //checking if Z babystep is in allowed range
|
|
|
|
|
|
#if !defined(DEBUG_DISABLE_FANCHECK) && defined(FANCHECK) && defined(TACH_1) && TACH_1 >-1
|
|
|
setup_fan_interrupt();
|
|
@@ -1518,8 +1509,10 @@ void setup()
|
|
|
#ifndef DEBUG_DISABLE_STARTMSGS
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
|
|
|
- check_if_fw_is_on_right_printer();
|
|
|
- show_fw_version_warnings();
|
|
|
+ if (!farm_mode) {
|
|
|
+ check_if_fw_is_on_right_printer();
|
|
|
+ show_fw_version_warnings();
|
|
|
+ }
|
|
|
|
|
|
switch (hw_changed) {
|
|
|
//if motherboard or printer type was changed inform user as it can indicate flashing wrong firmware version
|
|
@@ -1646,11 +1639,11 @@ void setup()
|
|
|
}
|
|
|
#endif //UVLO_SUPPORT
|
|
|
fCheckModeInit();
|
|
|
+ fSetMmuMode(mmu_enabled);
|
|
|
KEEPALIVE_STATE(NOT_BUSY);
|
|
|
#ifdef WATCHDOG
|
|
|
wdt_enable(WDTO_4S);
|
|
|
#endif //WATCHDOG
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2359,11 +2352,7 @@ void refresh_cmd_timeout(void)
|
|
|
#endif //FWRETRACT
|
|
|
|
|
|
void trace() {
|
|
|
-//if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
- _tone(BEEPER, 440);
|
|
|
- _delay(25);
|
|
|
- _noTone(BEEPER);
|
|
|
- _delay(20);
|
|
|
+ Sound_MakeCustom(25,440,true);
|
|
|
}
|
|
|
/*
|
|
|
void ramming() {
|
|
@@ -3206,9 +3195,7 @@ void gcode_M701()
|
|
|
load_filament_final_feed(); //slow sequence
|
|
|
st_synchronize();
|
|
|
|
|
|
- if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) _tone(BEEPER, 500);
|
|
|
- delay_keep_alive(50);
|
|
|
- _noTone(BEEPER);
|
|
|
+ Sound_MakeCustom(50,500,false);
|
|
|
|
|
|
if (!farm_mode && loading_flag) {
|
|
|
lcd_load_filament_color_check();
|
|
@@ -3289,14 +3276,19 @@ extern uint8_t st_backlash_x;
|
|
|
extern uint8_t st_backlash_y;
|
|
|
#endif //BACKLASH_Y
|
|
|
|
|
|
+//! \ingroup marlin_main
|
|
|
+
|
|
|
//! @brief Parse and process commands
|
|
|
//!
|
|
|
//! look here for descriptions of G-codes: http://linuxcnc.org/handbook/gcode/g-code.html
|
|
|
//! http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
|
|
|
//!
|
|
|
-//! Implemented Codes
|
|
|
+//!
|
|
|
+//! Implemented Codes
|
|
|
//! -------------------
|
|
|
//!
|
|
|
+//! * _This list is not updated. Current documentation is maintained inside the process_cmd function._
|
|
|
+//!
|
|
|
//!@n PRUSA CODES
|
|
|
//!@n P F - Returns FW versions
|
|
|
//!@n P R - Returns revision of printer
|
|
@@ -3419,14 +3411,30 @@ extern uint8_t st_backlash_y;
|
|
|
//!
|
|
|
//!@n M928 - Start SD logging (M928 filename.g) - ended by M29
|
|
|
//!@n M999 - Restart after being stopped by error
|
|
|
+//! <br><br>
|
|
|
+
|
|
|
+/** @defgroup marlin_main Marlin main */
|
|
|
+
|
|
|
+/** \ingroup GCodes */
|
|
|
+
|
|
|
+//! _This is a list of currently implemented G Codes in Prusa firmware (dynamically generated from doxygen)_
|
|
|
+
|
|
|
+
|
|
|
void process_commands()
|
|
|
{
|
|
|
#ifdef FANCHECK
|
|
|
if (fan_check_error){
|
|
|
if( fan_check_error == EFCE_DETECTED ){
|
|
|
fan_check_error = EFCE_REPORTED;
|
|
|
- lcd_pause_print();
|
|
|
- } // otherwise it has already been reported, so just ignore further processing
|
|
|
+
|
|
|
+ if(is_usb_printing){
|
|
|
+ SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ lcd_pause_print();
|
|
|
+ }
|
|
|
+
|
|
|
+ } // otherwise it has already been reported, so just ignore further processing
|
|
|
return;
|
|
|
}
|
|
|
#endif
|
|
@@ -3470,21 +3478,33 @@ void process_commands()
|
|
|
#ifdef TMC2130
|
|
|
else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("CRASH_"), 6) == 0)
|
|
|
{
|
|
|
- if(code_seen("CRASH_DETECTED")) //! CRASH_DETECTED
|
|
|
+
|
|
|
+ //! ### CRASH_DETECTED - TMC2130
|
|
|
+ // ---------------------------------
|
|
|
+ if(code_seen("CRASH_DETECTED"))
|
|
|
{
|
|
|
uint8_t mask = 0;
|
|
|
if (code_seen('X')) mask |= X_AXIS_MASK;
|
|
|
if (code_seen('Y')) mask |= Y_AXIS_MASK;
|
|
|
crashdet_detected(mask);
|
|
|
}
|
|
|
- else if(code_seen("CRASH_RECOVER")) //! CRASH_RECOVER
|
|
|
+
|
|
|
+ //! ### CRASH_RECOVER - TMC2130
|
|
|
+ // ----------------------------------
|
|
|
+ else if(code_seen("CRASH_RECOVER"))
|
|
|
crashdet_recover();
|
|
|
- else if(code_seen("CRASH_CANCEL")) //! CRASH_CANCEL
|
|
|
+
|
|
|
+ //! ### CRASH_CANCEL - TMC2130
|
|
|
+ // ----------------------------------
|
|
|
+ else if(code_seen("CRASH_CANCEL"))
|
|
|
crashdet_cancel();
|
|
|
}
|
|
|
else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("TMC_"), 4) == 0)
|
|
|
{
|
|
|
- if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_WAVE_"), 9) == 0) //! TMC_SET_WAVE_
|
|
|
+
|
|
|
+ //! ### TMC_SET_WAVE_
|
|
|
+ // --------------------
|
|
|
+ if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_WAVE_"), 9) == 0)
|
|
|
{
|
|
|
uint8_t axis = *(CMDBUFFER_CURRENT_STRING + 13);
|
|
|
axis = (axis == 'E')?3:(axis - 'X');
|
|
@@ -3494,7 +3514,10 @@ void process_commands()
|
|
|
tmc2130_set_wave(axis, 247, fac);
|
|
|
}
|
|
|
}
|
|
|
- else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_STEP_"), 9) == 0) //! TMC_SET_STEP_
|
|
|
+
|
|
|
+ //! ### TMC_SET_STEP_
|
|
|
+ // ------------------
|
|
|
+ else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_STEP_"), 9) == 0)
|
|
|
{
|
|
|
uint8_t axis = *(CMDBUFFER_CURRENT_STRING + 13);
|
|
|
axis = (axis == 'E')?3:(axis - 'X');
|
|
@@ -3505,7 +3528,10 @@ void process_commands()
|
|
|
tmc2130_goto_step(axis, step & (4*res - 1), 2, 1000, res);
|
|
|
}
|
|
|
}
|
|
|
- else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_CHOP_"), 9) == 0) //! TMC_SET_CHOP_
|
|
|
+
|
|
|
+ //! ### TMC_SET_CHOP_
|
|
|
+ // -------------------
|
|
|
+ else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_CHOP_"), 9) == 0)
|
|
|
{
|
|
|
uint8_t axis = *(CMDBUFFER_CURRENT_STRING + 13);
|
|
|
axis = (axis == 'E')?3:(axis - 'X');
|
|
@@ -3556,19 +3582,52 @@ void process_commands()
|
|
|
}
|
|
|
#endif //BACKLASH_Y
|
|
|
#endif //TMC2130
|
|
|
- else if(code_seen("PRUSA")){
|
|
|
- if (code_seen("Ping")) { //! PRUSA Ping
|
|
|
+ else if(code_seen("PRUSA")){
|
|
|
+ /*!
|
|
|
+ *
|
|
|
+ ### PRUSA - Internal command set
|
|
|
+
|
|
|
+ Set of internal PRUSA commands
|
|
|
+
|
|
|
+ PRUSA [ Ping | PRN | FAN | fn | thx | uvlo | fsensor_recover | MMURES | RESET | fv | M28 | SN | Fir | Rev | Lang | Lz | Beat | FR ]
|
|
|
+
|
|
|
+ - `Ping`
|
|
|
+ - `PRN` - Prints revision of the printer
|
|
|
+ - `FAN` - Prints fan details
|
|
|
+ - `fn` - Prints farm no.
|
|
|
+ - `thx`
|
|
|
+ - `uvlo`
|
|
|
+ - `fsensor_recover` - Filament sensor recover - restore print and continue
|
|
|
+ - `MMURES` - Reset MMU
|
|
|
+ - `RESET` - (Careful!)
|
|
|
+ - `fv` - ?
|
|
|
+ - `M28`
|
|
|
+ - `SN`
|
|
|
+ - `Fir` - Prints firmware version
|
|
|
+ - `Rev`- Prints filament size, elelectronics, nozzle type
|
|
|
+ - `Lang` - Reset the language
|
|
|
+ - `Lz`
|
|
|
+ - `Beat` - Kick farm link timer
|
|
|
+ - `FR` - Full factory reset
|
|
|
+ - `nozzle set <diameter>` - set nozzle diameter (farm mode only), e.g. `PRUSA nozzle set 0.4`
|
|
|
+ - `nozzle D<diameter>` - check the nozzle diameter (farm mode only), works like M862.1 P, e.g. `PRUSA nozzle D0.4`
|
|
|
+ - `nozzle` - prints nozzle diameter (farm mode only), works like M862.1 P, e.g. `PRUSA nozzle`
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+ if (code_seen("Ping")) { // PRUSA Ping
|
|
|
if (farm_mode) {
|
|
|
PingTime = _millis();
|
|
|
//MYSERIAL.print(farm_no); MYSERIAL.println(": OK");
|
|
|
}
|
|
|
}
|
|
|
- else if (code_seen("PRN")) { //! PRUSA PRN
|
|
|
+ else if (code_seen("PRN")) { // PRUSA PRN
|
|
|
printf_P(_N("%d"), status_number);
|
|
|
|
|
|
- }else if (code_seen("FAN")) { //! PRUSA FAN
|
|
|
+ }else if (code_seen("FAN")) { // PRUSA FAN
|
|
|
printf_P(_N("E0:%d RPM\nPRN0:%d RPM\n"), 60*fan_speed[0], 60*fan_speed[1]);
|
|
|
- }else if (code_seen("fn")) { //! PRUSA fn
|
|
|
+ }else if (code_seen("fn")) { // PRUSA fn
|
|
|
if (farm_mode) {
|
|
|
printf_P(_N("%d"), farm_no);
|
|
|
}
|
|
@@ -3577,26 +3636,26 @@ void process_commands()
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- else if (code_seen("thx")) //! PRUSA thx
|
|
|
+ else if (code_seen("thx")) // PRUSA thx
|
|
|
{
|
|
|
no_response = false;
|
|
|
}
|
|
|
- else if (code_seen("uvlo")) //! PRUSA uvlo
|
|
|
+ else if (code_seen("uvlo")) // PRUSA uvlo
|
|
|
{
|
|
|
eeprom_update_byte((uint8_t*)EEPROM_UVLO,0);
|
|
|
enquecommand_P(PSTR("M24"));
|
|
|
}
|
|
|
#ifdef FILAMENT_SENSOR
|
|
|
- else if (code_seen("fsensor_recover")) //! PRUSA fsensor_recover
|
|
|
+ else if (code_seen("fsensor_recover")) // PRUSA fsensor_recover
|
|
|
{
|
|
|
fsensor_restore_print_and_continue();
|
|
|
}
|
|
|
#endif //FILAMENT_SENSOR
|
|
|
- else if (code_seen("MMURES")) //! PRUSA MMURES
|
|
|
+ else if (code_seen("MMURES")) // PRUSA MMURES
|
|
|
{
|
|
|
mmu_reset();
|
|
|
}
|
|
|
- else if (code_seen("RESET")) { //! PRUSA RESET
|
|
|
+ else if (code_seen("RESET")) { // PRUSA RESET
|
|
|
// careful!
|
|
|
if (farm_mode) {
|
|
|
#if (defined(WATCHDOG) && (MOTHERBOARD == BOARD_EINSY_1_0a))
|
|
@@ -3612,7 +3671,7 @@ void process_commands()
|
|
|
else {
|
|
|
MYSERIAL.println("Not in farm mode.");
|
|
|
}
|
|
|
- }else if (code_seen("fv")) { //! PRUSA fv
|
|
|
+ }else if (code_seen("fv")) { // PRUSA fv
|
|
|
// get file version
|
|
|
#ifdef SDSUPPORT
|
|
|
card.openFile(strchr_pointer + 3,true);
|
|
@@ -3627,39 +3686,39 @@ void process_commands()
|
|
|
|
|
|
#endif // SDSUPPORT
|
|
|
|
|
|
- } else if (code_seen("M28")) { //! PRUSA M28
|
|
|
+ } else if (code_seen("M28")) { // PRUSA M28
|
|
|
trace();
|
|
|
prusa_sd_card_upload = true;
|
|
|
card.openFile(strchr_pointer+4,false);
|
|
|
|
|
|
- } else if (code_seen("SN")) { //! PRUSA SN
|
|
|
+ } else if (code_seen("SN")) { // PRUSA SN
|
|
|
gcode_PRUSA_SN();
|
|
|
|
|
|
- } else if(code_seen("Fir")){ //! PRUSA Fir
|
|
|
+ } else if(code_seen("Fir")){ // PRUSA Fir
|
|
|
|
|
|
SERIAL_PROTOCOLLN(FW_VERSION_FULL);
|
|
|
|
|
|
- } else if(code_seen("Rev")){ //! PRUSA Rev
|
|
|
+ } else if(code_seen("Rev")){ // PRUSA Rev
|
|
|
|
|
|
SERIAL_PROTOCOLLN(FILAMENT_SIZE "-" ELECTRONICS "-" NOZZLE_TYPE );
|
|
|
|
|
|
- } else if(code_seen("Lang")) { //! PRUSA Lang
|
|
|
+ } else if(code_seen("Lang")) { // PRUSA Lang
|
|
|
lang_reset();
|
|
|
|
|
|
- } else if(code_seen("Lz")) { //! PRUSA Lz
|
|
|
+ } else if(code_seen("Lz")) { // PRUSA Lz
|
|
|
EEPROM_save_B(EEPROM_BABYSTEP_Z,0);
|
|
|
|
|
|
- } else if(code_seen("Beat")) { //! PRUSA Beat
|
|
|
+ } else if(code_seen("Beat")) { // PRUSA Beat
|
|
|
// Kick farm link timer
|
|
|
kicktime = _millis();
|
|
|
|
|
|
- } else if(code_seen("FR")) { //! PRUSA FR
|
|
|
+ } else if(code_seen("FR")) { // PRUSA FR
|
|
|
// Factory full reset
|
|
|
factory_reset(0);
|
|
|
|
|
|
//-//
|
|
|
/*
|
|
|
- } else if(code_seen("qqq")) {
|
|
|
+ } else if(code_seen("rrr")) {
|
|
|
MYSERIAL.println("=== checking ===");
|
|
|
MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_CHECK_MODE),DEC);
|
|
|
MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER),DEC);
|
|
@@ -3672,7 +3731,7 @@ eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,0xFF);
|
|
|
eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,0xFF);
|
|
|
eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,0xFFFF);
|
|
|
*/
|
|
|
- } else if (code_seen("nozzle")) { //! PRUSA nozzle
|
|
|
+ } else if (code_seen("nozzle")) { // PRUSA nozzle
|
|
|
uint16_t nDiameter;
|
|
|
if(code_seen('D'))
|
|
|
{
|
|
@@ -3681,13 +3740,47 @@ eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,0xFFFF);
|
|
|
}
|
|
|
else if(code_seen("set") && farm_mode)
|
|
|
{
|
|
|
+ strchr_pointer++; // skip 1st char (~ 's')
|
|
|
strchr_pointer++; // skip 2nd char (~ 'e')
|
|
|
- strchr_pointer++; // skip 3rd char (~ 't')
|
|
|
nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um]
|
|
|
- eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)e_NOZZLE_DIAMETER_NULL); // for correct synchronization after farm-mode exiting
|
|
|
+ eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)ClNozzleDiameter::_Diameter_Undef); // for correct synchronization after farm-mode exiting
|
|
|
eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter);
|
|
|
}
|
|
|
else SERIAL_PROTOCOLLN((float)eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)/1000.0);
|
|
|
+
|
|
|
+//-// !!! SupportMenu
|
|
|
+/*
|
|
|
+// musi byt PRED "PRUSA model"
|
|
|
+ } else if (code_seen("smodel")) { //! PRUSA smodel
|
|
|
+ size_t nOffset;
|
|
|
+// ! -> "l"
|
|
|
+ strchr_pointer+=5*sizeof(*strchr_pointer); // skip 1st - 5th char (~ 'smode')
|
|
|
+ nOffset=strspn(strchr_pointer+1," \t\n\r\v\f");
|
|
|
+ if(*(strchr_pointer+1+nOffset))
|
|
|
+ printer_smodel_check(strchr_pointer);
|
|
|
+ else SERIAL_PROTOCOLLN(PRINTER_NAME);
|
|
|
+ } else if (code_seen("model")) { //! PRUSA model
|
|
|
+ uint16_t nPrinterModel;
|
|
|
+ strchr_pointer+=4*sizeof(*strchr_pointer); // skip 1st - 4th char (~ 'mode')
|
|
|
+ nPrinterModel=(uint16_t)code_value_long();
|
|
|
+ if(nPrinterModel!=0)
|
|
|
+ printer_model_check(nPrinterModel);
|
|
|
+ else SERIAL_PROTOCOLLN(PRINTER_TYPE);
|
|
|
+ } else if (code_seen("version")) { //! PRUSA version
|
|
|
+ strchr_pointer+=7*sizeof(*strchr_pointer); // skip 1st - 7th char (~ 'version')
|
|
|
+ while(*strchr_pointer==' ') // skip leading spaces
|
|
|
+ strchr_pointer++;
|
|
|
+ if(*strchr_pointer!=0)
|
|
|
+ fw_version_check(strchr_pointer);
|
|
|
+ else SERIAL_PROTOCOLLN(FW_VERSION);
|
|
|
+ } else if (code_seen("gcode")) { //! PRUSA gcode
|
|
|
+ uint16_t nGcodeLevel;
|
|
|
+ strchr_pointer+=4*sizeof(*strchr_pointer); // skip 1st - 4th char (~ 'gcod')
|
|
|
+ nGcodeLevel=(uint16_t)code_value_long();
|
|
|
+ if(nGcodeLevel!=0)
|
|
|
+ gcode_level_check(nGcodeLevel);
|
|
|
+ else SERIAL_PROTOCOLLN(GCODE_LEVEL);
|
|
|
+*/
|
|
|
}
|
|
|
//else if (code_seen('Cal')) {
|
|
|
// lcd_calibration();
|
|
@@ -3702,6 +3795,9 @@ eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,0xFFFF);
|
|
|
// printf_P(_N("BEGIN G-CODE=%u\n"), gcode_in_progress);
|
|
|
switch (gcode_in_progress)
|
|
|
{
|
|
|
+
|
|
|
+ //! ### G0, G1 - Coordinated movement X Y Z E
|
|
|
+ // --------------------------------------
|
|
|
case 0: // G0 -> G1
|
|
|
case 1: // G1
|
|
|
if(Stopped == false) {
|
|
@@ -3773,7 +3869,7 @@ eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,0xFFFF);
|
|
|
|
|
|
SET_OUTPUT(BEEPER);
|
|
|
if (counterBeep== 0){
|
|
|
-if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
+if(eSoundMode!=e_SOUND_MODE_SILENT)
|
|
|
WRITE(BEEPER,HIGH);
|
|
|
}
|
|
|
|
|
@@ -3899,19 +3995,30 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
//ClearToSend();
|
|
|
}
|
|
|
break;
|
|
|
- case 2: // G2 - CW ARC
|
|
|
+
|
|
|
+ //! ### G2 - CW ARC
|
|
|
+ // ------------------------------
|
|
|
+ case 2:
|
|
|
if(Stopped == false) {
|
|
|
get_arc_coordinates();
|
|
|
prepare_arc_move(true);
|
|
|
}
|
|
|
break;
|
|
|
- case 3: // G3 - CCW ARC
|
|
|
+
|
|
|
+
|
|
|
+ //! ### G3 - CCW ARC
|
|
|
+ // -------------------------------
|
|
|
+ case 3:
|
|
|
if(Stopped == false) {
|
|
|
get_arc_coordinates();
|
|
|
prepare_arc_move(false);
|
|
|
}
|
|
|
break;
|
|
|
- case 4: // G4 dwell
|
|
|
+
|
|
|
+
|
|
|
+ //! ### G4 - Dwell
|
|
|
+ // -------------------------------
|
|
|
+ case 4:
|
|
|
codenum = 0;
|
|
|
if(code_seen('P')) codenum = code_value(); // milliseconds to wait
|
|
|
if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
|
|
@@ -3926,7 +4033,11 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
#ifdef FWRETRACT
|
|
|
- case 10: // G10 retract
|
|
|
+
|
|
|
+
|
|
|
+ //! ### G10 Retract
|
|
|
+ // ------------------------------
|
|
|
+ case 10:
|
|
|
#if EXTRUDERS > 1
|
|
|
retracted_swap[active_extruder]=(code_seen('S') && code_value_long() == 1); // checks for swap retract argument
|
|
|
retract(true,retracted_swap[active_extruder]);
|
|
@@ -3934,7 +4045,11 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
retract(true);
|
|
|
#endif
|
|
|
break;
|
|
|
- case 11: // G11 retract_recover
|
|
|
+
|
|
|
+
|
|
|
+ //! ### G11 - Retract recover
|
|
|
+ // -----------------------------
|
|
|
+ case 11:
|
|
|
#if EXTRUDERS > 1
|
|
|
retract(false,retracted_swap[active_extruder]);
|
|
|
#else
|
|
@@ -3942,7 +4057,11 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
#endif
|
|
|
break;
|
|
|
#endif //FWRETRACT
|
|
|
- case 28: //G28 Home all Axis one at a time
|
|
|
+
|
|
|
+
|
|
|
+ //! ### G28 - Home all Axis one at a time
|
|
|
+ // --------------------------------------------
|
|
|
+ case 28:
|
|
|
{
|
|
|
long home_x_value = 0;
|
|
|
long home_y_value = 0;
|
|
@@ -3969,8 +4088,13 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
+
|
|
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
|
|
- case 29: // G29 Detailed Z-Probe, probes the bed at 3 or more points.
|
|
|
+
|
|
|
+
|
|
|
+ //! ### G29 - Detailed Z-Probe
|
|
|
+ // --------------------------------
|
|
|
+ case 29:
|
|
|
{
|
|
|
#if Z_MIN_PIN == -1
|
|
|
#error "You must have a Z_MIN endstop in order to enable Auto Bed Leveling feature! Z_MIN_PIN must point to a valid hardware pin."
|
|
@@ -4113,7 +4237,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
#ifndef Z_PROBE_SLED
|
|
|
- case 30: // G30 Single Z Probe
|
|
|
+
|
|
|
+ //! ### G30 - Single Z Probe
|
|
|
+ // ------------------------------------
|
|
|
+ case 30:
|
|
|
{
|
|
|
st_synchronize();
|
|
|
// TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly
|
|
@@ -4135,17 +4262,27 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
#else
|
|
|
- case 31: // dock the sled
|
|
|
+
|
|
|
+ //! ### G31 - Dock the sled
|
|
|
+ // ---------------------------
|
|
|
+ case 31:
|
|
|
dock_sled(true);
|
|
|
break;
|
|
|
- case 32: // undock the sled
|
|
|
+
|
|
|
+
|
|
|
+ //! ### G32 - Undock the sled
|
|
|
+ // ----------------------------
|
|
|
+ case 32:
|
|
|
dock_sled(false);
|
|
|
break;
|
|
|
#endif // Z_PROBE_SLED
|
|
|
#endif // ENABLE_AUTO_BED_LEVELING
|
|
|
|
|
|
#ifdef MESH_BED_LEVELING
|
|
|
- case 30: // G30 Single Z Probe
|
|
|
+
|
|
|
+ //! ### G30 - Single Z Probe
|
|
|
+ // ----------------------------
|
|
|
+ case 30:
|
|
|
{
|
|
|
st_synchronize();
|
|
|
// TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly
|
|
@@ -4161,7 +4298,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
-
|
|
|
+ //! ### G75 - Print temperature interpolation
|
|
|
+ // ---------------------------------------------
|
|
|
case 75:
|
|
|
{
|
|
|
for (int i = 40; i <= 110; i++)
|
|
@@ -4169,7 +4307,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 76: //! G76 - PINDA probe temperature calibration
|
|
|
+ //! ### G76 - PINDA probe temperature calibration
|
|
|
+ // ------------------------------------------------
|
|
|
+ case 76:
|
|
|
{
|
|
|
#ifdef PINDA_THERMISTOR
|
|
|
if (true)
|
|
@@ -4426,18 +4566,16 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
break;
|
|
|
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * G80: Mesh-based Z probe, probes a grid and produces a
|
|
|
- * mesh to compensate for variable bed height
|
|
|
- *
|
|
|
+ //! ### G80 - Mesh-based Z probe
|
|
|
+ // -----------------------------------
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Probes a grid and produces a mesh to compensate for variable bed height
|
|
|
* The S0 report the points as below
|
|
|
- * @code{.unparsed}
|
|
|
* +----> X-axis
|
|
|
* |
|
|
|
* |
|
|
|
* v Y-axis
|
|
|
- * @endcode
|
|
|
*/
|
|
|
|
|
|
case 80:
|
|
@@ -4861,8 +4999,11 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- /**
|
|
|
- * G81: Print mesh bed leveling status and bed profile if activated
|
|
|
+ //! ### G81 - Mesh bed leveling status
|
|
|
+ // -----------------------------------------
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Prints mesh bed leveling status and bed profile if activated
|
|
|
*/
|
|
|
case 81:
|
|
|
if (mbl.active) {
|
|
@@ -4886,7 +5027,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
break;
|
|
|
|
|
|
#if 0
|
|
|
- /**
|
|
|
+ /*
|
|
|
* G82: Single Z probe at current location
|
|
|
*
|
|
|
* WARNING! USE WITH CAUTION! If you'll try to probe where is no leveling pad, nasty things can happen!
|
|
@@ -4902,7 +5043,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
SERIAL_PROTOCOLPGM("\n");
|
|
|
break;
|
|
|
|
|
|
- /**
|
|
|
+ /*
|
|
|
* G83: Prusa3D specific: Babystep in Z and store to EEPROM
|
|
|
*/
|
|
|
case 83:
|
|
@@ -4927,7 +5068,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
|
|
|
}
|
|
|
break;
|
|
|
- /**
|
|
|
+ /*
|
|
|
* G84: Prusa3D specific: UNDO Babystep Z (move Z axis back)
|
|
|
*/
|
|
|
case 84:
|
|
@@ -4935,7 +5076,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
// babystepLoadZ = 0;
|
|
|
break;
|
|
|
|
|
|
- /**
|
|
|
+ /*
|
|
|
* G85: Prusa3D specific: Pick best babystep
|
|
|
*/
|
|
|
case 85:
|
|
@@ -4943,38 +5084,58 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
break;
|
|
|
#endif
|
|
|
|
|
|
- /**
|
|
|
- * G86: Prusa3D specific: Disable babystep correction after home.
|
|
|
- * This G-code will be performed at the start of a calibration script.
|
|
|
- */
|
|
|
+ /**
|
|
|
+ * ### G86 - Disable babystep correction after home
|
|
|
+ *
|
|
|
+ * This G-code will be performed at the start of a calibration script.
|
|
|
+ * (Prusa3D specific)
|
|
|
+ */
|
|
|
case 86:
|
|
|
calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
|
|
|
break;
|
|
|
- /**
|
|
|
- * G87: Prusa3D specific: Enable babystep correction after home
|
|
|
- * This G-code will be performed at the end of a calibration script.
|
|
|
- */
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * ### G87 - Enable babystep correction after home
|
|
|
+ *
|
|
|
+ *
|
|
|
+ * This G-code will be performed at the end of a calibration script.
|
|
|
+ * (Prusa3D specific)
|
|
|
+ */
|
|
|
case 87:
|
|
|
calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
|
|
break;
|
|
|
|
|
|
- /**
|
|
|
- * G88: Prusa3D specific: Don't know what it is for, it is in V2Calibration.gcode
|
|
|
- */
|
|
|
+
|
|
|
+ /**
|
|
|
+ * ### G88 - Reserved
|
|
|
+ *
|
|
|
+ * Currently has no effect.
|
|
|
+ */
|
|
|
+
|
|
|
+ // Prusa3D specific: Don't know what it is for, it is in V2Calibration.gcode
|
|
|
+
|
|
|
case 88:
|
|
|
break;
|
|
|
|
|
|
|
|
|
#endif // ENABLE_MESH_BED_LEVELING
|
|
|
|
|
|
-
|
|
|
- case 90: // G90
|
|
|
+ //! ### G90 - Switch off relative mode
|
|
|
+ // -------------------------------
|
|
|
+ case 90:
|
|
|
relative_mode = false;
|
|
|
break;
|
|
|
- case 91: // G91
|
|
|
+
|
|
|
+ //! ### G91 - Switch on relative mode
|
|
|
+ // -------------------------------
|
|
|
+ case 91:
|
|
|
relative_mode = true;
|
|
|
break;
|
|
|
- case 92: // G92
|
|
|
+
|
|
|
+ //! ### G92 - Set position
|
|
|
+ // -----------------------------
|
|
|
+ case 92:
|
|
|
if(!code_seen(axis_codes[E_AXIS]))
|
|
|
st_synchronize();
|
|
|
for(int8_t i=0; i < NUM_AXIS; i++) {
|
|
@@ -4991,7 +5152,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 98: //! G98 (activate farm mode)
|
|
|
+
|
|
|
+ //! ### G98 - Activate farm mode
|
|
|
+ // -----------------------------------
|
|
|
+ case 98:
|
|
|
farm_mode = 1;
|
|
|
PingTime = _millis();
|
|
|
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
|
|
@@ -5001,7 +5165,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
fCheckModeInit(); // alternatively invoke printer reset
|
|
|
break;
|
|
|
|
|
|
- case 99: //! G99 (deactivate farm mode)
|
|
|
+ //! ### G99 - Deactivate farm mode
|
|
|
+ // -------------------------------------
|
|
|
+ case 99:
|
|
|
farm_mode = 0;
|
|
|
lcd_printer_connected();
|
|
|
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
|
|
@@ -5015,6 +5181,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
gcode_in_progress = 0;
|
|
|
} // end if(code_seen('G'))
|
|
|
|
|
|
+
|
|
|
+ //! ---------------------------------------------------------------------------------
|
|
|
+
|
|
|
else if(code_seen('M'))
|
|
|
{
|
|
|
|
|
@@ -5033,6 +5202,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
switch(mcode_in_progress)
|
|
|
{
|
|
|
|
|
|
+ //! ### M0, M1 - Stop the printer
|
|
|
+ // ---------------------------------------------------------------
|
|
|
case 0: // M0 - Unconditional stop - Wait for user button press on LCD
|
|
|
case 1: // M1 - Conditional stop - Wait for user button press on LCD
|
|
|
{
|
|
@@ -5080,6 +5251,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
LCD_MESSAGERPGM(_T(WELCOME_MSG));
|
|
|
}
|
|
|
break;
|
|
|
+
|
|
|
+ //! ### M17 - Enable axes
|
|
|
+ // ---------------------------------
|
|
|
case 17:
|
|
|
LCD_MESSAGERPGM(_i("No move."));////MSG_NO_MOVE
|
|
|
enable_x();
|
|
@@ -5091,44 +5265,68 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
break;
|
|
|
|
|
|
#ifdef SDSUPPORT
|
|
|
- case 20: // M20 - list SD card
|
|
|
+
|
|
|
+ //! ### M20 - SD Card file list
|
|
|
+ // -----------------------------------
|
|
|
+ case 20:
|
|
|
SERIAL_PROTOCOLLNRPGM(_N("Begin file list"));////MSG_BEGIN_FILE_LIST
|
|
|
card.ls();
|
|
|
SERIAL_PROTOCOLLNRPGM(_N("End file list"));////MSG_END_FILE_LIST
|
|
|
break;
|
|
|
- case 21: // M21 - init SD card
|
|
|
|
|
|
+ //! ### M21 - Init SD card
|
|
|
+ // ------------------------------------
|
|
|
+ case 21:
|
|
|
card.initsd();
|
|
|
-
|
|
|
break;
|
|
|
- case 22: //M22 - release SD card
|
|
|
- card.release();
|
|
|
|
|
|
+ //! ### M22 - Release SD card
|
|
|
+ // -----------------------------------
|
|
|
+ case 22:
|
|
|
+ card.release();
|
|
|
break;
|
|
|
- case 23: //M23 - Select file
|
|
|
+
|
|
|
+ //! ### M23 - Select file
|
|
|
+ // -----------------------------------
|
|
|
+ case 23:
|
|
|
starpos = (strchr(strchr_pointer + 4,'*'));
|
|
|
if(starpos!=NULL)
|
|
|
*(starpos)='\0';
|
|
|
card.openFile(strchr_pointer + 4,true);
|
|
|
break;
|
|
|
- case 24: //M24 - Start SD print
|
|
|
+
|
|
|
+ //! ### M24 - Start SD print
|
|
|
+ // ----------------------------------
|
|
|
+ case 24:
|
|
|
if (!card.paused)
|
|
|
failstats_reset_print();
|
|
|
card.startFileprint();
|
|
|
starttime=_millis();
|
|
|
break;
|
|
|
- case 25: //M25 - Pause SD print
|
|
|
+
|
|
|
+ //! ### M25 - Pause SD print
|
|
|
+ // ----------------------------------
|
|
|
+ case 25:
|
|
|
card.pauseSDPrint();
|
|
|
break;
|
|
|
- case 26: //M26 - Set SD index
|
|
|
+
|
|
|
+ //! ### M26 - Set SD index
|
|
|
+ // ----------------------------------
|
|
|
+ case 26:
|
|
|
if(card.cardOK && code_seen('S')) {
|
|
|
card.setIndex(code_value_long());
|
|
|
}
|
|
|
break;
|
|
|
- case 27: //M27 - Get SD status
|
|
|
+
|
|
|
+ //! ### M27 - Get SD status
|
|
|
+ // ----------------------------------
|
|
|
+ case 27:
|
|
|
card.getStatus();
|
|
|
break;
|
|
|
- case 28: //M28 - Start SD write
|
|
|
+
|
|
|
+ //! ### M28 - Start SD write
|
|
|
+ // ---------------------------------
|
|
|
+ case 28:
|
|
|
starpos = (strchr(strchr_pointer + 4,'*'));
|
|
|
if(starpos != NULL){
|
|
|
char* npos = strchr(CMDBUFFER_CURRENT_STRING, 'N');
|
|
@@ -5137,11 +5335,18 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
card.openFile(strchr_pointer+4,false);
|
|
|
break;
|
|
|
- case 29: //M29 - Stop SD write
|
|
|
+
|
|
|
+ //! ### M29 - Stop SD write
|
|
|
+ // -------------------------------------
|
|
|
+ //! Currently has no effect.
|
|
|
+ case 29:
|
|
|
//processed in write to file routine above
|
|
|
//card,saving = false;
|
|
|
break;
|
|
|
- case 30: //M30 <filename> Delete File
|
|
|
+
|
|
|
+ //! ### M30 - Delete file <filename>
|
|
|
+ // ----------------------------------
|
|
|
+ case 30:
|
|
|
if (card.cardOK){
|
|
|
card.closefile();
|
|
|
starpos = (strchr(strchr_pointer + 4,'*'));
|
|
@@ -5153,7 +5358,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
card.removeFile(strchr_pointer + 4);
|
|
|
}
|
|
|
break;
|
|
|
- case 32: //M32 - Select file and start SD print
|
|
|
+
|
|
|
+ //! ### M32 - Select file and start SD print
|
|
|
+ // ------------------------------------
|
|
|
+ case 32:
|
|
|
{
|
|
|
if(card.sdprinting) {
|
|
|
st_synchronize();
|
|
@@ -5188,7 +5396,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
starttime=_millis(); //procedure calls count as normal print time.
|
|
|
}
|
|
|
} break;
|
|
|
- case 928: //M928 - Start SD write
|
|
|
+
|
|
|
+ //! ### M982 - Start SD write
|
|
|
+ // ---------------------------------
|
|
|
+ case 928:
|
|
|
starpos = (strchr(strchr_pointer + 5,'*'));
|
|
|
if(starpos != NULL){
|
|
|
char* npos = strchr(CMDBUFFER_CURRENT_STRING, 'N');
|
|
@@ -5200,6 +5411,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
|
|
|
#endif //SDSUPPORT
|
|
|
|
|
|
+ //! ### M31 - Report current print time
|
|
|
+ // --------------------------------------------------
|
|
|
case 31: //M31 take time since the start of the SD print or an M109 command
|
|
|
{
|
|
|
stoptime=_millis();
|
|
@@ -5215,7 +5428,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
autotempShutdown();
|
|
|
}
|
|
|
break;
|
|
|
- case 42: //M42 -Change pin status via gcode
|
|
|
+
|
|
|
+ //! ### M42 - Set pin state
|
|
|
+ // -----------------------------
|
|
|
+ case 42:
|
|
|
if (code_seen('S'))
|
|
|
{
|
|
|
int pin_status = code_value();
|
|
@@ -5242,7 +5458,11 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
- case 44: //! M44: Prusa3D: Reset the bed skew and offset calibration.
|
|
|
+
|
|
|
+
|
|
|
+ //! ### M44 - Reset the bed skew and offset calibration (Prusa specific)
|
|
|
+ // --------------------------------------------------------------------
|
|
|
+ case 44: // M44: Prusa3D: Reset the bed skew and offset calibration.
|
|
|
|
|
|
// Reset the baby step value and the baby step applied flag.
|
|
|
calibration_status_store(CALIBRATION_STATUS_ASSEMBLED);
|
|
@@ -5256,7 +5476,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
world2machine_revert_to_uncorrected();
|
|
|
break;
|
|
|
|
|
|
- case 45: //! M45: Prusa3D: bed skew and offset with manual Z up
|
|
|
+ //! ### M45 - Bed skew and offset with manual Z up (Prusa specific)
|
|
|
+ // ------------------------------------------------------
|
|
|
+ case 45: // M45: Prusa3D: bed skew and offset with manual Z up
|
|
|
{
|
|
|
int8_t verbosity_level = 0;
|
|
|
bool only_Z = code_seen('Z');
|
|
@@ -5295,15 +5517,17 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
+ //! ### M47 - Show end stops dialog on the display (Prusa specific)
|
|
|
+ // ----------------------------------------------------
|
|
|
case 47:
|
|
|
- //! M47: Prusa3D: Show end stops dialog on the display.
|
|
|
+
|
|
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
|
|
lcd_diag_show_end_stops();
|
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
|
break;
|
|
|
|
|
|
#if 0
|
|
|
- case 48: //! M48: scan the bed induction sensor points, print the sensor trigger coordinates to the serial line for visualization on the PC.
|
|
|
+ case 48: // M48: scan the bed induction sensor points, print the sensor trigger coordinates to the serial line for visualization on the PC.
|
|
|
{
|
|
|
// Disable the default update procedure of the display. We will do a modal dialog.
|
|
|
lcd_update_enable(false);
|
|
@@ -5341,11 +5565,15 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
|
|
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
|
|
#ifdef Z_PROBE_REPEATABILITY_TEST
|
|
|
- //! M48 Z-Probe repeatability measurement function.
|
|
|
- //!
|
|
|
- //! Usage: M48 <n #_samples> <X X_position_for_samples> <Y Y_position_for_samples> <V Verbose_Level> <L legs_of_movement_prior_to_doing_probe>
|
|
|
+
|
|
|
+ //! ### M48 - Z-Probe repeatability measurement function.
|
|
|
+ // ------------------------------------------------------
|
|
|
//!
|
|
|
- //! This function assumes the bed has been homed. Specificaly, that a G28 command
|
|
|
+ //! _Usage:_
|
|
|
+ //!
|
|
|
+ //! M48 <n #_samples> <X X_position_for_samples> <Y Y_position_for_samples> <V Verbose_Level> <L legs_of_movement_prior_to_doing_probe>
|
|
|
+ //!
|
|
|
+ //! This function assumes the bed has been homed. Specifically, that a G28 command
|
|
|
//! as been issued prior to invoking the M48 Z-Probe repeatability measurement function.
|
|
|
//! Any information generated by a prior G29 Bed leveling command will be lost and need to be
|
|
|
//! regenerated.
|
|
@@ -5591,6 +5819,13 @@ Sigma_Exit:
|
|
|
}
|
|
|
#endif // Z_PROBE_REPEATABILITY_TEST
|
|
|
#endif // ENABLE_AUTO_BED_LEVELING
|
|
|
+
|
|
|
+ //! ### M73 - Set/get print progress
|
|
|
+ // -------------------------------------
|
|
|
+ //! _Usage:_
|
|
|
+ //!
|
|
|
+ //! M73 P<percent> R<time_remaining> Q<percent_silent> S<time_remaining_silent>
|
|
|
+ //!
|
|
|
case 73: //M73 show percent done and time remaining
|
|
|
if(code_seen('P')) print_percent_done_normal = code_value();
|
|
|
if(code_seen('R')) print_time_remaining_normal = code_value();
|
|
@@ -5604,6 +5839,8 @@ Sigma_Exit:
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
+ //! ### M104 - Set hotend temperature
|
|
|
+ // -----------------------------------------
|
|
|
case 104: // M104
|
|
|
{
|
|
|
uint8_t extruder;
|
|
@@ -5617,13 +5854,22 @@ Sigma_Exit:
|
|
|
setWatch();
|
|
|
break;
|
|
|
}
|
|
|
- case 112: // M112 -Emergency Stop
|
|
|
+
|
|
|
+ //! ### M112 - Emergency stop
|
|
|
+ // -----------------------------------------
|
|
|
+ case 112:
|
|
|
kill(_n(""), 3);
|
|
|
break;
|
|
|
- case 140: // M140 set bed temp
|
|
|
+
|
|
|
+ //! ### M140 - Set bed temperature
|
|
|
+ // -----------------------------------------
|
|
|
+ case 140:
|
|
|
if (code_seen('S')) setTargetBed(code_value());
|
|
|
break;
|
|
|
- case 105 : // M105
|
|
|
+
|
|
|
+ //! ### M105 - Report temperatures
|
|
|
+ // -----------------------------------------
|
|
|
+ case 105:
|
|
|
{
|
|
|
uint8_t extruder;
|
|
|
if(setTargetedHotend(105, extruder)){
|
|
@@ -5717,8 +5963,11 @@ Sigma_Exit:
|
|
|
return;
|
|
|
break;
|
|
|
}
|
|
|
+
|
|
|
+ //! ### M109 - Wait for extruder temperature
|
|
|
+ // -------------------------------------------------
|
|
|
case 109:
|
|
|
- {// M109 - Wait for extruder heater to reach target.
|
|
|
+ {
|
|
|
uint8_t extruder;
|
|
|
if(setTargetedHotend(109, extruder)){
|
|
|
break;
|
|
@@ -5768,7 +6017,10 @@ Sigma_Exit:
|
|
|
previous_millis_cmd = _millis();
|
|
|
}
|
|
|
break;
|
|
|
- case 190: // M190 - Wait for bed heater to reach target.
|
|
|
+
|
|
|
+ //! ### M190 - Wait for bed temperature
|
|
|
+ // ---------------------------------------
|
|
|
+ case 190:
|
|
|
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
|
|
|
LCD_MESSAGERPGM(_T(MSG_BED_HEATING));
|
|
|
heating_status = 3;
|
|
@@ -5819,7 +6071,10 @@ Sigma_Exit:
|
|
|
break;
|
|
|
|
|
|
#if defined(FAN_PIN) && FAN_PIN > -1
|
|
|
- case 106: //!M106 Sxxx Fan On S<speed> 0 .. 255
|
|
|
+
|
|
|
+ //! ### M106 - Set fan speed
|
|
|
+ // -------------------------------------------
|
|
|
+ case 106: // M106 Sxxx Fan On S<speed> 0 .. 255
|
|
|
if (code_seen('S')){
|
|
|
fanSpeed=constrain(code_value(),0,255);
|
|
|
}
|
|
@@ -5827,13 +6082,19 @@ Sigma_Exit:
|
|
|
fanSpeed=255;
|
|
|
}
|
|
|
break;
|
|
|
- case 107: //M107 Fan Off
|
|
|
+
|
|
|
+ //! ### M107 - Fan off
|
|
|
+ // -------------------------------
|
|
|
+ case 107:
|
|
|
fanSpeed = 0;
|
|
|
break;
|
|
|
#endif //FAN_PIN
|
|
|
|
|
|
#if defined(PS_ON_PIN) && PS_ON_PIN > -1
|
|
|
- case 80: // M80 - Turn on Power Supply
|
|
|
+
|
|
|
+ //! ### M80 - Turn on the Power Supply
|
|
|
+ // -------------------------------
|
|
|
+ case 80:
|
|
|
SET_OUTPUT(PS_ON_PIN); //GND
|
|
|
WRITE(PS_ON_PIN, PS_ON_AWAKE);
|
|
|
|
|
@@ -5851,7 +6112,9 @@ Sigma_Exit:
|
|
|
break;
|
|
|
#endif
|
|
|
|
|
|
- case 81: // M81 - Turn off Power Supply
|
|
|
+ //! ### M81 - Turn off Power Supply
|
|
|
+ // --------------------------------------
|
|
|
+ case 81:
|
|
|
disable_heater();
|
|
|
st_synchronize();
|
|
|
disable_e0();
|
|
@@ -5872,12 +6135,24 @@ Sigma_Exit:
|
|
|
lcd_update(0);
|
|
|
break;
|
|
|
|
|
|
+ //! ### M82 - Set E axis to absolute mode
|
|
|
+ // ---------------------------------------
|
|
|
case 82:
|
|
|
axis_relative_modes[3] = false;
|
|
|
break;
|
|
|
+
|
|
|
+ //! ### M83 - Set E axis to relative mode
|
|
|
+ // ---------------------------------------
|
|
|
case 83:
|
|
|
axis_relative_modes[3] = true;
|
|
|
break;
|
|
|
+
|
|
|
+ //! ### M84, M18 - Disable steppers
|
|
|
+ //---------------------------------------
|
|
|
+ //! This command can be used to set the stepper inactivity timeout (`S`) or to disable steppers (`X`,`Y`,`Z`,`E`)
|
|
|
+ //!
|
|
|
+ //! M84 [E<flag>] [S<seconds>] [X<flag>] [Y<flag>] [Z<flag>]
|
|
|
+ //!
|
|
|
case 18: //compatibility
|
|
|
case 84: // M84
|
|
|
if(code_seen('S')){
|
|
@@ -5913,21 +6188,35 @@ Sigma_Exit:
|
|
|
print_time_remaining_init();
|
|
|
snmm_filaments_used = 0;
|
|
|
break;
|
|
|
+
|
|
|
+ //! ### M85 - Set max inactive time
|
|
|
+ // ---------------------------------------
|
|
|
case 85: // M85
|
|
|
if(code_seen('S')) {
|
|
|
max_inactive_time = code_value() * 1000;
|
|
|
}
|
|
|
break;
|
|
|
#ifdef SAFETYTIMER
|
|
|
- case 86: // M86 - set safety timer expiration time in seconds; M86 S0 will disable safety timer
|
|
|
- //when safety timer expires heatbed and nozzle target temperatures are set to zero
|
|
|
+
|
|
|
+ //! ### M86 - Set safety timer expiration time
|
|
|
+ //!
|
|
|
+ //! _Usage:_
|
|
|
+ //! M86 S<seconds>
|
|
|
+ //!
|
|
|
+ //! Sets the safety timer expiration time in seconds. M86 S0 will disable safety timer.
|
|
|
+ //! When safety timer expires, heatbed and nozzle target temperatures are set to zero.
|
|
|
+ case 86:
|
|
|
if (code_seen('S')) {
|
|
|
safetytimer_inactive_time = code_value() * 1000;
|
|
|
safetyTimer.start();
|
|
|
}
|
|
|
break;
|
|
|
#endif
|
|
|
- case 92: // M92
|
|
|
+
|
|
|
+ //! ### M92 Set Axis steps-per-unit
|
|
|
+ // ---------------------------------------
|
|
|
+ //! Same syntax as G92
|
|
|
+ case 92:
|
|
|
for(int8_t i=0; i < NUM_AXIS; i++)
|
|
|
{
|
|
|
if(code_seen(axis_codes[i]))
|
|
@@ -5948,11 +6237,17 @@ Sigma_Exit:
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
- case 110: //! M110 N<line number> - reset line pos
|
|
|
+
|
|
|
+ //! ### M110 - Set Line number
|
|
|
+ // ---------------------------------------
|
|
|
+ case 110:
|
|
|
if (code_seen('N'))
|
|
|
gcode_LastN = code_value_long();
|
|
|
break;
|
|
|
- case 113: // M113 - Get or set Host Keepalive interval
|
|
|
+
|
|
|
+ //! ### M113 - Get or set host keep-alive interval
|
|
|
+ // ------------------------------------------
|
|
|
+ case 113:
|
|
|
if (code_seen('S')) {
|
|
|
host_keepalive_interval = (uint8_t)code_value_short();
|
|
|
// NOMORE(host_keepalive_interval, 60);
|
|
@@ -5963,6 +6258,16 @@ Sigma_Exit:
|
|
|
SERIAL_PROTOCOLLN("");
|
|
|
}
|
|
|
break;
|
|
|
+
|
|
|
+ //! ### M115 - Firmware info
|
|
|
+ // --------------------------------------
|
|
|
+ //! Print the firmware info and capabilities
|
|
|
+ //!
|
|
|
+ //! M115 [V] [U<version>]
|
|
|
+ //!
|
|
|
+ //! Without any arguments, prints Prusa firmware version number, machine type, extruder count and UUID.
|
|
|
+ //! `M115 U` Checks the firmware version provided. If the firmware version provided by the U code is higher than the currently running firmware,
|
|
|
+ //! pause the print for 30s and ask the user to upgrade the firmware.
|
|
|
case 115: // M115
|
|
|
if (code_seen('V')) {
|
|
|
// Report the Prusa version number.
|
|
@@ -5984,22 +6289,43 @@ Sigma_Exit:
|
|
|
SERIAL_ECHOLNPGM(MACHINE_UUID);
|
|
|
}
|
|
|
break;
|
|
|
-/* case 117: // M117 display message
|
|
|
+
|
|
|
+ //! ### M114 - Get current position
|
|
|
+ // -------------------------------------
|
|
|
+ case 114:
|
|
|
+ gcode_M114();
|
|
|
+ break;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //! ### M117 - Set LCD Message
|
|
|
+ // --------------------------------------
|
|
|
+
|
|
|
+ /*
|
|
|
+ M117 moved up to get the high priority
|
|
|
+
|
|
|
+ case 117: // M117 display message
|
|
|
starpos = (strchr(strchr_pointer + 5,'*'));
|
|
|
if(starpos!=NULL)
|
|
|
*(starpos)='\0';
|
|
|
lcd_setstatus(strchr_pointer + 5);
|
|
|
break;*/
|
|
|
- case 114: // M114
|
|
|
- gcode_M114();
|
|
|
- break;
|
|
|
- case 120: //! M120 - Disable endstops
|
|
|
+
|
|
|
+ //! ### M120 - Disable endstops
|
|
|
+ // ----------------------------------------
|
|
|
+ case 120:
|
|
|
enable_endstops(false) ;
|
|
|
break;
|
|
|
- case 121: //! M121 - Enable endstops
|
|
|
+
|
|
|
+ //! ### M121 - Enable endstops
|
|
|
+ // ----------------------------------------
|
|
|
+ case 121:
|
|
|
enable_endstops(true) ;
|
|
|
break;
|
|
|
- case 119: // M119
|
|
|
+
|
|
|
+ //! ### M119 - Get endstop states
|
|
|
+ // ----------------------------------------
|
|
|
+ case 119:
|
|
|
SERIAL_PROTOCOLRPGM(_N("Reporting endstop status"));////MSG_M119_REPORT
|
|
|
SERIAL_PROTOCOLLN("");
|
|
|
#if defined(X_MIN_PIN) && X_MIN_PIN > -1
|
|
@@ -6058,8 +6384,12 @@ Sigma_Exit:
|
|
|
#endif
|
|
|
break;
|
|
|
//TODO: update for all axis, use for loop
|
|
|
+
|
|
|
#ifdef BLINKM
|
|
|
- case 150: // M150
|
|
|
+
|
|
|
+ //! ### M150 - Set RGB(W) Color
|
|
|
+ // -------------------------------------------
|
|
|
+ case 150:
|
|
|
{
|
|
|
byte red;
|
|
|
byte grn;
|
|
@@ -6073,6 +6403,9 @@ Sigma_Exit:
|
|
|
}
|
|
|
break;
|
|
|
#endif //BLINKM
|
|
|
+
|
|
|
+ //! ### M200 - Set filament diameter
|
|
|
+ // ----------------------------------------
|
|
|
case 200: // M200 D<millimeters> set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
|
|
|
{
|
|
|
|
|
@@ -6111,7 +6444,10 @@ Sigma_Exit:
|
|
|
calculate_extruder_multipliers();
|
|
|
}
|
|
|
break;
|
|
|
- case 201: // M201
|
|
|
+
|
|
|
+ //! ### M201 - Set Print Max Acceleration
|
|
|
+ // -------------------------------------------
|
|
|
+ case 201:
|
|
|
for (int8_t i = 0; i < NUM_AXIS; i++)
|
|
|
{
|
|
|
if (code_seen(axis_codes[i]))
|
|
@@ -6143,6 +6479,9 @@ Sigma_Exit:
|
|
|
}
|
|
|
break;
|
|
|
#endif
|
|
|
+
|
|
|
+ //! ### M203 - Set Max Feedrate
|
|
|
+ // ---------------------------------------
|
|
|
case 203: // M203 max feedrate mm/sec
|
|
|
for (int8_t i = 0; i < NUM_AXIS; i++)
|
|
|
{
|
|
@@ -6166,10 +6505,17 @@ Sigma_Exit:
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
+
|
|
|
+ //! ### M204 - Acceleration settings
|
|
|
+ // ------------------------------------------
|
|
|
+ //! Supporting old format:
|
|
|
+ //!
|
|
|
+ //! M204 S[normal moves] T[filmanent only moves]
|
|
|
+ //!
|
|
|
+ //! and new format:
|
|
|
+ //!
|
|
|
+ //! M204 P[printing moves] R[filmanent only moves] T[travel moves] (as of now T is ignored)
|
|
|
case 204:
|
|
|
- //! M204 acclereration settings.
|
|
|
- //!@n Supporting old format: M204 S[normal moves] T[filmanent only moves]
|
|
|
- //!@n and new format: M204 P[printing moves] R[filmanent only moves] T[travel moves] (as of now T is ignored)
|
|
|
{
|
|
|
if(code_seen('S')) {
|
|
|
// Legacy acceleration format. This format is used by the legacy Marlin, MK2 or MK3 firmware,
|
|
@@ -6193,7 +6539,19 @@ Sigma_Exit:
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
- case 205: //M205 advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
|
|
|
+
|
|
|
+ //! ### M205 - Set advanced settings
|
|
|
+ // ---------------------------------------------
|
|
|
+ //! Set some advanced settings related to movement.
|
|
|
+ //!
|
|
|
+ //! M205 [S] [T] [B] [X] [Y] [Z] [E]
|
|
|
+ /*!
|
|
|
+ - `S` - Minimum feedrate for print moves (unit/s)
|
|
|
+ - `T` - Minimum feedrate for travel moves (units/s)
|
|
|
+ - `B` - Minimum segment time (us)
|
|
|
+ - `X` - Maximum X jerk (units/s), similarly for other axes
|
|
|
+ */
|
|
|
+ case 205:
|
|
|
{
|
|
|
if(code_seen('S')) cs.minimumfeedrate = code_value();
|
|
|
if(code_seen('T')) cs.mintravelfeedrate = code_value();
|
|
@@ -6206,13 +6564,19 @@ Sigma_Exit:
|
|
|
if (cs.max_jerk[Y_AXIS] > DEFAULT_YJERK) cs.max_jerk[Y_AXIS] = DEFAULT_YJERK;
|
|
|
}
|
|
|
break;
|
|
|
- case 206: // M206 additional homing offset
|
|
|
+
|
|
|
+ //! ### M206 - Set additional homing offsets
|
|
|
+ // ----------------------------------------------
|
|
|
+ case 206:
|
|
|
for(int8_t i=0; i < 3; i++)
|
|
|
{
|
|
|
if(code_seen(axis_codes[i])) cs.add_homing[i] = code_value();
|
|
|
}
|
|
|
break;
|
|
|
#ifdef FWRETRACT
|
|
|
+
|
|
|
+ //! ### M207 - Set firmware retraction
|
|
|
+ // --------------------------------------------------
|
|
|
case 207: //M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop]
|
|
|
{
|
|
|
if(code_seen('S'))
|
|
@@ -6228,6 +6592,9 @@ Sigma_Exit:
|
|
|
cs.retract_zlift = code_value() ;
|
|
|
}
|
|
|
}break;
|
|
|
+
|
|
|
+ //! ### M208 - Set retract recover length
|
|
|
+ // --------------------------------------------
|
|
|
case 208: // M208 - set retract recover length S[positive mm surplus to the M207 S*] F[feedrate mm/min]
|
|
|
{
|
|
|
if(code_seen('S'))
|
|
@@ -6239,6 +6606,9 @@ Sigma_Exit:
|
|
|
cs.retract_recover_feedrate = code_value()/60 ;
|
|
|
}
|
|
|
}break;
|
|
|
+
|
|
|
+ //! ### M209 - Enable/disable automatict retract
|
|
|
+ // ---------------------------------------------
|
|
|
case 209: // M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
|
|
|
{
|
|
|
if(code_seen('S'))
|
|
@@ -6279,6 +6649,9 @@ Sigma_Exit:
|
|
|
}break;
|
|
|
#endif // FWRETRACT
|
|
|
#if EXTRUDERS > 1
|
|
|
+
|
|
|
+ // ### M218 - Set hotend offset
|
|
|
+ // ----------------------------------------
|
|
|
case 218: // M218 - set hotend offset (in mm), T<extruder_number> X<offset_on_X> Y<offset_on_Y>
|
|
|
{
|
|
|
uint8_t extruder;
|
|
@@ -6306,6 +6679,8 @@ Sigma_Exit:
|
|
|
}break;
|
|
|
#endif
|
|
|
|
|
|
+ //! ### M220 Set feedrate percentage
|
|
|
+ // -----------------------------------------------
|
|
|
case 220: // M220 S<factor in percent>- set speed factor override percentage
|
|
|
{
|
|
|
if (code_seen('B')) //backup current speed factor
|
|
@@ -6321,6 +6696,9 @@ Sigma_Exit:
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
+
|
|
|
+ //! ### M221 - Set extrude factor override percentage
|
|
|
+ // ----------------------------------------------------
|
|
|
case 221: // M221 S<factor in percent>- set extrude factor override percentage
|
|
|
{
|
|
|
if(code_seen('S'))
|
|
@@ -6343,6 +6721,8 @@ Sigma_Exit:
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
+ //! ### M226 - Wait for Pin state
|
|
|
+ // ------------------------------------------
|
|
|
case 226: // M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required
|
|
|
{
|
|
|
if(code_seen('P')){
|
|
@@ -6396,6 +6776,9 @@ Sigma_Exit:
|
|
|
break;
|
|
|
|
|
|
#if NUM_SERVOS > 0
|
|
|
+
|
|
|
+ //! ### M280 - Set/Get servo position
|
|
|
+ // --------------------------------------------
|
|
|
case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds
|
|
|
{
|
|
|
int servo_index = -1;
|
|
@@ -6434,6 +6817,9 @@ Sigma_Exit:
|
|
|
#endif // NUM_SERVOS > 0
|
|
|
|
|
|
#if (LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER)))
|
|
|
+
|
|
|
+ //! ### M300 - Play tone
|
|
|
+ // -----------------------
|
|
|
case 300: // M300
|
|
|
{
|
|
|
int beepS = code_seen('S') ? code_value() : 110;
|
|
@@ -6441,10 +6827,7 @@ Sigma_Exit:
|
|
|
if (beepS > 0)
|
|
|
{
|
|
|
#if BEEPER > 0
|
|
|
-if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
- _tone(BEEPER, beepS);
|
|
|
- _delay(beepP);
|
|
|
- _noTone(BEEPER);
|
|
|
+ Sound_MakeCustom(beepP,beepS,false);
|
|
|
#endif
|
|
|
}
|
|
|
else
|
|
@@ -6456,7 +6839,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
#endif // M300
|
|
|
|
|
|
#ifdef PIDTEMP
|
|
|
- case 301: // M301
|
|
|
+
|
|
|
+ //! ### M301 - Set hotend PID
|
|
|
+ // ---------------------------------------
|
|
|
+ case 301:
|
|
|
{
|
|
|
if(code_seen('P')) cs.Kp = code_value();
|
|
|
if(code_seen('I')) cs.Ki = scalePID_i(code_value());
|
|
@@ -6484,7 +6870,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
break;
|
|
|
#endif //PIDTEMP
|
|
|
#ifdef PIDTEMPBED
|
|
|
- case 304: // M304
|
|
|
+
|
|
|
+ //! ### M304 - Set bed PID
|
|
|
+ // --------------------------------------
|
|
|
+ case 304:
|
|
|
{
|
|
|
if(code_seen('P')) cs.bedKp = code_value();
|
|
|
if(code_seen('I')) cs.bedKi = scalePID_i(code_value());
|
|
@@ -6502,6 +6891,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
#endif //PIDTEMP
|
|
|
+
|
|
|
+ //! ### M240 - Trigger camera
|
|
|
+ // --------------------------------------------
|
|
|
case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
|
|
|
{
|
|
|
#ifdef CHDK
|
|
@@ -6534,7 +6926,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
#ifdef PREVENT_DANGEROUS_EXTRUDE
|
|
|
- case 302: // allow cold extrudes, or set the minimum extrude temperature
|
|
|
+
|
|
|
+ //! ### M302 - Allow cold extrude, or set minimum extrude temperature
|
|
|
+ // -------------------------------------------------------------------
|
|
|
+ case 302:
|
|
|
{
|
|
|
float temp = .0;
|
|
|
if (code_seen('S')) temp=code_value();
|
|
@@ -6542,7 +6937,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
#endif
|
|
|
- case 303: // M303 PID autotune
|
|
|
+
|
|
|
+ //! ### M303 - PID autotune
|
|
|
+ // -------------------------------------
|
|
|
+ case 303:
|
|
|
{
|
|
|
float temp = 150.0;
|
|
|
int e=0;
|
|
@@ -6555,17 +6953,22 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
PID_autotune(temp, e, c);
|
|
|
}
|
|
|
break;
|
|
|
- case 400: // M400 finish all moves
|
|
|
+
|
|
|
+ //! ### M400 - Wait for all moves to finish
|
|
|
+ // -----------------------------------------
|
|
|
+ case 400:
|
|
|
{
|
|
|
st_synchronize();
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 403: //! M403 set filament type (material) for particular extruder and send this information to mmu
|
|
|
+ //! ### M403 - Set filament type (material) for particular extruder and notify the MMU
|
|
|
+ // ----------------------------------------------
|
|
|
+ case 403:
|
|
|
{
|
|
|
- //! currently three different materials are needed (default, flex and PVA)
|
|
|
- //! add storing this information for different load/unload profiles etc. in the future
|
|
|
- //!firmware does not wait for "ok" from mmu
|
|
|
+ // currently three different materials are needed (default, flex and PVA)
|
|
|
+ // add storing this information for different load/unload profiles etc. in the future
|
|
|
+ // firmware does not wait for "ok" from mmu
|
|
|
if (mmu_enabled)
|
|
|
{
|
|
|
uint8_t extruder = 255;
|
|
@@ -6577,27 +6980,41 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 500: // M500 Store settings in EEPROM
|
|
|
+ //! ### M500 - Store settings in EEPROM
|
|
|
+ // -----------------------------------------
|
|
|
+ case 500:
|
|
|
{
|
|
|
Config_StoreSettings();
|
|
|
}
|
|
|
break;
|
|
|
- case 501: // M501 Read settings from EEPROM
|
|
|
+
|
|
|
+ //! ### M501 - Read settings from EEPROM
|
|
|
+ // ----------------------------------------
|
|
|
+ case 501:
|
|
|
{
|
|
|
Config_RetrieveSettings();
|
|
|
}
|
|
|
break;
|
|
|
- case 502: // M502 Revert to default settings
|
|
|
+
|
|
|
+ //! ### M502 - Revert all settings to factory default
|
|
|
+ // -------------------------------------------------
|
|
|
+ case 502:
|
|
|
{
|
|
|
Config_ResetDefault();
|
|
|
}
|
|
|
break;
|
|
|
- case 503: // M503 print settings currently in memory
|
|
|
+
|
|
|
+ //! ### M503 - Repport all settings currently in memory
|
|
|
+ // -------------------------------------------------
|
|
|
+ case 503:
|
|
|
{
|
|
|
Config_PrintSettings();
|
|
|
}
|
|
|
break;
|
|
|
- case 509: //M509 Force language selection
|
|
|
+
|
|
|
+ //! ### M509 - Force language selection
|
|
|
+ // ------------------------------------------------
|
|
|
+ case 509:
|
|
|
{
|
|
|
lang_reset();
|
|
|
SERIAL_ECHO_START;
|
|
@@ -6605,6 +7022,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
|
|
+
|
|
|
+ //! ### M540 - Abort print on endstop hit (enable/disable)
|
|
|
+ // -----------------------------------------------------
|
|
|
case 540:
|
|
|
{
|
|
|
if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
|
|
@@ -6649,6 +7069,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
#endif // CUSTOM_M_CODE_SET_Z_PROBE_OFFSET
|
|
|
|
|
|
#ifdef FILAMENTCHANGEENABLE
|
|
|
+
|
|
|
+ //! ### M600 - Initiate Filament change procedure
|
|
|
+ // --------------------------------------
|
|
|
case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
|
|
{
|
|
|
st_synchronize();
|
|
@@ -6723,20 +7146,39 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
#endif //FILAMENTCHANGEENABLE
|
|
|
- case 601: //! M601 - Pause print
|
|
|
+
|
|
|
+ //! ### M601 - Pause print
|
|
|
+ // -------------------------------
|
|
|
+ case 601:
|
|
|
{
|
|
|
cmdqueue_pop_front(); //trick because we want skip this command (M601) after restore
|
|
|
lcd_pause_print();
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 602: { //! M602 - Resume print
|
|
|
+ //! ### M602 - Resume print
|
|
|
+ // -------------------------------
|
|
|
+ case 602: {
|
|
|
lcd_resume_print();
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
+ //! ### M603 - Stop print
|
|
|
+ // -------------------------------
|
|
|
+ case 603: {
|
|
|
+ lcd_print_stop();
|
|
|
+ }
|
|
|
+
|
|
|
#ifdef PINDA_THERMISTOR
|
|
|
- case 860: // M860 - Wait for PINDA thermistor to reach target temperature.
|
|
|
+ //! ### M860 - Wait for extruder temperature (PINDA)
|
|
|
+ // --------------------------------------------------------------
|
|
|
+ /*!
|
|
|
+ Wait for PINDA thermistor to reach target temperature
|
|
|
+
|
|
|
+ M860 [S<target_temperature>]
|
|
|
+
|
|
|
+ */
|
|
|
+ case 860:
|
|
|
{
|
|
|
int set_target_pinda = 0;
|
|
|
|
|
@@ -6780,7 +7222,18 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- case 861: // M861 - Set/Read PINDA temperature compensation offsets
|
|
|
+ //! ### M861 - Set/Get PINDA temperature compensation offsets
|
|
|
+ // -----------------------------------------------------------
|
|
|
+ /*!
|
|
|
+
|
|
|
+ M861 [ ? | ! | Z | S<microsteps> [I<table_index>] ]
|
|
|
+
|
|
|
+ - `?` - Print current EEPROM offset values
|
|
|
+ - `!` - Set factory default values
|
|
|
+ - `Z` - Set all values to 0 (effectively disabling PINDA temperature compensation)
|
|
|
+ - `S<microsteps>` `I<table_index>` - Set compensation ustep value S for compensation table index I
|
|
|
+ */
|
|
|
+ case 861:
|
|
|
if (code_seen('?')) { // ? - Print out current EEPROM offset values
|
|
|
uint8_t cal_status = calibration_status_pinda();
|
|
|
int16_t usteps = 0;
|
|
@@ -6851,14 +7304,110 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
break;
|
|
|
|
|
|
#endif //PINDA_THERMISTOR
|
|
|
+
|
|
|
+ //! ### M862 - Print checking
|
|
|
+ // ----------------------------------------------
|
|
|
+ /*!
|
|
|
+ Checks the parameters of the printer and gcode and performs compatibility check
|
|
|
+ - M862.1 { P<nozzle_diameter> | Q }
|
|
|
+ - M862.2 { P<model_code> | Q }
|
|
|
+ - M862.3 { P"<model_name>" | Q }
|
|
|
+ - M862.4 { P<fw_version> | Q }
|
|
|
+ - M862.5 { P<gcode_level> | Q }
|
|
|
+
|
|
|
+ When run with P<> argument, the check is performed against the input value.
|
|
|
+ When run with Q argument, the current value is shown.
|
|
|
+
|
|
|
+ M862.3 accepts text identifiers of printer types too.
|
|
|
+ The syntax of M862.3 is (note the quotes around the type):
|
|
|
+
|
|
|
+ M862.3 P "MK3S"
|
|
|
+
|
|
|
+ Accepted printer type identifiers and their numeric counterparts:
|
|
|
+ - MK1 (100)
|
|
|
+ - MK2 (200)
|
|
|
+ - MK2MM (201)
|
|
|
+ - MK2S (202)
|
|
|
+ - MK2SMM (203)
|
|
|
+ - MK2.5 (250)
|
|
|
+ - MK2.5MMU2 (20250)
|
|
|
+ - MK2.5S (252)
|
|
|
+ - MK2.5SMMU2S (20252)
|
|
|
+ - MK3 (300)
|
|
|
+ - MK3MMU2 (20300)
|
|
|
+ - MK3S (302)
|
|
|
+ - MK3SMMU2S (20302)
|
|
|
+ */
|
|
|
+ case 862: // M862: print checking
|
|
|
+ float nDummy;
|
|
|
+ uint8_t nCommand;
|
|
|
+ nCommand=(uint8_t)(modff(code_value_float(),&nDummy)*10.0+0.5);
|
|
|
+ switch((ClPrintChecking)nCommand)
|
|
|
+ {
|
|
|
+ case ClPrintChecking::_Nozzle: // ~ .1
|
|
|
+ uint16_t nDiameter;
|
|
|
+ if(code_seen('P'))
|
|
|
+ {
|
|
|
+ nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um]
|
|
|
+ nozzle_diameter_check(nDiameter);
|
|
|
+ }
|
|
|
+/*
|
|
|
+ else if(code_seen('S')&&farm_mode)
|
|
|
+ {
|
|
|
+ nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um]
|
|
|
+ eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)ClNozzleDiameter::_Diameter_Undef); // for correct synchronization after farm-mode exiting
|
|
|
+ eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter);
|
|
|
+ }
|
|
|
+*/
|
|
|
+ else if(code_seen('Q'))
|
|
|
+ SERIAL_PROTOCOLLN((float)eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)/1000.0);
|
|
|
+ break;
|
|
|
+ case ClPrintChecking::_Model: // ~ .2
|
|
|
+ if(code_seen('P'))
|
|
|
+ {
|
|
|
+ uint16_t nPrinterModel;
|
|
|
+ nPrinterModel=(uint16_t)code_value_long();
|
|
|
+ printer_model_check(nPrinterModel);
|
|
|
+ }
|
|
|
+ else if(code_seen('Q'))
|
|
|
+ SERIAL_PROTOCOLLN(nPrinterType);
|
|
|
+ break;
|
|
|
+ case ClPrintChecking::_Smodel: // ~ .3
|
|
|
+ if(code_seen('P'))
|
|
|
+ printer_smodel_check(strchr_pointer);
|
|
|
+ else if(code_seen('Q'))
|
|
|
+ SERIAL_PROTOCOLLNRPGM(sPrinterName);
|
|
|
+ break;
|
|
|
+ case ClPrintChecking::_Version: // ~ .4
|
|
|
+ if(code_seen('P'))
|
|
|
+ fw_version_check(++strchr_pointer);
|
|
|
+ else if(code_seen('Q'))
|
|
|
+ SERIAL_PROTOCOLLN(FW_VERSION);
|
|
|
+ break;
|
|
|
+ case ClPrintChecking::_Gcode: // ~ .5
|
|
|
+ if(code_seen('P'))
|
|
|
+ {
|
|
|
+ uint16_t nGcodeLevel;
|
|
|
+ nGcodeLevel=(uint16_t)code_value_long();
|
|
|
+ gcode_level_check(nGcodeLevel);
|
|
|
+ }
|
|
|
+ else if(code_seen('Q'))
|
|
|
+ SERIAL_PROTOCOLLN(GCODE_LEVEL);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
|
|
|
#ifdef LIN_ADVANCE
|
|
|
- case 900: // M900: Set LIN_ADVANCE options.
|
|
|
+ //! ### M900 - Set Linear advance options
|
|
|
+ // ----------------------------------------------
|
|
|
+ case 900:
|
|
|
gcode_M900();
|
|
|
break;
|
|
|
#endif
|
|
|
|
|
|
- case 907: // M907 Set digital trimpot motor current using axis codes.
|
|
|
+ //! ### M907 - Set digital trimpot motor current using axis codes
|
|
|
+ // ---------------------------------------------------------------
|
|
|
+ case 907:
|
|
|
{
|
|
|
#ifdef TMC2130
|
|
|
for (int i = 0; i < NUM_AXIS; i++)
|
|
@@ -6889,7 +7438,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
#endif //TMC2130
|
|
|
}
|
|
|
break;
|
|
|
- case 908: // M908 Control digital trimpot directly.
|
|
|
+
|
|
|
+ //! ### M908 - Control digital trimpot directly
|
|
|
+ // ---------------------------------------------------------
|
|
|
+ case 908:
|
|
|
{
|
|
|
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
|
|
|
uint8_t channel,current;
|
|
@@ -6902,13 +7454,17 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
|
|
|
#ifdef TMC2130_SERVICE_CODES_M910_M918
|
|
|
|
|
|
- case 910: //! M910 - TMC2130 init
|
|
|
+ //! ### M910 - TMC2130 init
|
|
|
+ // -----------------------------------------------
|
|
|
+ case 910:
|
|
|
{
|
|
|
tmc2130_init();
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 911: //! M911 - Set TMC2130 holding currents
|
|
|
+ //! ### M911 - Set TMC2130 holding currents
|
|
|
+ // -------------------------------------------------
|
|
|
+ case 911:
|
|
|
{
|
|
|
if (code_seen('X')) tmc2130_set_current_h(0, code_value());
|
|
|
if (code_seen('Y')) tmc2130_set_current_h(1, code_value());
|
|
@@ -6917,7 +7473,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 912: //! M912 - Set TMC2130 running currents
|
|
|
+ //! ### M912 - Set TMC2130 running currents
|
|
|
+ // -----------------------------------------------
|
|
|
+ case 912:
|
|
|
{
|
|
|
if (code_seen('X')) tmc2130_set_current_r(0, code_value());
|
|
|
if (code_seen('Y')) tmc2130_set_current_r(1, code_value());
|
|
@@ -6925,13 +7483,18 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
if (code_seen('E')) tmc2130_set_current_r(3, code_value());
|
|
|
}
|
|
|
break;
|
|
|
- case 913: //! M913 - Print TMC2130 currents
|
|
|
+
|
|
|
+ //! ### M913 - Print TMC2130 currents
|
|
|
+ // -----------------------------
|
|
|
+ case 913:
|
|
|
{
|
|
|
tmc2130_print_currents();
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 914: //! M914 - Set normal mode
|
|
|
+ //! ### M914 - Set TMC2130 normal mode
|
|
|
+ // ------------------------------
|
|
|
+ case 914:
|
|
|
{
|
|
|
tmc2130_mode = TMC2130_MODE_NORMAL;
|
|
|
update_mode_profile();
|
|
@@ -6939,7 +7502,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 915: //! M915 - Set silent mode
|
|
|
+ //! ### M95 - Set TMC2130 silent mode
|
|
|
+ // ------------------------------
|
|
|
+ case 915:
|
|
|
{
|
|
|
tmc2130_mode = TMC2130_MODE_SILENT;
|
|
|
update_mode_profile();
|
|
@@ -6947,7 +7512,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 916: //! M916 - Set sg_thrs
|
|
|
+ //! ### M916 - Set TMC2130 Stallguard sensitivity threshold
|
|
|
+ // -------------------------------------------------------
|
|
|
+ case 916:
|
|
|
{
|
|
|
if (code_seen('X')) tmc2130_sg_thr[X_AXIS] = code_value();
|
|
|
if (code_seen('Y')) tmc2130_sg_thr[Y_AXIS] = code_value();
|
|
@@ -6958,7 +7525,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 917: //! M917 - Set TMC2130 pwm_ampl
|
|
|
+ //! ### M917 - Set TMC2130 PWM amplitude offset (pwm_ampl)
|
|
|
+ // --------------------------------------------------------------
|
|
|
+ case 917:
|
|
|
{
|
|
|
if (code_seen('X')) tmc2130_set_pwm_ampl(0, code_value());
|
|
|
if (code_seen('Y')) tmc2130_set_pwm_ampl(1, code_value());
|
|
@@ -6967,7 +7536,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 918: //! M918 - Set TMC2130 pwm_grad
|
|
|
+ //! ### M918 - Set TMC2130 PWM amplitude gradient (pwm_grad)
|
|
|
+ // -------------------------------------------------------------
|
|
|
+ case 918:
|
|
|
{
|
|
|
if (code_seen('X')) tmc2130_set_pwm_grad(0, code_value());
|
|
|
if (code_seen('Y')) tmc2130_set_pwm_grad(1, code_value());
|
|
@@ -6978,7 +7549,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
|
|
|
#endif //TMC2130_SERVICE_CODES_M910_M918
|
|
|
|
|
|
- case 350: //! M350 - Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
|
|
|
+ //! ### M350 - Set microstepping mode
|
|
|
+ // ---------------------------------------------------
|
|
|
+ //! Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
|
|
|
+ case 350:
|
|
|
{
|
|
|
#ifdef TMC2130
|
|
|
if(code_seen('E'))
|
|
@@ -7015,7 +7589,13 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
#endif //TMC2130
|
|
|
}
|
|
|
break;
|
|
|
- case 351: //! M351 - Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
|
|
|
+
|
|
|
+ //! ### M351 - Toggle Microstep Pins
|
|
|
+ // -----------------------------------
|
|
|
+ //! Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
|
|
|
+ //!
|
|
|
+ //! M351 [B<0|1>] [E<0|1>] S<1|2> [X<0|1>] [Y<0|1>] [Z<0|1>]
|
|
|
+ case 351:
|
|
|
{
|
|
|
#if defined(X_MS1_PIN) && X_MS1_PIN > -1
|
|
|
if(code_seen('S')) switch((int)code_value())
|
|
@@ -7033,14 +7613,28 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
#endif
|
|
|
}
|
|
|
break;
|
|
|
- case 701: //! M701 - load filament
|
|
|
+
|
|
|
+ //! ### M701 - Load filament
|
|
|
+ // -------------------------
|
|
|
+ case 701:
|
|
|
{
|
|
|
if (mmu_enabled && code_seen('E'))
|
|
|
tmp_extruder = code_value();
|
|
|
gcode_M701();
|
|
|
}
|
|
|
break;
|
|
|
- case 702: //! M702 [U C] -
|
|
|
+
|
|
|
+ //! ### M702 - Unload filament
|
|
|
+ // ------------------------
|
|
|
+ /*!
|
|
|
+
|
|
|
+ M702 [U C]
|
|
|
+
|
|
|
+ - `U` Unload all filaments used in current print
|
|
|
+ - `C` Unload just current filament
|
|
|
+ - without any parameters unload all filaments
|
|
|
+ */
|
|
|
+ case 702:
|
|
|
{
|
|
|
#ifdef SNMM
|
|
|
if (code_seen('U'))
|
|
@@ -7062,7 +7656,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
- case 999: // M999: Restart after being stopped
|
|
|
+ //! ### M999 - Restart after being stopped
|
|
|
+ // ------------------------------------
|
|
|
+ case 999:
|
|
|
Stopped = false;
|
|
|
lcd_reset_alert_level();
|
|
|
gcode_LastN = Stopped_gcode_LastN;
|
|
@@ -7076,6 +7672,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
}
|
|
|
// end if(code_seen('M')) (end of M codes)
|
|
|
+
|
|
|
+ //! -----------------------------------------------------------------------------------------
|
|
|
+ //! T Codes
|
|
|
+ //!
|
|
|
//! T<extruder nr.> - select extruder in case of multi extruder printer
|
|
|
//! select filament in case of MMU_V2
|
|
|
//! if extruder is "?", open menu to let the user select extruder/filament
|
|
@@ -7269,46 +7869,95 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}
|
|
|
} // end if(code_seen('T')) (end of T codes)
|
|
|
|
|
|
+ //! ----------------------------------------------------------------------------------------------
|
|
|
+
|
|
|
else if (code_seen('D')) // D codes (debug)
|
|
|
{
|
|
|
switch((int)code_value())
|
|
|
{
|
|
|
- case -1: //! D-1 - Endless loop
|
|
|
+
|
|
|
+ //! ### D-1 - Endless loop
|
|
|
+ // -------------------
|
|
|
+ case -1:
|
|
|
dcode__1(); break;
|
|
|
#ifdef DEBUG_DCODES
|
|
|
- case 0: //! D0 - Reset
|
|
|
+
|
|
|
+ //! ### D0 - Reset
|
|
|
+ // --------------
|
|
|
+ case 0:
|
|
|
dcode_0(); break;
|
|
|
- case 1: //! D1 - Clear EEPROM
|
|
|
+
|
|
|
+ //! ### D1 - Clear EEPROM
|
|
|
+ // ------------------
|
|
|
+ case 1:
|
|
|
dcode_1(); break;
|
|
|
- case 2: //! D2 - Read/Write RAM
|
|
|
+
|
|
|
+ //! ### D2 - Read/Write RAM
|
|
|
+ // --------------------
|
|
|
+ case 2:
|
|
|
dcode_2(); break;
|
|
|
#endif //DEBUG_DCODES
|
|
|
#ifdef DEBUG_DCODE3
|
|
|
- case 3: //! D3 - Read/Write EEPROM
|
|
|
+
|
|
|
+ //! ### D3 - Read/Write EEPROM
|
|
|
+ // -----------------------
|
|
|
+ case 3:
|
|
|
dcode_3(); break;
|
|
|
#endif //DEBUG_DCODE3
|
|
|
#ifdef DEBUG_DCODES
|
|
|
- case 4: //! D4 - Read/Write PIN
|
|
|
+
|
|
|
+ //! ### D4 - Read/Write PIN
|
|
|
+ // ---------------------
|
|
|
+ case 4:
|
|
|
dcode_4(); break;
|
|
|
#endif //DEBUG_DCODES
|
|
|
#ifdef DEBUG_DCODE5
|
|
|
- case 5: // D5 - Read/Write FLASH
|
|
|
+
|
|
|
+ //! ### D5 - Read/Write FLASH
|
|
|
+ // ------------------------
|
|
|
+ case 5:
|
|
|
dcode_5(); break;
|
|
|
break;
|
|
|
#endif //DEBUG_DCODE5
|
|
|
#ifdef DEBUG_DCODES
|
|
|
- case 6: // D6 - Read/Write external FLASH
|
|
|
+
|
|
|
+ //! ### D6 - Read/Write external FLASH
|
|
|
+ // ---------------------------------------
|
|
|
+ case 6:
|
|
|
dcode_6(); break;
|
|
|
- case 7: //! D7 - Read/Write Bootloader
|
|
|
+
|
|
|
+ //! ### D7 - Read/Write Bootloader
|
|
|
+ // -------------------------------
|
|
|
+ case 7:
|
|
|
dcode_7(); break;
|
|
|
- case 8: //! D8 - Read/Write PINDA
|
|
|
+
|
|
|
+ //! ### D8 - Read/Write PINDA
|
|
|
+ // ---------------------------
|
|
|
+ case 8:
|
|
|
dcode_8(); break;
|
|
|
- case 9: //! D9 - Read/Write ADC
|
|
|
+
|
|
|
+ // ### D9 - Read/Write ADC
|
|
|
+ // ------------------------
|
|
|
+ case 9:
|
|
|
dcode_9(); break;
|
|
|
- case 10: //! D10 - XYZ calibration = OK
|
|
|
+
|
|
|
+ //! ### D10 - XYZ calibration = OK
|
|
|
+ // ------------------------------
|
|
|
+ case 10:
|
|
|
dcode_10(); break;
|
|
|
#endif //DEBUG_DCODES
|
|
|
#ifdef HEATBED_ANALYSIS
|
|
|
+
|
|
|
+ //! ### D80 - Bed check
|
|
|
+ // ---------------------
|
|
|
+ /*!
|
|
|
+ - `E` - dimension x
|
|
|
+ - `F` - dimention y
|
|
|
+ - `G` - points_x
|
|
|
+ - `H` - points_y
|
|
|
+ - `I` - offset_x
|
|
|
+ - `J` - offset_y
|
|
|
+ */
|
|
|
case 80:
|
|
|
{
|
|
|
float dimension_x = 40;
|
|
@@ -7333,6 +7982,16 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
bed_check(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y);
|
|
|
}break;
|
|
|
|
|
|
+ //! ### D81 - Bed analysis
|
|
|
+ // -----------------------------
|
|
|
+ /*!
|
|
|
+ - `E` - dimension x
|
|
|
+ - `F` - dimention y
|
|
|
+ - `G` - points_x
|
|
|
+ - `H` - points_y
|
|
|
+ - `I` - offset_x
|
|
|
+ - `J` - offset_y
|
|
|
+ */
|
|
|
case 81:
|
|
|
{
|
|
|
float dimension_x = 40;
|
|
@@ -7355,7 +8014,10 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
|
|
|
#endif //HEATBED_ANALYSIS
|
|
|
#ifdef DEBUG_DCODES
|
|
|
- case 106: //D106 print measured fan speed for different pwm values
|
|
|
+
|
|
|
+ //! ### D106 print measured fan speed for different pwm values
|
|
|
+ // --------------------------------------------------------------
|
|
|
+ case 106:
|
|
|
{
|
|
|
for (int i = 255; i > 0; i = i - 5) {
|
|
|
fanSpeed = i;
|
|
@@ -7369,12 +8031,52 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
}break;
|
|
|
|
|
|
#ifdef TMC2130
|
|
|
- case 2130: //! D2130 - TMC2130
|
|
|
+ //! ### D2130 - TMC2130 Trinamic stepper controller
|
|
|
+ // ---------------------------
|
|
|
+
|
|
|
+
|
|
|
+ /*!
|
|
|
+
|
|
|
+
|
|
|
+ D2130<axis><command>[subcommand][value]
|
|
|
+
|
|
|
+ - <command>:
|
|
|
+ - '0' current off
|
|
|
+ - '1' current on
|
|
|
+ - '+' single step
|
|
|
+ - * value sereval steps
|
|
|
+ - '-' dtto oposite direction
|
|
|
+ - '?' read register
|
|
|
+ - * "mres"
|
|
|
+ - * "step"
|
|
|
+ - * "mscnt"
|
|
|
+ - * "mscuract"
|
|
|
+ - * "wave"
|
|
|
+ - '!' set register
|
|
|
+ - * "mres"
|
|
|
+ - * "step"
|
|
|
+ - * "wave"
|
|
|
+ - '@' home calibrate axis
|
|
|
+
|
|
|
+ Example:
|
|
|
+
|
|
|
+ D2130E?wave ... print extruder microstep linearity compensation curve
|
|
|
+
|
|
|
+ D2130E!wave0 ... disable extruder linearity compensation curve, (sine curve is used)
|
|
|
+
|
|
|
+ D2130E!wave220 ... (sin(x))^1.1 extruder microstep compensation curve used
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+ case 2130:
|
|
|
dcode_2130(); break;
|
|
|
#endif //TMC2130
|
|
|
|
|
|
#if (defined (FILAMENT_SENSOR) && defined(PAT9125))
|
|
|
- case 9125: //! D9125 - FILAMENT_SENSOR
|
|
|
+
|
|
|
+ //! ### D9125 - FILAMENT_SENSOR
|
|
|
+ // ---------------------------------
|
|
|
+ case 9125:
|
|
|
dcode_9125(); break;
|
|
|
#endif //FILAMENT_SENSOR
|
|
|
|
|
@@ -7393,6 +8095,13 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
ClearToSend();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ /** @defgroup GCodes G-Code List
|
|
|
+ */
|
|
|
+
|
|
|
+// ---------------------------------------------------
|
|
|
+
|
|
|
void FlushSerialRequestResend()
|
|
|
{
|
|
|
//char cmdbuffer[bufindr][100]="Resend:";
|
|
@@ -7746,10 +8455,7 @@ bool bInhibitFlag;
|
|
|
//-// if (degHotend0() > EXTRUDE_MINTEMP)
|
|
|
if(0)
|
|
|
{
|
|
|
- if ((eSoundMode == e_SOUND_MODE_LOUD) || (eSoundMode == e_SOUND_MODE_ONCE))
|
|
|
- _tone(BEEPER, 1000);
|
|
|
- delay_keep_alive(50);
|
|
|
- _noTone(BEEPER);
|
|
|
+ Sound_MakeCustom(50,1000,false);
|
|
|
loading_flag = true;
|
|
|
enquecommand_front_P((PSTR("M701")));
|
|
|
}
|
|
@@ -8159,12 +8865,15 @@ static void wait_for_heater(long codenum, uint8_t extruder) {
|
|
|
|
|
|
void check_babystep()
|
|
|
{
|
|
|
- int babystep_z;
|
|
|
- EEPROM_read_B(EEPROM_BABYSTEP_Z, &babystep_z);
|
|
|
+ int babystep_z = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->
|
|
|
+ s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)));
|
|
|
+
|
|
|
if ((babystep_z < Z_BABYSTEP_MIN) || (babystep_z > Z_BABYSTEP_MAX)) {
|
|
|
babystep_z = 0; //if babystep value is out of min max range, set it to 0
|
|
|
SERIAL_ECHOLNPGM("Z live adjust out of range. Setting to 0");
|
|
|
- EEPROM_save_B(EEPROM_BABYSTEP_Z, &babystep_z);
|
|
|
+ eeprom_write_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->
|
|
|
+ s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),
|
|
|
+ babystep_z);
|
|
|
lcd_show_fullscreen_message_and_wait_P(PSTR("Z live adjust out of range. Setting to 0. Click to continue."));
|
|
|
lcd_update_enable(true);
|
|
|
}
|
|
@@ -9009,8 +9718,7 @@ ISR(INT4_vect) {
|
|
|
EIMSK &= ~(1 << 4); //disable INT4 interrupt to make sure that this code will be executed just once
|
|
|
SERIAL_ECHOLNPGM("INT4");
|
|
|
//fire normal uvlo only in case where EEPROM_UVLO is 0 or if IS_SD_PRINTING is 1.
|
|
|
- //Don't change || to && because in some case the printer can be moving although IS_SD_PRINTING is zero
|
|
|
- if((IS_SD_PRINTING ) || (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO)))) uvlo_();
|
|
|
+ if(PRINTER_ACTIVE && (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO)))) uvlo_();
|
|
|
if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)) uvlo_tiny();
|
|
|
}
|
|
|
|
|
@@ -9371,7 +10079,6 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
|
|
|
if(!saved_extruder_relative_mode){
|
|
|
enquecommand(PSTR("M83"), true);
|
|
|
}
|
|
|
-
|
|
|
//retract 45mm/s
|
|
|
// A single sprintf may not be faster, but is definitely 20B shorter
|
|
|
// than a sequence of commands building the string piece by piece
|
|
@@ -9399,10 +10106,11 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
|
|
|
|
|
|
//! @brief Restore print from ram
|
|
|
//!
|
|
|
-//! Restore print saved by stop_and_save_print_to_ram(). Is blocking,
|
|
|
-//! waits for extruder temperature restore, then restores position and continues
|
|
|
-//! print moves.
|
|
|
-//! Internaly lcd_update() is called by wait_for_heater().
|
|
|
+//! Restore print saved by stop_and_save_print_to_ram(). Is blocking, restores
|
|
|
+//! print fan speed, waits for extruder temperature restore, then restores
|
|
|
+//! position and continues print moves.
|
|
|
+//!
|
|
|
+//! Internally lcd_update() is called by wait_for_heater().
|
|
|
//!
|
|
|
//! @param e_move
|
|
|
void restore_print_from_ram_and_continue(float e_move)
|
|
@@ -9417,7 +10125,9 @@ void restore_print_from_ram_and_continue(float e_move)
|
|
|
// for (int axis = X_AXIS; axis <= E_AXIS; axis++)
|
|
|
// current_position[axis] = st_get_position_mm(axis);
|
|
|
active_extruder = saved_active_extruder; //restore active_extruder
|
|
|
- if (saved_extruder_temperature) {
|
|
|
+ fanSpeed = saved_fanSpeed;
|
|
|
+ if (degTargetHotend(saved_active_extruder) != saved_extruder_temperature)
|
|
|
+ {
|
|
|
setTargetHotendSafe(saved_extruder_temperature, saved_active_extruder);
|
|
|
heating_status = 1;
|
|
|
wait_for_heater(_millis(), saved_active_extruder);
|
|
@@ -9425,9 +10135,13 @@ void restore_print_from_ram_and_continue(float e_move)
|
|
|
}
|
|
|
feedrate = saved_feedrate2; //restore feedrate
|
|
|
axis_relative_modes[E_AXIS] = saved_extruder_relative_mode;
|
|
|
- fanSpeed = saved_fanSpeed;
|
|
|
float e = saved_pos[E_AXIS] - e_move;
|
|
|
plan_set_e_position(e);
|
|
|
+
|
|
|
+ #ifdef FANCHECK
|
|
|
+ fans_check_enabled = false;
|
|
|
+ #endif
|
|
|
+
|
|
|
//first move print head in XY to the saved position:
|
|
|
plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], current_position[Z_AXIS], saved_pos[E_AXIS] - e_move, homing_feedrate[Z_AXIS]/13, active_extruder);
|
|
|
st_synchronize();
|
|
@@ -9438,13 +10152,16 @@ void restore_print_from_ram_and_continue(float e_move)
|
|
|
plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], saved_pos[Z_AXIS], saved_pos[E_AXIS], 35, active_extruder);
|
|
|
st_synchronize();
|
|
|
|
|
|
+ #ifdef FANCHECK
|
|
|
+ fans_check_enabled = true;
|
|
|
+ #endif
|
|
|
+
|
|
|
memcpy(current_position, saved_pos, sizeof(saved_pos));
|
|
|
memcpy(destination, current_position, sizeof(destination));
|
|
|
if (saved_printing_type == PRINTING_TYPE_SD) { //was sd printing
|
|
|
card.setIndex(saved_sdpos);
|
|
|
sdpos_atomic = saved_sdpos;
|
|
|
card.sdprinting = true;
|
|
|
- printf_P(PSTR("ok\n")); //dummy response because of octoprint is waiting for this
|
|
|
}
|
|
|
else if (saved_printing_type == PRINTING_TYPE_USB) { //was usb printing
|
|
|
gcode_LastN = saved_sdpos; //saved_sdpos was reused for storing line number when usb printing
|
|
@@ -9454,6 +10171,7 @@ void restore_print_from_ram_and_continue(float e_move)
|
|
|
else {
|
|
|
//not sd printing nor usb printing
|
|
|
}
|
|
|
+ printf_P(PSTR("ok\n")); //dummy response because of octoprint is waiting for this
|
|
|
lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
|
saved_printing = false;
|
|
|
}
|
|
@@ -9590,7 +10308,7 @@ void M600_wait_for_user(float HotendTempBckp) {
|
|
|
}
|
|
|
SET_OUTPUT(BEEPER);
|
|
|
if (counterBeep == 0) {
|
|
|
- if((eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst))
|
|
|
+ if((eSoundMode==e_SOUND_MODE_BLIND)|| (eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst))
|
|
|
{
|
|
|
bFirst=false;
|
|
|
WRITE(BEEPER, HIGH);
|
|
@@ -9693,10 +10411,7 @@ void M600_load_filament() {
|
|
|
#ifdef FILAMENT_SENSOR
|
|
|
if (fsensor_check_autoload())
|
|
|
{
|
|
|
-if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
- _tone(BEEPER, 1000);
|
|
|
- delay_keep_alive(50);
|
|
|
- _noTone(BEEPER);
|
|
|
+ Sound_MakeCustom(50,1000,false);
|
|
|
break;
|
|
|
}
|
|
|
#endif //FILAMENT_SENSOR
|
|
@@ -9712,10 +10427,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
|
|
|
M600_load_filament_movements();
|
|
|
|
|
|
-if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|
|
- _tone(BEEPER, 500);
|
|
|
- delay_keep_alive(50);
|
|
|
- _noTone(BEEPER);
|
|
|
+ Sound_MakeCustom(50,1000,false);
|
|
|
|
|
|
#ifdef FSENSOR_QUALITY
|
|
|
fsensor_oq_meassure_stop();
|
|
@@ -9751,3 +10463,69 @@ void marlin_wait_for_click()
|
|
|
}
|
|
|
|
|
|
#define FIL_LOAD_LENGTH 60
|
|
|
+
|
|
|
+#ifdef PSU_Delta
|
|
|
+bool bEnableForce_z;
|
|
|
+
|
|
|
+void init_force_z()
|
|
|
+{
|
|
|
+WRITE(Z_ENABLE_PIN,Z_ENABLE_ON);
|
|
|
+bEnableForce_z=true; // "true"-value enforce "disable_force_z()" executing
|
|
|
+disable_force_z();
|
|
|
+}
|
|
|
+
|
|
|
+void check_force_z()
|
|
|
+{
|
|
|
+if(!(bEnableForce_z||eeprom_read_byte((uint8_t*)EEPROM_SILENT)))
|
|
|
+ init_force_z(); // causes enforced switching into disable-state
|
|
|
+}
|
|
|
+
|
|
|
+void disable_force_z()
|
|
|
+{
|
|
|
+uint16_t z_microsteps=0;
|
|
|
+
|
|
|
+if(!bEnableForce_z)
|
|
|
+ return; // motor already disabled (may be ;-p )
|
|
|
+bEnableForce_z=false;
|
|
|
+
|
|
|
+// alignment to full-step
|
|
|
+#ifdef TMC2130
|
|
|
+z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS);
|
|
|
+#endif // TMC2130
|
|
|
+planner_abort_hard();
|
|
|
+sei();
|
|
|
+plan_buffer_line(
|
|
|
+ current_position[X_AXIS],
|
|
|
+ current_position[Y_AXIS],
|
|
|
+ current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS],
|
|
|
+ current_position[E_AXIS],
|
|
|
+ 40, active_extruder);
|
|
|
+st_synchronize();
|
|
|
+
|
|
|
+// switching to silent mode
|
|
|
+#ifdef TMC2130
|
|
|
+tmc2130_mode=TMC2130_MODE_SILENT;
|
|
|
+update_mode_profile();
|
|
|
+tmc2130_init(true);
|
|
|
+#endif // TMC2130
|
|
|
+
|
|
|
+axis_known_position[Z_AXIS]=false;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+void enable_force_z()
|
|
|
+{
|
|
|
+if(bEnableForce_z)
|
|
|
+ return; // motor already enabled (may be ;-p )
|
|
|
+bEnableForce_z=true;
|
|
|
+
|
|
|
+// mode recovering
|
|
|
+#ifdef TMC2130
|
|
|
+tmc2130_mode=eeprom_read_byte((uint8_t*)EEPROM_SILENT)?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL;
|
|
|
+update_mode_profile();
|
|
|
+tmc2130_init(true);
|
|
|
+#endif // TMC2130
|
|
|
+
|
|
|
+WRITE(Z_ENABLE_PIN,Z_ENABLE_ON); // slightly redundant ;-p
|
|
|
+}
|
|
|
+#endif // PSU_Delta
|