Skip to content

Commit 8df3a32

Browse files
committed
fix hid delay when serial monitor/program not open
1 parent 7d1b47d commit 8df3a32

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pedaal/pedaal.ino

+7-4
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,15 @@ void loop() {
256256
String clutchStringValues = ClutchBefore + p1 + ClutchAfter + p1 + clutchRawValue + p1 + ClutchBeforeHID + cm;
257257
String clutchString = clutchStringPrefix + clutchStringValues;
258258

259-
Serial.println(throttleString + brakeString + clutchString);
259+
260260
Joystick.sendState(); // Update the Joystick status on the PC
261-
// Serial.flush();
262-
// delay(150);
263261

264-
// timing
262+
if (Serial.availableForWrite ()) {
263+
Serial.println(throttleString + brakeString + clutchString);
264+
}
265+
266+
// delay(150);
267+
// timing
265268
// unsigned long end = micros();
266269
// unsigned long delta = end - start;
267270
// Serial.println(delta);

0 commit comments

Comments
 (0)