From 3725d6eb47ee30763071022f60b40c3739796f7a Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 28 Jul 2026 10:49:59 +0200 Subject: [PATCH] Fix Can sniffer functionality (#18287) --- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + .../tasmota_xsns_sensor/xsns_87_can_sniffer.ino | 15 ++++----------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 540a49a4d..2f85f4ad3 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. - Library `PubSubClient` renamed to `TasmotaPubSub`, hardening fixes and comprehensive non-regression tests (#24916) ### Fixed +- Can sniffer functionality (#18287) ### Removed diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 333934099..4778c0ded 100755 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -130,6 +130,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm ### Fixed - Default button/switch actions on builds without rules regression from v15.4.0.2 [#24871](https://github.com/arendst/Tasmota/issues/24871) - PZEM/Modbus energy monitor Exception crash-loop on ESP8266 regression from v15.5.0 [#24883](https://github.com/arendst/Tasmota/issues/24883) +- Can sniffer functionality [#18287](https://github.com/arendst/Tasmota/issues/18287) - Udisp SPI for mono color display [#24899](https://github.com/arendst/Tasmota/issues/24899) - BLE EQ3 float output in mqtt messages regression from v15.4.0.2 [#24869](https://github.com/arendst/Tasmota/issues/24869) diff --git a/tasmota/tasmota_xsns_sensor/xsns_87_can_sniffer.ino b/tasmota/tasmota_xsns_sensor/xsns_87_can_sniffer.ino index db4c62c3e..c80b021b0 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_87_can_sniffer.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_87_can_sniffer.ino @@ -119,7 +119,7 @@ void MCP2515_FrameSizeError(uint8_t len, uint32_t id) { void MCP2515_Init(void) { if (PinUsed(GPIO_MCP2515_CS, GPIO_ANY) && TasmotaGlobal.spi_enabled) { - mcp2515 = new MCP2515(5); + mcp2515 = new MCP2515(Pin(GPIO_MCP2515_CS, GPIO_ANY)); if (MCP2515::ERROR_OK != mcp2515->reset()) { AddLog(LOG_LEVEL_INFO, PSTR("CAN: Failed to reset module")); return; @@ -132,7 +132,8 @@ void MCP2515_Init(void) { AddLog(LOG_LEVEL_INFO, PSTR("CAN: Failed to set normal mode")); return; } - AddLog(LOG_LEVEL_INFO, PSTR("CAN: Sniffer Initialized")); + AddLog(LOG_LEVEL_INFO, PSTR("CAN: Sniffer Initialized on GPIO%d"), Pin(GPIO_MCP2515_CS, GPIO_ANY)); + Mcp2515.init_status = 1; } } @@ -205,15 +206,7 @@ bool Xsns87(uint32_t function) { case FUNC_COMMAND: result = DecodeCommand(kCanCommands, CanCommand); break; - case FUNC_JSON_APPEND: -// MCP2515_Show(1); - break; - #ifdef USE_WEBSERVER - case FUNC_WEB_SENSOR: -// MCP2515_Show(0); - break; - #endif // USE_WEBSERVER - } + } } return result; }