diff options
author | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-03-14 00:43:59 +0000 |
---|---|---|
committer | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-03-14 00:43:59 +0000 |
commit | 8dc38b0158d188849a417d9dc573c66bc9eed1f9 (patch) | |
tree | 4c0dd708edd2069325a49db061e4743262ea180d | |
parent | e798ee1ac24fd5f2f272360be28faef4cf39f079 (diff) | |
download | verteco-8dc38b0158d188849a417d9dc573c66bc9eed1f9.tar.gz |
modbuslog: Fix bitshiftingv1.4
Was not working correctly with Digirail 4C
Diffstat (limited to '')
-rw-r--r-- | src/modbuslog.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/modbuslog.c b/src/modbuslog.c index 9ef6f49..b310cc7 100644 --- a/src/modbuslog.c +++ b/src/modbuslog.c @@ -311,10 +311,7 @@ int main(int argc, char *argv[]) { } // bitshifting magic - switch (numregisters) { - case 1: - registervalue = byte[0]; - break; + switch (numregisters*2) { case 2: registervalue = ((byte[0]) << 8) + byte[1]; break; @@ -323,7 +320,7 @@ int main(int argc, char *argv[]) { + ((byte[2]) << 8) + byte[3]; break; default: - registervalue = byte[0]; + registervalue = ((byte[0]) << 8) + byte[1]; break; } |