Skip to content

Commit 33d8178

Browse files
committed
Update master
1 parent 3249a9b commit 33d8178

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Arduino_Pedelec_Controller/Arduino_Pedelec_Controller.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void loop()
199199
throttle_stat = constrain(map(analogRead(throttle_in),196,832,0,1023),0,1023); // 0...1023
200200
brake_stat = digitalRead(brake_in);
201201
//voltage, current, power
202-
voltage = (analogRead(voltage_in)+voltage_offset)*voltage_amplitude; //check with multimeter, change in config.h if needed!
202+
voltage = analogRead(voltage_in)*voltage_amplitude+voltage_offset; //check with multimeter, change in config.h if needed!
203203
#if HARDWARE_REV <= 2
204204
// Read in current and auto-calibrate the shift offset:
205205
// There is a constant offset depending on the
@@ -212,7 +212,7 @@ void loop()
212212
current = constrain(current,0,30);
213213
#endif
214214
#if HARDWARE_REV >= 3
215-
current = (analogRead(current_in)-512+current_offset)*current_amplitude_R13; //check with multimeter, change in config.h if needed!
215+
current = (analogRead(current_in)-512)*current_amplitude_R13+current_offset; //check with multimeter, change in config.h if needed!
216216
current = constrain(current,-30,30);
217217
#endif
218218

0 commit comments

Comments
 (0)