File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ typedef struct Range {
6
6
unsigned int min ;
7
7
unsigned int max ;
8
8
9
- unsigned int clamp (unsigned int v ) const { return constrain (v , min , max ); }
9
+ inline unsigned int clamp (unsigned int v ) const { return constrain (v , min , max ); }
10
+ inline unsigned int midpoint () const { return (max - min ) / 2 ; }
10
11
} Range ;
11
12
12
13
// a calibrated servo defines its input (signal) and output (position) ranges
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ const Range oilServoLimit { 0, 180 };
32
32
33
33
// define limits for LED strip brightness
34
34
const Range LEDStripBrightnessLimit { 5 , 255 };
35
- const int dimBrightnessLevel = ( LEDStripBrightnessLimit.max - LEDStripBrightnessLimit.min) / 2 ;
35
+ const int dimBrightnessLevel = LEDStripBrightnessLimit.midpoint() ;
36
36
37
37
const unsigned int ARDUINO_BOOT_ANIMATION_MS = 2000 ; // amount of time that we can use to do a bootup sequence
38
38
const unsigned int ARDUINO_SOFT_SHUTDOWN_MS = 3000 ; // amount of time that we can use to do a soft shutdown
You can’t perform that action at this time.
0 commit comments