Improve handling of devices referenced in config but not actually able to be used for some reason
This commit is contained in:
parent
8f4729c77a
commit
62e619780f
|
|
@ -38,7 +38,7 @@ int devinit(SimDevice* simdevices, int numdevices, DeviceSettings* ds, Monocoque
|
||||||
if (sim != NULL)
|
if (sim != NULL)
|
||||||
{
|
{
|
||||||
simdevices[j] = sim->m;
|
simdevices[j] = sim->m;
|
||||||
//simdevices[j].initialized = true;
|
simdevices[j].initialized = true;
|
||||||
simdevices[j].type = SIMDEV_USB;
|
simdevices[j].type = SIMDEV_USB;
|
||||||
simdevices[j].tyre = ds[j].tyre;
|
simdevices[j].tyre = ds[j].tyre;
|
||||||
simdevices[j].useconfig = ms->useconfig;
|
simdevices[j].useconfig = ms->useconfig;
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,10 @@ int clilooper(SimDevice* devices, int numdevices, Parameters* p, SimData* simdat
|
||||||
|
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( poll(&mypoll, 1, 1000.0/update_rate) )
|
if( poll(&mypoll, 1, 1000.0/update_rate) )
|
||||||
|
|
@ -220,7 +223,10 @@ int clilooper(SimDevice* devices, int numdevices, Parameters* p, SimData* simdat
|
||||||
simdata->rpms = 100;
|
simdata->rpms = 100;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
|
|
@ -339,7 +345,10 @@ int tester(SimDevice* devices, int numdevices)
|
||||||
simdata->rpms = 1000;
|
simdata->rpms = 1000;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
|
@ -347,7 +356,10 @@ int tester(SimDevice* devices, int numdevices)
|
||||||
simdata->gear = 2;
|
simdata->gear = 2;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
|
@ -355,7 +367,10 @@ int tester(SimDevice* devices, int numdevices)
|
||||||
simdata->velocity = 100;
|
simdata->velocity = 100;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
|
@ -363,7 +378,10 @@ int tester(SimDevice* devices, int numdevices)
|
||||||
simdata->gear = 3;
|
simdata->gear = 3;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
|
@ -371,7 +389,10 @@ int tester(SimDevice* devices, int numdevices)
|
||||||
simdata->velocity = 200;
|
simdata->velocity = 200;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
|
@ -379,7 +400,10 @@ int tester(SimDevice* devices, int numdevices)
|
||||||
simdata->gear = 4;
|
simdata->gear = 4;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
|
@ -387,7 +411,10 @@ int tester(SimDevice* devices, int numdevices)
|
||||||
simdata->rpms = 2000;
|
simdata->rpms = 2000;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
|
@ -395,7 +422,10 @@ int tester(SimDevice* devices, int numdevices)
|
||||||
simdata->rpms = 4000;
|
simdata->rpms = 4000;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
|
@ -403,7 +433,10 @@ int tester(SimDevice* devices, int numdevices)
|
||||||
simdata->gear = 5;
|
simdata->gear = 5;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
|
@ -411,7 +444,10 @@ int tester(SimDevice* devices, int numdevices)
|
||||||
simdata->velocity = 300;
|
simdata->velocity = 300;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
|
@ -419,7 +455,10 @@ int tester(SimDevice* devices, int numdevices)
|
||||||
simdata->rpms = 8000;
|
simdata->rpms = 8000;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
|
@ -427,7 +466,10 @@ int tester(SimDevice* devices, int numdevices)
|
||||||
simdata->rpms = 100;
|
simdata->rpms = 100;
|
||||||
for (int x = 0; x < numdevices; x++)
|
for (int x = 0; x < numdevices; x++)
|
||||||
{
|
{
|
||||||
devices[x].update(&devices[x], simdata);
|
if (devices[x].initialized == true)
|
||||||
|
{
|
||||||
|
devices[x].update(&devices[x], simdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ int main(int argc, char** argv)
|
||||||
pulseaudio = true;
|
pulseaudio = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
error = looper(devices, initdevices, p);
|
error = looper(devices, numdevices, p);
|
||||||
if (error == MONOCOQUE_ERROR_NONE)
|
if (error == MONOCOQUE_ERROR_NONE)
|
||||||
{
|
{
|
||||||
slogi("Game loop exited succesfully with error code: %i", error);
|
slogi("Game loop exited succesfully with error code: %i", error);
|
||||||
|
|
@ -242,7 +242,7 @@ int main(int argc, char** argv)
|
||||||
pulseaudio = true;
|
pulseaudio = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
error = tester(devices, initdevices);
|
error = tester(devices, numdevices);
|
||||||
if (error == MONOCOQUE_ERROR_NONE)
|
if (error == MONOCOQUE_ERROR_NONE)
|
||||||
{
|
{
|
||||||
slogi("Test exited succesfully with error code: %i", error);
|
slogi("Test exited succesfully with error code: %i", error);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue