debug modbus slave
This commit is contained in:
@@ -40,23 +40,23 @@ static void chrg_north_thread_entry (void *data)
|
||||
rt_uint8_t crc8 = 0;
|
||||
rt_size_t len_mq = 0, len_get = 0, len_msg = 0;
|
||||
struct chrg_tty_t *pTTY = pNOR->tty;
|
||||
struct mq_msg_t *pMQ = &pTTY->msg_mq;
|
||||
struct mq_msg_t msg;
|
||||
|
||||
while (1) {
|
||||
rt_memset(pMQ, 0, sizeof(struct mq_msg_t));
|
||||
len_mq = rt_mq_recv(pTTY->mq, pMQ, sizeof(struct mq_msg_t), RT_WAITING_FOREVER);
|
||||
rt_memset(&msg, 0, sizeof(struct mq_msg_t));
|
||||
len_mq = rt_mq_recv(pTTY->mq, &msg, sizeof(struct mq_msg_t), RT_WAITING_FOREVER);
|
||||
if (len_mq <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
len_get = rt_device_read(pMQ->dev, 0, &pNOR->rx_buf[0], 1);
|
||||
len_get = rt_device_read(msg.dev, 0, &pNOR->rx_buf[0], 1);
|
||||
if (1 != len_get) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pNOR->rx_len = 1;
|
||||
|
||||
len_msg = rt_device_read(pMQ->dev, 0, &pNOR->rx_buf[1], len_get-1);
|
||||
len_msg = rt_device_read(msg.dev, 0, &pNOR->rx_buf[1], len_get-1);
|
||||
if (len_msg <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user