Closed
Description
https://github.com/RobTillaart/MultiMap/runs/1637056493?check_suite_focus=true
MultiMap.h is a source file that contains one templated function, small enough to post here
#define MULTIMAP_LIB_VERSION "0.1.3"
#include "Arduino.h"
// note: the in array should have increasing values
template<typename T>
T multiMap(T val, T* _in, T* _out, uint8_t size)
{
// take care the value is within range
// val = constrain(val, _in[0], _in[size-1]);
if (val <= _in[0]) return _out[0];
if (val >= _in[size-1]) return _out[size-1];
// search right interval
uint8_t pos = 1; // _in[0] allready tested
while(val > _in[pos]) pos++;
// this will handle all exact "points" in the _in array
if (val == _in[pos]) return _out[pos];
// interpolate in the right segment for the rest
return (val - _in[pos-1]) * (_out[pos] - _out[pos-1]) / (_in[pos] - _in[pos-1]) + _out[pos-1];
}
The unit test is a simple test and that runs successful.
However compiling the examples , all complain that they cannot find the #include MultiMap.h
local compilation is no problem. So somehow the library is not findable.
Error message
Compiling multimap_NTC.ino for arduino:avr:uno...
Last command: $ /usr/local/bin/arduino-cli --format json compile --fqbn arduino:avr:uno --warnings all --dry-run /github/home/Arduino/libraries/MultiMap/examples/multimap_NTC/multimap_NTC.ino
/github/home/Arduino/libraries/MultiMap/examples/multimap_NTC/multimap_NTC.ino:10:10: fatal error: MultiMap.h: No such file or directory
#include "MultiMap.h"
^~~~~~~~~~~~
compilation terminated.
Error during build: exit status 1
Metadata
Metadata
Assignees
Labels
No labels