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:895b3a247932, committed 2020-01-07
- Comitter:
- noamnahum
- Date:
- Tue Jan 07 08:59:06 2020 +0000
- Parent:
- 1:dad975e2e150
- Commit message:
- mP
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 Tue Jan 07 08:59:06 2020 +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;
}