Lua CAN relay performance #3911
This commit is contained in:
parent
9a42afd435
commit
7bc130200d
|
@ -130,8 +130,9 @@ static int luaTickPeriodUs;
|
||||||
static int lua_setTickRate(lua_State* l) {
|
static int lua_setTickRate(lua_State* l) {
|
||||||
float freq = luaL_checknumber(l, 1);
|
float freq = luaL_checknumber(l, 1);
|
||||||
|
|
||||||
// Limit to 1..100 hz
|
// For instance BMW does 100 CAN messages per second on some IDs, let's allow at least twice that speed
|
||||||
freq = clampF(1, freq, 100);
|
// Limit to 1..200 hz
|
||||||
|
freq = clampF(1, freq, 200);
|
||||||
|
|
||||||
luaTickPeriodUs = 1000000.0f / freq;
|
luaTickPeriodUs = 1000000.0f / freq;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue