Fix issue with test not having a car set
This commit is contained in:
parent
88e762b718
commit
695581b66d
|
|
@ -561,6 +561,7 @@ int tester(SimDevice* devices, int numdevices)
|
|||
tcsetattr(0, TCSANOW, &newsettings);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
simdata->car = "MONOCOQUETESTCAR";
|
||||
simdata->gear = MONOCOQUE_GEAR_NEUTRAL;
|
||||
simdata->velocity = 16;
|
||||
simdata->rpms = 100;
|
||||
|
|
|
|||
|
|
@ -176,6 +176,22 @@ int strtodev(const char* device_type, const char* device_subtype, DeviceSettings
|
|||
return MONOCOQUE_ERROR_NONE;
|
||||
}
|
||||
|
||||
int getNumberOfConfigs(const char* config_file_str)
|
||||
{
|
||||
config_t cfg;
|
||||
config_init(&cfg);
|
||||
if (!config_read_file(&cfg, config_file_str))
|
||||
{
|
||||
fprintf(stderr, "%s:%d - %s\n", config_error_file(&cfg), config_error_line(&cfg), config_error_text(&cfg));
|
||||
return -1;
|
||||
}
|
||||
config_setting_t* config = NULL;
|
||||
config_setting_t* config_widgets = NULL;
|
||||
config = config_lookup(&cfg, "configs");
|
||||
int configs = config_setting_length(config);
|
||||
|
||||
return configs;
|
||||
}
|
||||
int getconfigtouse(const char* config_file_str, char* car, int sim)
|
||||
{
|
||||
config_t cfg;
|
||||
|
|
|
|||
|
|
@ -199,4 +199,5 @@ int configcheck(const char* config_file_str, int confignum, int* devices);
|
|||
|
||||
int uiloadconfig(const char* config_file_str, int confignum, int configureddevices, MonocoqueSettings* ms, DeviceSettings* ds);
|
||||
|
||||
int getNumberOfConfigs(const char* config_file_str);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -249,7 +249,8 @@ int main(int argc, char** argv)
|
|||
|
||||
ms->useconfig = 0;
|
||||
|
||||
int confignum = getconfigtouse(ms->config_str, "default", 0);
|
||||
int configs = getNumberOfConfigs(ms->config_str);
|
||||
int confignum = getconfigtouse(ms->config_str, "default", configs-1);
|
||||
int configureddevices;
|
||||
configcheck(ms->config_str, confignum, &configureddevices);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue