-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved getBlowIntensity() from ValueInput to Thresholds
Which is now also getting the inverted flag And now Thresholds encapsulates all its logic And it became much simpler to handle the inverted mode
- Loading branch information
Showing
11 changed files
with
92 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// Thresholds.cpp | ||
// vela2017 | ||
// | ||
// Created by Nuno on 29/04/2017. | ||
// | ||
// | ||
|
||
#include "Thresholds.h" | ||
|
||
//-------------------------------------------------------------- | ||
Thresholds::Thresholds(float _low, float _high, float _blowOut, bool _inverted) { | ||
inverted = _inverted; | ||
if (!inverted) { | ||
low = _low; | ||
high = _high; | ||
blowOut = _blowOut; | ||
} else { | ||
low = -_low; | ||
high = -_high; | ||
blowOut = -_blowOut; | ||
} | ||
} | ||
|
||
//-------------------------------------------------------------- | ||
BlowIntensity Thresholds::getBlowIntensity(float value) { | ||
|
||
if (!inverted) { | ||
if (value < getLow()) | ||
return BlowIntensity::IDLE; | ||
|
||
else if (value < getHigh()) | ||
return BlowIntensity::LOW; | ||
|
||
else if (value < getBlowOut()) | ||
return BlowIntensity::HIGH; | ||
|
||
else | ||
return BlowIntensity::BLOWOUT; | ||
|
||
} else { | ||
if (value > getLow()) | ||
return BlowIntensity::IDLE; | ||
|
||
else if (value > getHigh()) | ||
return BlowIntensity::LOW; | ||
|
||
else if (value > getBlowOut()) | ||
return BlowIntensity::HIGH; | ||
|
||
else | ||
return BlowIntensity::BLOWOUT; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters