@@ -600,14 +600,15 @@ Master::syncRead(InfoSyncReadInst_t* p_info, uint32_t timeout_ms)
600
600
return 0 ;
601
601
}
602
602
603
+ if (p_info->packet .p_buf != nullptr ){
604
+ p_packet_buf = p_info->packet .p_buf ;
605
+ packet_buf_cap = p_info->packet .buf_capacity ;
606
+ }else {
607
+ p_packet_buf = p_packet_buf_;
608
+ packet_buf_cap = packet_buf_capacity_;
609
+ }
610
+
603
611
if (p_info->packet .is_completed == false || p_info->is_info_changed == true ){
604
- if (p_info->packet .p_buf != nullptr ){
605
- p_packet_buf = p_info->packet .p_buf ;
606
- packet_buf_cap = p_info->packet .buf_capacity ;
607
- }else {
608
- p_packet_buf = p_packet_buf_;
609
- packet_buf_cap = packet_buf_capacity_;
610
- }
611
612
err = begin_make_dxl_packet (&info_tx_packet_, DXL_BROADCAST_ID, protocol_ver_idx_,
612
613
DXL_INST_SYNC_READ, 0 , p_packet_buf, packet_buf_cap);
613
614
if (err == DXL_LIB_OK){
@@ -628,7 +629,8 @@ Master::syncRead(InfoSyncReadInst_t* p_info, uint32_t timeout_ms)
628
629
err = end_make_dxl_packet (&info_tx_packet_);
629
630
if (err == DXL_LIB_OK){
630
631
p_info->packet .gen_length = info_tx_packet_.generated_packet_length ;
631
- p_info->packet .is_completed = true ;
632
+ p_info->packet .is_completed = true ;
633
+ p_info->is_info_changed = false ;
632
634
}
633
635
}
634
636
}
@@ -655,6 +657,8 @@ Master::syncRead(InfoSyncReadInst_t* p_info, uint32_t timeout_ms)
655
657
break ;
656
658
}
657
659
}
660
+ }else {
661
+ p_info->packet .is_completed = false ;
658
662
}
659
663
last_lib_err_ = err;
660
664
@@ -687,14 +691,15 @@ Master::syncWrite(InfoSyncWriteInst_t* p_info)
687
691
return 0 ;
688
692
}
689
693
694
+ if (p_info->packet .p_buf != nullptr ){
695
+ p_packet_buf = p_info->packet .p_buf ;
696
+ packet_buf_cap = p_info->packet .buf_capacity ;
697
+ }else {
698
+ p_packet_buf = p_packet_buf_;
699
+ packet_buf_cap = packet_buf_capacity_;
700
+ }
701
+
690
702
if (p_info->packet .is_completed == false || p_info->is_info_changed == true ){
691
- if (p_info->packet .p_buf != nullptr ){
692
- p_packet_buf = p_info->packet .p_buf ;
693
- packet_buf_cap = p_info->packet .buf_capacity ;
694
- }else {
695
- p_packet_buf = p_packet_buf_;
696
- packet_buf_cap = packet_buf_capacity_;
697
- }
698
703
err = begin_make_dxl_packet (&info_tx_packet_, DXL_BROADCAST_ID, protocol_ver_idx_,
699
704
DXL_INST_SYNC_WRITE, 0 , p_packet_buf, packet_buf_cap);
700
705
if (err == DXL_LIB_OK){
@@ -726,6 +731,7 @@ Master::syncWrite(InfoSyncWriteInst_t* p_info)
726
731
if (err == DXL_LIB_OK){
727
732
p_info->packet .gen_length = info_tx_packet_.generated_packet_length ;
728
733
p_info->packet .is_completed = true ;
734
+ p_info->is_info_changed = false ;
729
735
}
730
736
}
731
737
}
@@ -738,6 +744,8 @@ Master::syncWrite(InfoSyncWriteInst_t* p_info)
738
744
if (err == DXL_LIB_OK){
739
745
p_port_->write (p_packet_buf, p_info->packet .gen_length );
740
746
ret = true ;
747
+ }else {
748
+ p_info->packet .is_completed = false ;
741
749
}
742
750
last_lib_err_ = err;
743
751
@@ -770,15 +778,15 @@ Master::bulkRead(InfoBulkReadInst_t* p_info, uint32_t timeout_ms)
770
778
return 0 ;
771
779
}
772
780
773
- if (p_info->packet .is_completed == false || p_info->is_info_changed == true ){
781
+ if (p_info->packet .p_buf != nullptr ){
782
+ p_packet_buf = p_info->packet .p_buf ;
783
+ packet_buf_cap = p_info->packet .buf_capacity ;
784
+ }else {
785
+ p_packet_buf = p_packet_buf_;
786
+ packet_buf_cap = packet_buf_capacity_;
787
+ }
774
788
775
- if (p_info->packet .p_buf != nullptr ){
776
- p_packet_buf = p_info->packet .p_buf ;
777
- packet_buf_cap = p_info->packet .buf_capacity ;
778
- }else {
779
- p_packet_buf = p_packet_buf_;
780
- packet_buf_cap = packet_buf_capacity_;
781
- }
789
+ if (p_info->packet .is_completed == false || p_info->is_info_changed == true ){
782
790
err = begin_make_dxl_packet (&info_tx_packet_, DXL_BROADCAST_ID, protocol_ver_idx_,
783
791
DXL_INST_BULK_READ, 0 , p_packet_buf, packet_buf_cap);
784
792
if (protocol_ver_idx_ == 1 && err == DXL_LIB_OK){
@@ -810,6 +818,7 @@ Master::bulkRead(InfoBulkReadInst_t* p_info, uint32_t timeout_ms)
810
818
if (err == DXL_LIB_OK){
811
819
p_info->packet .gen_length = info_tx_packet_.generated_packet_length ;
812
820
p_info->packet .is_completed = true ;
821
+ p_info->is_info_changed = false ;
813
822
}
814
823
}
815
824
}
@@ -835,6 +844,8 @@ Master::bulkRead(InfoBulkReadInst_t* p_info, uint32_t timeout_ms)
835
844
break ;
836
845
}
837
846
}
847
+ }else {
848
+ p_info->packet .is_completed = false ;
838
849
}
839
850
last_lib_err_ = err;
840
851
@@ -867,14 +878,15 @@ Master::bulkWrite(InfoBulkWriteInst_t* p_info)
867
878
return 0 ;
868
879
}
869
880
881
+ if (p_info->packet .p_buf != nullptr ){
882
+ p_packet_buf = p_info->packet .p_buf ;
883
+ packet_buf_cap = p_info->packet .buf_capacity ;
884
+ }else {
885
+ p_packet_buf = p_packet_buf_;
886
+ packet_buf_cap = packet_buf_capacity_;
887
+ }
888
+
870
889
if (p_info->packet .is_completed == false || p_info->is_info_changed == true ){
871
- if (p_info->packet .p_buf != nullptr ){
872
- p_packet_buf = p_info->packet .p_buf ;
873
- packet_buf_cap = p_info->packet .buf_capacity ;
874
- }else {
875
- p_packet_buf = p_packet_buf_;
876
- packet_buf_cap = packet_buf_capacity_;
877
- }
878
890
err = begin_make_dxl_packet (&info_tx_packet_, DXL_BROADCAST_ID, protocol_ver_idx_,
879
891
DXL_INST_BULK_WRITE, 0 , p_packet_buf, packet_buf_cap);
880
892
if (err == DXL_LIB_OK){
@@ -898,7 +910,8 @@ Master::bulkWrite(InfoBulkWriteInst_t* p_info)
898
910
err = end_make_dxl_packet (&info_tx_packet_);
899
911
if (err == DXL_LIB_OK){
900
912
p_info->packet .gen_length = info_tx_packet_.generated_packet_length ;
901
- p_info->packet .is_completed = true ;
913
+ p_info->packet .is_completed = true ;
914
+ p_info->is_info_changed = false ;
902
915
}
903
916
}
904
917
}
@@ -910,6 +923,8 @@ Master::bulkWrite(InfoBulkWriteInst_t* p_info)
910
923
if (err == DXL_LIB_OK){
911
924
p_port_->write (p_packet_buf, p_info->packet .gen_length );
912
925
ret = true ;
926
+ }else {
927
+ p_info->packet .is_completed = false ;
913
928
}
914
929
last_lib_err_ = err;
915
930
0 commit comments