diff --git a/applications/app.h b/applications/app.h index 3f574f3d..dd96674c 100644 --- a/applications/app.h +++ b/applications/app.h @@ -93,6 +93,7 @@ void app_pas_stop(void); bool app_pas_is_running(void); void app_pas_configure(pas_config *conf); float app_pas_get_current_target_rel(void); +float app_pas_get_pedal_rpm(void); void app_pas_set_current_sub_scaling(float current_sub_scaling); // Custom apps diff --git a/applications/app_pas.c b/applications/app_pas.c index ba326d63..876dc825 100644 --- a/applications/app_pas.c +++ b/applications/app_pas.c @@ -115,6 +115,10 @@ float app_pas_get_current_target_rel(void) { return output_current_rel; } +float app_pas_get_pedal_rpm(void) { + return pedal_rpm; +} + void pas_event_handler(void) { #ifdef HW_PAS1_PORT const int8_t QEM[] = {0,-1,1,2,1,0,2,-1,-1,2,0,1,2,1,-1,0}; // Quadrature Encoder Matrix diff --git a/lispBM/README.md b/lispBM/README.md index 06dcdff4..b506b471 100644 --- a/lispBM/README.md +++ b/lispBM/README.md @@ -372,6 +372,14 @@ Send input to the VESC Remote app. Unlike the ADC and PPM apps, input can be sen Disable app output for ms milliseconds. 0 means enable now and -1 means disable forever. This can be used to override the control of apps temporarily. +#### app-pas-get-rpm + +```clj +(app-pas-get-rpm) +``` + +Returns the pedal RPM measured by the PAS-app. If you want to implement your own PAS-control based on this RPM you can use [app-disable-output](#app-disable-output) to disable the output of the PAS-app. + ### Motor Set Commands #### set-current diff --git a/lispBM/lispif_vesc_extensions.c b/lispBM/lispif_vesc_extensions.c index 8678e2b3..98933136 100644 --- a/lispBM/lispif_vesc_extensions.c +++ b/lispBM/lispif_vesc_extensions.c @@ -1122,6 +1122,11 @@ static lbm_value ext_app_disable_output(lbm_value *args, lbm_uint argn) { return ENC_SYM_TRUE; } +static lbm_value ext_app_pas_get_rpm(lbm_value *args, lbm_uint argn) { + (void)args; (void)argn; + return lbm_enc_float(app_pas_get_pedal_rpm()); +} + // Motor set commands static lbm_value ext_set_current(lbm_value *args, lbm_uint argn) { @@ -4016,6 +4021,8 @@ void lispif_load_vesc_extensions(void) { lbm_add_extension("app-ppm-override", ext_app_ppm_override); lbm_add_extension("set-remote-state", ext_set_remote_state); lbm_add_extension("app-disable-output", ext_app_disable_output); + lbm_add_extension("app-pas-get-rpm", ext_app_pas_get_rpm); + // Motor set commands lbm_add_extension("set-current", ext_set_current);