Skip to content

Commit

Permalink
Merge pull request #65 from phagemann/bit_parsing
Browse files Browse the repository at this point in the history
AGMultiRead Bit query
  • Loading branch information
robinson authored Oct 31, 2023
2 parents bdaa10e + f1da4ea commit fb5a72f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type S7DataItem struct {
WordLen int
DBNumber int
Start int
Bit int
Amount int
Data []byte
Error string
Expand Down Expand Up @@ -162,8 +163,11 @@ func (mb *client) AGReadMulti(dataItems []S7DataItem, itemsCount int) (err error

// Adjusts the offset
var addr int
if dataItems[i].WordLen == s7wlbit || dataItems[i].WordLen == s7wlcounter || dataItems[i].WordLen == s7wltimer {
if dataItems[i].WordLen == s7wlcounter || dataItems[i].WordLen == s7wltimer {
addr = dataItems[i].Start
} else if dataItems[i].WordLen == s7wlbit {
addr = dataItems[i].Start << 3
addr += dataItems[i].Bit // Add Bit addr
} else {
addr = dataItems[i].Start * 8
}
Expand Down

0 comments on commit fb5a72f

Please sign in to comment.