mirror of
https://github.com/emqx/neuron.git
synced 2026-10-17 04:40:42 +08:00
Fix issue of sometimes failed to read multiple points in the coil area
* The functional tester "Read multiple points in the coil area" sometimes fail, because there is a mistake when writing bit to coil area register. I fix this mistake.
This commit is contained in:
@@ -216,7 +216,7 @@ int main()
|
||||
w_res->n_reg = w_req->n_reg;
|
||||
|
||||
for (int i = 0; i < ntohs(w_req->n_reg); i++) {
|
||||
uint8_t x = w_u8[ntohs(w_req->n_reg) / 8] << (7 - (i % 8));
|
||||
uint8_t x = (w_u8[ntohs(w_req->n_reg) / 8] >> (i % 8)) & 0x1;
|
||||
|
||||
if (x > 0) {
|
||||
coil[ntohs(w_req->start_addr) + i] = 1;
|
||||
@@ -250,4 +250,4 @@ int main()
|
||||
neu_tcp_server_close(server);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user