(2018-02-26, 10:25 AM)affinite Wrote: Thanks for the suggestions guys
The range node is indeed linear so unfortunately it doesn't improve on the 2 point calibration in the ESPEasy firmware that generates the "raw" ADC values.
The mapping node looks more promising as it has multiple mapping points but I suspect it wont work because I want to convert a range of values.
Anyway I'll try later and report back.
oh and I'll look up the meaning of "JSON" for future reference
Sorry I've missed the non-linear.
Why not use a simple function node and an if-else statement?
Code:
if(msg.payload >=0 && msg.payload <=99) msg.payload = 0;
else if(msg.payload >=100 && msg.payload <=299) msg.payload = 20;
...
...
else if(msg.payload >=1020) msg.payload = 320;
return msg;