Page 1 of 1

Remap Function

Posted: Wed Oct 06, 2021 1:12 pm
by Bruno
Hello at all
I usually use a macro to remap outputs of different types of sensors. I saw that a "Map function" component was created in FC9.
I want to share this macro and the assembled component, for everyone who still has FC8 like me.. It works with both Int and float variables
Suggestions for improvements are accepted
Thanks

Re: Remap Function

Posted: Wed Oct 06, 2021 6:57 pm
by medelec35
Hi Bruno.
Thank you for creating the Map component.
My suggestion would be to use a single Long for the calculations as just using ints will cause rollover to occur.
See here.
Credit to our VC member mnf for spotting the issue with the v9 version.

Re: Remap Function

Posted: Wed Oct 06, 2021 9:36 pm
by Bruno
Hi medelec
Thanks for your suggestion, I also had variable overflow problems,
in fact I used a Long variable, even though I wrote Int. :) :)

regards

Re: Remap Function

Posted: Sun Mar 05, 2023 2:51 pm
by AbhijitR
Hello! Bruno

First of all many thanks for this post and for the component, to be honest I was struggling with the INT calculations because of the rollover issue but your Floating Variable in the component solved my problem. I do appreciate your thought for making the component for users who are not using V9 and V10 still.

As you mentioned in your post for suggestions, kindly excuse me to speak my mind, but I think your component will get complete by adding the CLAMPING function too in the Parameters, no doubt it is as per your convenience and time availability.

Once again thank you for this nice component.

Regards
Abhi