Configure servodec with app ppm options when started from lib or lbm

This commit is contained in:
Benjamin Vedder 2022-12-06 14:30:38 +01:00
parent 6482fcda39
commit f97ff0502f
2 changed files with 8 additions and 0 deletions

View File

@ -584,6 +584,10 @@ static float lib_get_ppm(void) {
if (!servodec_is_running()) {
servo_simple_stop();
servodec_init(0);
servodec_set_pulse_options(
app_get_configuration()->app_ppm_conf.pulse_start,
app_get_configuration()->app_ppm_conf.pulse_end,
app_get_configuration()->app_ppm_conf.median_filter);
}
return servodec_get_servo(0);

View File

@ -488,6 +488,10 @@ static lbm_value ext_get_ppm(lbm_value *args, lbm_uint argn) {
if (!servodec_is_running()) {
servo_simple_stop();
servodec_init(0);
servodec_set_pulse_options(
app_get_configuration()->app_ppm_conf.pulse_start,
app_get_configuration()->app_ppm_conf.pulse_end,
app_get_configuration()->app_ppm_conf.median_filter);
}
return lbm_enc_float(servodec_get_servo(0));