Skip to content

Commit

Permalink
Merge branch 'vedderb:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnSpintend authored Sep 8, 2022
2 parents f8f3fb2 + 451fe7a commit 80e3421
Show file tree
Hide file tree
Showing 110 changed files with 5,694 additions and 1,107 deletions.
13 changes: 11 additions & 2 deletions applications/app_balance.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,11 @@ static void apply_turntilt(void){
}

// Limit angle to max angle
turntilt_target = fminf(turntilt_target, balance_conf.turntilt_angle_limit);
if(turntilt_target > 0){
turntilt_target = fminf(turntilt_target, balance_conf.turntilt_angle_limit);
}else{
turntilt_target = fmaxf(turntilt_target, -balance_conf.turntilt_angle_limit);
}

// Move towards target limited by max speed
if(fabsf(turntilt_target - turntilt_interpolated) < turntilt_step_size){
Expand Down Expand Up @@ -582,6 +586,12 @@ static void brake(void){
}

static void set_current(float current, float yaw_current){
// Limit current output to configured max output (does not account for yaw_current)
if(current > 0 && current > mc_interface_get_configuration()->l_current_max){
current = mc_interface_get_configuration()->l_current_max;
}else if(current < 0 && current < mc_interface_get_configuration()->l_current_min){
current = mc_interface_get_configuration()->l_current_min;
}
// Reset the timeout
timeout_reset();
// Set current
Expand Down Expand Up @@ -760,7 +770,6 @@ static THD_FUNCTION(balance_thread, arg) {
}
}


if(balance_conf.multi_esc){
// Calculate setpoint
if(abs_duty_cycle < .02){
Expand Down
3 changes: 3 additions & 0 deletions applications/appconf_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
#ifndef APPCONF_UAVCAN_RAW_MODE
#define APPCONF_UAVCAN_RAW_MODE UAVCAN_RAW_MODE_CURRENT
#endif
#ifndef APPCONF_UAVCAN_STATUS_CURRENT_MODE
#define APPCONF_UAVCAN_STATUS_CURRENT_MODE UAVCAN_STATUS_CURRENT_MODE_MOTOR
#endif
#ifndef APPCONF_UAVCAN_RAW_RPM_MAX
#define APPCONF_UAVCAN_RAW_RPM_MAX 50000.0
#endif
Expand Down
2 changes: 1 addition & 1 deletion bms.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ void bms_process_cmd(unsigned char *data, unsigned int len,
switch (packet_id) {
case COMM_BMS_GET_VALUES: {
int32_t ind = 0;
uint8_t send_buffer[128];
uint8_t send_buffer[256];

send_buffer[ind++] = packet_id;

Expand Down
2 changes: 1 addition & 1 deletion conf_general.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define FW_VERSION_MAJOR 6
#define FW_VERSION_MINOR 00
// Set to 0 for building a release and iterate during beta test builds
#define FW_TEST_VERSION_NUMBER 56
#define FW_TEST_VERSION_NUMBER 58

#include "datatypes.h"

Expand Down
3 changes: 3 additions & 0 deletions confgenerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ int32_t confgenerator_serialize_appconf(uint8_t *buffer, const app_configuration
buffer[ind++] = (uint8_t)conf->uavcan_esc_index;
buffer[ind++] = conf->uavcan_raw_mode;
buffer_append_float32_auto(buffer, conf->uavcan_raw_rpm_max, &ind);
buffer[ind++] = conf->uavcan_status_current_mode;
buffer[ind++] = conf->servo_out_enable;
buffer[ind++] = conf->kill_sw_mode;
buffer[ind++] = conf->app_to_use;
Expand Down Expand Up @@ -614,6 +615,7 @@ bool confgenerator_deserialize_appconf(const uint8_t *buffer, app_configuration
conf->uavcan_esc_index = buffer[ind++];
conf->uavcan_raw_mode = buffer[ind++];
conf->uavcan_raw_rpm_max = buffer_get_float32_auto(buffer, &ind);
conf->uavcan_status_current_mode = buffer[ind++];
conf->servo_out_enable = buffer[ind++];
conf->kill_sw_mode = buffer[ind++];
conf->app_to_use = buffer[ind++];
Expand Down Expand Up @@ -992,6 +994,7 @@ void confgenerator_set_defaults_appconf(app_configuration *conf) {
conf->uavcan_esc_index = APPCONF_UAVCAN_ESC_INDEX;
conf->uavcan_raw_mode = APPCONF_UAVCAN_RAW_MODE;
conf->uavcan_raw_rpm_max = APPCONF_UAVCAN_RAW_RPM_MAX;
conf->uavcan_status_current_mode = APPCONF_UAVCAN_STATUS_CURRENT_MODE;
conf->servo_out_enable = APPCONF_SERVO_OUT_ENABLE;
conf->kill_sw_mode = APPCONF_KILL_SW_MODE;
conf->app_to_use = APPCONF_APP_TO_USE;
Expand Down
2 changes: 1 addition & 1 deletion confgenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// Constants
#define MCCONF_SIGNATURE 2217312675
#define APPCONF_SIGNATURE 2551442059
#define APPCONF_SIGNATURE 3688838172

// Functions
int32_t confgenerator_serialize_mcconf(uint8_t *buffer, const mc_configuration *conf);
Expand Down
8 changes: 7 additions & 1 deletion datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ typedef struct {
float v_cell[32];
bool bal_state[32];
int temp_adc_num;
float temps_adc[10];
float temps_adc[50];
float temp_ic;
float temp_hum;
float hum;
Expand Down Expand Up @@ -894,6 +894,11 @@ typedef enum {
UAVCAN_RAW_MODE_RPM
} UAVCAN_RAW_MODE;

typedef enum {
UAVCAN_STATUS_CURRENT_MODE_MOTOR = 0,
UAVCAN_STATUS_CURRENT_MODE_INPUT
} UAVCAN_STATUS_CURRENT_MODE;

typedef enum {
KILL_SW_MODE_DISABLED = 0,
KILL_SW_MODE_PPM_LOW,
Expand Down Expand Up @@ -923,6 +928,7 @@ typedef struct {
uint8_t uavcan_esc_index;
UAVCAN_RAW_MODE uavcan_raw_mode;
float uavcan_raw_rpm_max;
UAVCAN_STATUS_CURRENT_MODE uavcan_status_current_mode;

// Application to use
app_use app_to_use;
Expand Down
2 changes: 1 addition & 1 deletion driver/servo_dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define TIMER_FREQ 1000000

// Private variables
static volatile systime_t last_update_time;
static volatile systime_t last_update_time = 0;
static volatile float servo_pos[SERVO_NUM];
static volatile float pulse_start = 1.0;
static volatile float pulse_end = 2.0;
Expand Down
7 changes: 7 additions & 0 deletions hwconf/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,13 @@
#define NTC_TEMP_MOS3_M2() 0.0
#endif

#ifndef TEMP_MOTOR_1
#define TEMP_MOTOR_1(beta) 0.0
#endif
#ifndef TEMP_MOTOR_2
#define TEMP_MOTOR_2(beta) 0.0
#endif

// Sin/Cos Encoder Signals. Override if available
#ifndef ENCODER_SIN_VOLTS
#if defined(ADC_IND_EXT) && defined(ADC_VOLTS)
Expand Down
2 changes: 2 additions & 0 deletions hwconf/trampa/60_alva/hw_60v2_alva_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@

#define NTC_RES_MOTOR(adc_val) (10000.0 / ((4095.0 / (float)adc_val) - 1.0)) // Motor temp sensor on low side
#define NTC_TEMP_MOTOR(beta) alva_temp_motor_max(beta)
#define TEMP_MOTOR_1(beta) (1.0 / ((logf(NTC_RES_MOTOR(ADC_Value[ADC_IND_TEMP_MOTOR]) / 10000.0) / beta) + (1.0 / 298.15)) - 273.15)
#define TEMP_MOTOR_2(beta) (1.0 / ((logf(NTC_RES_MOTOR(ADC_Value[ADC_IND_TEMP_MOTOR_S2]) / 10000.0) / beta) + (1.0 / 298.15)) - 273.15)

// Voltage on ADC channel
#define ADC_VOLTS(ch) ((float)ADC_Value[ch] / 4096.0 * V_REG)
Expand Down
27 changes: 27 additions & 0 deletions hwconf/trampa/75_300_R34/hw_75_300_r34.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Copyright 2018 Benjamin Vedder [email protected]
This file is part of the VESC firmware.
The VESC firmware is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The VESC firmware is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef HW_75_300_R34_H_
#define HW_75_300_R34_H_

#define HW75_300_REV_34

#include "hw_75_300_r34_core.h"

#endif /* HW_75_300_R34_H_ */
Loading

0 comments on commit 80e3421

Please sign in to comment.