From: Andy P. <gi...@gi...> - 2011-09-29 23:54:23
|
Make it possible to alter bldc.N.encoder-offset live. Signed-off-by: Andy Pugh <an...@bo...> http://git.linuxcnc.org/?p=emc2.git;a=commitdiff;h=d467b5e --- src/hal/components/bldc.comp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hal/components/bldc.comp b/src/hal/components/bldc.comp index 76a5e01..6fbb426 100644 --- a/src/hal/components/bldc.comp +++ b/src/hal/components/bldc.comp @@ -27,7 +27,7 @@ pin in float initvalue = 0.2 if personality & 0x04 """The current to be used for the homing sequence in applications where an incremental encoder is used with no hall-sensor feedback"""; -pin in signed rawcounts if personality & 0x06 +pin in signed rawcounts = 0 if personality & 0x06 """Encoder counts input. This must be linked to the encoder rawcounts pin or encoder index resets will cause the motor commutation to fail"""; @@ -662,7 +662,7 @@ FUNCTION(_) { } else { lead = lead_angle / 360.0; } - rotor_angle = (double)((long_rawcounts-offset) * poles/2)/scale; + rotor_angle = (double)((long_rawcounts-encoder_offset) * poles/2)/scale; rotor_angle -= floor(rotor_angle); phase_angle = rotor_angle + lead; phase_angle -= floor(phase_angle); |