Cleanup and fix issue that could cause abs to not work.

This commit is contained in:
Paul Dino Jones 2024-07-13 11:36:21 -04:00
parent 4f8870427f
commit f1ddbf2fc0
2 changed files with 8 additions and 18 deletions

View File

@ -62,26 +62,20 @@ void loop() {
effect4 = sd.effect4; effect4 = sd.effect4;
} }
//if (motor == 0 || motor == 4 || motor == 7 || motor == 8 || motor == 10 || motor == 11 || motor == 13 || motor == 14)
//{
if (motor1 >= 1) if (motor1 >= 1)
{ {
myMotor1->setSpeed(effect1); myMotor1->setSpeed(effect1);
} }
//} //if (motor2 >= 1)
//if (motor == 1 || motor == 5 || motor == 7 || motor == 9 || motor == 10 || motor == 11 || motor == 12 || motor == 13)
//{ //{
// 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) if (motor3 >= 1)
{ {
myMotor3->setSpeed(effect3); myMotor3->setSpeed(effect3);
} }
//} //if (motor4 >= 1)
//if (motor == 3 || motor == 4 || motor == 5 || motor == 6 || motor == 10 || motor == 12 || motor == 13 || motor == 14)
//{ //{
// myMotor4->setSpeed(motor4); // myMotor4->setSpeed(effect4);
//} //}
} }

View File

@ -74,25 +74,21 @@ int arduino_simhaptic_update(SimDevice* this, SimData* simdata)
int motor = serialdevice->motorsposition; 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.effect1 = effectspeed;
serialdevice->u.simhapticdata.motor1 = 1; 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); 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 (motor == 2 || motor == 6 || motor == 8 || motor == 9 || motor == 10 || motor == 11 || motor == 12 || motor == 14)
{
if (play != serialdevice->state)
{ {
serialdevice->u.simhapticdata.effect3 = effectspeed; serialdevice->u.simhapticdata.effect3 = effectspeed;
serialdevice->u.simhapticdata.motor3 = 1; 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); 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); size_t size = sizeof(SimHapticData);