Skip to content

Commit

Permalink
Tweak passed arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
tyeth committed Oct 18, 2024
1 parent 973d2e3 commit 07b2512
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/components/analogIO/Wippersnapper_AnalogIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ bool Wippersnapper_AnalogIO::encodePinEvent(
*/
/**********************************************************/
void calculateHysteresis(analogInputPin pin, uint16_t pinValRaw,
uint16_t pinValThreshHi, uint16_t pinValThreshLow) {
uint16_t *pinValThreshHi, uint16_t *pinValThreshLow) {
// All boards ADC values scaled to 16bit, in future we may need to
// adjust dynamically
uint16_t maxDecimalValue = 65535;
Expand All @@ -344,8 +344,8 @@ void calculateHysteresis(analogInputPin pin, uint16_t pinValRaw,
}

// get the threshold values for previous pin value
pinValThreshHi = pin.prvPinVal + CURRENT_HYSTERISIS;
pinValThreshLow = pin.prvPinVal - CURRENT_HYSTERISIS;
*pinValThreshHi = pin.prvPinVal + CURRENT_HYSTERISIS;
*pinValThreshLow = pin.prvPinVal - CURRENT_HYSTERISIS;
}

/**********************************************************/
Expand Down Expand Up @@ -425,8 +425,8 @@ void Wippersnapper_AnalogIO::update() {

// check if pin value has changed enough
uint16_t pinValThreshHi, pinValThreshLow;
calculateHysteresis(_analog_input_pins[i], pinValRaw, pinValThreshHi,
pinValThreshLow);
calculateHysteresis(_analog_input_pins[i], pinValRaw, &pinValThreshHi,
&pinValThreshLow);
WS_DEBUG_PRINT("Returned pinValThreshHi: ");
WS_DEBUG_PRINTLN(pinValThreshHi);
WS_DEBUG_PRINT("Returned pinValThreshLow: ");
Expand Down
2 changes: 0 additions & 2 deletions src/components/analogIO/Wippersnapper_AnalogIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ class Wippersnapper_AnalogIO {
int pin);
void disableAnalogInPin(int pin);

void calculateHysteresis(analogInputPin pin, uint16_t pinValRaw,
uint16_t pinValThreshHi, uint16_t pinValThreshLow);
uint16_t getPinValue(int pin);
float getPinValueVolts(int pin);

Expand Down

0 comments on commit 07b2512

Please sign in to comment.