|
@@ -243,7 +243,7 @@ static unsigned long max_inactive_time = 0;
|
243
|
243
|
static unsigned long stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME*1000l;
|
244
|
244
|
unsigned long starttime = 0; ///< Print job start time
|
245
|
245
|
unsigned long stoptime = 0; ///< Print job stop time
|
246
|
|
-static uint8_t tmp_extruder;
|
|
246
|
+static uint8_t target_extruder;
|
247
|
247
|
bool Stopped = false;
|
248
|
248
|
bool CooldownNoWait = true;
|
249
|
249
|
bool target_direction;
|
|
@@ -857,7 +857,9 @@ float code_value() {
|
857
|
857
|
return ret;
|
858
|
858
|
}
|
859
|
859
|
|
860
|
|
-long code_value_long() { return (strtol(strchr_pointer + 1, NULL, 10)); }
|
|
860
|
+long code_value_long() { return strtol(strchr_pointer + 1, NULL, 10); }
|
|
861
|
+
|
|
862
|
+int16_t code_value_short() { return (int16_t)strtol(strchr_pointer + 1, NULL, 10); }
|
861
|
863
|
|
862
|
864
|
bool code_seen(char code) {
|
863
|
865
|
strchr_pointer = strchr(cmdbuffer[bufindr], code);
|
|
@@ -1410,9 +1412,9 @@ inline void sync_plan_position() {
|
1410
|
1412
|
for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) {
|
1411
|
1413
|
for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) {
|
1412
|
1414
|
SERIAL_PROTOCOL_F(bed_level[x][y], 2);
|
1413
|
|
- SERIAL_PROTOCOLPGM(" ");
|
|
1415
|
+ SERIAL_PROTOCOLCHAR(' ');
|
1414
|
1416
|
}
|
1415
|
|
- SERIAL_ECHOLN("");
|
|
1417
|
+ SERIAL_EOL;
|
1416
|
1418
|
}
|
1417
|
1419
|
}
|
1418
|
1420
|
|
|
@@ -1685,7 +1687,7 @@ inline void gcode_G2_G3(bool clockwise) {
|
1685
|
1687
|
* G4: Dwell S<seconds> or P<milliseconds>
|
1686
|
1688
|
*/
|
1687
|
1689
|
inline void gcode_G4() {
|
1688
|
|
- unsigned long codenum=0;
|
|
1690
|
+ unsigned long codenum = 0;
|
1689
|
1691
|
|
1690
|
1692
|
LCD_MESSAGEPGM(MSG_DWELL);
|
1691
|
1693
|
|
|
@@ -1711,7 +1713,7 @@ inline void gcode_G4() {
|
1711
|
1713
|
inline void gcode_G10_G11(bool doRetract=false) {
|
1712
|
1714
|
#if EXTRUDERS > 1
|
1713
|
1715
|
if (doRetract) {
|
1714
|
|
- retracted_swap[active_extruder] = (code_seen('S') && code_value_long() == 1); // checks for swap retract argument
|
|
1716
|
+ retracted_swap[active_extruder] = (code_seen('S') && code_value_short() == 1); // checks for swap retract argument
|
1715
|
1717
|
}
|
1716
|
1718
|
#endif
|
1717
|
1719
|
retract(doRetract
|
|
@@ -2029,7 +2031,7 @@ inline void gcode_G28() {
|
2029
|
2031
|
inline void gcode_G29() {
|
2030
|
2032
|
|
2031
|
2033
|
static int probe_point = -1;
|
2032
|
|
- MeshLevelingState state = code_seen('S') || code_seen('s') ? (MeshLevelingState)code_value_long() : MeshReport;
|
|
2034
|
+ MeshLevelingState state = code_seen('S') || code_seen('s') ? (MeshLevelingState)code_value_short() : MeshReport;
|
2033
|
2035
|
if (state < 0 || state > 2) {
|
2034
|
2036
|
SERIAL_PROTOCOLLNPGM("S out of range (0-2).");
|
2035
|
2037
|
return;
|
|
@@ -2040,7 +2042,7 @@ inline void gcode_G28() {
|
2040
|
2042
|
if (mbl.active) {
|
2041
|
2043
|
SERIAL_PROTOCOLPGM("Num X,Y: ");
|
2042
|
2044
|
SERIAL_PROTOCOL(MESH_NUM_X_POINTS);
|
2043
|
|
- SERIAL_PROTOCOLPGM(",");
|
|
2045
|
+ SERIAL_PROTOCOLCHAR(',');
|
2044
|
2046
|
SERIAL_PROTOCOL(MESH_NUM_Y_POINTS);
|
2045
|
2047
|
SERIAL_PROTOCOLPGM("\nZ search height: ");
|
2046
|
2048
|
SERIAL_PROTOCOL(MESH_HOME_SEARCH_Z);
|
|
@@ -2156,7 +2158,7 @@ inline void gcode_G28() {
|
2156
|
2158
|
return;
|
2157
|
2159
|
}
|
2158
|
2160
|
|
2159
|
|
- int verbose_level = code_seen('V') || code_seen('v') ? code_value_long() : 1;
|
|
2161
|
+ int verbose_level = code_seen('V') || code_seen('v') ? code_value_short() : 1;
|
2160
|
2162
|
if (verbose_level < 0 || verbose_level > 4) {
|
2161
|
2163
|
SERIAL_ECHOLNPGM("?(V)erbose Level is implausible (0-4).");
|
2162
|
2164
|
return;
|
|
@@ -2178,19 +2180,19 @@ inline void gcode_G28() {
|
2178
|
2180
|
|
2179
|
2181
|
int auto_bed_leveling_grid_points = AUTO_BED_LEVELING_GRID_POINTS;
|
2180
|
2182
|
#ifndef DELTA
|
2181
|
|
- if (code_seen('P')) auto_bed_leveling_grid_points = code_value_long();
|
|
2183
|
+ if (code_seen('P')) auto_bed_leveling_grid_points = code_value_short();
|
2182
|
2184
|
if (auto_bed_leveling_grid_points < 2) {
|
2183
|
2185
|
SERIAL_PROTOCOLPGM("?Number of probed (P)oints is implausible (2 minimum).\n");
|
2184
|
2186
|
return;
|
2185
|
2187
|
}
|
2186
|
2188
|
#endif
|
2187
|
2189
|
|
2188
|
|
- xy_travel_speed = code_seen('S') ? code_value_long() : XY_TRAVEL_SPEED;
|
|
2190
|
+ xy_travel_speed = code_seen('S') ? code_value_short() : XY_TRAVEL_SPEED;
|
2189
|
2191
|
|
2190
|
|
- int left_probe_bed_position = code_seen('L') ? code_value_long() : LEFT_PROBE_BED_POSITION,
|
2191
|
|
- right_probe_bed_position = code_seen('R') ? code_value_long() : RIGHT_PROBE_BED_POSITION,
|
2192
|
|
- front_probe_bed_position = code_seen('F') ? code_value_long() : FRONT_PROBE_BED_POSITION,
|
2193
|
|
- back_probe_bed_position = code_seen('B') ? code_value_long() : BACK_PROBE_BED_POSITION;
|
|
2192
|
+ int left_probe_bed_position = code_seen('L') ? code_value_short() : LEFT_PROBE_BED_POSITION,
|
|
2193
|
+ right_probe_bed_position = code_seen('R') ? code_value_short() : RIGHT_PROBE_BED_POSITION,
|
|
2194
|
+ front_probe_bed_position = code_seen('F') ? code_value_short() : FRONT_PROBE_BED_POSITION,
|
|
2195
|
+ back_probe_bed_position = code_seen('B') ? code_value_short() : BACK_PROBE_BED_POSITION;
|
2194
|
2196
|
|
2195
|
2197
|
bool left_out_l = left_probe_bed_position < MIN_PROBE_X,
|
2196
|
2198
|
left_out = left_out_l || left_probe_bed_position > right_probe_bed_position - MIN_PROBE_EDGE,
|
|
@@ -2394,7 +2396,7 @@ inline void gcode_G28() {
|
2394
|
2396
|
if (diff >= 0.0)
|
2395
|
2397
|
SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment
|
2396
|
2398
|
else
|
2397
|
|
- SERIAL_PROTOCOLPGM(" ");
|
|
2399
|
+ SERIAL_PROTOCOLCHAR(' ');
|
2398
|
2400
|
SERIAL_PROTOCOL_F(diff, 5);
|
2399
|
2401
|
} // xx
|
2400
|
2402
|
SERIAL_EOL;
|
|
@@ -2518,11 +2520,11 @@ inline void gcode_G92() {
|
2518
|
2520
|
unsigned long codenum = 0;
|
2519
|
2521
|
bool hasP = false, hasS = false;
|
2520
|
2522
|
if (code_seen('P')) {
|
2521
|
|
- codenum = code_value(); // milliseconds to wait
|
|
2523
|
+ codenum = code_value_short(); // milliseconds to wait
|
2522
|
2524
|
hasP = codenum > 0;
|
2523
|
2525
|
}
|
2524
|
2526
|
if (code_seen('S')) {
|
2525
|
|
- codenum = code_value() * 1000; // seconds to wait
|
|
2527
|
+ codenum = code_value_short() * 1000UL; // seconds to wait
|
2526
|
2528
|
hasS = codenum > 0;
|
2527
|
2529
|
}
|
2528
|
2530
|
char* starpos = strchr(src, '*');
|
|
@@ -2628,7 +2630,7 @@ inline void gcode_M17() {
|
2628
|
2630
|
*/
|
2629
|
2631
|
inline void gcode_M26() {
|
2630
|
2632
|
if (card.cardOK && code_seen('S'))
|
2631
|
|
- card.setIndex(code_value_long());
|
|
2633
|
+ card.setIndex(code_value_short());
|
2632
|
2634
|
}
|
2633
|
2635
|
|
2634
|
2636
|
/**
|
|
@@ -2719,7 +2721,7 @@ inline void gcode_M31() {
|
2719
|
2721
|
card.openFile(namestartpos, true, !call_procedure);
|
2720
|
2722
|
|
2721
|
2723
|
if (code_seen('S') && strchr_pointer < namestartpos) // "S" (must occur _before_ the filename!)
|
2722
|
|
- card.setIndex(code_value_long());
|
|
2724
|
+ card.setIndex(code_value_short());
|
2723
|
2725
|
|
2724
|
2726
|
card.startFileprint();
|
2725
|
2727
|
if (!call_procedure)
|
|
@@ -2747,11 +2749,11 @@ inline void gcode_M31() {
|
2747
|
2749
|
*/
|
2748
|
2750
|
inline void gcode_M42() {
|
2749
|
2751
|
if (code_seen('S')) {
|
2750
|
|
- int pin_status = code_value(),
|
|
2752
|
+ int pin_status = code_value_short(),
|
2751
|
2753
|
pin_number = LED_PIN;
|
2752
|
2754
|
|
2753
|
2755
|
if (code_seen('P') && pin_status >= 0 && pin_status <= 255)
|
2754
|
|
- pin_number = code_value();
|
|
2756
|
+ pin_number = code_value_short();
|
2755
|
2757
|
|
2756
|
2758
|
for (int8_t i = 0; i < (int8_t)(sizeof(sensitive_pins) / sizeof(*sensitive_pins)); i++) {
|
2757
|
2759
|
if (sensitive_pins[i] == pin_number) {
|
|
@@ -2810,7 +2812,7 @@ inline void gcode_M42() {
|
2810
|
2812
|
int verbose_level = 1, n_samples = 10, n_legs = 0;
|
2811
|
2813
|
|
2812
|
2814
|
if (code_seen('V') || code_seen('v')) {
|
2813
|
|
- verbose_level = code_value();
|
|
2815
|
+ verbose_level = code_value_short();
|
2814
|
2816
|
if (verbose_level < 0 || verbose_level > 4 ) {
|
2815
|
2817
|
SERIAL_PROTOCOLPGM("?Verbose Level not plausible (0-4).\n");
|
2816
|
2818
|
return;
|
|
@@ -2821,7 +2823,7 @@ inline void gcode_M42() {
|
2821
|
2823
|
SERIAL_PROTOCOLPGM("M48 Z-Probe Repeatability test\n");
|
2822
|
2824
|
|
2823
|
2825
|
if (code_seen('P') || code_seen('p') || code_seen('n')) { // `n` for legacy support only - please use `P`!
|
2824
|
|
- n_samples = code_value();
|
|
2826
|
+ n_samples = code_value_short();
|
2825
|
2827
|
if (n_samples < 4 || n_samples > 50) {
|
2826
|
2828
|
SERIAL_PROTOCOLPGM("?Sample size not plausible (4-50).\n");
|
2827
|
2829
|
return;
|
|
@@ -2854,7 +2856,7 @@ inline void gcode_M42() {
|
2854
|
2856
|
}
|
2855
|
2857
|
|
2856
|
2858
|
if (code_seen('L') || code_seen('l')) {
|
2857
|
|
- n_legs = code_value();
|
|
2859
|
+ n_legs = code_value_short();
|
2858
|
2860
|
if (n_legs == 1) n_legs = 2;
|
2859
|
2861
|
if (n_legs < 0 || n_legs > 15) {
|
2860
|
2862
|
SERIAL_PROTOCOLPGM("?Number of legs in movement not plausible (0-15).\n");
|
|
@@ -3036,12 +3038,15 @@ inline void gcode_M42() {
|
3036
|
3038
|
inline void gcode_M104() {
|
3037
|
3039
|
if (setTargetedHotend(104)) return;
|
3038
|
3040
|
|
3039
|
|
- if (code_seen('S')) setTargetHotend(code_value(), tmp_extruder);
|
3040
|
|
- #ifdef DUAL_X_CARRIAGE
|
3041
|
|
- if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
|
3042
|
|
- setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
|
3043
|
|
- #endif
|
3044
|
|
- setWatch();
|
|
3041
|
+ if (code_seen('S')) {
|
|
3042
|
+ float temp = code_value();
|
|
3043
|
+ setTargetHotend(temp, target_extruder);
|
|
3044
|
+ #ifdef DUAL_X_CARRIAGE
|
|
3045
|
+ if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
|
|
3046
|
+ setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
|
|
3047
|
+ #endif
|
|
3048
|
+ setWatch();
|
|
3049
|
+ }
|
3045
|
3050
|
}
|
3046
|
3051
|
|
3047
|
3052
|
/**
|
|
@@ -3054,9 +3059,9 @@ inline void gcode_M105() {
|
3054
|
3059
|
SERIAL_PROTOCOLPGM("ok");
|
3055
|
3060
|
#if HAS_TEMP_0
|
3056
|
3061
|
SERIAL_PROTOCOLPGM(" T:");
|
3057
|
|
- SERIAL_PROTOCOL_F(degHotend(tmp_extruder), 1);
|
|
3062
|
+ SERIAL_PROTOCOL_F(degHotend(target_extruder), 1);
|
3058
|
3063
|
SERIAL_PROTOCOLPGM(" /");
|
3059
|
|
- SERIAL_PROTOCOL_F(degTargetHotend(tmp_extruder), 1);
|
|
3064
|
+ SERIAL_PROTOCOL_F(degTargetHotend(target_extruder), 1);
|
3060
|
3065
|
#endif
|
3061
|
3066
|
#if HAS_TEMP_BED
|
3062
|
3067
|
SERIAL_PROTOCOLPGM(" B:");
|
|
@@ -3067,7 +3072,7 @@ inline void gcode_M105() {
|
3067
|
3072
|
for (int8_t e = 0; e < EXTRUDERS; ++e) {
|
3068
|
3073
|
SERIAL_PROTOCOLPGM(" T");
|
3069
|
3074
|
SERIAL_PROTOCOL(e);
|
3070
|
|
- SERIAL_PROTOCOLPGM(":");
|
|
3075
|
+ SERIAL_PROTOCOLCHAR(':');
|
3071
|
3076
|
SERIAL_PROTOCOL_F(degHotend(e), 1);
|
3072
|
3077
|
SERIAL_PROTOCOLPGM(" /");
|
3073
|
3078
|
SERIAL_PROTOCOL_F(degTargetHotend(e), 1);
|
|
@@ -3079,16 +3084,16 @@ inline void gcode_M105() {
|
3079
|
3084
|
|
3080
|
3085
|
SERIAL_PROTOCOLPGM(" @:");
|
3081
|
3086
|
#ifdef EXTRUDER_WATTS
|
3082
|
|
- SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(tmp_extruder))/127);
|
3083
|
|
- SERIAL_PROTOCOLPGM("W");
|
|
3087
|
+ SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(target_extruder))/127);
|
|
3088
|
+ SERIAL_PROTOCOLCHAR('W');
|
3084
|
3089
|
#else
|
3085
|
|
- SERIAL_PROTOCOL(getHeaterPower(tmp_extruder));
|
|
3090
|
+ SERIAL_PROTOCOL(getHeaterPower(target_extruder));
|
3086
|
3091
|
#endif
|
3087
|
3092
|
|
3088
|
3093
|
SERIAL_PROTOCOLPGM(" B@:");
|
3089
|
3094
|
#ifdef BED_WATTS
|
3090
|
3095
|
SERIAL_PROTOCOL((BED_WATTS * getHeaterPower(-1))/127);
|
3091
|
|
- SERIAL_PROTOCOLPGM("W");
|
|
3096
|
+ SERIAL_PROTOCOLCHAR('W');
|
3092
|
3097
|
#else
|
3093
|
3098
|
SERIAL_PROTOCOL(getHeaterPower(-1));
|
3094
|
3099
|
#endif
|
|
@@ -3103,7 +3108,7 @@ inline void gcode_M105() {
|
3103
|
3108
|
for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
|
3104
|
3109
|
SERIAL_PROTOCOLPGM(" T");
|
3105
|
3110
|
SERIAL_PROTOCOL(cur_extruder);
|
3106
|
|
- SERIAL_PROTOCOLPGM(":");
|
|
3111
|
+ SERIAL_PROTOCOLCHAR(':');
|
3107
|
3112
|
SERIAL_PROTOCOL_F(degHotend(cur_extruder),1);
|
3108
|
3113
|
SERIAL_PROTOCOLPGM("C->");
|
3109
|
3114
|
SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder)/OVERSAMPLENR,0);
|
|
@@ -3118,7 +3123,7 @@ inline void gcode_M105() {
|
3118
|
3123
|
/**
|
3119
|
3124
|
* M106: Set Fan Speed
|
3120
|
3125
|
*/
|
3121
|
|
- inline void gcode_M106() { fanSpeed = code_seen('S') ? constrain(code_value(), 0, 255) : 255; }
|
|
3126
|
+ inline void gcode_M106() { fanSpeed = code_seen('S') ? constrain(code_value_short(), 0, 255) : 255; }
|
3122
|
3127
|
|
3123
|
3128
|
/**
|
3124
|
3129
|
* M107: Fan Off
|
|
@@ -3137,10 +3142,11 @@ inline void gcode_M109() {
|
3137
|
3142
|
|
3138
|
3143
|
CooldownNoWait = code_seen('S');
|
3139
|
3144
|
if (CooldownNoWait || code_seen('R')) {
|
3140
|
|
- setTargetHotend(code_value(), tmp_extruder);
|
|
3145
|
+ float temp = code_value();
|
|
3146
|
+ setTargetHotend(temp, target_extruder);
|
3141
|
3147
|
#ifdef DUAL_X_CARRIAGE
|
3142
|
|
- if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
|
3143
|
|
- setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
|
|
3148
|
+ if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
|
|
3149
|
+ setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
|
3144
|
3150
|
#endif
|
3145
|
3151
|
}
|
3146
|
3152
|
|
|
@@ -3156,7 +3162,7 @@ inline void gcode_M109() {
|
3156
|
3162
|
unsigned long timetemp = millis();
|
3157
|
3163
|
|
3158
|
3164
|
/* See if we are heating up or cooling down */
|
3159
|
|
- target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling
|
|
3165
|
+ target_direction = isHeatingHotend(target_extruder); // true if heating, false if cooling
|
3160
|
3166
|
|
3161
|
3167
|
cancel_heatup = false;
|
3162
|
3168
|
|
|
@@ -3167,15 +3173,15 @@ inline void gcode_M109() {
|
3167
|
3173
|
while((!cancel_heatup)&&((residencyStart == -1) ||
|
3168
|
3174
|
(residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL)))) )
|
3169
|
3175
|
#else
|
3170
|
|
- while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) )
|
|
3176
|
+ while ( target_direction ? (isHeatingHotend(target_extruder)) : (isCoolingHotend(target_extruder)&&(CooldownNoWait==false)) )
|
3171
|
3177
|
#endif //TEMP_RESIDENCY_TIME
|
3172
|
3178
|
|
3173
|
3179
|
{ // while loop
|
3174
|
3180
|
if (millis() > timetemp + 1000UL) { //Print temp & remaining time every 1s while waiting
|
3175
|
3181
|
SERIAL_PROTOCOLPGM("T:");
|
3176
|
|
- SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1);
|
|
3182
|
+ SERIAL_PROTOCOL_F(degHotend(target_extruder),1);
|
3177
|
3183
|
SERIAL_PROTOCOLPGM(" E:");
|
3178
|
|
- SERIAL_PROTOCOL((int)tmp_extruder);
|
|
3184
|
+ SERIAL_PROTOCOL((int)target_extruder);
|
3179
|
3185
|
#ifdef TEMP_RESIDENCY_TIME
|
3180
|
3186
|
SERIAL_PROTOCOLPGM(" W:");
|
3181
|
3187
|
if (residencyStart > -1) {
|
|
@@ -3196,9 +3202,9 @@ inline void gcode_M109() {
|
3196
|
3202
|
#ifdef TEMP_RESIDENCY_TIME
|
3197
|
3203
|
// start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
|
3198
|
3204
|
// or when current temp falls outside the hysteresis after target temp was reached
|
3199
|
|
- if ((residencyStart == -1 && target_direction && (degHotend(tmp_extruder) >= (degTargetHotend(tmp_extruder)-TEMP_WINDOW))) ||
|
3200
|
|
- (residencyStart == -1 && !target_direction && (degHotend(tmp_extruder) <= (degTargetHotend(tmp_extruder)+TEMP_WINDOW))) ||
|
3201
|
|
- (residencyStart > -1 && labs(degHotend(tmp_extruder) - degTargetHotend(tmp_extruder)) > TEMP_HYSTERESIS) )
|
|
3205
|
+ if ((residencyStart == -1 && target_direction && (degHotend(target_extruder) >= (degTargetHotend(target_extruder)-TEMP_WINDOW))) ||
|
|
3206
|
+ (residencyStart == -1 && !target_direction && (degHotend(target_extruder) <= (degTargetHotend(target_extruder)+TEMP_WINDOW))) ||
|
|
3207
|
+ (residencyStart > -1 && labs(degHotend(target_extruder) - degTargetHotend(target_extruder)) > TEMP_HYSTERESIS) )
|
3202
|
3208
|
{
|
3203
|
3209
|
residencyStart = millis();
|
3204
|
3210
|
}
|
|
@@ -3535,9 +3541,9 @@ inline void gcode_M121() { enable_endstops(true); }
|
3535
|
3541
|
*/
|
3536
|
3542
|
inline void gcode_M150() {
|
3537
|
3543
|
SendColors(
|
3538
|
|
- code_seen('R') ? (byte)code_value() : 0,
|
3539
|
|
- code_seen('U') ? (byte)code_value() : 0,
|
3540
|
|
- code_seen('B') ? (byte)code_value() : 0
|
|
3544
|
+ code_seen('R') ? (byte)code_value_short() : 0,
|
|
3545
|
+ code_seen('U') ? (byte)code_value_short() : 0,
|
|
3546
|
+ code_seen('B') ? (byte)code_value_short() : 0
|
3541
|
3547
|
);
|
3542
|
3548
|
}
|
3543
|
3549
|
|
|
@@ -3549,9 +3555,9 @@ inline void gcode_M121() { enable_endstops(true); }
|
3549
|
3555
|
* D<millimeters>
|
3550
|
3556
|
*/
|
3551
|
3557
|
inline void gcode_M200() {
|
3552
|
|
- tmp_extruder = active_extruder;
|
|
3558
|
+ int tmp_extruder = active_extruder;
|
3553
|
3559
|
if (code_seen('T')) {
|
3554
|
|
- tmp_extruder = code_value();
|
|
3560
|
+ tmp_extruder = code_value_short();
|
3555
|
3561
|
if (tmp_extruder >= EXTRUDERS) {
|
3556
|
3562
|
SERIAL_ECHO_START;
|
3557
|
3563
|
SERIAL_ECHO(MSG_M200_INVALID_EXTRUDER);
|
|
@@ -3622,27 +3628,23 @@ inline void gcode_M203() {
|
3622
|
3628
|
* Also sets minimum segment time in ms (B20000) to prevent buffer under-runs and M20 minimum feedrate
|
3623
|
3629
|
*/
|
3624
|
3630
|
inline void gcode_M204() {
|
3625
|
|
- if (code_seen('S')) // Kept for legacy compatibility. Should NOT BE USED for new developments.
|
3626
|
|
- {
|
|
3631
|
+ if (code_seen('S')) { // Kept for legacy compatibility. Should NOT BE USED for new developments.
|
3627
|
3632
|
acceleration = code_value();
|
3628
|
3633
|
travel_acceleration = acceleration;
|
3629
|
|
- SERIAL_ECHOPAIR("Setting Printing and Travelling Acceleration: ", acceleration );
|
|
3634
|
+ SERIAL_ECHOPAIR("Setting Print and Travel Acceleration: ", acceleration );
|
3630
|
3635
|
SERIAL_EOL;
|
3631
|
3636
|
}
|
3632
|
|
- if (code_seen('P'))
|
3633
|
|
- {
|
|
3637
|
+ if (code_seen('P')) {
|
3634
|
3638
|
acceleration = code_value();
|
3635
|
|
- SERIAL_ECHOPAIR("Setting Printing Acceleration: ", acceleration );
|
|
3639
|
+ SERIAL_ECHOPAIR("Setting Print Acceleration: ", acceleration );
|
3636
|
3640
|
SERIAL_EOL;
|
3637
|
3641
|
}
|
3638
|
|
- if (code_seen('R'))
|
3639
|
|
- {
|
|
3642
|
+ if (code_seen('R')) {
|
3640
|
3643
|
retract_acceleration = code_value();
|
3641
|
3644
|
SERIAL_ECHOPAIR("Setting Retract Acceleration: ", retract_acceleration );
|
3642
|
3645
|
SERIAL_EOL;
|
3643
|
3646
|
}
|
3644
|
|
- if (code_seen('T'))
|
3645
|
|
- {
|
|
3647
|
+ if (code_seen('T')) {
|
3646
|
3648
|
travel_acceleration = code_value();
|
3647
|
3649
|
SERIAL_ECHOPAIR("Setting Travel Acceleration: ", travel_acceleration );
|
3648
|
3650
|
SERIAL_EOL;
|
|
@@ -3745,7 +3747,7 @@ inline void gcode_M206() {
|
3745
|
3747
|
*/
|
3746
|
3748
|
inline void gcode_M209() {
|
3747
|
3749
|
if (code_seen('S')) {
|
3748
|
|
- int t = code_value();
|
|
3750
|
+ int t = code_value_short();
|
3749
|
3751
|
switch(t) {
|
3750
|
3752
|
case 0:
|
3751
|
3753
|
autoretract_enabled = false;
|
|
@@ -3774,23 +3776,23 @@ inline void gcode_M206() {
|
3774
|
3776
|
inline void gcode_M218() {
|
3775
|
3777
|
if (setTargetedHotend(218)) return;
|
3776
|
3778
|
|
3777
|
|
- if (code_seen('X')) extruder_offset[X_AXIS][tmp_extruder] = code_value();
|
3778
|
|
- if (code_seen('Y')) extruder_offset[Y_AXIS][tmp_extruder] = code_value();
|
|
3779
|
+ if (code_seen('X')) extruder_offset[X_AXIS][target_extruder] = code_value();
|
|
3780
|
+ if (code_seen('Y')) extruder_offset[Y_AXIS][target_extruder] = code_value();
|
3779
|
3781
|
|
3780
|
3782
|
#ifdef DUAL_X_CARRIAGE
|
3781
|
|
- if (code_seen('Z')) extruder_offset[Z_AXIS][tmp_extruder] = code_value();
|
|
3783
|
+ if (code_seen('Z')) extruder_offset[Z_AXIS][target_extruder] = code_value();
|
3782
|
3784
|
#endif
|
3783
|
3785
|
|
3784
|
3786
|
SERIAL_ECHO_START;
|
3785
|
3787
|
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
3786
|
|
- for (tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++) {
|
3787
|
|
- SERIAL_ECHO(" ");
|
3788
|
|
- SERIAL_ECHO(extruder_offset[X_AXIS][tmp_extruder]);
|
3789
|
|
- SERIAL_ECHO(",");
|
3790
|
|
- SERIAL_ECHO(extruder_offset[Y_AXIS][tmp_extruder]);
|
|
3788
|
+ for (int e = 0; e < EXTRUDERS; e++) {
|
|
3789
|
+ SERIAL_CHAR(' ');
|
|
3790
|
+ SERIAL_ECHO(extruder_offset[X_AXIS][e]);
|
|
3791
|
+ SERIAL_CHAR(',');
|
|
3792
|
+ SERIAL_ECHO(extruder_offset[Y_AXIS][e]);
|
3791
|
3793
|
#ifdef DUAL_X_CARRIAGE
|
3792
|
|
- SERIAL_ECHO(",");
|
3793
|
|
- SERIAL_ECHO(extruder_offset[Z_AXIS][tmp_extruder]);
|
|
3794
|
+ SERIAL_CHAR(',');
|
|
3795
|
+ SERIAL_ECHO(extruder_offset[Z_AXIS][e]);
|
3794
|
3796
|
#endif
|
3795
|
3797
|
}
|
3796
|
3798
|
SERIAL_EOL;
|
|
@@ -3813,7 +3815,7 @@ inline void gcode_M221() {
|
3813
|
3815
|
int sval = code_value();
|
3814
|
3816
|
if (code_seen('T')) {
|
3815
|
3817
|
if (setTargetedHotend(221)) return;
|
3816
|
|
- extruder_multiply[tmp_extruder] = sval;
|
|
3818
|
+ extruder_multiply[target_extruder] = sval;
|
3817
|
3819
|
}
|
3818
|
3820
|
else {
|
3819
|
3821
|
extruder_multiply[active_extruder] = sval;
|
|
@@ -4044,7 +4046,7 @@ inline void gcode_M226() {
|
4044
|
4046
|
* M250: Read and optionally set the LCD contrast
|
4045
|
4047
|
*/
|
4046
|
4048
|
inline void gcode_M250() {
|
4047
|
|
- if (code_seen('C')) lcd_setcontrast(code_value_long() & 0x3F);
|
|
4049
|
+ if (code_seen('C')) lcd_setcontrast(code_value_short() & 0x3F);
|
4048
|
4050
|
SERIAL_PROTOCOLPGM("lcd contrast value: ");
|
4049
|
4051
|
SERIAL_PROTOCOL(lcd_contrast);
|
4050
|
4052
|
SERIAL_EOL;
|
|
@@ -4070,8 +4072,8 @@ inline void gcode_M226() {
|
4070
|
4072
|
* C<cycles>
|
4071
|
4073
|
*/
|
4072
|
4074
|
inline void gcode_M303() {
|
4073
|
|
- int e = code_seen('E') ? code_value_long() : 0;
|
4074
|
|
- int c = code_seen('C') ? code_value_long() : 5;
|
|
4075
|
+ int e = code_seen('E') ? code_value_short() : 0;
|
|
4076
|
+ int c = code_seen('C') ? code_value_short() : 5;
|
4075
|
4077
|
float temp = code_seen('S') ? code_value() : (e < 0 ? 70.0 : 150.0);
|
4076
|
4078
|
PID_autotune(temp, e, c);
|
4077
|
4079
|
}
|
|
@@ -4480,13 +4482,13 @@ inline void gcode_M503() {
|
4480
|
4482
|
if (code_seen('R')) duplicate_extruder_temp_offset = code_value();
|
4481
|
4483
|
SERIAL_ECHO_START;
|
4482
|
4484
|
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
4483
|
|
- SERIAL_ECHO(" ");
|
|
4485
|
+ SERIAL_CHAR(' ');
|
4484
|
4486
|
SERIAL_ECHO(extruder_offset[X_AXIS][0]);
|
4485
|
|
- SERIAL_ECHO(",");
|
|
4487
|
+ SERIAL_CHAR(',');
|
4486
|
4488
|
SERIAL_ECHO(extruder_offset[Y_AXIS][0]);
|
4487
|
|
- SERIAL_ECHO(" ");
|
|
4489
|
+ SERIAL_CHAR(' ');
|
4488
|
4490
|
SERIAL_ECHO(duplicate_extruder_x_offset);
|
4489
|
|
- SERIAL_ECHO(",");
|
|
4491
|
+ SERIAL_CHAR(',');
|
4490
|
4492
|
SERIAL_ECHOLN(extruder_offset[Y_AXIS][1]);
|
4491
|
4493
|
break;
|
4492
|
4494
|
case DXC_FULL_CONTROL_MODE:
|
|
@@ -4559,7 +4561,7 @@ inline void gcode_M907() {
|
4559
|
4561
|
* S# determines MS1 or MS2, X# sets the pin high/low.
|
4560
|
4562
|
*/
|
4561
|
4563
|
inline void gcode_M351() {
|
4562
|
|
- if (code_seen('S')) switch(code_value_long()) {
|
|
4564
|
+ if (code_seen('S')) switch(code_value_short()) {
|
4563
|
4565
|
case 1:
|
4564
|
4566
|
for(int i=0;i<NUM_AXIS;i++) if (code_seen(axis_codes[i])) microstep_ms(i, code_value(), -1);
|
4565
|
4567
|
if (code_seen('B')) microstep_ms(4, code_value(), -1);
|
|
@@ -4585,21 +4587,26 @@ inline void gcode_M999() {
|
4585
|
4587
|
}
|
4586
|
4588
|
|
4587
|
4589
|
inline void gcode_T() {
|
4588
|
|
- tmp_extruder = code_value();
|
|
4590
|
+ int tmp_extruder = code_value();
|
4589
|
4591
|
if (tmp_extruder >= EXTRUDERS) {
|
4590
|
4592
|
SERIAL_ECHO_START;
|
4591
|
|
- SERIAL_ECHO("T");
|
|
4593
|
+ SERIAL_CHAR('T');
|
4592
|
4594
|
SERIAL_ECHO(tmp_extruder);
|
4593
|
4595
|
SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
|
4594
|
4596
|
}
|
4595
|
4597
|
else {
|
|
4598
|
+ target_extruder = tmp_extruder;
|
|
4599
|
+
|
4596
|
4600
|
#if EXTRUDERS > 1
|
4597
|
4601
|
bool make_move = false;
|
4598
|
4602
|
#endif
|
|
4603
|
+
|
4599
|
4604
|
if (code_seen('F')) {
|
|
4605
|
+
|
4600
|
4606
|
#if EXTRUDERS > 1
|
4601
|
4607
|
make_move = true;
|
4602
|
4608
|
#endif
|
|
4609
|
+
|
4603
|
4610
|
next_feedrate = code_value();
|
4604
|
4611
|
if (next_feedrate > 0.0) feedrate = next_feedrate;
|
4605
|
4612
|
}
|
|
@@ -4689,7 +4696,7 @@ inline void gcode_T() {
|
4689
|
4696
|
void process_commands() {
|
4690
|
4697
|
if (code_seen('G')) {
|
4691
|
4698
|
|
4692
|
|
- int gCode = code_value_long();
|
|
4699
|
+ int gCode = code_value_short();
|
4693
|
4700
|
|
4694
|
4701
|
switch(gCode) {
|
4695
|
4702
|
|
|
@@ -4764,7 +4771,7 @@ void process_commands() {
|
4764
|
4771
|
}
|
4765
|
4772
|
|
4766
|
4773
|
else if (code_seen('M')) {
|
4767
|
|
- switch( code_value_long() ) {
|
|
4774
|
+ switch(code_value_short()) {
|
4768
|
4775
|
#ifdef ULTIPANEL
|
4769
|
4776
|
case 0: // M0 - Unconditional stop - Wait for user button press on LCD
|
4770
|
4777
|
case 1: // M1 - Conditional stop - Wait for user button press on LCD
|
|
@@ -5929,10 +5936,10 @@ void setPwmFrequency(uint8_t pin, int val)
|
5929
|
5936
|
#endif //FAST_PWM_FAN
|
5930
|
5937
|
|
5931
|
5938
|
bool setTargetedHotend(int code){
|
5932
|
|
- tmp_extruder = active_extruder;
|
5933
|
|
- if(code_seen('T')) {
|
5934
|
|
- tmp_extruder = code_value();
|
5935
|
|
- if(tmp_extruder >= EXTRUDERS) {
|
|
5939
|
+ target_extruder = active_extruder;
|
|
5940
|
+ if (code_seen('T')) {
|
|
5941
|
+ target_extruder = code_value_short();
|
|
5942
|
+ if (target_extruder >= EXTRUDERS) {
|
5936
|
5943
|
SERIAL_ECHO_START;
|
5937
|
5944
|
switch(code){
|
5938
|
5945
|
case 104:
|
|
@@ -5951,7 +5958,7 @@ bool setTargetedHotend(int code){
|
5951
|
5958
|
SERIAL_ECHO(MSG_M221_INVALID_EXTRUDER);
|
5952
|
5959
|
break;
|
5953
|
5960
|
}
|
5954
|
|
- SERIAL_ECHOLN(tmp_extruder);
|
|
5961
|
+ SERIAL_ECHOLN(target_extruder);
|
5955
|
5962
|
return true;
|
5956
|
5963
|
}
|
5957
|
5964
|
}
|