You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then, i check if the screen shows the same values.
Then, i changed the x driver power from screen.
The value is not changed.
Explanation
In setDrvPct(), the multiplication operator is used.
If values are 0, then multiplying by 0 leads to 0.
If values are different from 0, the goal is to set a percentage of the max power, not a percentage of the previous percentage.
So we must use the assignment operator and not the multiplication assignment one.
The following line
By doing this, values are really changed but it still doesn't work.
Indeed, manually setting all dac values to 0 to force DAC_MOTOR_CURRENT_DEFAULT usage at initialization leads to weird values.
M909
echo:Stepper current values in % (Amps):
echo: X:0.02 (0.00) Y:0.02 (0.00) Z:0.02 (0.00) E:0.02 (0.00)ok
Configuration change
If we change the DAC configuration (ie. change any DAC_MOTOR_CURRENT_DEFAULT value), it is not handled by the current code of StepperDAC::init().
Solutions
About initialization
The quik and dirty way i found to make it work is to use LOOP_XYZE.
The root cause is there are some types discrepancies and/or missing struct operators.
Example : dac_values is type of xyze_uint_t whereas pct is type of xyze_uint8_t
4 solutions :
Avoid using structs operators and replace them by LOOP_XYZE
Align types (e.g. declare pct as xyze_uint_t)
Add a asUnsignedInt() method in structs defined in types.h
Add an assignment operator with a XYZEval<float> or XYZEval<uint8_t> typed argument in structs defined in types.h
Do you have any preference?
About configuration change
I guess the condition setting DAC values in StepperDAC::init() doesn't fit the needs.
We should compare current DAC values and DAC_MOTOR_CURRENT_DEFAULT values.
Hi,
Prerequisites
I have a board with a mcp4728.
I set DAC_MOTOR_CURRENT_DEFAULT to { 30, 30, 20, 30 }.
The M908 command works well and can be used as a workaround.
Setting DAC values at initialization
I manually set all dac channels to 0 to be sure values will be set from
DAC_MOTOR_CURRENT_DEFAULT
inStepperDAC::init()
(line 55).After resetting the board, i check the dac values.
Dac values are still equals to 0.
Setting DAC values from screen
I manually set all dac channels to any non zero values.
Then, i check if the screen shows the same values.
Then, i changed the x driver power from screen.
The value is not changed.
Explanation
In
setDrvPct()
, the multiplication operator is used.If values are 0, then multiplying by 0 leads to 0.
If values are different from 0, the goal is to set a percentage of the max power, not a percentage of the previous percentage.
So we must use the assignment operator and not the multiplication assignment one.
The following line
must be replaced by
By doing this, values are really changed but it still doesn't work.
Indeed, manually setting all dac values to 0 to force
DAC_MOTOR_CURRENT_DEFAULT
usage at initialization leads to weird values.Configuration change
If we change the DAC configuration (ie. change any
DAC_MOTOR_CURRENT_DEFAULT
value), it is not handled by the current code ofStepperDAC::init()
.Solutions
About initialization
The quik and dirty way i found to make it work is to use
LOOP_XYZE
.The root cause is there are some types discrepancies and/or missing struct operators.
Example :
dac_values
is type ofxyze_uint_t
whereaspct
is type ofxyze_uint8_t
4 solutions :
LOOP_XYZE
pct
asxyze_uint_t
)asUnsignedInt()
method in structs defined in types.hXYZEval<float>
orXYZEval<uint8_t>
typed argument in structs defined in types.hDo you have any preference?
About configuration change
I guess the condition setting DAC values in
StepperDAC::init()
doesn't fit the needs.We should compare current DAC values and DAC_MOTOR_CURRENT_DEFAULT values.
It means replacing
by
The text was updated successfully, but these errors were encountered: