add logging for haptic effects, fix consistency of test sequence

This commit is contained in:
Paul Dino Jones 2025-01-15 18:16:07 -05:00
parent eabfef6efe
commit a30247eb6f
3 changed files with 16 additions and 6 deletions

View File

@ -440,6 +440,7 @@ double slipeffect(SimData* simdata, int effecttype, int tyre, double threshold,
if(wheelslip[0] > threshold) if(wheelslip[0] > threshold)
{ {
play += wheelslip[0] - threshold; play += wheelslip[0] - threshold;
slogt("lock is %f", play);
} }
} }
if (tyre == FRONTRIGHT || tyre == FRONTS || tyre == ALLFOUR) 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) if(wheelslip[1] > threshold)
{ {
play += wheelslip[1] - threshold; play += wheelslip[1] - threshold;
slogt("lock is %f", play);
} }
} }
if (tyre == REARLEFT || tyre == REARS || tyre == ALLFOUR) 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) if(wheelslip[2] > threshold)
{ {
play += wheelslip[2] - threshold; play += wheelslip[2] - threshold;
slogt("lock is %f", play);
} }
} }
if (tyre == REARRIGHT || tyre == REARS || tyre == ALLFOUR) 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) if(wheelslip[3] > threshold)
{ {
play += 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) if(wheelslip[0] > threshold)
{ {
play += wheelslip[0] - threshold; play += wheelslip[0] - threshold;
slogt("abs is %f", play);
} }
} }
if (tyre == FRONTRIGHT || tyre == FRONTS || tyre == ALLFOUR) 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) if(wheelslip[1] > threshold)
{ {
play += wheelslip[1] - threshold; play += wheelslip[1] - threshold;
slogt("abs is %f", play);
} }
} }
if (tyre == REARLEFT || tyre == REARS || tyre == ALLFOUR) 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) if(wheelslip[2] > threshold)
{ {
play += wheelslip[2] - threshold; play += wheelslip[2] - threshold;
slogt("abs is %f", play);
} }
} }
if (tyre == REARRIGHT || tyre == REARS || tyre == ALLFOUR) 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) if(wheelslip[3] > threshold)
{ {
play += wheelslip[3] - threshold; play += wheelslip[3] - threshold;
slogt("abs is %f", play);
} }
} }
if(simdata->abs <= 0) if(simdata->abs <= 0)

View File

@ -43,7 +43,7 @@ int sounddev_tyreslip_update(SimDevice* this, SimData* simdata)
SoundDevice* sounddevice = (void *) this->derived; 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); 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) if (play > 0)
{ {
@ -63,6 +63,7 @@ int sounddev_tyrelock_update(SimDevice* this, SimData* simdata)
SoundDevice* sounddevice = (void *) this->derived; 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); 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) if (play > 0)
{ {
@ -80,6 +81,7 @@ int sounddev_absbrakes_update(SimDevice* this, SimData* simdata)
{ {
SoundDevice* sounddevice = (void *) this->derived; 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); 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) if (play > 0)
{ {

View File

@ -827,14 +827,14 @@ int tester(SimDevice* devices, int numdevices)
sleep(3); sleep(3);
fprintf(stdout, "testing wheel spin\n"); 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[0] = 0.638636385206394;
simdata->tyrediameter[1] = 0.633384434597093; simdata->tyrediameter[1] = 0.633384434597093;
simdata->tyrediameter[2] = 0.710475735564615; simdata->tyrediameter[2] = 0.710475735564615;
simdata->tyrediameter[3] = 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++) for (int x = 0; x < numdevices; x++)
{ {
if (devices[x].initialized == true) if (devices[x].initialized == true)
@ -883,11 +883,11 @@ int tester(SimDevice* devices, int numdevices)
simdata->tyreRPS[0] = 50; simdata->tyreRPS[0] = 50;
simdata->tyreRPS[1] = 50; simdata->tyreRPS[1] = 50;
simdata->tyreRPS[2] = 50; simdata->tyreRPS[2] = 50;
simdata->tyreRPS[3] = 50;
simdata->tyrediameter[0] = 0.638636385206394; simdata->tyrediameter[0] = 0.638636385206394;
simdata->tyrediameter[1] = 0.633384434597093; simdata->tyrediameter[1] = 0.633384434597093;
simdata->tyrediameter[2] = 0.710475735564615; simdata->tyrediameter[2] = 0.710475735564615;
simdata->tyrediameter[3] = 0.710475735564615; simdata->tyrediameter[3] = 0.710475735564615;
simdata->tyreRPS[3] = 50;
simdata->abs = .11; simdata->abs = .11;
for (int x = 0; x < numdevices; x++) for (int x = 0; x < numdevices; x++)
{ {