Skip to content

Commit

Permalink
Merge pull request #331 from runger1101001/dev
Browse files Browse the repository at this point in the history
fix #324 to enable more than one HallSensor
  • Loading branch information
runger1101001 authored Oct 31, 2023
2 parents 29cb4d0 + 2b18cac commit 72e7458
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/communication/StepDirListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
#include "../common/foc_utils.h"


#if !defined(TARGET_RP2040) && !defined(_SAMD21_) && !defined(_SAMD51_) && !defined(_SAME51_) && !defined(ARDUINO_UNOR4_WIFI) && !defined(ARDUINO_UNOR4_MINIMA) && !defined(NRF52_SERIES) && !defined(ARDUINO_ARCH_MEGAAVR)
#define PinStatus int
#endif


/**
* Step/Dir listenner class for easier interraction with this communication interface.
*/
Expand Down Expand Up @@ -53,7 +48,7 @@ class StepDirListener
int pin_step; //!< step pin
int pin_dir; //!< direction pin
long count; //!< current counter value - should be set to 0 for homing
PinStatus polarity = RISING; //!< polarity of the step pin
decltype(RISING) polarity = RISING; //!< polarity of the step pin

private:
float* attached_variable = nullptr; //!< pointer to the attached variable
Expand Down
1 change: 0 additions & 1 deletion src/sensors/HallSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ void HallSensor::updateState() {
hall_state = new_hall_state;

int8_t new_electric_sector = ELECTRIC_SECTORS[hall_state];
static Direction old_direction;
if (new_electric_sector - electric_sector > 3) {
//underflow
direction = Direction::CCW;
Expand Down
1 change: 1 addition & 0 deletions src/sensors/HallSensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class HallSensor: public Sensor{

// whether last step was CW (+1) or CCW (-1).
Direction direction;
Direction old_direction;

void attachSectorCallback(void (*onSectorChange)(int a) = nullptr);

Expand Down

0 comments on commit 72e7458

Please sign in to comment.