Good Job Glenn
I find the best way is to open the script editor then the mainscreen script, then i can step thru and see the actions.
I create some test routines to pass the data and see what is being processed.
shows me that there is no return value to be passed back from the function.
but I might be missing something you are expecting to see.
Code: Select all
global map = function(Val,inMin,inMax,outMin,outMax)
{
result = (Val - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
print ("Map Result " + result);
r2 = ToFloat(result);
return r2;
};
Val=2;
inMin=8000;
inMax=18000;
outMin=0.1;
outMax=100;
Val3=GlobalGet("SpindleSpeed");
debug();
v1 = map(Val,inMin,inMax,outMin,outMax);
print ("map value1: "+v1);
v2 = SetPWMDuty_1(2,map(GlobalGet("SpindleSpeed"),8000,18000,0.1,100));
print ("map value2: "+v2);
v3 = SetPWMDuty_1(2,map(Val3,8000,18000,0.1,100));
print ("map value3: "+v3);
debug();
v3 = SetPWMDuty_1(2,map(Val3,8000,18000,0.1,100));
print ("map value3: "+v3);
debug();