Fix to use lua on c12 if lua script loads properly
This commit is contained in:
parent
b776e05f66
commit
22930163ec
|
|
@ -92,9 +92,11 @@ int cammusc12_init_(USBDevice* wheeldevice)
|
||||||
int cammusc12_init(USBDevice* wheeldevice, const char* luafile)
|
int cammusc12_init(USBDevice* wheeldevice, const char* luafile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
wheeldevice->u.wheeldevice.useLua = false;
|
||||||
int res = cammusc12_init_(wheeldevice);
|
int res = cammusc12_init_(wheeldevice);
|
||||||
if(luafile == NULL)
|
if(luafile == NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,9 +111,11 @@ int cammusc12_init(USBDevice* wheeldevice, const char* luafile)
|
||||||
/* the stack */
|
/* the stack */
|
||||||
sloge("There is an issue with your lua script");
|
sloge("There is an issue with your lua script");
|
||||||
fprintf(stderr, "Couldn't load file: %s\n", lua_tostring(L, -1));
|
fprintf(stderr, "Couldn't load file: %s\n", lua_tostring(L, -1));
|
||||||
|
return -1;
|
||||||
//exit(1);
|
//exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wheeldevice->u.wheeldevice.useLua = true;
|
||||||
lua_setglobal(L,"myFunc");
|
lua_setglobal(L,"myFunc");
|
||||||
|
|
||||||
wheeldevice->m.L = L;
|
wheeldevice->m.L = L;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include "../../simdevice.h"
|
#include "../../simdevice.h"
|
||||||
|
|
||||||
int cammusc12_update(USBDevice* wheeldevice, int maxrpm, int rpm, int gear, int velocity);
|
int cammusc12_update(USBDevice* wheeldevice, int maxrpm, int rpm, int gear, int velocity);
|
||||||
|
int cammusc12_customled_update(USBDevice* usbdevice, SimData* simdata);
|
||||||
int cammusc12_init(USBDevice* wheeldevice, const char* luafile);
|
int cammusc12_init(USBDevice* wheeldevice, const char* luafile);
|
||||||
int cammusc12_free(USBDevice* wheeldevice);
|
int cammusc12_free(USBDevice* wheeldevice);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,14 @@ int wheeldev_update(USBDevice* usbdevice, SimData* simdata)
|
||||||
cammusc5_update(usbdevice, simdata->maxrpm, simdata->rpms, simdata->gear, simdata->velocity);
|
cammusc5_update(usbdevice, simdata->maxrpm, simdata->rpms, simdata->gear, simdata->velocity);
|
||||||
break;
|
break;
|
||||||
case WHEELDEV_CAMMUSC12 :
|
case WHEELDEV_CAMMUSC12 :
|
||||||
|
if(usbdevice->u.wheeldevice.useLua == true)
|
||||||
|
{
|
||||||
|
cammusc12_customled_update(usbdevice, simdata);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
cammusc12_update(usbdevice, simdata->maxrpm, simdata->rpms, simdata->gear, simdata->velocity);
|
cammusc12_update(usbdevice, simdata->maxrpm, simdata->rpms, simdata->gear, simdata->velocity);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
WheelType type;
|
WheelType type;
|
||||||
|
bool useLua;
|
||||||
char* port;
|
char* port;
|
||||||
}
|
}
|
||||||
WheelDevice;
|
WheelDevice;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue