From 0a6f5f221daadc555689f95d22480a23b7035f76 Mon Sep 17 00:00:00 2001 From: Ingo Fischer Date: Sat, 25 May 2024 19:18:41 +0200 Subject: [PATCH] deps and logs --- .github/workflows/test-and-release.yml | 2 +- README.md | 5 +++++ lib/master.js | 18 +++++++++--------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 5a4a60b8..bd4d1395 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -52,7 +52,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - node-version: [18.x, 20.x] + node-version: [18.x, 20.x, 22.x] os: [ubuntu-latest, windows-latest, macos-latest] steps: diff --git a/README.md b/README.md index 47f42fbf..37e84566 100644 --- a/README.md +++ b/README.md @@ -303,6 +303,11 @@ There are some programs in folder `test` to test the TCP communication: ### **WORK IN PROGRESS** --> ## Changelog + +### __WORK IN PROGRESS__ +* (Q7Jensen) Fixed error at aligning addresses to word +* (Apollon77) Added device id to some errors + ### 6.2.2 (2024-04-26) * (Apollon77) Downgrade gulp to 4.0.2 to fix build diff --git a/lib/master.js b/lib/master.js index 4324094a..420cb365 100755 --- a/lib/master.js +++ b/lib/master.js @@ -245,7 +245,7 @@ function Master(options, adapter) { scaleFactors[regs.deviceId][regs.config[n]._address] = val; showDebug && adapter.log.debug(`[${prefixAddr}] Scale factor value stored from this address = ${val}`); } catch (err) { - adapter.log.error(`Can not set value: ${err.message}`); + adapter.log.error(`Can not set value for [${regs.deviceId}]: ${err.message}`); } } } @@ -438,11 +438,11 @@ function Master(options, adapter) { }); } - function pollResult(startTime, err, cb) { + function pollResult(startTime, deviceId, err, cb) { if (err) { errorCount++; - adapter.log.warn(`Poll error count: ${errorCount} code: ${JSON.stringify(err)}`); + adapter.log.warn(`[${deviceId}] Poll error count: ${errorCount} code: ${JSON.stringify(err)}`); adapter.setState('info.connection', false, true); if (errorCount > 12 * deviceIds.length) { // 2 reconnects did not help, restart adapter @@ -481,7 +481,7 @@ function Master(options, adapter) { let requestTimer = adapter.setTimeout(() => { requestTimer = null; if (connected && !isStop) { - pollResult(startTime, 'App Timeout', callback); + pollResult(startTime, device.coils.deviceId, `App Timeout`, callback); } }, options.config.timeout + 200); @@ -492,7 +492,7 @@ function Master(options, adapter) { clearTimeout(requestTimer); requestTimer = null; if (connected && !isStop) { - pollResult(startTime, err, callback); + pollResult(startTime, device.coils.deviceId, err, callback); } } } else { @@ -502,7 +502,7 @@ function Master(options, adapter) { clearTimeout(requestTimer); requestTimer = null; if (connected && !isStop) { - pollResult(startTime, err, callback); + pollResult(startTime, device.coils.deviceId, err, callback); } } } else { @@ -512,7 +512,7 @@ function Master(options, adapter) { clearTimeout(requestTimer); requestTimer = null; if (connected && !isStop) { - pollResult(startTime, err, callback); + pollResult(startTime, device.coils.deviceId, err, callback); } } } else { @@ -521,7 +521,7 @@ function Master(options, adapter) { clearTimeout(requestTimer); requestTimer = null; if (connected && !isStop) { - pollResult(startTime, err, callback); + pollResult(startTime, device.coils.deviceId, err, callback); } } }); @@ -891,4 +891,4 @@ function Master(options, adapter) { return this; } -module.exports = Master; \ No newline at end of file +module.exports = Master;