|
@ -40,11 +40,11 @@ |
|
|
#include "language.h" |
|
|
#include "language.h" |
|
|
#include "pins_arduino.h" |
|
|
#include "pins_arduino.h" |
|
|
|
|
|
|
|
|
#if (defined NUM_SERVOS) && (NUM_SERVOS > 0) |
|
|
#if NUM_SERVOS > 0 |
|
|
#include "Servo.h" |
|
|
#include "Servo.h" |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if DIGIPOTSS_PIN > -1 |
|
|
#if DIGIPOTSS_PIN > 0 |
|
|
#include <SPI.h> |
|
|
#include <SPI.h> |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
@ -102,7 +102,7 @@ |
|
|
// M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
|
|
|
// M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
|
|
|
// M92 - Set axis_steps_per_unit - same syntax as G92
|
|
|
// M92 - Set axis_steps_per_unit - same syntax as G92
|
|
|
// M114 - Output current position to serial port
|
|
|
// M114 - Output current position to serial port
|
|
|
// M115 - Capabilities string
|
|
|
// M115 - Capabilities string
|
|
|
// M117 - display message
|
|
|
// M117 - display message
|
|
|
// M119 - Output Endstop status to serial port
|
|
|
// M119 - Output Endstop status to serial port
|
|
|
// M126 - Solenoid Air Valve Open (BariCUDA support by jmil)
|
|
|
// M126 - Solenoid Air Valve Open (BariCUDA support by jmil)
|
|
@ -230,7 +230,7 @@ static uint8_t tmp_extruder; |
|
|
|
|
|
|
|
|
bool Stopped=false; |
|
|
bool Stopped=false; |
|
|
|
|
|
|
|
|
#if (defined NUM_SERVOS) && (NUM_SERVOS > 0) |
|
|
#if NUM_SERVOS > 0 |
|
|
Servo servos[NUM_SERVOS]; |
|
|
Servo servos[NUM_SERVOS]; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
@ -309,7 +309,7 @@ void setup_killpin() |
|
|
void setup_photpin() |
|
|
void setup_photpin() |
|
|
{ |
|
|
{ |
|
|
#ifdef PHOTOGRAPH_PIN |
|
|
#ifdef PHOTOGRAPH_PIN |
|
|
#if (PHOTOGRAPH_PIN > -1) |
|
|
#if (PHOTOGRAPH_PIN > 0) |
|
|
SET_OUTPUT(PHOTOGRAPH_PIN); |
|
|
SET_OUTPUT(PHOTOGRAPH_PIN); |
|
|
WRITE(PHOTOGRAPH_PIN, LOW); |
|
|
WRITE(PHOTOGRAPH_PIN, LOW); |
|
|
#endif |
|
|
#endif |
|
@ -324,7 +324,7 @@ void setup_powerhold() |
|
|
WRITE(SUICIDE_PIN, HIGH); |
|
|
WRITE(SUICIDE_PIN, HIGH); |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
#if (PS_ON_PIN > -1) |
|
|
#if (PS_ON_PIN > 0) |
|
|
SET_OUTPUT(PS_ON_PIN); |
|
|
SET_OUTPUT(PS_ON_PIN); |
|
|
WRITE(PS_ON_PIN, PS_ON_AWAKE); |
|
|
WRITE(PS_ON_PIN, PS_ON_AWAKE); |
|
|
#endif |
|
|
#endif |
|
@ -333,7 +333,7 @@ void setup_powerhold() |
|
|
void suicide() |
|
|
void suicide() |
|
|
{ |
|
|
{ |
|
|
#ifdef SUICIDE_PIN |
|
|
#ifdef SUICIDE_PIN |
|
|
#if (SUICIDE_PIN> -1) |
|
|
#if (SUICIDE_PIN > 0) |
|
|
SET_OUTPUT(SUICIDE_PIN); |
|
|
SET_OUTPUT(SUICIDE_PIN); |
|
|
WRITE(SUICIDE_PIN, LOW); |
|
|
WRITE(SUICIDE_PIN, LOW); |
|
|
#endif |
|
|
#endif |
|
@ -342,16 +342,16 @@ void suicide() |
|
|
|
|
|
|
|
|
void servo_init() |
|
|
void servo_init() |
|
|
{ |
|
|
{ |
|
|
#if (NUM_SERVOS >= 1) && defined (SERVO0_PIN) && (SERVO0_PIN > -1) |
|
|
#if (NUM_SERVOS >= 1) && (SERVO0_PIN > 0) |
|
|
servos[0].attach(SERVO0_PIN); |
|
|
servos[0].attach(SERVO0_PIN); |
|
|
#endif |
|
|
#endif |
|
|
#if (NUM_SERVOS >= 2) && defined (SERVO1_PIN) && (SERVO1_PIN > -1) |
|
|
#if (NUM_SERVOS >= 2) && (SERVO1_PIN > 0) |
|
|
servos[1].attach(SERVO1_PIN); |
|
|
servos[1].attach(SERVO1_PIN); |
|
|
#endif |
|
|
#endif |
|
|
#if (NUM_SERVOS >= 3) && defined (SERVO2_PIN) && (SERVO2_PIN > -1) |
|
|
#if (NUM_SERVOS >= 3) && (SERVO2_PIN > 0) |
|
|
servos[2].attach(SERVO2_PIN); |
|
|
servos[2].attach(SERVO2_PIN); |
|
|
#endif |
|
|
#endif |
|
|
#if (NUM_SERVOS >= 4) && defined (SERVO3_PIN) && (SERVO3_PIN > -1) |
|
|
#if (NUM_SERVOS >= 4) && (SERVO3_PIN > 0) |
|
|
servos[3].attach(SERVO3_PIN); |
|
|
servos[3].attach(SERVO3_PIN); |
|
|
#endif |
|
|
#endif |
|
|
#if (NUM_SERVOS >= 5) |
|
|
#if (NUM_SERVOS >= 5) |
|
@ -433,9 +433,9 @@ void loop() |
|
|
#ifdef SDSUPPORT |
|
|
#ifdef SDSUPPORT |
|
|
if(card.saving) |
|
|
if(card.saving) |
|
|
{ |
|
|
{ |
|
|
if(strstr_P(cmdbuffer[bufindr], PSTR("M29")) == NULL) |
|
|
if(strstr_P(cmdbuffer[bufindr], PSTR("M29")) == NULL) |
|
|
{ |
|
|
{ |
|
|
card.write_command(cmdbuffer[bufindr]); |
|
|
card.write_command(cmdbuffer[bufindr]); |
|
|
if(card.logging) |
|
|
if(card.logging) |
|
|
{ |
|
|
{ |
|
|
process_commands(); |
|
|
process_commands(); |
|
@ -444,16 +444,16 @@ void loop() |
|
|
{ |
|
|
{ |
|
|
SERIAL_PROTOCOLLNPGM(MSG_OK); |
|
|
SERIAL_PROTOCOLLNPGM(MSG_OK); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
card.closefile(); |
|
|
card.closefile(); |
|
|
SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED); |
|
|
SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
process_commands(); |
|
|
process_commands(); |
|
|
} |
|
|
} |
|
|
#else |
|
|
#else |
|
|
process_commands(); |
|
|
process_commands(); |
|
@ -548,10 +548,10 @@ void get_command() |
|
|
case 2: |
|
|
case 2: |
|
|
case 3: |
|
|
case 3: |
|
|
if(Stopped == false) { // If printer is stopped by an error the G[0-3] codes are ignored.
|
|
|
if(Stopped == false) { // If printer is stopped by an error the G[0-3] codes are ignored.
|
|
|
#ifdef SDSUPPORT |
|
|
#ifdef SDSUPPORT |
|
|
if(card.saving) |
|
|
if(card.saving) |
|
|
break; |
|
|
break; |
|
|
#endif //SDSUPPORT
|
|
|
#endif //SDSUPPORT
|
|
|
SERIAL_PROTOCOLLNPGM(MSG_OK); |
|
|
SERIAL_PROTOCOLLNPGM(MSG_OK); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
@ -645,17 +645,17 @@ bool code_seen(char code) |
|
|
return (strchr_pointer != NULL); //Return True if a character was found
|
|
|
return (strchr_pointer != NULL); //Return True if a character was found
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#define DEFINE_PGM_READ_ANY(type, reader) \ |
|
|
#define DEFINE_PGM_READ_ANY(type, reader) \ |
|
|
static inline type pgm_read_any(const type *p) \ |
|
|
static inline type pgm_read_any(const type *p) \ |
|
|
{ return pgm_read_##reader##_near(p); } |
|
|
{ return pgm_read_##reader##_near(p); } |
|
|
|
|
|
|
|
|
DEFINE_PGM_READ_ANY(float, float); |
|
|
DEFINE_PGM_READ_ANY(float, float); |
|
|
DEFINE_PGM_READ_ANY(signed char, byte); |
|
|
DEFINE_PGM_READ_ANY(signed char, byte); |
|
|
|
|
|
|
|
|
#define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \ |
|
|
#define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \ |
|
|
static const PROGMEM type array##_P[3] = \ |
|
|
static const PROGMEM type array##_P[3] = \ |
|
|
{ X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \ |
|
|
{ X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \ |
|
|
static inline type array(int axis) \ |
|
|
static inline type array(int axis) \ |
|
|
{ return pgm_read_any(&array##_P[axis]); } |
|
|
{ return pgm_read_any(&array##_P[axis]); } |
|
|
|
|
|
|
|
|
XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS); |
|
|
XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS); |
|
@ -673,7 +673,7 @@ static void axis_is_at_home(int axis) { |
|
|
|
|
|
|
|
|
static void homeaxis(int axis) { |
|
|
static void homeaxis(int axis) { |
|
|
#define HOMEAXIS_DO(LETTER) \ |
|
|
#define HOMEAXIS_DO(LETTER) \ |
|
|
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1)) |
|
|
((LETTER##_MIN_PIN > 0 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > 0 && LETTER##_HOME_DIR==1)) |
|
|
|
|
|
|
|
|
if (axis==X_AXIS ? HOMEAXIS_DO(X) : |
|
|
if (axis==X_AXIS ? HOMEAXIS_DO(X) : |
|
|
axis==Y_AXIS ? HOMEAXIS_DO(Y) : |
|
|
axis==Y_AXIS ? HOMEAXIS_DO(Y) : |
|
@ -911,13 +911,13 @@ void process_commands() |
|
|
previous_millis_cmd = millis(); |
|
|
previous_millis_cmd = millis(); |
|
|
if (codenum > 0){ |
|
|
if (codenum > 0){ |
|
|
codenum += millis(); // keep track of when we started waiting
|
|
|
codenum += millis(); // keep track of when we started waiting
|
|
|
while(millis() < codenum && !LCD_CLICKED){ |
|
|
while(millis() < codenum && !lcd_clicked()){ |
|
|
manage_heater(); |
|
|
manage_heater(); |
|
|
manage_inactivity(); |
|
|
manage_inactivity(); |
|
|
lcd_update(); |
|
|
lcd_update(); |
|
|
} |
|
|
} |
|
|
}else{ |
|
|
}else{ |
|
|
while(!LCD_CLICKED){ |
|
|
while(!lcd_clicked()){ |
|
|
manage_heater(); |
|
|
manage_heater(); |
|
|
manage_inactivity(); |
|
|
manage_inactivity(); |
|
|
lcd_update(); |
|
|
lcd_update(); |
|
@ -987,17 +987,17 @@ void process_commands() |
|
|
//card,saving = false;
|
|
|
//card,saving = false;
|
|
|
break; |
|
|
break; |
|
|
case 30: //M30 <filename> Delete File
|
|
|
case 30: //M30 <filename> Delete File
|
|
|
if (card.cardOK){ |
|
|
if (card.cardOK){ |
|
|
card.closefile(); |
|
|
card.closefile(); |
|
|
starpos = (strchr(strchr_pointer + 4,'*')); |
|
|
starpos = (strchr(strchr_pointer + 4,'*')); |
|
|
if(starpos != NULL){ |
|
|
if(starpos != NULL){ |
|
|
char* npos = strchr(cmdbuffer[bufindr], 'N'); |
|
|
char* npos = strchr(cmdbuffer[bufindr], 'N'); |
|
|
strchr_pointer = strchr(npos,' ') + 1; |
|
|
strchr_pointer = strchr(npos,' ') + 1; |
|
|
*(starpos-1) = '\0'; |
|
|
*(starpos-1) = '\0'; |
|
|
} |
|
|
} |
|
|
card.removeFile(strchr_pointer + 4); |
|
|
card.removeFile(strchr_pointer + 4); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
case 928: //M928 - Start SD write
|
|
|
case 928: //M928 - Start SD write
|
|
|
starpos = (strchr(strchr_pointer + 5,'*')); |
|
|
starpos = (strchr(strchr_pointer + 5,'*')); |
|
|
if(starpos != NULL){ |
|
|
if(starpos != NULL){ |
|
@ -1062,12 +1062,12 @@ void process_commands() |
|
|
if(setTargetedHotend(105)){ |
|
|
if(setTargetedHotend(105)){ |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
#if (TEMP_0_PIN > -1) |
|
|
#if (TEMP_0_PIN > 0) |
|
|
SERIAL_PROTOCOLPGM("ok T:"); |
|
|
SERIAL_PROTOCOLPGM("ok T:"); |
|
|
SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1); |
|
|
SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1); |
|
|
SERIAL_PROTOCOLPGM(" /"); |
|
|
SERIAL_PROTOCOLPGM(" /"); |
|
|
SERIAL_PROTOCOL_F(degTargetHotend(tmp_extruder),1); |
|
|
SERIAL_PROTOCOL_F(degTargetHotend(tmp_extruder),1); |
|
|
#if TEMP_BED_PIN > -1 |
|
|
#if TEMP_BED_PIN > 0 |
|
|
SERIAL_PROTOCOLPGM(" B:"); |
|
|
SERIAL_PROTOCOLPGM(" B:"); |
|
|
SERIAL_PROTOCOL_F(degBed(),1); |
|
|
SERIAL_PROTOCOL_F(degBed(),1); |
|
|
SERIAL_PROTOCOLPGM(" /"); |
|
|
SERIAL_PROTOCOLPGM(" /"); |
|
@ -1165,7 +1165,7 @@ void process_commands() |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
case 190: // M190 - Wait for bed heater to reach target.
|
|
|
case 190: // M190 - Wait for bed heater to reach target.
|
|
|
#if TEMP_BED_PIN > -1 |
|
|
#if TEMP_BED_PIN > 0 |
|
|
LCD_MESSAGEPGM(MSG_BED_HEATING); |
|
|
LCD_MESSAGEPGM(MSG_BED_HEATING); |
|
|
if (code_seen('S')) setTargetBed(code_value()); |
|
|
if (code_seen('S')) setTargetBed(code_value()); |
|
|
codenum = millis(); |
|
|
codenum = millis(); |
|
@ -1192,7 +1192,7 @@ void process_commands() |
|
|
#endif |
|
|
#endif |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
#if FAN_PIN > -1 |
|
|
#if FAN_PIN > 0 |
|
|
case 106: //M106 Fan On
|
|
|
case 106: //M106 Fan On
|
|
|
if (code_seen('S')){ |
|
|
if (code_seen('S')){ |
|
|
fanSpeed=constrain(code_value(),0,255); |
|
|
fanSpeed=constrain(code_value(),0,255); |
|
@ -1206,8 +1206,8 @@ void process_commands() |
|
|
break; |
|
|
break; |
|
|
#endif //FAN_PIN
|
|
|
#endif //FAN_PIN
|
|
|
#ifdef BARICUDA |
|
|
#ifdef BARICUDA |
|
|
// PWM for HEATER_1_PIN
|
|
|
// PWM for HEATER_1_PIN
|
|
|
#if HEATER_1_PIN > -1 |
|
|
#if HEATER_1_PIN > 0 |
|
|
case 126: //M126 valve open
|
|
|
case 126: //M126 valve open
|
|
|
if (code_seen('S')){ |
|
|
if (code_seen('S')){ |
|
|
ValvePressure=constrain(code_value(),0,255); |
|
|
ValvePressure=constrain(code_value(),0,255); |
|
@ -1221,8 +1221,8 @@ void process_commands() |
|
|
break; |
|
|
break; |
|
|
#endif //HEATER_1_PIN
|
|
|
#endif //HEATER_1_PIN
|
|
|
|
|
|
|
|
|
// PWM for HEATER_2_PIN
|
|
|
// PWM for HEATER_2_PIN
|
|
|
#if HEATER_2_PIN > -1 |
|
|
#if HEATER_2_PIN > 0 |
|
|
case 128: //M128 valve open
|
|
|
case 128: //M128 valve open
|
|
|
if (code_seen('S')){ |
|
|
if (code_seen('S')){ |
|
|
EtoPPressure=constrain(code_value(),0,255); |
|
|
EtoPPressure=constrain(code_value(),0,255); |
|
@ -1237,7 +1237,7 @@ void process_commands() |
|
|
#endif //HEATER_2_PIN
|
|
|
#endif //HEATER_2_PIN
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if (PS_ON_PIN > -1) |
|
|
#if (PS_ON_PIN > 0) |
|
|
case 80: // M80 - ATX Power On
|
|
|
case 80: // M80 - ATX Power On
|
|
|
SET_OUTPUT(PS_ON_PIN); //GND
|
|
|
SET_OUTPUT(PS_ON_PIN); //GND
|
|
|
WRITE(PS_ON_PIN, PS_ON_AWAKE); |
|
|
WRITE(PS_ON_PIN, PS_ON_AWAKE); |
|
@ -1246,14 +1246,14 @@ void process_commands() |
|
|
|
|
|
|
|
|
case 81: // M81 - ATX Power Off
|
|
|
case 81: // M81 - ATX Power Off
|
|
|
|
|
|
|
|
|
#if defined SUICIDE_PIN && SUICIDE_PIN > -1 |
|
|
#if defined SUICIDE_PIN && SUICIDE_PIN > 0 |
|
|
st_synchronize(); |
|
|
st_synchronize(); |
|
|
suicide(); |
|
|
suicide(); |
|
|
#elif (PS_ON_PIN > -1) |
|
|
#elif (PS_ON_PIN > 0) |
|
|
SET_OUTPUT(PS_ON_PIN); |
|
|
SET_OUTPUT(PS_ON_PIN); |
|
|
WRITE(PS_ON_PIN, PS_ON_ASLEEP); |
|
|
WRITE(PS_ON_PIN, PS_ON_ASLEEP); |
|
|
#endif |
|
|
#endif |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 82: |
|
|
case 82: |
|
|
axis_relative_modes[3] = false; |
|
|
axis_relative_modes[3] = false; |
|
@ -1354,27 +1354,27 @@ void process_commands() |
|
|
break; |
|
|
break; |
|
|
case 119: // M119
|
|
|
case 119: // M119
|
|
|
SERIAL_PROTOCOLLN(MSG_M119_REPORT); |
|
|
SERIAL_PROTOCOLLN(MSG_M119_REPORT); |
|
|
#if (X_MIN_PIN > -1) |
|
|
#if (X_MIN_PIN > 0) |
|
|
SERIAL_PROTOCOLPGM(MSG_X_MIN); |
|
|
SERIAL_PROTOCOLPGM(MSG_X_MIN); |
|
|
SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); |
|
|
SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); |
|
|
#endif |
|
|
#endif |
|
|
#if (X_MAX_PIN > -1) |
|
|
#if (X_MAX_PIN > 0) |
|
|
SERIAL_PROTOCOLPGM(MSG_X_MAX); |
|
|
SERIAL_PROTOCOLPGM(MSG_X_MAX); |
|
|
SERIAL_PROTOCOLLN(((READ(X_MAX_PIN)^X_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); |
|
|
SERIAL_PROTOCOLLN(((READ(X_MAX_PIN)^X_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); |
|
|
#endif |
|
|
#endif |
|
|
#if (Y_MIN_PIN > -1) |
|
|
#if (Y_MIN_PIN > 0) |
|
|
SERIAL_PROTOCOLPGM(MSG_Y_MIN); |
|
|
SERIAL_PROTOCOLPGM(MSG_Y_MIN); |
|
|
SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); |
|
|
SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); |
|
|
#endif |
|
|
#endif |
|
|
#if (Y_MAX_PIN > -1) |
|
|
#if (Y_MAX_PIN > 0) |
|
|
SERIAL_PROTOCOLPGM(MSG_Y_MAX); |
|
|
SERIAL_PROTOCOLPGM(MSG_Y_MAX); |
|
|
SERIAL_PROTOCOLLN(((READ(Y_MAX_PIN)^Y_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); |
|
|
SERIAL_PROTOCOLLN(((READ(Y_MAX_PIN)^Y_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); |
|
|
#endif |
|
|
#endif |
|
|
#if (Z_MIN_PIN > -1) |
|
|
#if (Z_MIN_PIN > 0) |
|
|
SERIAL_PROTOCOLPGM(MSG_Z_MIN); |
|
|
SERIAL_PROTOCOLPGM(MSG_Z_MIN); |
|
|
SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); |
|
|
SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); |
|
|
#endif |
|
|
#endif |
|
|
#if (Z_MAX_PIN > -1) |
|
|
#if (Z_MAX_PIN > 0) |
|
|
SERIAL_PROTOCOLPGM(MSG_Z_MAX); |
|
|
SERIAL_PROTOCOLPGM(MSG_Z_MAX); |
|
|
SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); |
|
|
SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); |
|
|
#endif |
|
|
#endif |
|
@ -1389,7 +1389,7 @@ void process_commands() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
|
|
|
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
|
|
|
reset_acceleration_rates(); |
|
|
reset_acceleration_rates(); |
|
|
break; |
|
|
break; |
|
|
#if 0 // Not used for Sprinter/grbl gen6
|
|
|
#if 0 // Not used for Sprinter/grbl gen6
|
|
|
case 202: // M202
|
|
|
case 202: // M202
|
|
@ -1513,8 +1513,8 @@ void process_commands() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
#if (defined NUM_SERVOS) && (NUM_SERVOS > 0) |
|
|
#if NUM_SERVOS > 0 |
|
|
case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds
|
|
|
case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds
|
|
|
{ |
|
|
{ |
|
|
int servo_index = -1; |
|
|
int servo_index = -1; |
|
@ -1545,16 +1545,20 @@ void process_commands() |
|
|
break; |
|
|
break; |
|
|
#endif // NUM_SERVOS > 0
|
|
|
#endif // NUM_SERVOS > 0
|
|
|
|
|
|
|
|
|
#if defined(LARGE_FLASH) && LARGE_FLASH == true && defined(BEEPER) && BEEPER > -1 |
|
|
#if LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) ) |
|
|
case 300: // M300
|
|
|
case 300: // M300
|
|
|
{ |
|
|
{ |
|
|
int beepS = 1; |
|
|
int beepS = 400; |
|
|
int beepP = 1000; |
|
|
int beepP = 1000; |
|
|
if(code_seen('S')) beepS = code_value(); |
|
|
if(code_seen('S')) beepS = code_value(); |
|
|
if(code_seen('P')) beepP = code_value(); |
|
|
if(code_seen('P')) beepP = code_value(); |
|
|
tone(BEEPER, beepS); |
|
|
#if BEEPER > 0 |
|
|
delay(beepP); |
|
|
tone(BEEPER, beepS); |
|
|
noTone(BEEPER); |
|
|
delay(beepP); |
|
|
|
|
|
noTone(BEEPER); |
|
|
|
|
|
#elif defined(ULTRALCD) |
|
|
|
|
|
lcd_buzz(beepS, beepP); |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
#endif // M300
|
|
|
#endif // M300
|
|
@ -1572,7 +1576,7 @@ void process_commands() |
|
|
|
|
|
|
|
|
updatePID(); |
|
|
updatePID(); |
|
|
SERIAL_PROTOCOL(MSG_OK); |
|
|
SERIAL_PROTOCOL(MSG_OK); |
|
|
SERIAL_PROTOCOL(" p:"); |
|
|
SERIAL_PROTOCOL(" p:"); |
|
|
SERIAL_PROTOCOL(Kp); |
|
|
SERIAL_PROTOCOL(Kp); |
|
|
SERIAL_PROTOCOL(" i:"); |
|
|
SERIAL_PROTOCOL(" i:"); |
|
|
SERIAL_PROTOCOL(unscalePID_i(Ki)); |
|
|
SERIAL_PROTOCOL(unscalePID_i(Ki)); |
|
@ -1596,7 +1600,7 @@ void process_commands() |
|
|
|
|
|
|
|
|
updatePID(); |
|
|
updatePID(); |
|
|
SERIAL_PROTOCOL(MSG_OK); |
|
|
SERIAL_PROTOCOL(MSG_OK); |
|
|
SERIAL_PROTOCOL(" p:"); |
|
|
SERIAL_PROTOCOL(" p:"); |
|
|
SERIAL_PROTOCOL(bedKp); |
|
|
SERIAL_PROTOCOL(bedKp); |
|
|
SERIAL_PROTOCOL(" i:"); |
|
|
SERIAL_PROTOCOL(" i:"); |
|
|
SERIAL_PROTOCOL(unscalePID_i(bedKi)); |
|
|
SERIAL_PROTOCOL(unscalePID_i(bedKi)); |
|
@ -1609,7 +1613,7 @@ void process_commands() |
|
|
case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
|
|
|
case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
|
|
|
{ |
|
|
{ |
|
|
#ifdef PHOTOGRAPH_PIN |
|
|
#ifdef PHOTOGRAPH_PIN |
|
|
#if (PHOTOGRAPH_PIN > -1) |
|
|
#if (PHOTOGRAPH_PIN > 0) |
|
|
const uint8_t NUM_PULSES=16; |
|
|
const uint8_t NUM_PULSES=16; |
|
|
const float PULSE_LENGTH=0.01524; |
|
|
const float PULSE_LENGTH=0.01524; |
|
|
for(int i=0; i < NUM_PULSES; i++) { |
|
|
for(int i=0; i < NUM_PULSES; i++) { |
|
@ -1641,8 +1645,8 @@ void process_commands() |
|
|
int e=0; |
|
|
int e=0; |
|
|
int c=5; |
|
|
int c=5; |
|
|
if (code_seen('E')) e=code_value(); |
|
|
if (code_seen('E')) e=code_value(); |
|
|
if (e<0) |
|
|
if (e<0) |
|
|
temp=70; |
|
|
temp=70; |
|
|
if (code_seen('S')) temp=code_value(); |
|
|
if (code_seen('S')) temp=code_value(); |
|
|
if (code_seen('C')) c=code_value(); |
|
|
if (code_seen('C')) c=code_value(); |
|
|
PID_autotune(temp, e, c); |
|
|
PID_autotune(temp, e, c); |
|
@ -1765,23 +1769,24 @@ void process_commands() |
|
|
delay(100); |
|
|
delay(100); |
|
|
LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE); |
|
|
LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE); |
|
|
uint8_t cnt=0; |
|
|
uint8_t cnt=0; |
|
|
while(!LCD_CLICKED){ |
|
|
while(!lcd_clicked()){ |
|
|
cnt++; |
|
|
cnt++; |
|
|
manage_heater(); |
|
|
manage_heater(); |
|
|
manage_inactivity(); |
|
|
manage_inactivity(); |
|
|
lcd_update(); |
|
|
lcd_update(); |
|
|
|
|
|
|
|
|
#if BEEPER > -1 |
|
|
|
|
|
if(cnt==0) |
|
|
if(cnt==0) |
|
|
{ |
|
|
{ |
|
|
|
|
|
#if BEEPER > 0 |
|
|
SET_OUTPUT(BEEPER); |
|
|
SET_OUTPUT(BEEPER); |
|
|
|
|
|
|
|
|
WRITE(BEEPER,HIGH); |
|
|
WRITE(BEEPER,HIGH); |
|
|
delay(3); |
|
|
delay(3); |
|
|
WRITE(BEEPER,LOW); |
|
|
WRITE(BEEPER,LOW); |
|
|
delay(3); |
|
|
delay(3); |
|
|
} |
|
|
#else |
|
|
|
|
|
lcd_buzz(1000/6,100); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//return to normal
|
|
|
//return to normal
|
|
@ -1806,7 +1811,7 @@ void process_commands() |
|
|
#endif //FILAMENTCHANGEENABLE
|
|
|
#endif //FILAMENTCHANGEENABLE
|
|
|
case 907: // M907 Set digital trimpot motor current using axis codes.
|
|
|
case 907: // M907 Set digital trimpot motor current using axis codes.
|
|
|
{ |
|
|
{ |
|
|
#if DIGIPOTSS_PIN > -1 |
|
|
#if DIGIPOTSS_PIN > 0 |
|
|
for(int i=0;i<NUM_AXIS;i++) if(code_seen(axis_codes[i])) digipot_current(i,code_value()); |
|
|
for(int i=0;i<NUM_AXIS;i++) if(code_seen(axis_codes[i])) digipot_current(i,code_value()); |
|
|
if(code_seen('B')) digipot_current(4,code_value()); |
|
|
if(code_seen('B')) digipot_current(4,code_value()); |
|
|
if(code_seen('S')) for(int i=0;i<=4;i++) digipot_current(i,code_value()); |
|
|
if(code_seen('S')) for(int i=0;i<=4;i++) digipot_current(i,code_value()); |
|
@ -1815,7 +1820,7 @@ void process_commands() |
|
|
break; |
|
|
break; |
|
|
case 908: // M908 Control digital trimpot directly.
|
|
|
case 908: // M908 Control digital trimpot directly.
|
|
|
{ |
|
|
{ |
|
|
#if DIGIPOTSS_PIN > -1 |
|
|
#if DIGIPOTSS_PIN > 0 |
|
|
uint8_t channel,current; |
|
|
uint8_t channel,current; |
|
|
if(code_seen('P')) channel=code_value(); |
|
|
if(code_seen('P')) channel=code_value(); |
|
|
if(code_seen('S')) current=code_value(); |
|
|
if(code_seen('S')) current=code_value(); |
|
@ -1825,7 +1830,7 @@ void process_commands() |
|
|
break; |
|
|
break; |
|
|
case 350: // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
|
|
|
case 350: // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
|
|
|
{ |
|
|
{ |
|
|
#if X_MS1_PIN > -1 |
|
|
#if X_MS1_PIN > 0 |
|
|
if(code_seen('S')) for(int i=0;i<=4;i++) microstep_mode(i,code_value()); |
|
|
if(code_seen('S')) for(int i=0;i<=4;i++) microstep_mode(i,code_value()); |
|
|
for(int i=0;i<NUM_AXIS;i++) if(code_seen(axis_codes[i])) microstep_mode(i,(uint8_t)code_value()); |
|
|
for(int i=0;i<NUM_AXIS;i++) if(code_seen(axis_codes[i])) microstep_mode(i,(uint8_t)code_value()); |
|
|
if(code_seen('B')) microstep_mode(4,code_value()); |
|
|
if(code_seen('B')) microstep_mode(4,code_value()); |
|
@ -1835,7 +1840,7 @@ void process_commands() |
|
|
break; |
|
|
break; |
|
|
case 351: // M351 Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
|
|
|
case 351: // M351 Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
|
|
|
{ |
|
|
{ |
|
|
#if X_MS1_PIN > -1 |
|
|
#if X_MS1_PIN > 0 |
|
|
if(code_seen('S')) switch((int)code_value()) |
|
|
if(code_seen('S')) switch((int)code_value()) |
|
|
{ |
|
|
{ |
|
|
case 1: |
|
|
case 1: |
|
@ -2173,7 +2178,7 @@ void kill() |
|
|
disable_e1(); |
|
|
disable_e1(); |
|
|
disable_e2(); |
|
|
disable_e2(); |
|
|
|
|
|
|
|
|
if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT); |
|
|
if(PS_ON_PIN > 0) pinMode(PS_ON_PIN,INPUT); |
|
|
SERIAL_ERROR_START; |
|
|
SERIAL_ERROR_START; |
|
|
SERIAL_ERRORLNPGM(MSG_ERR_KILLED); |
|
|
SERIAL_ERRORLNPGM(MSG_ERR_KILLED); |
|
|
LCD_ALERTMESSAGEPGM(MSG_KILLED); |
|
|
LCD_ALERTMESSAGEPGM(MSG_KILLED); |
|
|