mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-21 23:44:48 +08:00
comms hijack compiles
This commit is contained in:
+16
-3
@@ -10,14 +10,27 @@ extern "C" {
|
||||
extern "C" {
|
||||
void axis_thread_entry(void const* temp_motor_ptr) {
|
||||
Motor_t* motor = (Motor_t*)temp_motor_ptr;
|
||||
Axis axis(motor);
|
||||
|
||||
//TODO: explicit axis number assignment
|
||||
//for now we search for it
|
||||
uint8_t ax_number = 0;
|
||||
while(&motors[ax_number] != motor)
|
||||
++ax_number;
|
||||
|
||||
Axis axis(ax_number, motor);
|
||||
axis.StateMachineLoop();
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
Axis::Axis(Motor_t* legacy_motor_ref)
|
||||
: legacy_motor_ref_(legacy_motor_ref) {}
|
||||
Axis::Axis(uint8_t axis_number, Motor_t* legacy_motor_ref)
|
||||
: axis_number_(axis_number),
|
||||
legacy_motor_ref_(legacy_motor_ref) {}
|
||||
|
||||
void Axis::StateMachineLoop() {
|
||||
// override for compatibility with legacy comms paradigm
|
||||
// TODO next gen comms
|
||||
exposed_bools[4*axis_number_ + 1] = &enable_control_;
|
||||
exposed_bools[4*axis_number_ + 2] = &do_calibration_;
|
||||
|
||||
motor_thread(legacy_motor_ref_);
|
||||
}
|
||||
Reference in New Issue
Block a user