Merge branch 'rc-v0.5.1' into devel

This commit is contained in:
Unknown
2020-09-02 20:51:13 -04:00
3 changed files with 20 additions and 10 deletions
+3 -3
View File
@@ -97,10 +97,10 @@ void Axis::clear_config() {
config_.can_node_id = axis_num_;
}
// @brief Sets up all components of the axis,
// such as gate driver and encoder hardware.
// @brief Does Nothing
bool Axis::setup() {
return motor_.setup();
// Does nothing - Motor and encoder setup called separately.
return true;
}
static void run_state_machine_loop_wrapper(void* ctx) {
+2 -1
View File
@@ -6,9 +6,10 @@
#include "utils.hpp"
#include <autogen/interfaces.hpp>
class Encoder : public ODriveIntf::EncoderIntf {
public:
const uint32_t MODE_FLAG_ABS = 0x100;
static constexpr uint32_t MODE_FLAG_ABS = 0x100;
struct Config_t {
Mode mode = MODE_INCREMENTAL;
+15 -6
View File
@@ -259,19 +259,28 @@ static void rtos_main(void*) {
// must happen after communication is initialized
pwm0_input.init();
// Set up hardware for all components
for (size_t i = 0; i < AXIS_COUNT; ++i) {
if (!axes[i].setup()) {
for (;;) {
osDelay(10); // TODO: proper error handling
}
// Set up the CS pins for absolute encoders
for(auto& axis : axes){
if(axis.encoder_.config_.mode & Encoder::MODE_FLAG_ABS){
axis.encoder_.abs_spi_cs_pin_init();
}
}
// Setup motors (DRV8301 SPI transactions here)
for(auto& axis : axes){
axis.motor_.setup();
}
// Setup encoders (Starts encoder SPI transactions)
for(auto& axis : axes){
axis.encoder_.setup();
}
// Setup anything remaining in each axis
for(auto& axis : axes){
axis.setup();
}
// Start PWM and enable adc interrupts/callbacks
start_adc_pwm();