MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / init

Method init

libraries/FastMap/FastMap.cpp:24–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23
24bool FastMap::init(float in_min, float in_max, float out_min, float out_max)
25{
26 float _inRange = in_max - in_min;
27 float _outRange = out_max - out_min;
28 if ((_inRange == 0.0 ) || (_outRange == 0.0)) return false;
29
30 _in_min = in_min;
31 _in_max = in_max;
32 _out_min = out_min;
33 _out_max = out_max;
34
35 _factor = _outRange/_inRange;
36 _base = _out_min - _in_min * _factor;
37
38 _backfactor = _inRange/_outRange;
39 _backbase = _in_min - _out_min * _backfactor;
40 return true;
41}
42
43
44float FastMap::constrainedMap(float value)

Callers 1

unittestFunction · 0.45

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.36