Skip to content

Commit 8e1c483

Browse files
committed
main.cpp touches
1 parent 3a5ca39 commit 8e1c483

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/main.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -84,32 +84,32 @@ int main() {
8484

8585
Serial.begin(115200); // the serial monitor is actually always active (for debug use logger.println & tycmd)
8686
debug.begin(SerialUSB1);
87-
87+
8888
print_logo();
8989

9090
// check to see if there is a crash report, and if so, print it repeatedly over Serial
9191
// in the future, we'll send this directly over comms
9292
if (CrashReport) {
9393
while (1) {
94-
logger.println(CrashReport);
95-
logger.println("\nReflash to clear CrashReport (and also please fix why it crashed)");
94+
logger.println(LogDestination::Serial, CrashReport);
95+
logger.println(LogDestination::Serial, "\nReflash to clear CrashReport (and also please fix why it crashed)");
9696
delay(1000);
9797
}
9898
}
9999

100100
// Execute setup functions
101101
pinMode(LED_BUILTIN, OUTPUT);
102-
102+
103103
//initialize objects
104104
can.init();
105105
dr16.init();
106106
comms_layer.init();
107107
ref = sensor_manager.get_ref();
108108

109109
// Config config
110-
logger.println("Configuring...");
110+
logger.println(LogDestination::Serial, "Configuring...");
111111
const Config* config = config_layer.configure(&comms_layer);
112-
logger.println("Configured!");
112+
logger.println(LogDestination::Serial, "Configured!");
113113

114114
// configure motors
115115
can.configure(config->motor_info);
@@ -163,19 +163,19 @@ int main() {
163163
Timer loop_timer;
164164
Timer stall_timer;
165165
Timer control_input_timer;
166-
166+
167167
// start the main loop watchdog
168168
watchdog.start();
169169

170-
logger.println("Entering main loop...\n");
170+
logger.println(LogDestination::Serial, "Entering main loop...\n");
171171

172172
uint8_t log_buffer_copy[LOGGER_BUFFER_SIZE];
173173

174174
// Main loop
175175
while (true) {
176176
// start main loop time timer
177177
stall_timer.start();
178-
178+
179179
// read sensors
180180
sensor_manager.read();
181181
// read CAN and DR16 -- These are kept out of sensor manager for safety reasons
@@ -194,7 +194,7 @@ int main() {
194194

195195
// print loopc every second to verify it is still alive
196196
if (loopc % 1000 == 0) {
197-
Serial.println(loopc);
197+
logger.println(loopc);
198198
}
199199

200200
// manual controls on firmware
@@ -208,7 +208,7 @@ int main() {
208208
// clamp to pitch limits
209209
if (dr16_pos_y < pitch_min) { dr16_pos_y = pitch_min; }
210210
if (dr16_pos_y > pitch_max) { dr16_pos_y = pitch_max; }
211-
211+
212212
float chassis_vel_x = 0;
213213
float chassis_vel_y = 0;
214214
float chassis_pos_x = 0;
@@ -273,19 +273,19 @@ int main() {
273273
}
274274

275275
// print dr16
276-
// Serial.printf("DR16:\n\t");
276+
// logger.printf("DR16:\n\t");
277277
// dr16.print();
278278

279-
// Serial.printf("Target state:\n");
279+
// logger.printf("Target state:\n");
280280
// for (int i = 0; i < 8; i++) {
281-
// Serial.printf("\t%d: %f %f %f\n", i, target_state[i][0], target_state[i][1], target_state[i][2]);
281+
// logger.printf("\t%d: %f %f %f\n", i, target_state[i][0], target_state[i][1], target_state[i][2]);
282282
// }
283-
283+
284284
// override temp state if needed
285285
if (comms_layer.get_hive_data().override_state.active) {
286286
// clear the request
287287
comms_layer.get_hive_data().override_state.active = false;
288-
288+
289289
logger.printf("Overriding state with hive state\n");
290290
memcpy(hive_state_offset, comms_layer.get_hive_data().override_state.state, sizeof(hive_state_offset));
291291
memcpy(temp_state, hive_state_offset, sizeof(hive_state_offset));
@@ -303,9 +303,9 @@ int main() {
303303
count_one++;
304304
}
305305

306-
// Serial.printf("Estimated state:\n");
306+
// logger.printf("Estimated state:\n");
307307
// for (int i = 0; i < 8; i++) {
308-
// Serial.printf("\t%d: %f %f %f\n", i, temp_state[i][0], temp_state[i][1], temp_state[i][2]);
308+
// logger.printf("\t%d: %f %f %f\n", i, temp_state[i][0], temp_state[i][1], temp_state[i][2]);
309309
// }
310310

311311
// give the sensors the current estimated state
@@ -316,9 +316,9 @@ int main() {
316316
governor.step_reference(target_state, config->governor_types);
317317
governor.get_reference(temp_reference);
318318

319-
// Serial.printf("Reference state:\n");
319+
// logger.printf("Reference state:\n");
320320
// for (int i = 0; i < 8; i++) {
321-
// Serial.printf("\t%d: %f %f %f\n", i, temp_reference[i][0], temp_reference[i][1], temp_reference[i][2]);
321+
// logger.printf("\t%d: %f %f %f\n", i, temp_reference[i][0], temp_reference[i][1], temp_reference[i][2]);
322322
// }
323323

324324
// generate motor outputs from controls

0 commit comments

Comments
 (0)