From 9b6b5bc7293454fcfafe4694f185f7c8623f696b Mon Sep 17 00:00:00 2001 From: lilvinz Date: Fri, 21 Sep 2012 23:51:21 +0200 Subject: [PATCH] changed receiver constants to be all negative in order to allow valid channel values of 0 for dsm --- flight/PiOS/STM32F10x/pios_ppm.c | 4 ++-- flight/PiOS/STM32F4xx/pios_ppm.c | 4 ++-- flight/PiOS/inc/pios_rcvr.h | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flight/PiOS/STM32F10x/pios_ppm.c b/flight/PiOS/STM32F10x/pios_ppm.c index 64d1196f9..b47a2d6c2 100644 --- a/flight/PiOS/STM32F10x/pios_ppm.c +++ b/flight/PiOS/STM32F10x/pios_ppm.c @@ -145,8 +145,8 @@ extern int32_t PIOS_PPM_Init(uint32_t * ppm_id, const struct pios_ppm_cfg * cfg) for (uint8_t i = 0; i < PIOS_PPM_IN_MAX_NUM_CHANNELS; i++) { /* Flush counter variables */ - ppm_dev->CaptureValue[i] = 0; - ppm_dev->CaptureValueNewFrame[i] = 0; + ppm_dev->CaptureValue[i] = PIOS_RCVR_TIMEOUT; + ppm_dev->CaptureValueNewFrame[i] = PIOS_RCVR_TIMEOUT; } diff --git a/flight/PiOS/STM32F4xx/pios_ppm.c b/flight/PiOS/STM32F4xx/pios_ppm.c index e17b342b7..048377ebd 100644 --- a/flight/PiOS/STM32F4xx/pios_ppm.c +++ b/flight/PiOS/STM32F4xx/pios_ppm.c @@ -145,8 +145,8 @@ extern int32_t PIOS_PPM_Init(uint32_t * ppm_id, const struct pios_ppm_cfg * cfg) for (uint8_t i = 0; i < PIOS_PPM_IN_MAX_NUM_CHANNELS; i++) { /* Flush counter variables */ - ppm_dev->CaptureValue[i] = 0; - ppm_dev->CaptureValueNewFrame[i] = 0; + ppm_dev->CaptureValue[i] = PIOS_RCVR_TIMEOUT; + ppm_dev->CaptureValueNewFrame[i] = PIOS_RCVR_TIMEOUT; } diff --git a/flight/PiOS/inc/pios_rcvr.h b/flight/PiOS/inc/pios_rcvr.h index ab493cd35..6b74c9b52 100644 --- a/flight/PiOS/inc/pios_rcvr.h +++ b/flight/PiOS/inc/pios_rcvr.h @@ -42,11 +42,11 @@ extern int32_t PIOS_RCVR_Read(uint32_t rcvr_id, uint8_t channel); /*! Define error codes for PIOS_RCVR_Get */ enum PIOS_RCVR_errors { /*! Indicates that a failsafe condition or missing receiver detected for that channel */ - PIOS_RCVR_TIMEOUT = 0, + PIOS_RCVR_TIMEOUT = -1, /*! Channel is invalid for this driver (usually out of range supported) */ - PIOS_RCVR_INVALID = -1, + PIOS_RCVR_INVALID = -2, /*! Indicates that the driver for this channel has not been initialized */ - PIOS_RCVR_NODRIVER = -2 + PIOS_RCVR_NODRIVER = -3 }; #endif /* PIOS_RCVR_H */