From 673e682e5a6e8a9eee82352a0ba376c8d0f5d3de Mon Sep 17 00:00:00 2001 From: Benjamin Vedder Date: Sun, 1 May 2022 13:59:44 +0200 Subject: [PATCH] Added LBM input voltage and duty cycle settings --- lispBM/README.md | 4 ++++ lispBM/lispif_vesc_extensions.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/lispBM/README.md b/lispBM/README.md index 22d5dccd..e991ad84 100644 --- a/lispBM/README.md +++ b/lispBM/README.md @@ -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-min-erpm ; Minimum ERPM (a negative value) '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-max ; Maximum power regen in W 'foc-current-kp ; FOC current controller KP diff --git a/lispBM/lispif_vesc_extensions.c b/lispBM/lispif_vesc_extensions.c index 6555d721..a9e5c72f 100644 --- a/lispBM/lispif_vesc_extensions.c +++ b/lispBM/lispif_vesc_extensions.c @@ -93,6 +93,10 @@ typedef struct { lbm_uint l_in_current_max; lbm_uint l_min_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_max; 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); } else if (comp == &syms_vesc.l_max_erpm) { 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) { get_add_symbol("l-watt-min", comp); } 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)) { mcconf->l_max_erpm = lbm_dec_as_float(args[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)) { mcconf->l_min_erpm = -fabsf(lbm_dec_as_float(args[1])) * speed_fact; 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); } else if (compare_symbol(name, &syms_vesc.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)) { res = lbm_enc_float(mcconf->l_watt_min); } else if (compare_symbol(name, &syms_vesc.l_watt_max)) {