diff --git a/src/iflytop/components/zcanreceiver/socket_can/socket_can.cpp b/src/iflytop/components/zcanreceiver/socket_can/socket_can.cpp index 33886c5..213b18b 100644 --- a/src/iflytop/components/zcanreceiver/socket_can/socket_can.cpp +++ b/src/iflytop/components/zcanreceiver/socket_can/socket_can.cpp @@ -30,14 +30,17 @@ SocketCan::SocketCanError_t SocketCan::sendFrame(shared_ptr fram canfd_frame_t canframe = frame->getCanFrame(); return writeFrame(canframe); } -SocketCan::SocketCanError_t SocketCan::writeFrame(const canfd_frame_t &frame) { +SocketCan::SocketCanError_t SocketCan::writeFrame(const canfd_frame_t &_frame) { if (!m_canBusIsReady) { return kDeviceBusy; } - setTxStateToTxing(frame); - int ret = write(m_socketCanFd, &frame, frame.len + 8); - if (ret != (frame.len + 8)) { + canfd_frame_t txframe = _frame; + txframe.can_id |= 0x10000000; + setTxStateToTxing(txframe); + + int ret = write(m_socketCanFd, &txframe, 16); + if (ret != (16)) { logger->error("write fail,{}", strerror(errno)); unsetTxStateToTxing(); return kWriteError; diff --git a/src/iflytop/components/zcanreceiver/zcanreceiverhost.cpp b/src/iflytop/components/zcanreceiver/zcanreceiverhost.cpp index f48058c..13ca3d0 100644 --- a/src/iflytop/components/zcanreceiver/zcanreceiverhost.cpp +++ b/src/iflytop/components/zcanreceiver/zcanreceiverhost.cpp @@ -7,7 +7,7 @@ using namespace iflytop; #define TAG "ZCanReceiver" -#define OVER_TIME_MS 5 +#define OVER_TIME_MS 20 using namespace iflytop; ZCanReceiverHost::ZCanReceiverHost() {}