Skip to content
12 changes: 10 additions & 2 deletions src/hal/user_comps/xhc-whb04b-6/hal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -1340,6 +1341,13 @@ bool Hal::requestAutoMode(bool isRisingEdge)
// ----------------------------------------------------------------------
bool Hal::requestManualMode(bool isRisingEdge)
{
if(isRisingEdge && !*memory->in.isProgramIdle)
{
//Don't try to change to manual when not idle
//When a program is running, this will fail
//When an MDI command is active, this would stop it
return false;
}
return requestMode(isRisingEdge, memory->out.doModeManual, memory->in.isModeManual);
}
// ----------------------------------------------------------------------
Expand Down
41 changes: 24 additions & 17 deletions src/hal/user_comps/xhc-whb04b-6/pendant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ FeedRotaryButtonCodes::FeedRotaryButtonCodes() :
{percent_60.code, &percent_60},
{percent_100.code, &percent_100},
{lead.code, &lead},
{lead9B.code, &lead9B},
{undefined.code, &undefined}
}
{
Expand Down Expand Up @@ -586,6 +587,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;
Expand Down Expand Up @@ -625,7 +631,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 = 1.0;}

}
else if (mStepMode == HandwheelStepmodes::Mode::CON)
Expand Down Expand Up @@ -730,11 +736,6 @@ void Handwheel::enableVerbose(bool enable)
}
}
// ----------------------------------------------------------------------
void Handwheel::setMode(HandWheelCounters::CounterNameToIndex activeCounterMode)
{
mCounters.setActiveCounter(activeCounterMode);
}
// ----------------------------------------------------------------------
void Handwheel::count(int8_t delta)
{
assert(mEventListener != nullptr);
Expand Down Expand Up @@ -1475,11 +1476,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;
Expand Down Expand Up @@ -1563,19 +1570,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) :
Expand Down
3 changes: 1 addition & 2 deletions src/hal/user_comps/xhc-whb04b-6/pendant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -440,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();
Expand Down Expand Up @@ -588,7 +588,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;
Expand Down
Loading