Added LBM input voltage and duty cycle settings

This commit is contained in:
Benjamin Vedder 2022-05-01 13:59:44 +02:00
parent c1bffc44c8
commit 673e682e5a
2 changed files with 36 additions and 0 deletions

View File

@ -986,6 +986,10 @@ The following selection of app and motor parameters can be read and set from Lis
'l-in-current-max ; Maximum input current in A 'l-in-current-max ; Maximum input current in A
'l-min-erpm ; Minimum ERPM (a negative value) 'l-min-erpm ; Minimum ERPM (a negative value)
'l-max-erpm ; Maximum ERPM 'l-max-erpm ; Maximum ERPM
'l-min-vin ; Minimum input voltage
'l-max-vin ; Maximum input voltage
'l-min-duty ; Minimum duty cycle
'l-max-duty ; Maximum duty cycle
'l-watt-min ; Minimum power regen in W (a negative value) 'l-watt-min ; Minimum power regen in W (a negative value)
'l-watt-max ; Maximum power regen in W 'l-watt-max ; Maximum power regen in W
'foc-current-kp ; FOC current controller KP 'foc-current-kp ; FOC current controller KP

View File

@ -93,6 +93,10 @@ typedef struct {
lbm_uint l_in_current_max; lbm_uint l_in_current_max;
lbm_uint l_min_erpm; lbm_uint l_min_erpm;
lbm_uint l_max_erpm; lbm_uint l_max_erpm;
lbm_uint l_min_vin;
lbm_uint l_max_vin;
lbm_uint l_min_duty;
lbm_uint l_max_duty;
lbm_uint l_watt_min; lbm_uint l_watt_min;
lbm_uint l_watt_max; lbm_uint l_watt_max;
lbm_uint foc_current_kp; lbm_uint foc_current_kp;
@ -228,6 +232,14 @@ static bool compare_symbol(lbm_uint sym, lbm_uint *comp) {
get_add_symbol("l-min-erpm", comp); get_add_symbol("l-min-erpm", comp);
} else if (comp == &syms_vesc.l_max_erpm) { } else if (comp == &syms_vesc.l_max_erpm) {
get_add_symbol("l-max-erpm", comp); get_add_symbol("l-max-erpm", comp);
} else if (comp == &syms_vesc.l_min_vin) {
get_add_symbol("l-min-vin", comp);
} else if (comp == &syms_vesc.l_max_vin) {
get_add_symbol("l-max-vin", comp);
} else if (comp == &syms_vesc.l_min_duty) {
get_add_symbol("l-min-duty", comp);
} else if (comp == &syms_vesc.l_max_duty) {
get_add_symbol("l-max-duty", comp);
} else if (comp == &syms_vesc.l_watt_min) { } else if (comp == &syms_vesc.l_watt_min) {
get_add_symbol("l-watt-min", comp); get_add_symbol("l-watt-min", comp);
} else if (comp == &syms_vesc.l_watt_max) { } else if (comp == &syms_vesc.l_watt_max) {
@ -2421,6 +2433,18 @@ static lbm_value ext_conf_set(lbm_value *args, lbm_uint argn) {
} else if (compare_symbol(name, &syms_vesc.l_max_erpm)) { } else if (compare_symbol(name, &syms_vesc.l_max_erpm)) {
mcconf->l_max_erpm = lbm_dec_as_float(args[1]); mcconf->l_max_erpm = lbm_dec_as_float(args[1]);
changed_mc = 1; changed_mc = 1;
} else if (compare_symbol(name, &syms_vesc.l_min_vin)) {
mcconf->l_min_vin = lbm_dec_as_float(args[1]);
changed_mc = 1;
} else if (compare_symbol(name, &syms_vesc.l_max_vin)) {
mcconf->l_max_vin = lbm_dec_as_float(args[1]);
changed_mc = 1;
} else if (compare_symbol(name, &syms_vesc.l_min_duty)) {
mcconf->l_min_duty = lbm_dec_as_float(args[1]);
changed_mc = 1;
} else if (compare_symbol(name, &syms_vesc.l_max_duty)) {
mcconf->l_max_duty = lbm_dec_as_float(args[1]);
changed_mc = 1;
} else if (compare_symbol(name, &syms_vesc.min_speed)) { } else if (compare_symbol(name, &syms_vesc.min_speed)) {
mcconf->l_min_erpm = -fabsf(lbm_dec_as_float(args[1])) * speed_fact; mcconf->l_min_erpm = -fabsf(lbm_dec_as_float(args[1])) * speed_fact;
changed_mc = 1; changed_mc = 1;
@ -2547,6 +2571,14 @@ static lbm_value ext_conf_get(lbm_value *args, lbm_uint argn) {
res = lbm_enc_float(mcconf->l_min_erpm); res = lbm_enc_float(mcconf->l_min_erpm);
} else if (compare_symbol(name, &syms_vesc.l_max_erpm)) { } else if (compare_symbol(name, &syms_vesc.l_max_erpm)) {
res = lbm_enc_float(mcconf->l_max_erpm); res = lbm_enc_float(mcconf->l_max_erpm);
} else if (compare_symbol(name, &syms_vesc.l_min_vin)) {
res = lbm_enc_float(mcconf->l_min_vin);
} else if (compare_symbol(name, &syms_vesc.l_max_vin)) {
res = lbm_enc_float(mcconf->l_max_vin);
} else if (compare_symbol(name, &syms_vesc.l_min_duty)) {
res = lbm_enc_float(mcconf->l_min_duty);
} else if (compare_symbol(name, &syms_vesc.l_max_duty)) {
res = lbm_enc_float(mcconf->l_max_duty);
} else if (compare_symbol(name, &syms_vesc.l_watt_min)) { } else if (compare_symbol(name, &syms_vesc.l_watt_min)) {
res = lbm_enc_float(mcconf->l_watt_min); res = lbm_enc_float(mcconf->l_watt_min);
} else if (compare_symbol(name, &syms_vesc.l_watt_max)) { } else if (compare_symbol(name, &syms_vesc.l_watt_max)) {