aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-03-14 00:43:59 +0000
committerJonathan McCrohan <jmccrohan@gmail.com>2012-03-14 00:43:59 +0000
commit8dc38b0158d188849a417d9dc573c66bc9eed1f9 (patch)
tree4c0dd708edd2069325a49db061e4743262ea180d /src
parente798ee1ac24fd5f2f272360be28faef4cf39f079 (diff)
downloadverteco-1.4.tar.gz
modbuslog: Fix bitshiftingv1.4
Was not working correctly with Digirail 4C
Diffstat (limited to 'src')
-rw-r--r--src/modbuslog.c7
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;
}