Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 2:ac294c579449, committed 2019-12-27
- Comitter:
- drorbalbul
- Date:
- Fri Dec 27 17:52:39 2019 +0000
- Parent:
- 1:dad975e2e150
- Commit message:
- cantran for noam
Changed in this revision
Map.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Map.cpp Wed Sep 28 04:02:59 2016 +0200 +++ b/Map.cpp Fri Dec 27 17:52:39 2019 +0000 @@ -10,5 +10,12 @@ float Map::Calculate(float inVal) { - return ( (inVal - _inMin)*(_outMax - _outMin)/(_inMax - _inMin) + _outMin ); + float rval = (inVal - _inMin)*(_outMax - _outMin)/(_inMax - _inMin) + _outMin ; + if (rval < _outMin) { + rval = _outMin; + } + if (rval > _outMax) { + rval = _outMax; + } + return rval; }