Fix tachometer config error handling
This commit is contained in:
parent
54dde79ad8
commit
5bd816bdb1
|
|
@ -38,7 +38,7 @@ int devinit(SimDevice* simdevices, int numdevices, DeviceSettings* ds)
|
||||||
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;
|
||||||
devices++;
|
devices++;
|
||||||
|
|
|
||||||
|
|
@ -92,5 +92,7 @@ USBDevice* new_usb_device(DeviceSettings* ds) {
|
||||||
free(this);
|
free(this);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->m.initialized = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,12 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error = devinit(tachdev, 1, ds);
|
int devices = 0;
|
||||||
|
devices = devinit(tachdev, 1, ds);
|
||||||
|
if(devices < 1)
|
||||||
|
{
|
||||||
|
error = MONOCOQUE_ERROR_INVALID_DEV;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error != MONOCOQUE_ERROR_NONE)
|
if (error != MONOCOQUE_ERROR_NONE)
|
||||||
|
|
@ -136,7 +141,13 @@ int main(int argc, char** argv)
|
||||||
slogi("configuring tachometer with max revs: %i, granularity: %i, saving to %s", p->max_revs, p->granularity, p->save_file);
|
slogi("configuring tachometer with max revs: %i, granularity: %i, saving to %s", p->max_revs, p->granularity, p->save_file);
|
||||||
config_tachometer(p->max_revs, p->granularity, p->save_file, tachdev, sdata);
|
config_tachometer(p->max_revs, p->granularity, p->save_file, tachdev, sdata);
|
||||||
}
|
}
|
||||||
devfree(tachdev, 1);
|
|
||||||
|
slogt("freeing devices if necessary");
|
||||||
|
if(tachdev->initialized == true)
|
||||||
|
{
|
||||||
|
slogt("freeing tachmoeter device");
|
||||||
|
tachdev->free(tachdev);
|
||||||
|
}
|
||||||
//free(tachdev);
|
//free(tachdev);
|
||||||
free(sdata);
|
free(sdata);
|
||||||
free(ds);
|
free(ds);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue