From f1ddbf2fc0f7b87eb88b60458497035939dcb8bb Mon Sep 17 00:00:00 2001 From: Paul Dino Jones Date: Sat, 13 Jul 2024 11:36:21 -0400 Subject: [PATCH] Cleanup and fix issue that could cause abs to not work. --- src/arduino/simhaptic/simhaptic.ino | 14 ++++---------- src/monocoque/devices/serialdevice.c | 12 ++++-------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/arduino/simhaptic/simhaptic.ino b/src/arduino/simhaptic/simhaptic.ino index 894a786..94ce4e3 100644 --- a/src/arduino/simhaptic/simhaptic.ino +++ b/src/arduino/simhaptic/simhaptic.ino @@ -62,26 +62,20 @@ void loop() { effect4 = sd.effect4; } - //if (motor == 0 || motor == 4 || motor == 7 || motor == 8 || motor == 10 || motor == 11 || motor == 13 || motor == 14) - //{ if (motor1 >= 1) { myMotor1->setSpeed(effect1); } - //} - //if (motor == 1 || motor == 5 || motor == 7 || motor == 9 || motor == 10 || motor == 11 || motor == 12 || motor == 13) + //if (motor2 >= 1) //{ - // myMotor2->setSpeed(motor2); + // myMotor2->setSpeed(effect2); //} - //if (motor == 2 || motor == 6 || motor == 8 || motor == 9 || motor == 10 || motor == 11 || motor == 12 || motor == 14) - //{ if (motor3 >= 1) { myMotor3->setSpeed(effect3); } - //} - //if (motor == 3 || motor == 4 || motor == 5 || motor == 6 || motor == 10 || motor == 12 || motor == 13 || motor == 14) + //if (motor4 >= 1) //{ - // myMotor4->setSpeed(motor4); + // myMotor4->setSpeed(effect4); //} } diff --git a/src/monocoque/devices/serialdevice.c b/src/monocoque/devices/serialdevice.c index 8014ec2..f1723c4 100644 --- a/src/monocoque/devices/serialdevice.c +++ b/src/monocoque/devices/serialdevice.c @@ -74,25 +74,21 @@ int arduino_simhaptic_update(SimDevice* this, SimData* simdata) int motor = serialdevice->motorsposition; - if (motor == 0 || motor == 4 || motor == 7 || motor == 8 || motor == 10 || motor == 11 || motor == 13 || motor == 14) + if (play != serialdevice->state) { - if (play != serialdevice->state) + if (motor == 0 || motor == 4 || motor == 7 || motor == 8 || motor == 10 || motor == 11 || motor == 13 || motor == 14) { serialdevice->u.simhapticdata.effect1 = effectspeed; serialdevice->u.simhapticdata.motor1 = 1; slogt("Updating arduino haptic device speed motor speed %i on motor %i from original effect %f", serialdevice->u.simhapticdata.effect1, serialdevice->motorsposition, rplay); - serialdevice->state = play; } - } - if (motor == 2 || motor == 6 || motor == 8 || motor == 9 || motor == 10 || motor == 11 || motor == 12 || motor == 14) - { - if (play != serialdevice->state) + if (motor == 2 || motor == 6 || motor == 8 || motor == 9 || motor == 10 || motor == 11 || motor == 12 || motor == 14) { serialdevice->u.simhapticdata.effect3 = effectspeed; serialdevice->u.simhapticdata.motor3 = 1; slogt("Updating arduino haptic device speed motor speed %i on motor %i from original effect %f", serialdevice->u.simhapticdata.effect3, serialdevice->motorsposition, rplay); - serialdevice->state = play; } + serialdevice->state = play; } size_t size = sizeof(SimHapticData);