|
@@ -44,6 +44,11 @@
|
44
|
44
|
#include "language.h"
|
45
|
45
|
#include "pins_arduino.h"
|
46
|
46
|
|
|
47
|
+#ifdef BLINKM
|
|
48
|
+#include "BlinkM.h"
|
|
49
|
+#include "Wire.h"
|
|
50
|
+#endif
|
|
51
|
+
|
47
|
52
|
#if NUM_SERVOS > 0
|
48
|
53
|
#include "Servo.h"
|
49
|
54
|
#endif
|
|
@@ -118,6 +123,7 @@
|
118
|
123
|
// M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
|
119
|
124
|
// M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
|
120
|
125
|
// M140 - Set bed target temp
|
|
126
|
+// M150 - Set BlinkM Colour Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work.
|
121
|
127
|
// M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
|
122
|
128
|
// Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
|
123
|
129
|
// M200 - Set filament diameter
|
|
@@ -935,19 +941,28 @@ static void homeaxis(int axis) {
|
935
|
941
|
axis_home_dir = x_home_dir(active_extruder);
|
936
|
942
|
#endif
|
937
|
943
|
|
|
944
|
+ current_position[axis] = 0;
|
|
945
|
+ plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
946
|
+
|
938
|
947
|
// Engage Servo endstop if enabled
|
939
|
948
|
#ifdef SERVO_ENDSTOPS
|
940
|
|
-#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
|
941
|
|
- if (axis==Z_AXIS) engage_z_probe();
|
942
|
|
- else
|
943
|
|
-#endif
|
|
949
|
+ #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
|
|
950
|
+ if (axis==Z_AXIS) {
|
|
951
|
+ #if defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0)
|
|
952
|
+ destination[axis] = Z_RAISE_BEFORE_HOMING * axis_home_dir * (-1); // Set destination away from bed
|
|
953
|
+ feedrate = max_feedrate[axis];
|
|
954
|
+ plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
|
955
|
+ st_synchronize();
|
|
956
|
+ #endif
|
|
957
|
+ engage_z_probe();
|
|
958
|
+ }
|
|
959
|
+ else
|
|
960
|
+ #endif
|
944
|
961
|
if (servo_endstops[axis] > -1) {
|
945
|
962
|
servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
|
946
|
963
|
}
|
947
|
964
|
#endif
|
948
|
965
|
|
949
|
|
- current_position[axis] = 0;
|
950
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
951
|
966
|
destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
|
952
|
967
|
feedrate = homing_feedrate[axis];
|
953
|
968
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
@@ -1213,6 +1228,9 @@ void process_commands()
|
1213
|
1228
|
current_position[Z_AXIS]=code_value()+add_homeing[2];
|
1214
|
1229
|
}
|
1215
|
1230
|
}
|
|
1231
|
+ #ifdef ENABLE_AUTO_BED_LEVELING
|
|
1232
|
+ current_position[Z_AXIS] -= Z_PROBE_OFFSET_FROM_EXTRUDER; //Add Z_Probe offset (the distance is negative)
|
|
1233
|
+ #endif
|
1216
|
1234
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
1217
|
1235
|
#endif // else DELTA
|
1218
|
1236
|
|
|
@@ -1607,6 +1625,23 @@ void process_commands()
|
1607
|
1625
|
SERIAL_PROTOCOLPGM(" B@:");
|
1608
|
1626
|
SERIAL_PROTOCOL(getHeaterPower(-1));
|
1609
|
1627
|
|
|
1628
|
+ #ifdef SHOW_TEMP_ADC_VALUES
|
|
1629
|
+ #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
|
|
1630
|
+ SERIAL_PROTOCOLPGM(" ADC B:");
|
|
1631
|
+ SERIAL_PROTOCOL_F(degBed(),1);
|
|
1632
|
+ SERIAL_PROTOCOLPGM("C->");
|
|
1633
|
+ SERIAL_PROTOCOL_F(rawBedTemp()/OVERSAMPLENR,0);
|
|
1634
|
+ #endif
|
|
1635
|
+ for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
|
|
1636
|
+ SERIAL_PROTOCOLPGM(" T");
|
|
1637
|
+ SERIAL_PROTOCOL(cur_extruder);
|
|
1638
|
+ SERIAL_PROTOCOLPGM(":");
|
|
1639
|
+ SERIAL_PROTOCOL_F(degHotend(cur_extruder),1);
|
|
1640
|
+ SERIAL_PROTOCOLPGM("C->");
|
|
1641
|
+ SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder)/OVERSAMPLENR,0);
|
|
1642
|
+ }
|
|
1643
|
+ #endif
|
|
1644
|
+
|
1610
|
1645
|
SERIAL_PROTOCOLLN("");
|
1611
|
1646
|
return;
|
1612
|
1647
|
break;
|
|
@@ -1943,6 +1978,21 @@ void process_commands()
|
1943
|
1978
|
#endif
|
1944
|
1979
|
break;
|
1945
|
1980
|
//TODO: update for all axis, use for loop
|
|
1981
|
+ #ifdef BLINKM
|
|
1982
|
+ case 150: // M150
|
|
1983
|
+ {
|
|
1984
|
+ byte red;
|
|
1985
|
+ byte grn;
|
|
1986
|
+ byte blu;
|
|
1987
|
+
|
|
1988
|
+ if(code_seen('R')) red = code_value();
|
|
1989
|
+ if(code_seen('U')) grn = code_value();
|
|
1990
|
+ if(code_seen('B')) blu = code_value();
|
|
1991
|
+
|
|
1992
|
+ SendColors(red,grn,blu);
|
|
1993
|
+ }
|
|
1994
|
+ break;
|
|
1995
|
+ #endif //BLINKM
|
1946
|
1996
|
case 201: // M201
|
1947
|
1997
|
for(int8_t i=0; i < NUM_AXIS; i++)
|
1948
|
1998
|
{
|
|
@@ -2925,6 +2975,39 @@ void controllerFan()
|
2925
|
2975
|
}
|
2926
|
2976
|
#endif
|
2927
|
2977
|
|
|
2978
|
+#ifdef TEMP_STAT_LEDS
|
|
2979
|
+static bool blue_led = false;
|
|
2980
|
+static bool red_led = false;
|
|
2981
|
+static uint32_t stat_update = 0;
|
|
2982
|
+
|
|
2983
|
+void handle_status_leds(void) {
|
|
2984
|
+ float max_temp = 0.0;
|
|
2985
|
+ if(millis() > stat_update) {
|
|
2986
|
+ stat_update += 500; // Update every 0.5s
|
|
2987
|
+ for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
|
|
2988
|
+ max_temp = max(max_temp, degHotend(cur_extruder));
|
|
2989
|
+ max_temp = max(max_temp, degTargetHotend(cur_extruder));
|
|
2990
|
+ }
|
|
2991
|
+ #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
|
|
2992
|
+ max_temp = max(max_temp, degTargetBed());
|
|
2993
|
+ max_temp = max(max_temp, degBed());
|
|
2994
|
+ #endif
|
|
2995
|
+ if((max_temp > 55.0) && (red_led == false)) {
|
|
2996
|
+ digitalWrite(STAT_LED_RED, 1);
|
|
2997
|
+ digitalWrite(STAT_LED_BLUE, 0);
|
|
2998
|
+ red_led = true;
|
|
2999
|
+ blue_led = false;
|
|
3000
|
+ }
|
|
3001
|
+ if((max_temp < 54.0) && (blue_led == false)) {
|
|
3002
|
+ digitalWrite(STAT_LED_RED, 0);
|
|
3003
|
+ digitalWrite(STAT_LED_BLUE, 1);
|
|
3004
|
+ red_led = false;
|
|
3005
|
+ blue_led = true;
|
|
3006
|
+ }
|
|
3007
|
+ }
|
|
3008
|
+}
|
|
3009
|
+#endif
|
|
3010
|
+
|
2928
|
3011
|
void manage_inactivity()
|
2929
|
3012
|
{
|
2930
|
3013
|
if( (millis() - previous_millis_cmd) > max_inactive_time )
|
|
@@ -2978,7 +3061,10 @@ void manage_inactivity()
|
2978
|
3061
|
memcpy(destination,current_position,sizeof(destination));
|
2979
|
3062
|
prepare_move();
|
2980
|
3063
|
}
|
2981
|
|
- #endif
|
|
3064
|
+ #endif
|
|
3065
|
+ #ifdef TEMP_STAT_LEDS
|
|
3066
|
+ handle_status_leds();
|
|
3067
|
+ #endif
|
2982
|
3068
|
check_axes_activity();
|
2983
|
3069
|
}
|
2984
|
3070
|
|