From be8f43f6bbcd135f5fac4e35809c2bd9de605e1d Mon Sep 17 00:00:00 2001 From: Jensen Date: Fri, 10 May 2024 07:29:39 +0200 Subject: [PATCH] Update main.js because of error at aligning adresses to word The length was not taken into account when moving the start address. If, for example, the start address was reduced by 15 bits and the length increased by 11 bits, 4 bits were missing at the end. This should no longer happen with the proposed change. --- main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 33889756..ed48f5e5 100644 --- a/main.js +++ b/main.js @@ -739,14 +739,18 @@ function iterateAddresses(isBools, deviceId, result, regName, regType, localOpti if (config.length) { result.length = result.addressHigh - result.addressLow; if (isBools && !localOptions.doNotRoundAddressToWord) { + let oldstart = result.addressLow; result.addressLow = (result.addressLow >> 4) << 4; + result.length += (oldstart - result.addressLow); if (result.length % 16) { result.length = ((result.length >> 4) + 1) << 4; } if (result.blocks) { for (let b = 0; b < result.blocks.length; b++) { + let oldstart = result.blocks[b].start; result.blocks[b].start = (result.blocks[b].start >> 4) << 4; + result.blocks[b].count += (oldstart - result.blocks[b].count); if (result.blocks[b].count % 16) { result.blocks[b].count = ((result.blocks[b].count >> 4) + 1) << 4; @@ -946,4 +950,4 @@ if (module && module.parent) { } else { // or start the instance directly startAdapter(); -} \ No newline at end of file +}