Skip to content

Commit 72e7458

Browse files
Merge pull request #331 from runger1101001/dev
fix #324 to enable more than one HallSensor
2 parents 29cb4d0 + 2b18cac commit 72e7458

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

src/communication/StepDirListener.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
#include "../common/foc_utils.h"
66

77

8-
#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)
9-
#define PinStatus int
10-
#endif
11-
12-
138
/**
149
* Step/Dir listenner class for easier interraction with this communication interface.
1510
*/
@@ -53,7 +48,7 @@ class StepDirListener
5348
int pin_step; //!< step pin
5449
int pin_dir; //!< direction pin
5550
long count; //!< current counter value - should be set to 0 for homing
56-
PinStatus polarity = RISING; //!< polarity of the step pin
51+
decltype(RISING) polarity = RISING; //!< polarity of the step pin
5752

5853
private:
5954
float* attached_variable = nullptr; //!< pointer to the attached variable

src/sensors/HallSensor.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ void HallSensor::updateState() {
5353
hall_state = new_hall_state;
5454

5555
int8_t new_electric_sector = ELECTRIC_SECTORS[hall_state];
56-
static Direction old_direction;
5756
if (new_electric_sector - electric_sector > 3) {
5857
//underflow
5958
direction = Direction::CCW;

src/sensors/HallSensor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class HallSensor: public Sensor{
6262

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

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

0 commit comments

Comments
 (0)