diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-05-13 08:06:33 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-05-13 08:06:33 +0200 |
commit | 37970c58284591bd994f0320e7656c1106be505b (patch) | |
tree | 5bc6fa43621d5aeb848aa2e75d62078bd6c29299 /src/drivers/stm32 | |
parent | be6b9a1b3693a32f6d6870a3986b01c0778993fa (diff) | |
download | px4-firmware-37970c58284591bd994f0320e7656c1106be505b.tar.gz px4-firmware-37970c58284591bd994f0320e7656c1106be505b.tar.bz2 px4-firmware-37970c58284591bd994f0320e7656c1106be505b.zip |
hrt driver: Make a debug data array compiling condiditional on PPM debug, we are never accessing it in normal operation
Diffstat (limited to 'src/drivers/stm32')
-rw-r--r-- | src/drivers/stm32/drv_hrt.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/drivers/stm32/drv_hrt.c b/src/drivers/stm32/drv_hrt.c index f324b341e..5bb550279 100644 --- a/src/drivers/stm32/drv_hrt.c +++ b/src/drivers/stm32/drv_hrt.c @@ -354,6 +354,9 @@ __EXPORT uint16_t ppm_frame_length = 0; __EXPORT unsigned ppm_decoded_channels = 0; __EXPORT uint64_t ppm_last_valid_decode = 0; +#define PPM_DEBUG 0 + +#if PPM_DEBUG /* PPM edge history */ __EXPORT uint16_t ppm_edge_history[32]; unsigned ppm_edge_next; @@ -361,6 +364,7 @@ unsigned ppm_edge_next; /* PPM pulse history */ __EXPORT uint16_t ppm_pulse_history[32]; unsigned ppm_pulse_next; +#endif static uint16_t ppm_temp_buffer[PPM_MAX_CHANNELS]; @@ -455,10 +459,12 @@ hrt_ppm_decode(uint32_t status) /* how long since the last edge? - this handles counter wrapping implicitely. */ width = count - ppm.last_edge; +#if PPM_DEBUG ppm_edge_history[ppm_edge_next++] = width; if (ppm_edge_next >= 32) ppm_edge_next = 0; +#endif /* * if this looks like a start pulse, then push the last set of values @@ -546,10 +552,12 @@ hrt_ppm_decode(uint32_t status) interval = count - ppm.last_mark; ppm.last_mark = count; +#if PPM_DEBUG ppm_pulse_history[ppm_pulse_next++] = interval; if (ppm_pulse_next >= 32) ppm_pulse_next = 0; +#endif /* if the mark-mark timing is out of bounds, abandon the frame */ if ((interval < PPM_MIN_CHANNEL_VALUE) || (interval > PPM_MAX_CHANNEL_VALUE)) |