From 047b9008ee01cffa1a880efdf2299c29966d2100 Mon Sep 17 00:00:00 2001 From: Thiago Alves Date: Tue, 18 Nov 2025 16:22:44 -0500 Subject: [PATCH 1/6] Remove emoji --- core/src/drivers/plugin_driver.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/core/src/drivers/plugin_driver.c b/core/src/drivers/plugin_driver.c index c10a400a..4395c8e1 100644 --- a/core/src/drivers/plugin_driver.c +++ b/core/src/drivers/plugin_driver.c @@ -160,9 +160,7 @@ int plugin_driver_init(plugin_driver_t *driver) // Call the Python init function with proper capsule PyObject *result = PyObject_CallFunctionObjArgs(plugin->python_plugin->pFuncInit, args, NULL); - - // Store the capsule reference for the lifetime of the plugin - plugin->python_plugin->args_capsule = args; + Py_SET_REFCNT(args, UINT64_MAX); if (!result) { @@ -596,10 +594,10 @@ int python_plugin_get_symbols(plugin_instance_t *plugin) plugin->python_plugin = py_binds; printf("Python plugin '%s' symbols loaded successfully\n", module_name); - printf(" - init: %s\n", py_binds->pFuncInit ? "✓" : "✗"); - printf(" - start_loop: %s\n", py_binds->pFuncStart ? "✓" : "✗"); - printf(" - stop_loop: %s\n", py_binds->pFuncStop ? "✓" : "✗"); - printf(" - cleanup: %s\n", py_binds->pFuncCleanup ? "✓" : "✗"); + printf(" - init: %s\n", py_binds->pFuncInit ? "OK" : "Failed"); + printf(" - start_loop: %s\n", py_binds->pFuncStart ? "OK" : "Failed"); + printf(" - stop_loop: %s\n", py_binds->pFuncStop ? "OK" : "Failed"); + printf(" - cleanup: %s\n", py_binds->pFuncCleanup ? "OK" : "Failed"); return 0; } @@ -641,7 +639,6 @@ static void python_plugin_cleanup(plugin_instance_t *plugin) Py_XDECREF(plugin->python_plugin->pFuncStop); Py_XDECREF(plugin->python_plugin->pFuncCleanup); Py_XDECREF(plugin->python_plugin->pModule); - Py_XDECREF(plugin->python_plugin->args_capsule); free(plugin->python_plugin); plugin->python_plugin = NULL; From 2849d27239eb2825ae7310db106e892dabe72e0b Mon Sep 17 00:00:00 2001 From: Thiago Alves Date: Tue, 18 Nov 2025 16:24:44 -0500 Subject: [PATCH 2/6] revert accidental changes --- core/src/drivers/plugin_driver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/drivers/plugin_driver.c b/core/src/drivers/plugin_driver.c index 4395c8e1..34325a46 100644 --- a/core/src/drivers/plugin_driver.c +++ b/core/src/drivers/plugin_driver.c @@ -160,7 +160,9 @@ int plugin_driver_init(plugin_driver_t *driver) // Call the Python init function with proper capsule PyObject *result = PyObject_CallFunctionObjArgs(plugin->python_plugin->pFuncInit, args, NULL); - Py_SET_REFCNT(args, UINT64_MAX); + + // Store the capsule reference for the lifetime of the plugin + plugin->python_plugin->args_capsule = args; if (!result) { @@ -639,6 +641,7 @@ static void python_plugin_cleanup(plugin_instance_t *plugin) Py_XDECREF(plugin->python_plugin->pFuncStop); Py_XDECREF(plugin->python_plugin->pFuncCleanup); Py_XDECREF(plugin->python_plugin->pModule); + Py_XDECREF(plugin->python_plugin->args_capsule); free(plugin->python_plugin); plugin->python_plugin = NULL; From cc02348b0923d4bc6d6268f694c7fa813a0dab56 Mon Sep 17 00:00:00 2001 From: Thiago Alves Date: Tue, 18 Nov 2025 16:25:43 -0500 Subject: [PATCH 3/6] Remove emojis --- .../python/modbus_slave/simple_modbus.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/src/drivers/plugins/python/modbus_slave/simple_modbus.py b/core/src/drivers/plugins/python/modbus_slave/simple_modbus.py index bf49960a..81dab08a 100644 --- a/core/src/drivers/plugins/python/modbus_slave/simple_modbus.py +++ b/core/src/drivers/plugins/python/modbus_slave/simple_modbus.py @@ -311,14 +311,14 @@ def init(args_capsule): # This is a PyCapsule from C - use safe extraction runtime_args, error_msg = safe_extract_runtime_args_from_capsule(args_capsule) if runtime_args is None: - print(f"[MODBUS] ✗ Failed to extract runtime args: {error_msg}") + print(f"[MODBUS] Failed to extract runtime args: {error_msg}") return False - print(f"[MODBUS] ✓ Runtime arguments extracted successfully") + print(f"[MODBUS] Runtime arguments extracted successfully") else: # This is a direct object (for testing) runtime_args = args_capsule - print(f"[MODBUS] ✓ Using direct runtime args for testing") + print(f"[MODBUS] Using direct runtime args for testing") # Try to load configuration from plugin_specific_config_file_path try: @@ -329,21 +329,21 @@ def init(args_capsule): if network_config and 'host' in network_config and 'port' in network_config: gIp = str(network_config['host']) gPort = int(network_config['port']) - print(f"[MODBUS] ✓ Configuration loaded - Host: {gIp}, Port: {gPort}") + print(f"[MODBUS] Configuration loaded - Host: {gIp}, Port: {gPort}") else: - print(f"[MODBUS] ⚠ Config file loaded but network_configuration section missing or incomplete - using defaults") + print(f"[MODBUS] Config file loaded but network_configuration section missing or incomplete - using defaults") print(f"[MODBUS] Available config sections: {list(config_map.keys())}") else: - print(f"[MODBUS] ✗ Failed to load configuration file: {status} - using defaults") + print(f"[MODBUS] Failed to load configuration file: {status} - using defaults") except Exception as config_error: - print(f"[MODBUS] ⚠ Exception while loading config: {config_error} - using defaults") + print(f"[MODBUS] Exception while loading config: {config_error} - using defaults") import traceback traceback.print_exc() # Safely access buffer size using validation buffer_size, size_error = runtime_args.safe_access_buffer_size() if buffer_size == -1: - print(f"[MODBUS] ✗ Failed to access buffer size: {size_error}") + print(f"[MODBUS] Failed to access buffer size: {size_error}") return False # print(f"[MODBUS] Buffer size: {buffer_size}") @@ -371,11 +371,11 @@ def init(args_capsule): ) server_context = ModbusServerContext(devices={1: device}, single=False) - print(f"[MODBUS] ✓ Plugin initialized successfully - Host: {gIp}, Port: {gPort}") + print(f"[MODBUS] Plugin initialized successfully - Host: {gIp}, Port: {gPort}") return True except Exception as e: - print(f"[MODBUS] ✗ Plugin initialization failed: {e}") + print(f"[MODBUS] Plugin initialization failed: {e}") import traceback traceback.print_exc() return False From 50a821863e7f3de30c2fa6e2d00e131183028e63 Mon Sep 17 00:00:00 2001 From: Thiago Alves Date: Tue, 18 Nov 2025 16:26:19 -0500 Subject: [PATCH 4/6] Remove emojis --- scripts/setup-tests-env.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/setup-tests-env.sh b/scripts/setup-tests-env.sh index 018e0874..5d7984b1 100755 --- a/scripts/setup-tests-env.sh +++ b/scripts/setup-tests-env.sh @@ -8,35 +8,35 @@ set -e PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" VENV_DIR="$PROJECT_ROOT/venvs/test-env" -echo "🚀 Setting up test environment for OpenPLC Runtime" -echo "📂 Project root: $PROJECT_ROOT" -echo "🐍 Virtualenv: $VENV_DIR" +echo "Setting up test environment for OpenPLC Runtime" +echo "Project root: $PROJECT_ROOT" +echo "Virtualenv: $VENV_DIR" echo "==============================" if [ ! -d "$VENV_DIR" ]; then - echo "📦 Creating virtual environment..." + echo "Creating virtual environment..." python3 -m venv "$VENV_DIR" else - echo "✅ Virtual environment already exists." + echo "Virtual environment already exists." fi source "$VENV_DIR/bin/activate" -echo "⬆️ Upgrading pip..." +echo "Upgrading pip..." pip install --upgrade pip if [ -f "$PROJECT_ROOT/requirements.txt" ]; then - echo "📦 Installing dependencies from requirements.txt..." + echo "Installing dependencies from requirements.txt..." pip install -r "$PROJECT_ROOT/requirements.txt" fi # 4. Install pytest and project in editable mode -echo "🧪 Installing pytest and local package..." +echo "Installing pytest and local package..." pip install pytest pip install -e "$PROJECT_ROOT" if [ ! -f "$PROJECT_ROOT/pytest.ini" ]; then - echo "⚙️ Creating default pytest.ini..." + echo "Creating default pytest.ini..." cat < "$PROJECT_ROOT/pytest.ini" [pytest] minversion = 7.0 @@ -48,7 +48,7 @@ fi # Existing conftest.py with fixtures is preserved; no need to create or overwrite. -echo "🧪 Running pytest..." +echo "Running pytest..." pytest -vvv -echo "✅ All done!" +echo "All done!" From 98b90e2a85546ee29c64cf750c7d6bcf872d8a3a Mon Sep 17 00:00:00 2001 From: Thiago Alves Date: Tue, 18 Nov 2025 16:26:55 -0500 Subject: [PATCH 5/6] Remove emojis --- webserver/DEBUG_WEBSOCKET.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webserver/DEBUG_WEBSOCKET.md b/webserver/DEBUG_WEBSOCKET.md index b7b4b54f..daea267b 100644 --- a/webserver/DEBUG_WEBSOCKET.md +++ b/webserver/DEBUG_WEBSOCKET.md @@ -192,15 +192,15 @@ sio = socketio.Client(ssl_verify=False) @sio.event(namespace='/api/debug') def connect(): - print("✓ Connected to WebSocket!") + print("Connected to WebSocket!") @sio.event(namespace='/api/debug') def connected(data): - print(f"✓ Server confirmed: {data}") + print(f"Server confirmed: {data}") @sio.event(namespace='/api/debug') def debug_response(data): - print(f"\n✓ Debug response:") + print(f"\nDebug response:") print(f" Success: {data.get('success')}") if data.get('success'): print(f" Data: {data.get('data')}") @@ -209,7 +209,7 @@ def debug_response(data): @sio.event(namespace='/api/debug') def disconnect(): - print("✗ Disconnected") + print("Disconnected") # Connect with token in auth dict (preferred method) try: From e0f0fea0655f71c4767154eebb2de14f55cb6b93 Mon Sep 17 00:00:00 2001 From: Thiago Alves Date: Tue, 18 Nov 2025 16:27:38 -0500 Subject: [PATCH 6/6] Remove emojis --- webserver/logger/logger_module_documentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webserver/logger/logger_module_documentation.md b/webserver/logger/logger_module_documentation.md index d308e31a..06e7aa5e 100644 --- a/webserver/logger/logger_module_documentation.md +++ b/webserver/logger/logger_module_documentation.md @@ -192,7 +192,7 @@ for record in buffer.buffer: --- -## 🧪 Development & Testing +## Development & Testing This section guides developers on how to **test and validate the logging module** during development.