Skip to content

Commit 30aabb7

Browse files
committed
Detect FOC fix, adc brake multi fix, make ppm pulses invalid above 150 percent
1 parent 3ac3a4a commit 30aabb7

File tree

5 files changed

+22
-12
lines changed

5 files changed

+22
-12
lines changed

CHANGELOG

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
=== FW 3.58 ===
2+
* Set motor to FOC mode after successful FOC detection instead of the default type for the hardware.
3+
* APP_ADC: Do not send brake command over CAN if config.multi_esc is not set.
4+
* APP_PPM: Make pulses invalid if they are above 150 % instead of 120 %.
5+
16
=== FW 3.57 ===
27
* Added CAN status message 5 with input voltage and tachometer data.
38
* Fix github issue #94.

applications/app_adc.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -499,11 +499,13 @@ static THD_FUNCTION(adc_thread, arg) {
499499
mc_interface_set_brake_current_rel(current_rel);
500500

501501
// Send brake command to all ESCs seen recently on the CAN bus
502-
for (int i = 0;i < CAN_STATUS_MSGS_TO_STORE;i++) {
503-
can_status_msg *msg = comm_can_get_status_msg_index(i);
502+
if (config.multi_esc) {
503+
for (int i = 0;i < CAN_STATUS_MSGS_TO_STORE;i++) {
504+
can_status_msg *msg = comm_can_get_status_msg_index(i);
504505

505-
if (msg->id >= 0 && UTILS_AGE_S(msg->rx_time) < MAX_CAN_AGE) {
506-
comm_can_set_current_brake_rel(msg->id, current_rel);
506+
if (msg->id >= 0 && UTILS_AGE_S(msg->rx_time) < MAX_CAN_AGE) {
507+
comm_can_set_current_brake_rel(msg->id, current_rel);
508+
}
507509
}
508510
}
509511
} else {

conf_general.c

+3
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,7 @@ int conf_general_detect_apply_all_foc(float max_power_loss,
11151115
float lambda = 0.0;
11161116
int res = conf_general_measure_flux_linkage_openloop(i_max / 2.5, 0.3, 1800, r, &lambda);
11171117

1118+
mc_motor_type old_type = mcconf_old.motor_type;
11181119
float old_r = mcconf_old.foc_motor_r;
11191120
float old_l = mcconf_old.foc_motor_l;
11201121
float old_flux_linkage = mcconf_old.foc_motor_flux_linkage;
@@ -1134,6 +1135,7 @@ int conf_general_detect_apply_all_foc(float max_power_loss,
11341135
float ki = r * bw;
11351136
float gain = 0.001 / (lambda * lambda);
11361137

1138+
mcconf_old.motor_type = MOTOR_TYPE_FOC;
11371139
mcconf_old.foc_motor_r = r;
11381140
mcconf_old.foc_motor_l = l;
11391141
mcconf_old.foc_motor_flux_linkage = lambda;
@@ -1175,6 +1177,7 @@ int conf_general_detect_apply_all_foc(float max_power_loss,
11751177
result = conf_general_autodetect_apply_sensors_foc(i_max / 3.0,
11761178
store_mcconf_on_success, send_mcconf_on_success);
11771179
} else {
1180+
mcconf_old.motor_type = old_type;
11781181
mcconf_old.foc_motor_r = old_r;
11791182
mcconf_old.foc_motor_l = old_l;
11801183
mcconf_old.foc_motor_flux_linkage = old_flux_linkage;

conf_general.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
// Firmware version
2424
#define FW_VERSION_MAJOR 3
25-
#define FW_VERSION_MINOR 57
25+
#define FW_VERSION_MINOR 58
2626

2727
#include "datatypes.h"
2828

@@ -67,8 +67,8 @@
6767
// Benjamins first HW60 PCB with PB5 and PB6 swapped
6868
//#define HW60_VEDDER_FIRST_PCB
6969

70-
#define HW_SOURCE "hw_60.c"
71-
#define HW_HEADER "hw_60.h"
70+
//#define HW_SOURCE "hw_60.c"
71+
//#define HW_HEADER "hw_60.h"
7272

7373
//#define HW_SOURCE "hw_r2.c"
7474
//#define HW_HEADER "hw_r2.h"
@@ -92,10 +92,10 @@
9292
//#define HW75_300_VEDDER_FIRST_PCB
9393

9494
// Second revision with separate UART for NRF51
95-
//#define HW75_300_REV_2
95+
#define HW75_300_REV_2
9696

97-
//#define HW_SOURCE "hw_75_300.c"
98-
//#define HW_HEADER "hw_75_300.h"
97+
#define HW_SOURCE "hw_75_300.c"
98+
#define HW_HEADER "hw_75_300.h"
9999

100100
//#define HW_SOURCE "hw_mini4.c"
101101
//#define HW_HEADER "hw_mini4.h"

servo_dec.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2016 Benjamin Vedder [email protected]
2+
Copyright 2016 - 2019 Benjamin Vedder [email protected]
33
44
This file is part of the VESC firmware.
55
@@ -48,7 +48,7 @@ static void icuwidthcb(ICUDriver *icup) {
4848
const float len_set = (pulse_end - pulse_start);
4949

5050
if (len > len_set) {
51-
if (len < (len_set * 1.2)) {
51+
if (len < (len_set * 1.5)) {
5252
len = len_set;
5353
} else {
5454
// Too long pulse. Most likely something is wrong.

0 commit comments

Comments
 (0)