Skip to content

Commit

Permalink
[rpm_sensor] filter docs and defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter committed Jul 28, 2016
1 parent d95d147 commit bd8422a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions conf/modules/rpm_sensor.xml
Expand Up @@ -7,6 +7,7 @@
</description>
<configure name="RPM_PWM_CHANNEL" value="PWM_INPUTX" description="Select PWM input channel for RPM sensor"/>
<define name="RPM_PULSE_PER_RND" value="14" description="Amount of pulses per round"/>
<define name="RPM_FILTER_TAU" value="0.3" description="1/cut-off-frequency = filter time"/>
</doc>
<depends>pwm_meas</depends>
<header>
Expand Down
7 changes: 6 additions & 1 deletion sw/airborne/modules/sensors/rpm_sensor.c
Expand Up @@ -31,6 +31,11 @@

static struct FirstOrderLowPass rpm_lp;

#ifndef RPM_FILTER_TAU
#define RPM_FILTER_TAU RPM_SENSOR_PERIODIC_PERIOD
#endif


#if PERIODIC_TELEMETRY
#include "subsystems/datalink/telemetry.h"

Expand All @@ -44,7 +49,7 @@ static void rpm_sensor_send_motor(struct transport_tx *trans, struct link_device
/* Initialize the RPM measurement by configuring the telemetry */
void rpm_sensor_init(void)
{
init_first_order_low_pass(&rpm_lp, 0.3, RPM_SENSOR_PERIODIC_PERIOD, 0);
init_first_order_low_pass(&rpm_lp, RPM_FILTER_TAU, RPM_SENSOR_PERIODIC_PERIOD, 0);

#if PERIODIC_TELEMETRY
register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_MOTOR, rpm_sensor_send_motor);
Expand Down

0 comments on commit bd8422a

Please sign in to comment.