![](/media/cache/profiles/P1030212_resized.JPG.50x50_q85.jpg)
明石高専ロボ研 mbedライブラリ
Dependents: MDD_L432KC USB2RS485 pathtracking odometry ... more
Diff: scrp_slave.cpp
- Revision:
- 4:39ef4d91dc34
- Parent:
- 3:28c77df7c0b6
- Child:
- 5:a7894e6982ea
--- a/scrp_slave.cpp Mon Jan 06 11:06:26 2020 +0000 +++ b/scrp_slave.cpp Fri Jul 24 14:12:15 2020 +0000 @@ -80,8 +80,7 @@ } int16_t ScrpSlave::send2(uint8_t id,uint8_t cmd,int16_t tx_data){ - if(mode_ < 2)return -1; - return sending(1,id,cmd,tx_data); + return ((mode_ < 2) ? -1 : sending(1,id,cmd,tx_data)); } int16_t ScrpSlave::sending(int port,uint8_t id,uint8_t cmd,int16_t tx_data){ @@ -167,7 +166,7 @@ } }else if(stx_flag_[port]){ uint8_t get_data = serial_[port]->getc(); - if(get_data == my_id_ || get_data == 255){ + if(get_data == my_id_ || get_data == 255 || wait_data_[port]){ id_ok_[port] = true; tmp_data_[port][0] = get_data; data_count_[port]++; @@ -177,7 +176,8 @@ }else if(serial_[port]->getc() == STX){ stx_flag_[port] = true; data_count_[port] = 0; - id_ok_[port] = wait_data_[port];//データ返信待ち時はidチェック無し + id_ok_[port] = false; + //id_ok_[port] = wait_data_[port];//データ返信待ち時はidチェック無し } return; }