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