I've been experimenting with some changes to KMotionCNC to make it more to my liking. My DROs now show 3 digit resolution when Metric mode is selected and I've also modified the default 'Set' values for the X & Y DROs to offer half the current DRO reading for the Set value. This is really useful for a milling machine where you often use a centre finder on one side of the work, clear the DRO and then touch the other side. While at the second side, the DRO needs to be set to half the value you've travelled, so that's now offered as the default when I go to set the DRO.
So far so good. However, I'd also really like to change the Feedrate slider override to be say 4x the feedrate.
KMotionCNCDlg.cpp has the following declaration which I've changed from 2 to 4...
#define OVERRIDE_MAX 4.0
... however this doesn't change it. Tracing the code into this procedure reveals that low and high don't receive the values passed to them.
/****************************************************************************
* CLogSlider::SetRange
* Inputs:
* double low: Low value for range
* double high: High value for range
* UINT resolution: Number of points between low and high
* Result: void
*
* Effect:
* Sets the range
****************************************************************************/
void CLogSlider::SetRange(double L, double H, UINT resolution, int offset, int color)
{
ASSERT(L < H);
low = L;
high = H; <------------- high remains 0 even though H = 4
m_offset=offset; <------ this works though.
m_color=color;
CSliderCtrl::SetRange(0, (int)resolution);
SetTic(20);
} // CLogSlider::SetRange
So I really can't figure out how it seems to still know that 2 is the maximum. OVERRIDE_MAX isn't referenced anywhere else.
I don't know this well enough to fix it myself, so some assistance would be most welcome.
KMotionCNC modifications
Moderators: TomKerekes, dynomotion
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: KMotionCNC modifications
Hi Roger,
Changing the define should change the high value. Are you sure it reads 0? Are you stepping through Debug or Release Configuration code?
However the labels 0.10 0.15 ... 2.0 etc are fixed text values. You will need to pick some reasonable numbers in the range 0.1 to 4.0 and position them appropriately in the log scale. Or change the class to somehow do that automatically.
The Edit Control limits the value the User can enter manually as well so you should also change these:
DDV_MinMaxDouble(pDX, m_FeedRateRapidValue, 0.1, 2.);
DDV_MinMaxDouble(pDX, m_FeedRateValue, 0.1, 2.);
HTH
Changing the define should change the high value. Are you sure it reads 0? Are you stepping through Debug or Release Configuration code?
However the labels 0.10 0.15 ... 2.0 etc are fixed text values. You will need to pick some reasonable numbers in the range 0.1 to 4.0 and position them appropriately in the log scale. Or change the class to somehow do that automatically.
The Edit Control limits the value the User can enter manually as well so you should also change these:
DDV_MinMaxDouble(pDX, m_FeedRateRapidValue, 0.1, 2.);
DDV_MinMaxDouble(pDX, m_FeedRateValue, 0.1, 2.);
HTH
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
-
- Posts: 78
- Joined: Tue Mar 30, 2021 8:07 am
Re: KMotionCNC modifications
Well spotted, I'd left it in Release build mode. It's odd that one of the variable behaved but the other didn't.
I just assumed that the OVERRIDE_MIN / MAX would be used to set the labels and range for the inputs too. I'm more used to Borland rapid development components where these things are a given.
So yes, it does change the value that you can move the slider to, I'll change the labels to suit. Changing it to a specific value isn't very useful for my application anyway, I'll just leave that as it is.
I just assumed that the OVERRIDE_MIN / MAX would be used to set the labels and range for the inputs too. I'm more used to Borland rapid development components where these things are a given.
So yes, it does change the value that you can move the slider to, I'll change the labels to suit. Changing it to a specific value isn't very useful for my application anyway, I'll just leave that as it is.
- TomKerekes
- Posts: 2676
- Joined: Mon Dec 04, 2017 1:49 am
Re: KMotionCNC modifications
Yes, optimizations can do strange things. Variables can be eliminated, orders of executions reversed, code eliminated, and so forth.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.