diff --git a/firmware/controllers/core/fsio_core.cpp b/firmware/controllers/core/fsio_core.cpp index 8807cf7ab1..a0a6446b3c 100644 --- a/firmware/controllers/core/fsio_core.cpp +++ b/firmware/controllers/core/fsio_core.cpp @@ -22,6 +22,11 @@ extern fsio8_Map3D_f32t fsioTable1; extern fsio8_Map3D_u8t fsioTable2; +extern fsio8_Map3D_u8t fsioTable3; +extern fsio8_Map3D_u8t fsioTable4; + +static fsio8_Map3D_u8t * fsio8t_tables[] = {NULL, NULL, &fsioTable2, &fsioTable3, &fsioTable4}; + LENameOrdinalPair * LE_FIRST = NULL; @@ -262,7 +267,7 @@ bool LECalculator::processElement(Engine *engine, LEElement *element) { float yValue = pop(LE_METHOD_FSIO_TABLE); float xValue = pop(LE_METHOD_FSIO_TABLE); int index = (int) i; - if (index < 1 || index > 2) { + if (index < 1 || index > MAX_TABLE_INDEX) { push(element->action, NAN); } else { if (index == 1) { @@ -270,7 +275,7 @@ bool LECalculator::processElement(Engine *engine, LEElement *element) { push(element->action, t->getValue(xValue, yValue)); } else { - fsio8_Map3D_u8t *t = &fsioTable2; + fsio8_Map3D_u8t *t = fsio8t_tables[index]; push(element->action, t->getValue(xValue, yValue)); } diff --git a/firmware/controllers/core/fsio_core.h b/firmware/controllers/core/fsio_core.h index 4fcb6faaf7..c3922372e5 100644 --- a/firmware/controllers/core/fsio_core.h +++ b/firmware/controllers/core/fsio_core.h @@ -12,6 +12,8 @@ #include "fl_stack.h" #include "engine.h" +#define MAX_TABLE_INDEX 4 + typedef enum { LE_UNDEFINED = 0 ,