Ramping updates

This commit is contained in:
Benjamin Vedder 2019-03-01 17:18:07 +01:00
parent cf949d00c0
commit f9ce429447
5 changed files with 23 additions and 4 deletions

View File

@ -1,3 +1,10 @@
=== FW 3.49 ===
* New watchdog implementation.
* HW updates.
* Fixed DC motor current sampling issue.
* Deadtime in nanoseconds instead of register value.
* Use fastest ramping time when throttle is applied.
=== FW 3.48 === === FW 3.48 ===
* Added pairing flag to appconf. * Added pairing flag to appconf.
* Decreased CAN TX timeout. * Decreased CAN TX timeout.

View File

@ -288,7 +288,11 @@ static THD_FUNCTION(adc_thread, arg) {
// Apply ramping // Apply ramping
static systime_t last_time = 0; static systime_t last_time = 0;
static float pwr_ramp = 0.0; static float pwr_ramp = 0.0;
const float ramp_time = fabsf(pwr) > fabsf(pwr_ramp) ? config.ramp_time_pos : config.ramp_time_neg; float ramp_time = fabsf(pwr) > fabsf(pwr_ramp) ? config.ramp_time_pos : config.ramp_time_neg;
if (fabsf(pwr) > 0.001) {
ramp_time = fminf(config.ramp_time_pos, config.ramp_time_neg);
}
if (ramp_time > 0.01) { if (ramp_time > 0.01) {
const float ramp_step = (float)ST2MS(chVTTimeElapsedSinceX(last_time)) / (ramp_time * 1000.0); const float ramp_step = (float)ST2MS(chVTTimeElapsedSinceX(last_time)) / (ramp_time * 1000.0);

View File

@ -406,7 +406,11 @@ static THD_FUNCTION(output_thread, arg) {
// Apply ramping // Apply ramping
const float current_range = mcconf->l_current_max * mcconf->l_current_max_scale + const float current_range = mcconf->l_current_max * mcconf->l_current_max_scale +
fabsf(mcconf->l_current_min) * mcconf->l_current_min_scale; fabsf(mcconf->l_current_min) * mcconf->l_current_min_scale;
const float ramp_time = fabsf(current) > fabsf(prev_current) ? config.ramp_time_pos : config.ramp_time_neg; float ramp_time = fabsf(current) > fabsf(prev_current) ? config.ramp_time_pos : config.ramp_time_neg;
if (fabsf(out_val) > 0.001) {
ramp_time = fminf(config.ramp_time_pos, config.ramp_time_neg);
}
if (ramp_time > 0.01) { if (ramp_time > 0.01) {
const float ramp_step = ((float)OUTPUT_ITERATION_TIME_MS * current_range) / (ramp_time * 1000.0); const float ramp_step = ((float)OUTPUT_ITERATION_TIME_MS * current_range) / (ramp_time * 1000.0);

View File

@ -188,7 +188,11 @@ static THD_FUNCTION(ppm_thread, arg) {
// Apply ramping // Apply ramping
static systime_t last_time = 0; static systime_t last_time = 0;
static float servo_val_ramp = 0.0; static float servo_val_ramp = 0.0;
const float ramp_time = fabsf(servo_val) > fabsf(servo_val_ramp) ? config.ramp_time_pos : config.ramp_time_neg; float ramp_time = fabsf(servo_val) > fabsf(servo_val_ramp) ? config.ramp_time_pos : config.ramp_time_neg;
if (fabsf(servo_val) > 0.001) {
ramp_time = fminf(config.ramp_time_pos, config.ramp_time_neg);
}
if (ramp_time > 0.01) { if (ramp_time > 0.01) {
const float ramp_step = (float)ST2MS(chVTTimeElapsedSinceX(last_time)) / (ramp_time * 1000.0); const float ramp_step = (float)ST2MS(chVTTimeElapsedSinceX(last_time)) / (ramp_time * 1000.0);

View File

@ -22,7 +22,7 @@
// Firmware version // Firmware version
#define FW_VERSION_MAJOR 3 #define FW_VERSION_MAJOR 3
#define FW_VERSION_MINOR 48 #define FW_VERSION_MINOR 49
#include "datatypes.h" #include "datatypes.h"