🩹 Fix some parameters w/out values (#24051)

This commit is contained in:
DerAndere
2022-04-18 06:03:39 +02:00
committed by Scott Lahteine
parent 85599abba7
commit ecfe7b6400
16 changed files with 35 additions and 62 deletions

View File

@ -44,14 +44,14 @@ void GcodeSuite::M486() {
cancelable.object_count = parser.intval('T', 1);
}
if (parser.seen('S'))
if (parser.seenval('S'))
cancelable.set_active_object(parser.value_int());
if (parser.seen('C')) cancelable.cancel_active_object();
if (parser.seen('P')) cancelable.cancel_object(parser.value_int());
if (parser.seenval('P')) cancelable.cancel_object(parser.value_int());
if (parser.seen('U')) cancelable.uncancel_object(parser.value_int());
if (parser.seenval('U')) cancelable.uncancel_object(parser.value_int());
}
#endif // CANCEL_OBJECTS

View File

@ -45,10 +45,10 @@
*/
void GcodeSuite::M260() {
// Set the target address
if (parser.seen('A')) i2c.address(parser.value_byte());
if (parser.seenval('A')) i2c.address(parser.value_byte());
// Add a new byte to the buffer
if (parser.seen('B')) i2c.addbyte(parser.value_byte());
if (parser.seenval('B')) i2c.addbyte(parser.value_byte());
// Flush the buffer to the bus
if (parser.seen('S')) i2c.send();
@ -63,7 +63,7 @@ void GcodeSuite::M260() {
* Usage: M261 A<slave device address base 10> B<number of bytes> S<style>
*/
void GcodeSuite::M261() {
if (parser.seen('A')) i2c.address(parser.value_byte());
if (parser.seenval('A')) i2c.address(parser.value_byte());
const uint8_t bytes = parser.byteval('B', 1), // Bytes to request
style = parser.byteval('S'); // Serial output style (ASCII, HEX etc)

View File

@ -71,7 +71,7 @@ void GcodeSuite::G61() {
if (parser.seen(NUM_AXIS_GANG("X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W))) {
DEBUG_ECHOPGM(STR_RESTORING_POS " S", slot);
LOOP_NUM_AXES(i) {
destination[i] = parser.seen(AXIS_CHAR(i))
destination[i] = parser.seenval(AXIS_CHAR(i))
? stored_position[slot][i] + parser.value_axis_units((AxisEnum)i)
: current_position[i];
DEBUG_CHAR(' ', AXIS_CHAR(i));

View File

@ -48,7 +48,7 @@ void GcodeSuite::M603() {
if (target_extruder < 0) return;
// Unload length
if (parser.seen('U')) {
if (parser.seenval('U')) {
fc_settings[target_extruder].unload_length = ABS(parser.value_axis_units(E_AXIS));
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
NOMORE(fc_settings[target_extruder].unload_length, EXTRUDE_MAXLENGTH);
@ -56,7 +56,7 @@ void GcodeSuite::M603() {
}
// Load length
if (parser.seen('L')) {
if (parser.seenval('L')) {
fc_settings[target_extruder].load_length = ABS(parser.value_axis_units(E_AXIS));
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
NOMORE(fc_settings[target_extruder].load_length, EXTRUDE_MAXLENGTH);

View File

@ -106,7 +106,7 @@ void GcodeSuite::M701() {
#else
constexpr float purge_length = ADVANCED_PAUSE_PURGE_LENGTH,
slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH;
const float fast_load_length = ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS)
const float fast_load_length = ABS(parser.seenval('L') ? parser.value_axis_units(E_AXIS)
: fc_settings[active_extruder].load_length);
load_filament(
slow_load_length, fast_load_length, purge_length,

View File

@ -48,7 +48,7 @@ void GcodeSuite::M412() {
if (seenR || seenS) runout.reset();
if (seenS) runout.enabled = parser.value_bool();
#if HAS_FILAMENT_RUNOUT_DISTANCE
if (parser.seen('D')) runout.set_runout_distance(parser.value_linear_units());
if (parser.seenval('D')) runout.set_runout_distance(parser.value_linear_units());
#endif
}
else {