My setup is
loadusr -Wn spindle-vfd hy_vfd -n spind;e-vfd -d /dev/ttyUSB0 - p none -r 38400 -t 1 -S24000
I have 24000 RPM at 400hz water cooled spindle. Command as above set PD144 to 2400 id don't known that is good. In manual PD144 mean RPM at nominal 50hz, for my spindle thats should be 3000 (400hz/50hz*3000 = 24000)
To show RPM on axis I use spindle-speed-fb pin thats looks to working ok when I call command M3 S24000 I se rpm when spindle speed up, but when I call M5 in the same time i see 0 rpm and spindle is still spinning and i can read RPM from spindle-vfd.Root .
In my opinion when set M3 S0 and spindle is off or stopped or after M5 and spindle stopped the pin spindle-at-speed should be 1 not 0
For me others stuff works fine, good job :)
The file is / src / hal / user_comps / huanyang-vfd / hy_vfd.c
510 if (
511 haldata->spindle_on
512 && (fabs(haldata->speed_command) > 0.0)
513 && (haldata->Set_F > 0.0)
514 ) {
515 haldata->spindle_speed_fb = (haldata->Out_F / haldata->max_freq) * haldata->rated_motor_rev;
516 if (fabs(1 - (haldata->spindle_speed_fb / haldata->speed_command)) < haldata->spindle_at_speed_tolerance) {
517 haldata->spindle_at_speed = 1;
518 } else {
519 haldata->spindle_at_speed = 0;
520 }
521 } else {
522 haldata->spindle_speed_fb = 0.0;
523 haldata->spindle_at_speed = 0;
524 }
In my opinion this values should be set alvays not only when
haldata->spindle_on && (fabs(haldata->speed_command) > 0.0) && (*haldata->Set_F > 0.0)
Becouse spindle has option to slow down when off, not only cutoff current (slowdown is faster then cutoff).
Thanks for the bug report. I can duplicate your results on my setup. I will try to fix it.
I pushed a fix for the PD144 problem, it's in v2.7.0-21-g760a7f2 and it'll be in 2.7.1 when that comes out. This commit should make the RPMs displayed on the VFD face plate and available in the .RoTT hal pin come out right. Can you test it and report back?
I'll see if i can fix the spindle speed feedback during spin-down issue next...