Skip to content

Commit 730db71

Browse files
committed
format lint
1 parent f05b409 commit 730db71

File tree

8 files changed

+23
-25
lines changed

8 files changed

+23
-25
lines changed

include/can/core/ids.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ enum class SensorOutputBinding {
215215
sync = 0x1,
216216
report = 0x2,
217217
max_threshold_sync = 0x4,
218-
auto_baseline_report = 0x8,
218+
auto_baseline_report = 0x08,
219219
multi_sensor_sync = 0x10,
220220
};
221221

include/motor-control/core/motor_messages.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ struct SensorSyncMove { // NOLINT(cppcoreguidelines-pro-type-member-init)
9191
uint16_t usage_key;
9292
can::ids::SensorId sensor_id;
9393
can::ids::SensorType sensor_type;
94+
uint8_t binding_flags;
9495

9596
auto build_ack(uint32_t position, int32_t pulses, uint8_t flags,
9697
AckMessageId _id) -> Ack {
@@ -121,6 +122,7 @@ struct GearMotorMove // NOLINT(cppcoreguidelines-pro-type-member-init)
121122
can::ids::GearMotorId gear_motor_id;
122123
can::ids::SensorId sensor_id;
123124
can::ids::SensorType sensor_type;
125+
uint8_t binding_flags;
124126
auto build_ack(uint32_t position, int32_t pulses, uint8_t flags,
125127
AckMessageId _id) -> GearMotorAck {
126128
return GearMotorAck{message_index, group_id,

include/motor-control/core/stepper_motor/motor_interrupt_handler.hpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -408,20 +408,17 @@ class MotorInterruptHandler {
408408
hardware.get_encoder_pulses();
409409
#ifdef USE_SENSOR_MOVE
410410
if (buffered_move.sensor_id != can::ids::SensorId::UNUSED) {
411-
auto binding =
412-
static_cast<uint8_t>(can::ids::SensorOutputBinding::sync) |
413-
static_cast<uint8_t>(
414-
can::ids::SensorOutputBinding::report) |
415-
static_cast<uint8_t>(
416-
can::ids::SensorOutputBinding::auto_baseline_report);
417411
if (buffered_move.sensor_id == can::ids::SensorId::BOTH) {
418412
send_bind_message(buffered_move.sensor_type,
419-
can::ids::SensorId::S0, binding);
413+
can::ids::SensorId::S0,
414+
buffered_move.binding_flags);
420415
send_bind_message(buffered_move.sensor_type,
421-
can::ids::SensorId::S1, binding);
416+
can::ids::SensorId::S1,
417+
buffered_move.binding_flags);
422418
} else {
423419
send_bind_message(buffered_move.sensor_type,
424-
buffered_move.sensor_id, binding);
420+
buffered_move.sensor_id,
421+
buffered_move.binding_flags);
425422
}
426423
}
427424
#endif

include/sensors/core/sensor_hardware_interface.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,35 +56,32 @@ class SensorHardwareBase {
5656
virtual auto check_tip_presence() -> bool = 0;
5757

5858
auto mask_satisfied() -> bool {
59-
if (set_sync_required_mask != static_cast<uint8_t>(SensorIdBitMask::UNUSED)) {
59+
if (set_sync_required_mask !=
60+
static_cast<uint8_t>(SensorIdBitMask::UNUSED)) {
6061
// if anything is "required" only sync when they are all triggered
61-
return (sync_state_mask & set_sync_required_mask) == set_sync_required_mask;
62+
return (sync_state_mask & set_sync_required_mask) ==
63+
set_sync_required_mask;
6264
}
6365
return sync_state_mask & set_sync_enabled_mask;
6466
}
6567

6668
auto set_sync(can::ids::SensorId sensor) -> void {
67-
printf("Set sync sensor called\n");
6869
// force the bit for this sensor to 1
6970
sync_state_mask |= get_mask_from_id(sensor);
7071
if (mask_satisfied()) {
71-
printf("satisfied calling sync\n");
7272
set_sync();
7373
}
7474
}
7575

7676
auto reset_sync(can::ids::SensorId sensor) -> void {
7777
// force the bit for this sensor to 0
78-
printf("reset sync sensor called\n");
7978
sync_state_mask &= 0xFF ^ get_mask_from_id(sensor);
8079
if (!mask_satisfied()) {
81-
printf("No longer satisfied calling reset\n");
8280
reset_sync();
8381
}
8482
}
8583

8684
auto set_sync_enabled(can::ids::SensorId sensor, bool enabled) -> void {
87-
printf("Set sync required called %d\n", enabled);
8885
uint8_t applied_mask = get_mask_from_id(sensor);
8986
if (!enabled) {
9087
// force enabled bit to 0
@@ -117,6 +114,7 @@ class SensorHardwareBase {
117114
reset_sync();
118115
}
119116
}
117+
120118
private:
121119
uint8_t set_sync_required_mask = 0x00;
122120
uint8_t set_sync_enabled_mask = 0x00;

include/sensors/core/tasks/pressure_sensor_task.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ class PressureMessageHandler {
131131
m.binding &
132132
static_cast<uint8_t>(can::ids::SensorOutputBinding::report));
133133
driver.set_multi_sensor_sync(
134-
m.binding &
135-
static_cast<uint8_t>(can::ids::SensorOutputBinding::multi_sensor_sync));
134+
m.binding & static_cast<uint8_t>(
135+
can::ids::SensorOutputBinding::multi_sensor_sync));
136136
driver.set_bind_sync(
137137
m.binding &
138138
static_cast<uint8_t>(can::ids::SensorOutputBinding::sync));

include/sensors/firmware/sensor_hardware.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
namespace sensors {
88
namespace hardware {
99

10-
1110
class SensorHardware : public SensorHardwareBase {
1211
public:
1312
SensorHardware(sensors::hardware::SensorHardwareConfiguration hardware)

include/sensors/tests/mock_hardware.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ class MockSensorHardware : public sensors::hardware::SensorHardwareBase {
2525
sensors::hardware::SensorHardwareBase::reset_sync(sensor);
2626
}
2727
auto set_sync_enabled(can::ids::SensorId sensor, bool enabled) -> void {
28-
sensors::hardware::SensorHardwareBase::set_sync_enabled(sensor, enabled);
28+
sensors::hardware::SensorHardwareBase::set_sync_enabled(sensor,
29+
enabled);
2930
}
3031
auto set_sync_required(can::ids::SensorId sensor, bool required) -> void {
31-
sensors::hardware::SensorHardwareBase::set_sync_required(sensor, required);
32+
sensors::hardware::SensorHardwareBase::set_sync_required(sensor,
33+
required);
3234
}
35+
3336
private:
3437
bool sync_state = false;
3538
uint32_t sync_set_calls = 0;

sensors/tests/test_sensor_hardware.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include <concepts>
22

3-
#include "catch2/catch.hpp"
43
#include "can/core/messages.hpp"
5-
#include "sensors/tests/mock_hardware.hpp"
4+
#include "catch2/catch.hpp"
65
#include "sensors/core/sensor_hardware_interface.hpp"
6+
#include "sensors/tests/mock_hardware.hpp"
77

88
constexpr auto sensor_id_primary = can::ids::SensorId::S0;
99
constexpr auto sensor_id_secondary = can::ids::SensorId::S1;
@@ -79,7 +79,6 @@ SCENARIO("Multiple Sensors connected") {
7979
mock_hw.set_sync_enabled(sensor_id_secondary, false);
8080
REQUIRE(mock_hw.get_sync_state_mock() == false);
8181
}
82-
8382
}
8483
GIVEN("Two sensors required") {
8584
mock_hw.set_sync_required(sensor_id_primary, true);

0 commit comments

Comments
 (0)