S command doesn't work properly

Moderators: TomKerekes, dynomotion

BepsIt
Posts: 12
Joined: Wed Apr 17, 2019 4:43 pm

Re: S command doesn't work properly

Post by BepsIt » Sun Apr 21, 2019 10:02 am

good morning Tom,
problem fixed: now the Spindle is full functional, but only after a modification of FACTOR value into the header MySpindleDefs.h. In particular I had to replace the declaration:

#define FACTOR (1.0/3000.0)

with the new one:

#define FACTOR 0.00033 // (1/3000 = 0.00033)

the first one #define, checked on Console, gave me always zero; can you explain me why?
Happy Easter day

Beppe

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: S command doesn't work properly

Post by TomKerekes » Sun Apr 21, 2019 5:41 pm

Hi Beppe,

Congratulations!

I'm not sure.

#define FACTOR (1.0/3000.0)

should work. However:

#define FACTOR (1/3000)

will not work because the first does a floating point division and the 2nd does an integer division which would be zero. Could that be what you really tried?
Regards,

Tom Kerekes
Dynomotion, Inc.

BepsIt
Posts: 12
Joined: Wed Apr 17, 2019 4:43 pm

Re: S command doesn't work properly

Post by BepsIt » Mon Apr 22, 2019 9:29 am

hi Tom

yes you right: i tryed 1/3000 and not 1.0/3000.0, I am not a C++ user and I didn't know that difference

Many thanks

Beppe

Post Reply