From a30247eb6f80f028094c1d85c9af5cc1936b1626 Mon Sep 17 00:00:00 2001 From: Paul Dino Jones Date: Wed, 15 Jan 2025 18:16:07 -0500 Subject: [PATCH] add logging for haptic effects, fix consistency of test sequence --- src/monocoque/devices/hapticeffect.c | 8 ++++++++ src/monocoque/devices/sounddevice.c | 4 +++- src/monocoque/gameloop/gameloop.c | 10 +++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/monocoque/devices/hapticeffect.c b/src/monocoque/devices/hapticeffect.c index 8be90ad..d8014b6 100644 --- a/src/monocoque/devices/hapticeffect.c +++ b/src/monocoque/devices/hapticeffect.c @@ -440,6 +440,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, if(wheelslip[0] > threshold) { play += wheelslip[0] - threshold; + slogt("lock is %f", play); } } if (tyre == FRONTRIGHT || tyre == FRONTS || tyre == ALLFOUR) @@ -447,6 +448,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, if(wheelslip[1] > threshold) { play += wheelslip[1] - threshold; + slogt("lock is %f", play); } } if (tyre == REARLEFT || tyre == REARS || tyre == ALLFOUR) @@ -454,6 +456,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, if(wheelslip[2] > threshold) { play += wheelslip[2] - threshold; + slogt("lock is %f", play); } } if (tyre == REARRIGHT || tyre == REARS || tyre == ALLFOUR) @@ -461,6 +464,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, if(wheelslip[3] > threshold) { play += wheelslip[3] - threshold; + slogt("lock is %f", play); } } @@ -472,6 +476,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, if(wheelslip[0] > threshold) { play += wheelslip[0] - threshold; + slogt("abs is %f", play); } } if (tyre == FRONTRIGHT || tyre == FRONTS || tyre == ALLFOUR) @@ -479,6 +484,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, if(wheelslip[1] > threshold) { play += wheelslip[1] - threshold; + slogt("abs is %f", play); } } if (tyre == REARLEFT || tyre == REARS || tyre == ALLFOUR) @@ -486,6 +492,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, if(wheelslip[2] > threshold) { play += wheelslip[2] - threshold; + slogt("abs is %f", play); } } if (tyre == REARRIGHT || tyre == REARS || tyre == ALLFOUR) @@ -493,6 +500,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold, if(wheelslip[3] > threshold) { play += wheelslip[3] - threshold; + slogt("abs is %f", play); } } if(simdata->abs <= 0) diff --git a/src/monocoque/devices/sounddevice.c b/src/monocoque/devices/sounddevice.c index 5f38e09..48b3969 100644 --- a/src/monocoque/devices/sounddevice.c +++ b/src/monocoque/devices/sounddevice.c @@ -43,7 +43,7 @@ int sounddev_tyreslip_update(SimDevice* this, SimData* simdata) SoundDevice* sounddevice = (void *) this->derived; double play = slipeffect(simdata, this->hapticeffect.effecttype, this->hapticeffect.tyre, this->hapticeffect.threshold, this->hapticeffect.useconfig, this->hapticeffect.configcheck, this->hapticeffect.tyrediameterconfig); - slogt("Updating sound device frequency from original effect %f", play); + slogt("Updating sound device frequency from original tyre slip effect %f", play); if (play > 0) { @@ -63,6 +63,7 @@ int sounddev_tyrelock_update(SimDevice* this, SimData* simdata) SoundDevice* sounddevice = (void *) this->derived; double play = slipeffect(simdata, this->hapticeffect.effecttype, this->hapticeffect.tyre, this->hapticeffect.threshold, this->hapticeffect.useconfig, this->hapticeffect.configcheck, this->hapticeffect.tyrediameterconfig); + slogt("Updating sound device frequency from original tyre lock effect %f", play); if (play > 0) { @@ -80,6 +81,7 @@ int sounddev_absbrakes_update(SimDevice* this, SimData* simdata) { SoundDevice* sounddevice = (void *) this->derived; double play = slipeffect(simdata, this->hapticeffect.effecttype, this->hapticeffect.tyre, this->hapticeffect.threshold, this->hapticeffect.useconfig, this->hapticeffect.configcheck, this->hapticeffect.tyrediameterconfig); + slogt("Updating sound device frequency from original abs effect %f", play); if (play > 0) { diff --git a/src/monocoque/gameloop/gameloop.c b/src/monocoque/gameloop/gameloop.c index f61b8c1..0ae5d0e 100644 --- a/src/monocoque/gameloop/gameloop.c +++ b/src/monocoque/gameloop/gameloop.c @@ -827,14 +827,14 @@ int tester(SimDevice* devices, int numdevices) sleep(3); fprintf(stdout, "testing wheel spin\n"); + simdata->tyreRPS[0] = 50; + simdata->tyreRPS[1] = 50; + simdata->tyreRPS[2] = 50; + simdata->tyreRPS[3] = 50; simdata->tyrediameter[0] = 0.638636385206394; simdata->tyrediameter[1] = 0.633384434597093; simdata->tyrediameter[2] = 0.710475735564615; simdata->tyrediameter[3] = 0.710475735564615; - simdata->tyreRPS[0] = 103; - simdata->tyreRPS[1] = 103; - simdata->tyreRPS[2] = 103; - simdata->tyreRPS[3] = 103; for (int x = 0; x < numdevices; x++) { if (devices[x].initialized == true) @@ -883,11 +883,11 @@ int tester(SimDevice* devices, int numdevices) simdata->tyreRPS[0] = 50; simdata->tyreRPS[1] = 50; simdata->tyreRPS[2] = 50; + simdata->tyreRPS[3] = 50; simdata->tyrediameter[0] = 0.638636385206394; simdata->tyrediameter[1] = 0.633384434597093; simdata->tyrediameter[2] = 0.710475735564615; simdata->tyrediameter[3] = 0.710475735564615; - simdata->tyreRPS[3] = 50; simdata->abs = .11; for (int x = 0; x < numdevices; x++) {