Added adc_ctrl_type to lisp config parameters that can be changed

This commit is contained in:
Benjamin Vedder 2022-12-14 22:20:50 +01:00
parent 26c97f7624
commit 38e071dfd2
2 changed files with 24 additions and 0 deletions

View File

@ -1420,6 +1420,22 @@ The following selection of app and motor parameters can be read and set from Lis
'ppm-pulse-center ; Pulse corresponding to center throttle in ms
'ppm-ramp-time-pos ; Positive ramping time in seconds
'ppm-ramp-time-neg ; Negative ramping time in seconds
'adc-ctrl-type ; ADC Control Type (Added in FW 6.02)
; 0: ADC_CTRL_TYPE_NONE
; 1: ADC_CTRL_TYPE_CURRENT
; 2: ADC_CTRL_TYPE_CURRENT_REV_CENTER
; 3: ADC_CTRL_TYPE_CURRENT_REV_BUTTON
; 4: ADC_CTRL_TYPE_CURRENT_REV_BUTTON_BRAKE_ADC
; 5: ADC_CTRL_TYPE_CURRENT_REV_BUTTON_BRAKE_CENTER
; 6: ADC_CTRL_TYPE_CURRENT_NOREV_BRAKE_CENTER
; 7: ADC_CTRL_TYPE_CURRENT_NOREV_BRAKE_BUTTON
; 8: ADC_CTRL_TYPE_CURRENT_NOREV_BRAKE_ADC
; 9: ADC_CTRL_TYPE_DUTY
; 10: ADC_CTRL_TYPE_DUTY_REV_CENTER
; 11: ADC_CTRL_TYPE_DUTY_REV_BUTTON
; 12: ADC_CTRL_TYPE_PID
; 13: ADC_CTRL_TYPE_PID_REV_CENTER
; 14: ADC_CTRL_TYPE_PID_REV_BUTTON
```
#### conf-set

View File

@ -142,6 +142,7 @@ typedef struct {
lbm_uint ppm_pulse_center;
lbm_uint ppm_ramp_time_pos;
lbm_uint ppm_ramp_time_neg;
lbm_uint adc_ctrl_type;
// Sysinfo
lbm_uint hw_name;
@ -362,6 +363,8 @@ static bool compare_symbol(lbm_uint sym, lbm_uint *comp) {
get_add_symbol("ppm-ramp-time-pos", comp);
} else if (comp == &syms_vesc.ppm_ramp_time_neg) {
get_add_symbol("ppm-ramp-time-neg", comp);
} else if (comp == &syms_vesc.adc_ctrl_type) {
get_add_symbol("adc-ctrl-type", comp);
}
else if (comp == &syms_vesc.hw_name) {
@ -3208,6 +3211,9 @@ static lbm_value ext_conf_set(lbm_value *args, lbm_uint argn) {
} else if (compare_symbol(name, &syms_vesc.ppm_ramp_time_neg)) {
appconf->app_ppm_conf.ramp_time_neg = lbm_dec_as_float(args[1]);
changed_app = 2;
} else if (compare_symbol(name, &syms_vesc.adc_ctrl_type)) {
appconf->app_adc_conf.ctrl_type = lbm_dec_as_i32(args[1]);
changed_app = 2;
}
}
@ -3412,6 +3418,8 @@ static lbm_value ext_conf_get(lbm_value *args, lbm_uint argn) {
res = lbm_enc_float(appconf->app_ppm_conf.ramp_time_pos);
} else if (compare_symbol(name, &syms_vesc.ppm_ramp_time_neg)) {
res = lbm_enc_float(appconf->app_ppm_conf.ramp_time_neg);
} else if (compare_symbol(name, &syms_vesc.adc_ctrl_type)) {
res = lbm_enc_i(appconf->app_adc_conf.ctrl_type);
}
if (defaultcfg) {