From a082f3d69d07559753c3b15a3321f9e789b25707 Mon Sep 17 00:00:00 2001 From: Hannes Diethelm Date: Mon, 16 Feb 2026 23:04:37 +0100 Subject: [PATCH 1/5] whb04b: Pass arguments properly Fixes step 5/10 enable/disable --- src/hal/user_comps/xhc-whb04b-6/pendant.cc | 17 +++++++++++------ src/hal/user_comps/xhc-whb04b-6/pendant.h | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/hal/user_comps/xhc-whb04b-6/pendant.cc b/src/hal/user_comps/xhc-whb04b-6/pendant.cc index d1fe8969064..983b90ab16e 100644 --- a/src/hal/user_comps/xhc-whb04b-6/pendant.cc +++ b/src/hal/user_comps/xhc-whb04b-6/pendant.cc @@ -586,6 +586,11 @@ void FeedRotaryButton::setStepMode(HandwheelStepmodes::Mode stepMode) update(); } // ---------------------------------------------------------------------- +void FeedRotaryButton::setStepMode_5_10(bool enable) +{ + mIsStepMode_5_10 = enable; +} +// ---------------------------------------------------------------------- HandwheelStepmodes::Mode FeedRotaryButton::stepMode() const { return mStepMode; @@ -1563,19 +1568,19 @@ void Pendant::dispatchAxisEventToHal(const KeyCode& axis, bool isActive) } } // ---------------------------------------------------------------------- -void Pendant::setLeadModeSpindle(bool /*enable*/) +void Pendant::setLeadModeSpindle(bool enable) { - mIsLeadModeSpindle = true; + mIsLeadModeSpindle = enable; } // ---------------------------------------------------------------------- -void Pendant::setLeadModeFeed(bool /*enable*/) +void Pendant::setLeadModeFeed(bool enable) { - mIsLeadModeFeed = true; + mIsLeadModeFeed = enable; } // ---------------------------------------------------------------------- -void Pendant::setStepMode_5_10(bool /*enable*/) +void Pendant::setStepMode_5_10(bool enable) { - mIsStepMode_5_10 = true; + mCurrentButtonsState.feedButton().setStepMode_5_10(enable); } // ---------------------------------------------------------------------- Display::Display(const ButtonsState& currentButtonsState, Hal& hal, UsbOutPackageData& displayData) : diff --git a/src/hal/user_comps/xhc-whb04b-6/pendant.h b/src/hal/user_comps/xhc-whb04b-6/pendant.h index 53c121cd1cd..df0617b6fc7 100644 --- a/src/hal/user_comps/xhc-whb04b-6/pendant.h +++ b/src/hal/user_comps/xhc-whb04b-6/pendant.h @@ -393,6 +393,7 @@ class FeedRotaryButton : public RotaryButton ~FeedRotaryButton(); virtual bool setKeyCode(const KeyCode& keyCode) override; void setStepMode(HandwheelStepmodes::Mode stepMode); + void setStepMode_5_10(bool enable); HandwheelStepmodes::Mode stepMode() const; float stepSize() const; bool isPermitted() const override; @@ -588,7 +589,6 @@ class Pendant : public KeyEventListener //! if in Lead mode: if true jog wheel changes the spindle speed, changes the feed override otherwise bool mIsLeadModeSpindle = false; bool mIsLeadModeFeed = false; - bool mIsStepMode_5_10 = false; // float mScale; // float mMaxVelocity; From ab008c8de3b4f11d49393095c4ea6312fa09c969 Mon Sep 17 00:00:00 2001 From: Hannes Diethelm Date: Mon, 16 Feb 2026 23:05:57 +0100 Subject: [PATCH 2/5] whb04b: Fix inversion of -B argument --- src/hal/user_comps/xhc-whb04b-6/pendant.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hal/user_comps/xhc-whb04b-6/pendant.cc b/src/hal/user_comps/xhc-whb04b-6/pendant.cc index 983b90ab16e..1dbc022ccb4 100644 --- a/src/hal/user_comps/xhc-whb04b-6/pendant.cc +++ b/src/hal/user_comps/xhc-whb04b-6/pendant.cc @@ -630,7 +630,7 @@ void FeedRotaryButton::update() mStepSize = mStepSizeMapper.getStepSize(second); mIsPermitted = mStepSizeMapper.isPermitted(second); - if (mIsStepMode_5_10 && mStepSize > 2) {mStepSize = 0;} // TODO DOES NOT WORK bool variable seems to be not synched inside pendant.h + if (!mIsStepMode_5_10 && mStepSize > 2) {mStepSize = 0;} } else if (mStepMode == HandwheelStepmodes::Mode::CON) From 40307f22d7a1cfef73dfe86caf558b16870394b3 Mon Sep 17 00:00:00 2001 From: Hannes Diethelm Date: Mon, 16 Feb 2026 23:06:44 +0100 Subject: [PATCH 3/5] whb04b: Remove unused code --- src/hal/user_comps/xhc-whb04b-6/pendant.cc | 5 ----- src/hal/user_comps/xhc-whb04b-6/pendant.h | 1 - 2 files changed, 6 deletions(-) diff --git a/src/hal/user_comps/xhc-whb04b-6/pendant.cc b/src/hal/user_comps/xhc-whb04b-6/pendant.cc index 1dbc022ccb4..53ccacd7676 100644 --- a/src/hal/user_comps/xhc-whb04b-6/pendant.cc +++ b/src/hal/user_comps/xhc-whb04b-6/pendant.cc @@ -735,11 +735,6 @@ void Handwheel::enableVerbose(bool enable) } } // ---------------------------------------------------------------------- -void Handwheel::setMode(HandWheelCounters::CounterNameToIndex activeCounterMode) -{ - mCounters.setActiveCounter(activeCounterMode); -} -// ---------------------------------------------------------------------- void Handwheel::count(int8_t delta) { assert(mEventListener != nullptr); diff --git a/src/hal/user_comps/xhc-whb04b-6/pendant.h b/src/hal/user_comps/xhc-whb04b-6/pendant.h index df0617b6fc7..a1060e005fd 100644 --- a/src/hal/user_comps/xhc-whb04b-6/pendant.h +++ b/src/hal/user_comps/xhc-whb04b-6/pendant.h @@ -441,7 +441,6 @@ class Handwheel Handwheel(const FeedRotaryButton& feedButton, KeyEventListener* listener = nullptr); ~Handwheel(); void enableVerbose(bool enable); - void setMode(HandWheelCounters::CounterNameToIndex mode); void count(int8_t delta); const HandWheelCounters& counters() const; HandWheelCounters& counters(); From 44e0d17fdb2c750611bcb9a956fc669414ed2694 Mon Sep 17 00:00:00 2001 From: Hannes Diethelm Date: Mon, 16 Feb 2026 23:07:04 +0100 Subject: [PATCH 4/5] whb04b: Fix machine moving after change from MPG to STEP or CON --- src/hal/user_comps/xhc-whb04b-6/pendant.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/hal/user_comps/xhc-whb04b-6/pendant.cc b/src/hal/user_comps/xhc-whb04b-6/pendant.cc index 53ccacd7676..4c22736d30a 100644 --- a/src/hal/user_comps/xhc-whb04b-6/pendant.cc +++ b/src/hal/user_comps/xhc-whb04b-6/pendant.cc @@ -1475,11 +1475,17 @@ bool Pendant::onJogDialEvent(const HandWheelCounters& counters, int8_t delta) { mHal.toggleFeedrateDecrease(); } - } - else if (!counters.isLeadCounterActive() && (feedButton.stepMode() == HandwheelStepmodes::Mode::CON || feedButton.stepMode() == HandwheelStepmodes::Mode::STEP)) - { // Normal Mode - mHal.setJogCounts(counters); - } + } + + if (!counters.isLeadCounterActive()) + { + //The counters must be set always if not in lead mode + //Otherwhise, the machine will move, sometimes a long distance in the following case: + //MGP mode -> Wheel turned -> CON or STEP mode -> After first wheel pulse + //due to the counters are increased in MPG mode but not set until the first wheel count event + //Setting them does not create a move in MPG mode due to the scale is zero + mHal.setJogCounts(counters); + } } mDisplay.onJogDialEvent(counters, delta); return true; From 6b51915f6866353817d0eb7f07d4a57f2644fc95 Mon Sep 17 00:00:00 2001 From: Hannes Diethelm Date: Tue, 17 Feb 2026 10:20:15 +0100 Subject: [PATCH 5/5] whb04b: Don't change from auto to manual when jogging Changing mode from auto to manual would require the program to stop and just gives unneccesary warnings when trying it anyway --- src/hal/user_comps/xhc-whb04b-6/hal.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hal/user_comps/xhc-whb04b-6/hal.cc b/src/hal/user_comps/xhc-whb04b-6/hal.cc index 8d12e0ab559..e191a7bd87a 100644 --- a/src/hal/user_comps/xhc-whb04b-6/hal.cc +++ b/src/hal/user_comps/xhc-whb04b-6/hal.cc @@ -1324,8 +1324,9 @@ void Hal::setJogCounts(const HandWheelCounters& counters) *memory->out.axisAJogCounts = counters.counts(HandWheelCounters::CounterNameToIndex::AXIS_A); *memory->out.axisBJogCounts = counters.counts(HandWheelCounters::CounterNameToIndex::AXIS_B); *memory->out.axisCJogCounts = counters.counts(HandWheelCounters::CounterNameToIndex::AXIS_C); - requestManualMode(false); - requestTeleopMode(false); + + requestManualMode(false); + requestTeleopMode(false); } // ---------------------------------------------------------------------- void Hal::setFunction(bool enabled) @@ -1340,6 +1341,11 @@ bool Hal::requestAutoMode(bool isRisingEdge) // ---------------------------------------------------------------------- bool Hal::requestManualMode(bool isRisingEdge) { + if(isRisingEdge && *memory->in.isModeAuto) + { + //Don't try to change from auto to manual + return false; + } return requestMode(isRisingEdge, memory->out.doModeManual, memory->in.isModeManual); } // ----------------------------------------------------------------------