Skip to content

Commit 48010c7

Browse files
committed
Tweaked logic based on actual ratio between tach wheel and bike wheel.
1 parent fef0141 commit 48010c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Hall_Sensor_FTMS_server.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ inline bool positiveEdge(bool state, bool &oldState)
9999

100100
double calculateRpmFromRevolutions(int revolutions, unsigned long revolutionsTime)
101101
{
102-
double ROAD_WHEEL_TO_TACH_WHEEL_RATIO = 6.8;
102+
double ROAD_WHEEL_TO_TACH_WHEEL_RATIO = 20.68;
103103
double instantaneousRpm = revolutions * 60 * 1000 / revolutionsTime / ROAD_WHEEL_TO_TACH_WHEEL_RATIO;
104104
// Serial.printf("revolutionsTime: %d, rev: %d , instantaneousRpm: %2.9f \n",
105105
// revolutionsTime, revolutions, instantaneousRpm);
@@ -266,7 +266,7 @@ void loop()
266266
unsigned long intervalTime = millis() - elapsedTime;
267267
unsigned long sampleTime = millis() - elapsedSampleTime;
268268
bool state = digitalRead(digitalPin);
269-
if (sampleTime > 10 && state != magStateOld)
269+
if (sampleTime > 5 && state != magStateOld)
270270
{
271271
rev += (int)positiveEdge(state, magStateOld);
272272
elapsedSampleTime = millis();

0 commit comments

Comments
 (0)