Skip to content

Commit fb99107

Browse files
committed
fixed logical issue with reconnection
1 parent 5f06475 commit fb99107

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pio_workspace/src/power_main.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ bool create_entities() {
7272
return true;
7373
}
7474

75-
void publishAndSubscribe() {
75+
void computeAndPublish() {
7676
power_board_temperature_msg.data = temperatureSensor.readTemperature();
7777
micro_ros.publishData(&power_board_temperature_msg, *power_board_temperature_publisher); // Dereference pointer
7878

@@ -117,17 +117,18 @@ void power_setup() {
117117

118118
void power_loop() {
119119
if (micro_ros.pingAgent()) {
120-
publishAndSubscribe();
120+
computeAndPublish();
121121
micro_ros.spin();
122122
updateThrusters(microseconds);
123123

124124
} else {
125125
updateThrusters(offCommand);
126126
micro_ros.destroyMicroROS();
127127

128-
while (micro_ros.pingAgent()) {
128+
while (!micro_ros.pingAgent()) {
129129

130130
}
131+
delay(10);
131132
create_entities();
132133
}
133134

0 commit comments

Comments
 (0)