0.1.6 MultiMap

This commit is contained in:
rob tillaart 2022-11-18 15:09:05 +01:00
parent 4bcd11b45d
commit ae00e713ca
7 changed files with 81 additions and 36 deletions

View File

@ -1,3 +1,18 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:
packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
@ -9,3 +24,4 @@ compile:
- esp32
# - esp8266
# - mega2560
- rpipico

View File

@ -0,0 +1,43 @@
# Change Log MultiMap
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.1.6] - 2022-11-17
- add RP2040 in build-CI
- add changelog.md
- update readme.md
- clean up unit test
## [0.1.5] - 2021-12-22
- update library.json
- update readme
- update license
- minor edits
## [0.1.4] - 2021-05-27
- fix Arduino-lint
## [0.1.3] - 2021-01-02
- add Arduino-CI
## [0.1.2] - 2020-06-19
- fix library.json
## [0.1.1] - 2020-04-09
## [0.1.0] - 2015-03-29
----
..... eons passed ...
-----
## [0.0.1] - 2011-01-26
- initial version.

View File

@ -2,24 +2,15 @@
//
// FILE: MultiMap.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.5
// VERSION: 0.1.6
// DATE: 2011-01-26
// PURPOSE: Arduino library for fast non-linear mapping or interpolation of values
// URL: https://github.com/RobTillaart/MultiMap
// URL: http://playground.arduino.cc/Main/MultiMap
//
// HISTORY:
// 0.0.1 2011-01-26 initial version (see forum)
// ..... eons passed ...
// 0.1.0 2015-03-29
// 0.1.1 2020-04-09
// 0.1.2 2020-06-19 fix library.json
// 0.1.3 2021-01-02 add Arduino-CI
// 0.1.4 2021-05-27 fix Arduino-lint
// 0.1.5 2021-12-22 update library.json, readme, license, minor edits
#define MULTIMAP_LIB_VERSION (F("0.1.5"))
#define MULTIMAP_LIB_VERSION (F("0.1.6"))
#include "Arduino.h"
@ -47,9 +38,10 @@ T multiMap(T value, T* _in, T* _out, uint8_t size)
/*
* speed optimized version if inputs do not change often e.g. 2 2 2 2 2 3 3 3 3 5 5 5 5 5 5 8 8 8 8 5 5 5 5 5
*
// note: the in array should have increasing values
// speed optimized version if inputs do not change often e.g. 2 2 2 2 2 3 3 3 3 5 5 5 5 5 5 8 8 8 8 5 5 5 5 5
// implements a minimal cache
//
// note: the in array should have increasing values
template<typename T>
T multiMap(T value, T* _in, T* _out, uint8_t size)

View File

@ -51,13 +51,20 @@ Please note the fail example as this shows that in the intern math overflow can
## Future
- Investigate class implementation for performance / footprint
#### must
- improve documentation
#### should
- Investigate class implementation
- performance / footprint
- less parameter passing
#### could
- flag if input value was "IN_MIN" < input < "IN_MAX",
now it is constrained without user being informed.
- extend unit tests
**wont**
#### wont
- should the lookup tables be merged into one array of pairs?
- you cannot reuse e.g. the input array then. (memory footprint)

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/MultiMap.git"
},
"version": "0.1.5",
"version": "0.1.6",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=MultiMap
version=0.1.5
version=0.1.6
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Library for fast non-linear interpolation by means of two arrays.

View File

@ -45,26 +45,13 @@ unittest_teardown()
{
}
/*
unittest(test_new_operator)
{
assertEqualINF(exp(800));
assertEqualINF(0.0/0.0);
assertEqualINF(42);
assertEqualNAN(INFINITY - INFINITY);
assertEqualNAN(0.0/0.0);
assertEqualNAN(42);
}
*/
unittest(test_float)
{
// based on the distance example
// out[] holds the distances in cm
// based on the distance example
// out[] holds the distances in cm
float out[] = {150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20};
// in[] holds the measured analogRead() values for that distance
// in[] holds the measured analogRead() values for that distance
float in[] = { 90, 97, 105, 113, 124, 134, 147, 164, 185, 218, 255, 317, 408, 506};
assertEqualFloat(150.000, multiMap<float>(80, in, out, 14), 0.001);