Skip to content

Commit f74e0cf

Browse files
Merge pull request #224 from 18301328831/patch-1
Method configure4PWM of esp8266_mcu.cpp bug fix
2 parents 091a98d + 6532226 commit f74e0cf

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/common/base_classes/Sensor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void Sensor::update() {
1818
float Sensor::getVelocity() {
1919
// calculate sample time
2020
float Ts = (angle_prev_ts - vel_angle_prev_ts)*1e-6;
21-
if (Ts<minDeltaT) return velocity; // don't update velocity if deltaT is too small
21+
if (Ts < min_elapsed_time) return velocity; // don't update velocity if Ts is too small
2222

2323
velocity = ( (float)(full_rotations - vel_full_rotations)*_2PI + (angle_prev - vel_angle_prev) ) / Ts;
2424
vel_angle_prev = angle_prev;

src/common/base_classes/Sensor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class Sensor{
105105
/**
106106
* Minimum time between updates to velocity. If time elapsed is lower than this, the velocity is not updated.
107107
*/
108-
float minDeltaT = 0.000100; // default is 100 microseconds, or 10kHz
108+
float min_elapsed_time = 0.000100; // default is 100 microseconds, or 10kHz
109109

110110
protected:
111111
/**

src/drivers/hardware_specific/esp8266_mcu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void* _configure4PWM(long pwm_frequency,const int pinA, const int pinB, const in
7070
_setHighFrequency(pwm_frequency, pinC);
7171
_setHighFrequency(pwm_frequency, pinD);
7272
GenericDriverParams* params = new GenericDriverParams {
73-
.pins = { pin1A, pin1B, pin2A, pin2B },
73+
.pins = { pinA, pinB, pinC, pinD },
7474
.pwm_frequency = pwm_frequency
7575
};
7676
return params;
@@ -112,4 +112,4 @@ void _writeDutyCycle4PWM(float dc_1a, float dc_1b, float dc_2a, float dc_2b, vo
112112
analogWrite(((GenericDriverParams*)params)->pins[3], 255.0f*dc_2b);
113113
}
114114

115-
#endif
115+
#endif

0 commit comments

Comments
 (0)