|
@@ -47,41 +47,7 @@ void GcodeSuite::M900() {
|
47
|
47
|
SERIAL_ECHOPGM(" value out of range");
|
48
|
48
|
if (ten) SERIAL_ECHOPGM(" (0-10)");
|
49
|
49
|
SERIAL_ECHOLNPGM(".");
|
50
|
|
- }
|
51
|
|
-
|
52
|
|
- if (!parser.seen_any()) {
|
53
|
|
-
|
54
|
|
- #if ENABLED(EXTRA_LIN_ADVANCE_K)
|
55
|
|
-
|
56
|
|
- #if EXTRUDERS < 2
|
57
|
|
- SERIAL_ECHOLNPAIR("Advance S", int(new_slot), " K", kref, "(S", int(!new_slot), " K", lref, ")");
|
58
|
|
- #else
|
59
|
|
- LOOP_L_N(i, EXTRUDERS) {
|
60
|
|
- const bool slot = TEST(lin_adv_slot, i);
|
61
|
|
- SERIAL_ECHOLNPAIR("Advance T", int(i), " S", int(slot), " K", planner.extruder_advance_K[i],
|
62
|
|
- "(S", int(!slot), " K", other_extruder_advance_K[i], ")");
|
63
|
|
- SERIAL_EOL();
|
64
|
|
- }
|
65
|
|
- #endif
|
66
|
|
-
|
67
|
|
- #else
|
68
|
|
-
|
69
|
|
- SERIAL_ECHO_START();
|
70
|
|
- #if EXTRUDERS < 2
|
71
|
|
- SERIAL_ECHOLNPAIR("Advance K=", planner.extruder_advance_K[0]);
|
72
|
|
- #else
|
73
|
|
- SERIAL_ECHOPGM("Advance K");
|
74
|
|
- LOOP_L_N(i, EXTRUDERS) {
|
75
|
|
- SERIAL_CHAR(' ', '0' + i, ':');
|
76
|
|
- SERIAL_ECHO(planner.extruder_advance_K[i]);
|
77
|
|
- }
|
78
|
|
- SERIAL_EOL();
|
79
|
|
- #endif
|
80
|
|
-
|
81
|
|
- #endif
|
82
|
|
-
|
83
|
|
- return;
|
84
|
|
- }
|
|
50
|
+ };
|
85
|
51
|
|
86
|
52
|
#if EXTRUDERS < 2
|
87
|
53
|
constexpr uint8_t tool_index = 0;
|
|
@@ -93,9 +59,13 @@ void GcodeSuite::M900() {
|
93
|
59
|
}
|
94
|
60
|
#endif
|
95
|
61
|
|
96
|
|
- float &kref = planner.extruder_advance_K[tool_index],
|
97
|
|
- &lref = other_extruder_advance_K[tool_index];
|
98
|
|
- const float oldK = kref, oldOther = lref;
|
|
62
|
+ float &kref = planner.extruder_advance_K[tool_index];
|
|
63
|
+
|
|
64
|
+ #if ENABLED(EXTRA_LIN_ADVANCE_K)
|
|
65
|
+ float &lref = other_extruder_advance_K[tool_index];
|
|
66
|
+ #endif
|
|
67
|
+
|
|
68
|
+ const float oldK = kref;
|
99
|
69
|
float newK = oldK;
|
100
|
70
|
|
101
|
71
|
#if ENABLED(EXTRA_LIN_ADVANCE_K)
|
|
@@ -107,32 +77,32 @@ void GcodeSuite::M900() {
|
107
|
77
|
// saved K values. Do here so K/L will apply correctly.
|
108
|
78
|
if (new_slot != old_slot) { // Not the same slot?
|
109
|
79
|
SET_BIT_TO(lin_adv_slot, tool_index, new_slot); // Update the slot for the tool
|
110
|
|
- newK = oldOther; // Get new K value from backup
|
|
80
|
+ newK = lref; // Get new K value from backup
|
111
|
81
|
lref = oldK; // Save K to backup
|
112
|
82
|
}
|
113
|
83
|
|
114
|
84
|
// Set the main K value. Apply if the main slot is active.
|
115
|
85
|
if (parser.seenval('K')) {
|
116
|
|
- const float newK = parser.value_float();
|
117
|
|
- if (!WITHIN(newK, 0, 10)) echo_value_oor('K');
|
118
|
|
- else if (new_slot) lref = newK; // S1 Knn
|
119
|
|
- else newK = newK; // S0 Knn
|
|
86
|
+ const float K = parser.value_float();
|
|
87
|
+ if (!WITHIN(K, 0, 10)) echo_value_oor('K');
|
|
88
|
+ else if (new_slot) lref = K; // S1 Knn
|
|
89
|
+ else newK = K; // S0 Knn
|
120
|
90
|
}
|
121
|
91
|
|
122
|
92
|
// Set the extra K value. Apply if the extra slot is active.
|
123
|
93
|
if (parser.seenval('L')) {
|
124
|
|
- const float newL = parser.value_float();
|
125
|
|
- if (!WITHIN(newL, 0, 10)) echo_value_oor('L');
|
126
|
|
- else if (!new_slot) lref = newL; // S0 Lnn
|
127
|
|
- else newK = newL; // S1 Lnn
|
|
94
|
+ const float L = parser.value_float();
|
|
95
|
+ if (!WITHIN(L, 0, 10)) echo_value_oor('L');
|
|
96
|
+ else if (!new_slot) lref = L; // S0 Lnn
|
|
97
|
+ else newK = L; // S1 Lnn
|
128
|
98
|
}
|
129
|
99
|
|
130
|
100
|
#else
|
131
|
101
|
|
132
|
102
|
if (parser.seenval('K')) {
|
133
|
|
- const float newK = parser.value_float();
|
134
|
|
- if (WITHIN(newK, 0, 10))
|
135
|
|
- newK = newK;
|
|
103
|
+ const float K = parser.value_float();
|
|
104
|
+ if (WITHIN(K, 0, 10))
|
|
105
|
+ newK = K;
|
136
|
106
|
else
|
137
|
107
|
echo_value_oor('K');
|
138
|
108
|
}
|
|
@@ -143,6 +113,39 @@ void GcodeSuite::M900() {
|
143
|
113
|
planner.synchronize();
|
144
|
114
|
kref = newK;
|
145
|
115
|
}
|
|
116
|
+
|
|
117
|
+ if (!parser.seen_any()) {
|
|
118
|
+
|
|
119
|
+ #if ENABLED(EXTRA_LIN_ADVANCE_K)
|
|
120
|
+
|
|
121
|
+ #if EXTRUDERS < 2
|
|
122
|
+ SERIAL_ECHOLNPAIR("Advance S", int(new_slot), " K", kref, "(S", int(!new_slot), " K", lref, ")");
|
|
123
|
+ #else
|
|
124
|
+ LOOP_L_N(i, EXTRUDERS) {
|
|
125
|
+ const bool slot = TEST(lin_adv_slot, i);
|
|
126
|
+ SERIAL_ECHOLNPAIR("Advance T", int(i), " S", int(slot), " K", planner.extruder_advance_K[i],
|
|
127
|
+ "(S", int(!slot), " K", other_extruder_advance_K[i], ")");
|
|
128
|
+ SERIAL_EOL();
|
|
129
|
+ }
|
|
130
|
+ #endif
|
|
131
|
+
|
|
132
|
+ #else
|
|
133
|
+
|
|
134
|
+ SERIAL_ECHO_START();
|
|
135
|
+ #if EXTRUDERS < 2
|
|
136
|
+ SERIAL_ECHOLNPAIR("Advance K=", planner.extruder_advance_K[0]);
|
|
137
|
+ #else
|
|
138
|
+ SERIAL_ECHOPGM("Advance K");
|
|
139
|
+ LOOP_L_N(i, EXTRUDERS) {
|
|
140
|
+ SERIAL_CHAR(' ', '0' + i, ':');
|
|
141
|
+ SERIAL_ECHO(planner.extruder_advance_K[i]);
|
|
142
|
+ }
|
|
143
|
+ SERIAL_EOL();
|
|
144
|
+ #endif
|
|
145
|
+
|
|
146
|
+ #endif
|
|
147
|
+ }
|
|
148
|
+
|
146
|
149
|
}
|
147
|
150
|
|
148
|
151
|
#endif // LIN_ADVANCE
|