Set PAS pins to UART RX and TX if they are undefined, made PAS config serialization more compact, added PAS to changelog

This commit is contained in:
Benjamin Vedder 2020-12-09 19:37:16 +01:00
parent a17c2f5453
commit fefb2b7d10
5 changed files with 21 additions and 12 deletions

View File

@ -25,6 +25,7 @@
* Added UAVCAN raw throttle drive mode (current or duty cycle control). * Added UAVCAN raw throttle drive mode (current or duty cycle control).
* Added MT6816 encoder support. See https://github.com/vedderb/bldc/pull/238 * Added MT6816 encoder support. See https://github.com/vedderb/bldc/pull/238
* Added modulation-based D axis current controller gain scaling. Addresses https://github.com/vedderb/bldc/pull/220 * Added modulation-based D axis current controller gain scaling. Addresses https://github.com/vedderb/bldc/pull/220
* Added PAS app. See: https://github.com/vedderb/bldc/pull/243
=== FW 5.01 === === FW 5.01 ===
* Fixed PPM bug in previous release. * Fixed PPM bug in previous release.

View File

@ -200,6 +200,7 @@
//#define APP_CUSTOM_TO_USE "app_motor_heater.c" //#define APP_CUSTOM_TO_USE "app_motor_heater.c"
//#include "app_erockit_conf_v2.h" //#include "app_erockit_conf_v2.h"
//#include "finn/app_finn_az_conf.h" //#include "finn/app_finn_az_conf.h"
//#include "vccu/app_vccu_conf.h"
// CAN-plotter // CAN-plotter
//#define APP_CUSTOM_TO_USE "app_plot_can.c" //#define APP_CUSTOM_TO_USE "app_plot_can.c"

View File

