From a7c8a85d30e43cb5bf1f14a27ae4b60a2ee658e9 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Fri, 26 Jan 2018 22:59:21 -0800 Subject: [PATCH] expose motor_dir --- Firmware/MotorControl/commands.cpp | 6 ++++-- Firmware/MotorControl/low_level.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Firmware/MotorControl/commands.cpp b/Firmware/MotorControl/commands.cpp index ed9a263c..414d03d3 100644 --- a/Firmware/MotorControl/commands.cpp +++ b/Firmware/MotorControl/commands.cpp @@ -137,6 +137,7 @@ const Endpoint endpoints[] = { Endpoint::make_property("pll_ki", &motors[0].encoder.pll_ki), Endpoint::make_property("encoder_offset", &motors[0].encoder.encoder_offset), Endpoint::make_property("encoder_state", &motors[0].encoder.encoder_state), + Endpoint::make_property("motor_dir", &motors[0].encoder.motor_dir), Endpoint::close_tree(), Endpoint::make_function("set_pos_setpoint", &motors_0_set_pos_setpoint_func), Endpoint::make_property("pos_setpoint", &motors[0].set_pos_setpoint_args.pos_setpoint), @@ -189,8 +190,9 @@ const Endpoint endpoints[] = { Endpoint::make_property("pll_vel", &motors[1].encoder.pll_vel), Endpoint::make_property("pll_kp", &motors[1].encoder.pll_kp), Endpoint::make_property("pll_ki", &motors[1].encoder.pll_ki), - Endpoint::make_property("encoder_offset", reinterpret_cast(&motors[1].encoder.encoder_offset)), - Endpoint::make_property("encoder_state", reinterpret_cast(&motors[1].encoder.encoder_state)), + Endpoint::make_property("encoder_offset", &motors[1].encoder.encoder_offset), + Endpoint::make_property("encoder_state", &motors[1].encoder.encoder_state), + Endpoint::make_property("motor_dir", &motors[1].encoder.motor_dir), Endpoint::close_tree(), Endpoint::make_function("set_pos_setpoint", &motors_1_set_pos_setpoint_func), Endpoint::make_property("pos_setpoint", &motors[1].set_pos_setpoint_args.pos_setpoint), diff --git a/Firmware/MotorControl/low_level.h b/Firmware/MotorControl/low_level.h index 194e0a49..6ff91fd4 100644 --- a/Firmware/MotorControl/low_level.h +++ b/Firmware/MotorControl/low_level.h @@ -117,7 +117,7 @@ typedef struct { int encoder_cpr; int32_t encoder_offset; int32_t encoder_state; - int motor_dir; // 1/-1 for fwd/rev alignment to encoder. + int32_t motor_dir; // 1/-1 for fwd/rev alignment to encoder. float phase; float pll_pos; float pll_vel;