Add numlights setting
This commit is contained in:
parent
d3618c758d
commit
6d24c5e7f2
|
|
@ -39,7 +39,7 @@ int arduino_shiftlights_update(SimDevice* this, SimData* simdata)
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
|
||||||
|
|
||||||
int num_avail_leds = 6;
|
int num_avail_leds = serialdevice->numlights;
|
||||||
int rpm = simdata->rpms;
|
int rpm = simdata->rpms;
|
||||||
int maxrpm = simdata->maxrpm;
|
int maxrpm = simdata->maxrpm;
|
||||||
int litleds = 0;
|
int litleds = 0;
|
||||||
|
|
@ -197,6 +197,7 @@ SerialDevice* new_serial_device(DeviceSettings* ds, MonocoqueSettings* ms) {
|
||||||
switch (ds->dev_subtype) {
|
switch (ds->dev_subtype) {
|
||||||
case (SIMDEVTYPE_SHIFTLIGHTS):
|
case (SIMDEVTYPE_SHIFTLIGHTS):
|
||||||
this->devicetype = ARDUINODEV__SHIFTLIGHTS;
|
this->devicetype = ARDUINODEV__SHIFTLIGHTS;
|
||||||
|
this->numlights = ds->serialdevsettings.numlights;
|
||||||
this->m.vtable = &arduino_shiftlights_vtable;
|
this->m.vtable = &arduino_shiftlights_vtable;
|
||||||
slogi("Initializing arduino device for shiftlights.");
|
slogi("Initializing arduino device for shiftlights.");
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ typedef struct
|
||||||
SerialDeviceType devicetype;
|
SerialDeviceType devicetype;
|
||||||
// move these two they only apply to the haptic device
|
// move these two they only apply to the haptic device
|
||||||
int motorsposition;
|
int motorsposition;
|
||||||
|
int numlights;
|
||||||
int baudrate;
|
int baudrate;
|
||||||
double ampfactor;
|
double ampfactor;
|
||||||
double state;
|
double state;
|
||||||
|
|
|
||||||
|
|
@ -716,6 +716,10 @@ int devsetup(const char* device_type, const char* device_subtype, const char* co
|
||||||
config_setting_lookup_int(device_settings, "motors", &motorposition);
|
config_setting_lookup_int(device_settings, "motors", &motorposition);
|
||||||
ds->serialdevsettings.motorsposition = motorposition;
|
ds->serialdevsettings.motorsposition = motorposition;
|
||||||
|
|
||||||
|
int numlights = 6;
|
||||||
|
config_setting_lookup_int(device_settings, "numlights", &numlights);
|
||||||
|
ds->serialdevsettings.numlights = numlights;
|
||||||
|
|
||||||
int baud = 9600;
|
int baud = 9600;
|
||||||
config_setting_lookup_int(device_settings, "baud", &baud);
|
config_setting_lookup_int(device_settings, "baud", &baud);
|
||||||
ds->serialdevsettings.baud = baud;
|
ds->serialdevsettings.baud = baud;
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
char* portdev;
|
char* portdev;
|
||||||
MotorPosition motorsposition;
|
MotorPosition motorsposition;
|
||||||
|
int numlights;
|
||||||
float ampfactor;
|
float ampfactor;
|
||||||
int baud;
|
int baud;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue