Skip to content

Commit 2fd4582

Browse files
committed
clean code
1 parent 0893054 commit 2fd4582

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

pio_workspace/src/power_main.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
#include <std_msgs/msg/float32.h>
1818
#include <std_msgs/msg/float32_multi_array.h>
1919

20-
#if !defined(MICRO_ROS_TRANSPORT_ARDUINO_SERIAL)
21-
#error This example is only avaliable for Arduino framework with serial transport.
22-
#endif
23-
2420
#define LED_PIN 13
2521

2622
bool micro_ros_init_successful;
@@ -58,12 +54,11 @@ rcl_timer_t timer;
5854
void error_loop() {
5955
int error = 0;
6056
while (error < 10) {
61-
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
57+
digitalWrite(LED_PIN, !digitalRead(LED_PIN));
6258
delay(100);
63-
6459
error++;
6560
}
66-
digitalWrite(LED_BUILTIN, HIGH);
61+
digitalWrite(LED_PIN, HIGH);
6762
}
6863

6964
enum states {
@@ -85,6 +80,8 @@ void propulsion_microseconds_callback(const void * msgin)
8580
digitalWrite(7, msg->data.data[5] == 0 ? LOW : HIGH);
8681
digitalWrite(8, msg->data.data[6] == 0 ? LOW : HIGH);
8782
digitalWrite(9, msg->data.data[7] == 0 ? LOW : HIGH);
83+
84+
//logic can go here
8885
}
8986

9087
void timer_callback(rcl_timer_t * timer, int64_t last_call_time) {
@@ -246,6 +243,7 @@ void power_setup() {
246243
power_board_temperature_msg.data = -2.0;
247244
power_teensy_temperature_msg.data = -2.0;
248245

246+
// first state
249247
state = WAITING_AGENT;
250248
}
251249

@@ -267,12 +265,10 @@ void power_loop() {
267265
}
268266
break;
269267
case AGENT_DISCONNECTED:
270-
delay(500);
271268
destroy_entities();
272269
state = WAITING_AGENT;
273270
break;
274271
default:
275-
delay(200);
276272
break;
277273
}
278274

0 commit comments

Comments
 (0)