Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Feb 6, 2025
1 parent a28e57d commit b3cdebc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,8 @@ class MotorInterruptHandler {
can::messages::ErrorMessage{.message_index = message_index,
.severity = severity,
.error_code = err_code});
if (err_code == can::ids::ErrorCode::collision_detected && _has_active_move) {
if (err_code == can::ids::ErrorCode::collision_detected &&
_has_active_move) {
build_and_send_ack(AckMessageId::position_error);
}
status_queue_client.send_move_status_reporter_queue(
Expand Down
9 changes: 5 additions & 4 deletions motor-control/tests/test_motor_stall_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,14 @@ SCENARIO("motor handler stall detection") {
test_objs.hw.sim_set_encoder_pulses(0);
test_objs.handler.set_current_position(0);


WHEN("A move is commanded") {
test_objs.queue.try_write(msg1);
test_objs.handler.update_move();
for (int i = 0; i < (int)msg1.duration; ++i) {
test_objs.handler.run_interrupt();
test_objs.hw.sim_set_encoder_pulses(i*velocity);
test_objs.handler.set_current_position(static_cast<uint64_t>(i*velocity) << 31);
test_objs.hw.sim_set_encoder_pulses(i * velocity);
test_objs.handler.set_current_position(
static_cast<uint64_t>(i * velocity) << 31);
}
THEN("Move ends successfully.") {
REQUIRE(test_objs.hw.position_flags.check_flag(
Expand All @@ -387,7 +387,8 @@ SCENARIO("motor handler stall detection") {
THEN("an error is sent.") {
// should be 2 but idk why this runs more than once
REQUIRE(test_objs.reporter.messages.size() == 3);
REQUIRE(!test_objs.hw.position_flags.check_flag(Flags::stepper_position_ok));
REQUIRE(!test_objs.hw.position_flags.check_flag(
Flags::stepper_position_ok));
}
}
}
Expand Down

0 comments on commit b3cdebc

Please sign in to comment.