Skip to content

Commit 7937593

Browse files
committed
whb04b: Fix machine moving after change from MPG to STEP or CON
1 parent d6b4da9 commit 7937593

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/hal/user_comps/xhc-whb04b-6/pendant.cc

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,11 +1475,17 @@ bool Pendant::onJogDialEvent(const HandWheelCounters& counters, int8_t delta)
14751475
{
14761476
mHal.toggleFeedrateDecrease();
14771477
}
1478-
}
1479-
else if (!counters.isLeadCounterActive() && (feedButton.stepMode() == HandwheelStepmodes::Mode::CON || feedButton.stepMode() == HandwheelStepmodes::Mode::STEP))
1480-
{ // Normal Mode
1481-
mHal.setJogCounts(counters);
1482-
}
1478+
}
1479+
1480+
if (!counters.isLeadCounterActive())
1481+
{
1482+
//The counters must be set always if not in lead mode
1483+
//Otherwhise, the machine will move, sometimes a long distance in the following case:
1484+
//MGP mode -> Wheel turned -> CON or STEP mode -> After first wheel pulse
1485+
//due to the counters are increased in MPG mode but not set until the first wheel count event
1486+
//Setting them does not create a move in MPG mode due to the scale is zero
1487+
mHal.setJogCounts(counters);
1488+
}
14831489
}
14841490
mDisplay.onJogDialEvent(counters, delta);
14851491
return true;

0 commit comments

Comments
 (0)