summaryrefslogtreecommitdiff
path: root/Sprinter
diff options
context:
space:
mode:
authorkliment <kliment.yanev@gmail.com>2011-08-03 02:46:06 -0700
committerkliment <kliment.yanev@gmail.com>2011-08-03 02:46:06 -0700
commit6fe2dbe3662030573759fdf35163b068b6d9cb17 (patch)
tree1befeb80f24102d80517807c880410ae1be6ae39 /Sprinter
parent96291e27a89f2e68e00a3d90f2a8bd3b8bba8d97 (diff)
parent02dfbc071d295e50f2bd752508226672850b7fe2 (diff)
Merge pull request #65 from blddk/master
M42 for toggling individual pins or setting PWM, modified MINTEMP to apply to heated bed
Diffstat (limited to 'Sprinter')
-rw-r--r--Sprinter/Sprinter.pde30
-rw-r--r--Sprinter/pins.h3
2 files changed, 33 insertions, 0 deletions
diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde
index 76c221f..1173c79 100644
--- a/Sprinter/Sprinter.pde
+++ b/Sprinter/Sprinter.pde
@@ -43,6 +43,7 @@
// M27 - Report SD print status
// M28 - Start SD write (M28 filename.g)
// M29 - Stop SD write
+// M42 - Set output on free pins, on a non pwm pin (over pin 13 on an arduino mega) use S255 to turn it on and S0 to turn it off. Use P to decide the pin (M42 P23 S255) would turn pin 23 on
// M81 - Turn off Power Supply
// M82 - Set E codes absolute (default)
// M83 - Set E codes relative while in Absolute Coordinates (G90) mode
@@ -724,6 +725,31 @@ inline void process_commands()
//savetosd = false;
break;
#endif
+ case 42: //M42 -Change pin status via gcode
+ if (code_seen('S'))
+ {
+ int pin_status = code_value();
+ if (code_seen('P') && pin_status >= 0 && pin_status <= 255)
+ {
+ int pin_number = code_value();
+ for(int i = 0; i < sizeof(sensitive_pins); i++)
+ {
+ if (sensitive_pins[i] == pin_number)
+ {
+ pin_number = -1;
+ break;
+ }
+ }
+
+ if (pin_number > -1)
+ {
+ pinMode(pin_number, OUTPUT);
+ digitalWrite(pin_number, pin_status);
+ analogWrite(pin_number, pin_status);
+ }
+ }
+ }
+ break;
case 104: // M104
if (code_seen('S')) target_raw = temp2analogh(code_value());
#ifdef WATCHPERIOD
@@ -1496,7 +1522,11 @@ void manage_heater()
#endif
+ #ifdef MINTEMP
+ if(current_bed_raw >= target_bed_raw || current_bed_raw < minttemp)
+ #else
if(current_bed_raw >= target_bed_raw)
+ #endif
{
WRITE(HEATER_1_PIN,LOW);
}
diff --git a/Sprinter/pins.h b/Sprinter/pins.h
index 720f3a9..9c38bed 100644
--- a/Sprinter/pins.h
+++ b/Sprinter/pins.h
@@ -495,4 +495,7 @@
#endif
+//List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!
+const int sensitive_pins[] = {0, 1, X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, E_STEP_PIN, E_DIR_PIN, E_ENABLE_PIN, LED_PIN, PS_ON_PIN, HEATER_0_PIN, HEATER_1_PIN, FAN_PIN, TEMP_0_PIN, TEMP_1_PIN};
+
#endif