Skip to content

Commit

Permalink
Merge pull request #510 from Q7Jensen/patch-1
Browse files Browse the repository at this point in the history
Update main.js because of error at aligning adresses to word
  • Loading branch information
Apollon77 authored May 25, 2024
2 parents 31e406a + be8f43f commit 95c1a12
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -946,4 +950,4 @@ if (module && module.parent) {
} else {
// or start the instance directly
startAdapter();
}
}

0 comments on commit 95c1a12

Please sign in to comment.