From 746b16bbff4c5849ec7cfcc4bc3d081cf24ccedc Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 17:58:12 +0000 Subject: [PATCH] Fix Simulink hardware layer: remove deprecated pinNotPresent calls The pinNotPresent function and ignored_* arrays were removed from the runtime in commit ea789c51, but the Simulink hardware layer was not updated accordingly. This caused compilation failures when users tried to use the Simulink driver. This fix aligns Simulink.cpp with the pattern used in other hardware layers (raspberrypi.cpp, neuron.cpp, etc.) by: - Removing the pinNotPresent() calls - Removing the unused ARRAY_SIZE macro - Keeping only the NULL pointer checks for I/O buffer access Co-Authored-By: Thiago Alves --- webserver/core/hardware_layers/simulink.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/webserver/core/hardware_layers/simulink.cpp b/webserver/core/hardware_layers/simulink.cpp index ddf7024..4eaf272 100755 --- a/webserver/core/hardware_layers/simulink.cpp +++ b/webserver/core/hardware_layers/simulink.cpp @@ -38,10 +38,6 @@ #include "ladder.h" -#if !defined(ARRAY_SIZE) - #define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0])) -#endif - #define PORT 6668 #define ANALOG_BUF_SIZE 8 @@ -131,19 +127,13 @@ void *exchangeData(void *arg) pthread_mutex_lock(&bufferLock); //lock mutex for (int i = 0; i < ANALOG_BUF_SIZE; i++) { - if (pinNotPresent(ignored_int_inputs, ARRAY_SIZE(ignored_int_inputs), i)) - if (int_input[i] != NULL) *int_input[i] = plc_data->analogIn[i]; - - if (pinNotPresent(ignored_int_outputs, ARRAY_SIZE(ignored_int_outputs), i)) - if (int_output[i] != NULL) plc_data->analogOut[i] = *int_output[i]; + if (int_input[i] != NULL) *int_input[i] = plc_data->analogIn[i]; + if (int_output[i] != NULL) plc_data->analogOut[i] = *int_output[i]; } for (int i = 0; i < DIGITAL_BUF_SIZE; i++) { - if (pinNotPresent(ignored_bool_inputs, ARRAY_SIZE(ignored_bool_inputs), i)) - if (bool_input[i/8][i%8] != NULL) *bool_input[i/8][i%8] = plc_data->digitalIn[i]; - - if (pinNotPresent(ignored_bool_outputs, ARRAY_SIZE(ignored_bool_outputs), i)) - if (bool_output[i/8][i%8] != NULL) plc_data->digitalOut[i] = *bool_output[i/8][i%8]; + if (bool_input[i/8][i%8] != NULL) *bool_input[i/8][i%8] = plc_data->digitalIn[i]; + if (bool_output[i/8][i%8] != NULL) plc_data->digitalOut[i] = *bool_output[i/8][i%8]; } pthread_mutex_unlock(&bufferLock); //unlock mutex