refactoring: magic constant

This commit is contained in:
rusefi 2022-08-21 22:46:49 -04:00
parent 26eda07424
commit 7f84657aac
3 changed files with 4 additions and 3 deletions

View File

@ -4,6 +4,7 @@
#define FILTER_SPECIFIC 0x1FFFFFFF
#define ANY_BUS -1
#define NO_CALLBACK -1
struct CanFilter {
int32_t Id;

View File

@ -57,7 +57,7 @@ void processLuaCan(const size_t busIndex, const CANRxFrame& frame) {
}
static void handleCanFrame(LuaHandle& ls, CanFrameData* data) {
if (data->Callback == -1) {
if (data->Callback == NO_CALLBACK) {
// No callback, use catch-all function
lua_getglobal(ls, "onCanRx");
} else {

View File

@ -467,7 +467,7 @@ int lua_canRxAdd(lua_State* l) {
// defaults if not passed
int bus = ANY_BUS;
int callback = -1;
int callback = NO_CALLBACK;
switch (lua_gettop(l)) {
case 1:
@ -511,7 +511,7 @@ int lua_canRxAddMask(lua_State* l) {
// defaults if not passed
int bus = ANY_BUS;
int callback = -1;
int callback = NO_CALLBACK;
switch (lua_gettop(l)) {
case 2: