diff --git a/lispBM/README.md b/lispBM/README.md index 6a7dda453..2c127a0a5 100644 --- a/lispBM/README.md +++ b/lispBM/README.md @@ -1047,6 +1047,11 @@ The following selection of app and motor parameters can be read and set from Lis 'l-min-duty ; Minimum duty cycle 'l-max-duty ; Maximum duty cycle 'l-watt-min ; Minimum power regen in W (a negative value) +'motor-type ; Motor Type + ; 0: BLDC (6-step commutation) + ; 1: DC (DC motor on phase A and C) + ; 2: FOC (Field Oriented Control) + ; 3: GPD (General Purpose Drive) 'l-watt-max ; Maximum power regen in W 'm-invert-direction ; Invert motor direction, 0 or 1 'm-out-aux-mode ; AUX-pin output mode. Options: diff --git a/lispBM/lispif_vesc_extensions.c b/lispBM/lispif_vesc_extensions.c index 953f4a070..c062eb8d9 100644 --- a/lispBM/lispif_vesc_extensions.c +++ b/lispBM/lispif_vesc_extensions.c @@ -108,6 +108,7 @@ typedef struct { lbm_uint l_max_duty; lbm_uint l_watt_min; lbm_uint l_watt_max; + lbm_uint motor_type; lbm_uint foc_sensor_mode; lbm_uint foc_current_kp; lbm_uint foc_current_ki; @@ -279,6 +280,8 @@ static bool compare_symbol(lbm_uint sym, lbm_uint *comp) { get_add_symbol("l-watt-min", comp); } else if (comp == &syms_vesc.l_watt_max) { get_add_symbol("l-watt-max", comp); + } else if (comp == &syms_vesc.motor_type) { + get_add_symbol("motor-type", comp); } else if (comp == &syms_vesc.foc_sensor_mode) { get_add_symbol("foc-sensor-mode", comp); } else if (comp == &syms_vesc.foc_current_kp) { @@ -2661,7 +2664,10 @@ static lbm_value ext_conf_set(lbm_value *args, lbm_uint argn) { appconf = mempools_alloc_appconf(); *appconf = *app_get_configuration(); - if (compare_symbol(name, &syms_vesc.foc_sensor_mode)) { + if (compare_symbol(name, &syms_vesc.motor_type)) { + mcconf->motor_type = lbm_dec_as_i32(args[1]); + changed_mc = 2; + } else if (compare_symbol(name, &syms_vesc.foc_sensor_mode)) { mcconf->foc_sensor_mode = lbm_dec_as_i32(args[1]); changed_mc = 2; } else if (compare_symbol(name, &syms_vesc.foc_current_kp)) { @@ -2868,6 +2874,8 @@ static lbm_value ext_conf_get(lbm_value *args, lbm_uint argn) { res = lbm_enc_float(mcconf->l_watt_min); } else if (compare_symbol(name, &syms_vesc.l_watt_max)) { res = lbm_enc_float(mcconf->l_watt_max); + } else if (compare_symbol(name, &syms_vesc.motor_type)) { + res = lbm_enc_i(mcconf->motor_type); } else if (compare_symbol(name, &syms_vesc.foc_sensor_mode)) { res = lbm_enc_i(mcconf->foc_sensor_mode); } else if (compare_symbol(name, &syms_vesc.foc_current_kp)) {