You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Arduino_Pedelec_Controller/Arduino_Pedelec_Controller.ino
+37-14Lines changed: 37 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -213,6 +213,8 @@ double power_human=0.0; //cyclist's power
213
213
double wh_human=0;
214
214
#ifdef SUPPORT_XCELL_RT
215
215
int torque_zero=533; //Offset of X-Cell RT torque sensor. Adjusted at startup
216
+
staticvolatile boolean analogRead_in_use = false; //read torque values in interrupt only if no analogRead in process
217
+
staticvolatile boolean thun_want_calculation = false; //read torque values in interrupt only if no analogRead in process
216
218
#if HARDWARE_REV<20
217
219
constint torquevalues_count=8;
218
220
volatileint torquevalues[torquevalues_count]= {0,0,0,0,0,0,0,0}; //stores the 8 torque values per pedal roundtrip
@@ -221,7 +223,7 @@ const int torquevalues_count=16;
221
223
volatileint torquevalues[torquevalues_count]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //stores the 16 torque values per pedal roundtrip
222
224
#endif
223
225
volatile byte torqueindex=0; //index to write next torque value
224
-
volatile boolean readtorque=false; //true if pas-interrupt received -> read torque in main loop. unfortunately analogRead gives wrong values inside the PAS-interrupt-routine
226
+
volatile boolean readtorque=false; //true if torque array has been updated -> recalculate in main loop
225
227
#endif
226
228
227
229
#if (SERIAL_MODE & SERIAL_MODE_MMC) //communicate with mmc-app
voidpas_change() //Are we pedaling? PAS Sensor Change------------------------------------------------------------------------------------------------------------------
@@ -862,11 +877,10 @@ void pas_change() //Are we pedaling? PAS Sensor Change--------------------
0 commit comments