@ -289,14 +289,14 @@ int32_t confgenerator_serialize_appconf(uint8_t *buffer, const app_configuration
buffer_append_uint16(buffer, conf->app_balance_conf.kd_pt1_frequency, &ind); buffer_append_uint16(buffer, conf->app_balance_conf.kd_pt1_frequency, &ind);
buffer[ind++] = conf->app_pas_conf.ctrl_type; buffer[ind++] = conf->app_pas_conf.ctrl_type;
buffer[ind++] = conf->app_pas_conf.sensor_type; buffer[ind++] = conf->app_pas_conf.sensor_type;
buffer_append_float32_auto(buffer, conf->app_pas_conf.current_scaling, &ind); buffer_append_float16(buffer, conf->app_pas_conf.current_scaling, 1000, &ind);
buffer_append_float32_auto(buffer, conf->app_pas_conf.pedal_rpm_start, &ind); buffer_append_float16(buffer, conf->app_pas_conf.pedal_rpm_start, 10, &ind);
buffer_append_float32_auto(buffer, conf->app_pas_conf.pedal_rpm_end, &ind); buffer_append_float16(buffer, conf->app_pas_conf.pedal_rpm_end, 10, &ind);
buffer[ind++] = conf->app_pas_conf.invert_pedal_direction; buffer[ind++] = conf->app_pas_conf.invert_pedal_direction;
buffer_append_uint16(buffer, conf->app_pas_conf.magnets, &ind); buffer_append_uint16(buffer, conf->app_pas_conf.magnets, &ind);
buffer[ind++] = conf->app_pas_conf.use_filter; buffer[ind++] = conf->app_pas_conf.use_filter;
buffer_append_float32_auto(buffer, conf->app_pas_conf.ramp_time_pos, &ind); buffer_append_float16(buffer, conf->app_pas_conf.ramp_time_pos, 100, &ind);
buffer_append_float32_auto(buffer, conf->app_pas_conf.ramp_time_neg, &ind); buffer_append_float16(buffer, conf->app_pas_conf.ramp_time_neg, 100, &ind);
buffer_append_uint16(buffer, conf->app_pas_conf.update_rate_hz, &ind); buffer_append_uint16(buffer, conf->app_pas_conf.update_rate_hz, &ind);
buffer[ind++] = conf->imu_conf.type; buffer[ind++] = conf->imu_conf.type;
buffer[ind++] = conf->imu_conf.mode; buffer[ind++] = conf->imu_conf.mode;
@ -613,14 +613,14 @@ bool confgenerator_deserialize_appconf(const uint8_t *buffer, app_configuration
conf->app_balance_conf.kd_pt1_frequency = buffer_get_uint16(buffer, &ind); conf->app_balance_conf.kd_pt1_frequency = buffer_get_uint16(buffer, &ind);
conf->app_pas_conf.ctrl_type = buffer[ind++]; conf->app_pas_conf.ctrl_type = buffer[ind++];
conf->app_pas_conf.sensor_type = buffer[ind++]; conf->app_pas_conf.sensor_type = buffer[ind++];
conf->app_pas_conf.current_scaling = buffer_get_float32_auto(buffer, &ind); conf->app_pas_conf.current_scaling = buffer_get_float16(buffer, 1000, &ind);
conf->app_pas_conf.pedal_rpm_start = buffer_get_float32_auto(buffer, &ind); conf->app_pas_conf.pedal_rpm_start = buffer_get_float16(buffer, 10, &ind);
conf->app_pas_conf.pedal_rpm_end = buffer_get_float32_auto(buffer, &ind); conf->app_pas_conf.pedal_rpm_end = buffer_get_float16(buffer, 10, &ind);
conf->app_pas_conf.invert_pedal_direction = buffer[ind++]; conf->app_pas_conf.invert_pedal_direction = buffer[ind++];
conf->app_pas_conf.magnets = buffer_get_uint16(buffer, &ind); conf->app_pas_conf.magnets = buffer_get_uint16(buffer, &ind);
conf->app_pas_conf.use_filter = buffer[ind++]; conf->app_pas_conf.use_filter = buffer[ind++];
conf->app_pas_conf.ramp_time_pos = buffer_get_float32_auto(buffer, &ind); conf->app_pas_conf.ramp_time_pos = buffer_get_float16(buffer, 100, &ind);
conf->app_pas_conf.ramp_time_neg = buffer_get_float32_auto(buffer, &ind); conf->app_pas_conf.ramp_time_neg = buffer_get_float16(buffer, 100, &ind);
conf->app_pas_conf.update_rate_hz = buffer_get_uint16(buffer, &ind); conf->app_pas_conf.update_rate_hz = buffer_get_uint16(buffer, &ind);
conf->imu_conf.type = buffer[ind++]; conf->imu_conf.type = buffer[ind++];
conf->imu_conf.mode = buffer[ind++]; conf->imu_conf.mode = buffer[ind++];

View File

@ -8,8 +8,8 @@
#include <stdbool.h> #include <stdbool.h>
// Constants // Constants
#define MCCONF_SIGNATURE 789840453 #define MCCONF_SIGNATURE 1050464887
#define APPCONF_SIGNATURE 4074252355 #define APPCONF_SIGNATURE 2237177524
// Functions // Functions
int32_t confgenerator_serialize_mcconf(uint8_t *buffer, const mc_configuration *conf); int32_t confgenerator_serialize_mcconf(uint8_t *buffer, const mc_configuration *conf);

View File

@ -460,6 +460,13 @@
#endif #endif
#endif #endif
#ifndef HW_PAS1_PORT
#define HW_PAS1_PORT HW_UART_RX_PORT
#define HW_PAS1_PIN HW_UART_RX_PIN
#define HW_PAS2_PORT HW_UART_TX_PORT
#define HW_PAS2_PIN HW_UART_TX_PIN
#endif
// Functions // Functions
void hw_init_gpio(void); void hw_init_gpio(void);
void hw_setup_adc_channels(void); void hw_setup_adc_channels(void);