I think I figured it out. When scotta wrote this program, I guess he used the default for pd004 on his VFD/Spindle.
In the file hy_vfd.c look for
Code:
hzcalc = *(haldata->base_freq) / *(haldata->rated_motor_rev);
freq = abs((int)(*(haldata->speed_command)*hzcalc*100));
base_freq is pd004 (default of 50)
rated_motor_rev is pd144 (default of 1440)
I am assuming when he set his VFD up, and wrote the program, that he set pd144 to 3000 like the rest of us using this spindle, but left pd004 at 50?
this would set hzcalc to 0.01666667 When I set my pd004 at 400 as instructed by the consensus. it would set hzcalc 8 times more, to 0.13333333
Which explains why my vfd tries to run at 8x the speed of my S command.
So to fix I will change to
Code:
hzcalc = 50 / *(haldata->rated_motor_rev);
freq = abs((int)(*(haldata->speed_command)*hzcalc*100));
this should work for all cases. The definition of rated_motor_rev is the speed of the motor at 50hz, so this should be good for all.
I will test it out this week and make sure it all works.