diff options
Diffstat (limited to 'src')
-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; } |