Optimize G-code flag parameters (#21849)

This commit is contained in:
Scott Lahteine
2021-05-09 03:50:51 -05:00
committed by GitHub
parent 4588d836a3
commit 49548c343d
25 changed files with 95 additions and 94 deletions

View File

@@ -819,11 +819,11 @@ int8_t I2CPositionEncodersMgr::parse() {
void I2CPositionEncodersMgr::M860() {
if (parse()) return;
const bool hasU = parser.seen('U'), hasO = parser.seen('O');
const bool hasU = parser.seen_test('U'), hasO = parser.seen_test('O');
if (I2CPE_idx == 0xFF) {
LOOP_XYZE(i) {
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
if (!I2CPE_anyaxis || parser.seen_test(axis_codes[i])) {
const uint8_t idx = idx_from_axis(AxisEnum(i));
if ((int8_t)idx >= 0) report_position(idx, hasU, hasO);
}
@@ -956,10 +956,10 @@ void I2CPositionEncodersMgr::M864() {
return;
}
else {
if (parser.seen('X')) newAddress = I2CPE_PRESET_ADDR_X;
else if (parser.seen('Y')) newAddress = I2CPE_PRESET_ADDR_Y;
else if (parser.seen('Z')) newAddress = I2CPE_PRESET_ADDR_Z;
else if (parser.seen('E')) newAddress = I2CPE_PRESET_ADDR_E;
if (parser.seen_test('X')) newAddress = I2CPE_PRESET_ADDR_X;
else if (parser.seen_test('Y')) newAddress = I2CPE_PRESET_ADDR_Y;
else if (parser.seen_test('Z')) newAddress = I2CPE_PRESET_ADDR_Z;
else if (parser.seen_test('E')) newAddress = I2CPE_PRESET_ADDR_E;
else return;
}
@@ -1012,7 +1012,7 @@ void I2CPositionEncodersMgr::M865() {
void I2CPositionEncodersMgr::M866() {
if (parse()) return;
const bool hasR = parser.seen('R');
const bool hasR = parser.seen_test('R');
if (I2CPE_idx == 0xFF) {
LOOP_XYZE(i) {