Skip to content

Commit 03ad236

Browse files
committed
Change detection 'invert' to 'activeLow'
This more accurately describes what the constructor is *asking*, if not how the code actually works.
1 parent 14c737d commit 03ad236

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/SimRacing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ static void readFloat(float& value, Stream& client) {
176176
// DeviceConnection #
177177
//#########################################################
178178

179-
DeviceConnection::DeviceConnection(PinNum pin, bool invert, unsigned long detectTime)
179+
DeviceConnection::DeviceConnection(PinNum pin, bool activeLow, unsigned long detectTime)
180180
:
181-
pin(sanitizePin(pin)), inverted(invert), stablePeriod(detectTime), // constants(ish)
181+
pin(sanitizePin(pin)), inverted(activeLow), stablePeriod(detectTime), // constants(ish)
182182

183183
/* Assume we're connected on first call
184184
*/

src/SimRacing.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ namespace SimRacing {
7575
/**
7676
* Class constructor
7777
*
78-
* @param pin the pin number being read. Can be 'UnusedPin' to disable.
79-
* @param invert whether the input is inverted, so 'LOW' is detected instead of 'HIGH'
78+
* @param pin the pin number being read. Can be 'UnusedPin' to disable.
79+
* @param activeLow whether the device is detected on a high signal (false,
80+
* default) or a low signal (true)
8081
* @param detectTime the amount of time, in ms, the input must be stable for
81-
* before it's interpreted as 'detected'
82+
* before it's interpreted as 'detected'
8283
*/
83-
DeviceConnection(PinNum pin, bool invert = false, unsigned long detectTime = 250);
84+
DeviceConnection(PinNum pin, bool activeLow = false, unsigned long detectTime = 250);
8485

8586
/**
8687
* Checks if the pin detects a connection. This polls the input and checks

0 commit comments

Comments
 (0)