From 7ce5daef8f35488876594273746e86d378f50c27 Mon Sep 17 00:00:00 2001 From: James Whitlock Date: Tue, 19 Jul 2011 22:06:29 +0100 Subject: [PATCH 1/9] Clean up of PPM code in master. --- flight/PiOS/STM32F10x/pios_ppm.c | 135 ++++++++++++++++--------------- 1 file changed, 71 insertions(+), 64 deletions(-) diff --git a/flight/PiOS/STM32F10x/pios_ppm.c b/flight/PiOS/STM32F10x/pios_ppm.c index 851fe217a..3aafd3f22 100644 --- a/flight/PiOS/STM32F10x/pios_ppm.c +++ b/flight/PiOS/STM32F10x/pios_ppm.c @@ -41,19 +41,23 @@ const struct pios_rcvr_driver pios_ppm_rcvr_driver = { .read = PIOS_PPM_Get, }; +#define PIOS_PPM_IN_MIN_SYNC_PULSE_US 7000 // microseconds +#define PIOS_PPM_IN_MIN_CHANNEL_PULSE_US 750 // microseconds +#define PIOS_PPM_IN_MAX_CHANNEL_PULSE_US 2400 // microseconds +#define PIOS_PPM_INPUT_INVALID 0 + /* Local Variables */ static TIM_ICInitTypeDef TIM_ICInitStructure; static uint8_t PulseIndex; -static uint32_t PreviousValue; -static uint32_t CurrentValue; -static uint32_t CapturedValue; +static uint32_t PreviousTime; +static uint32_t CurrentTime; +static uint32_t DeltaTime; static uint32_t CaptureValue[PIOS_PPM_NUM_INPUTS]; -static uint32_t CapCounter[PIOS_PPM_NUM_INPUTS]; -static uint16_t TimerCounter; +static uint32_t LargeCounter; static uint8_t supv_timer = 0; -static uint8_t SupervisorState = 0; -static uint32_t CapCounterPrev[PIOS_PPM_NUM_INPUTS]; +static bool Tracking; +static bool Fresh; static void PIOS_PPM_Supervisor(uint32_t ppm_id); @@ -63,10 +67,12 @@ void PIOS_PPM_Init(void) int32_t i; PulseIndex = 0; - PreviousValue = 0; - CurrentValue = 0; - CapturedValue = 0; - TimerCounter = 0; + PreviousTime = 0; + CurrentTime = 0; + DeltaTime = 0; + LargeCounter = 0; + Tracking = FALSE; + Fresh = FALSE; for (i = 0; i < PIOS_PPM_NUM_INPUTS; i++) { CaptureValue[i] = 0; @@ -134,15 +140,6 @@ void PIOS_PPM_Init(void) /* Enable timers */ TIM_Cmd(pios_ppm_cfg.timer, ENABLE); - /* Supervisor Setup */ - /* Flush counter variables */ - for (i = 0; i < PIOS_PPM_NUM_INPUTS; i++) { - CapCounter[i] = 0; - } - for (i = 0; i < PIOS_PPM_NUM_INPUTS; i++) { - CapCounterPrev[i] = 0; - } - /* Setup local variable which stays in this scope */ /* Doing this here and using a local variable saves doing it in the ISR */ TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI; @@ -176,56 +173,77 @@ static int32_t PIOS_PPM_Get(uint32_t rcvr_id, uint8_t channel) */ void PIOS_PPM_irq_handler(void) { + /* Timer Overflow Interrupt + * The time between timer overflows must be greater than the PPM + * frame period. If a full frame has not decoded in the between timer + * overflows then capture values should be cleared. + */ + if (TIM_GetITStatus(pios_ppm_cfg.timer, TIM_IT_Update) == SET) { - TimerCounter+=pios_ppm_cfg.timer->ARR; + /* Clear TIMx overflow interrupt pending bit */ TIM_ClearITPendingBit(pios_ppm_cfg.timer, TIM_IT_Update); - if (TIM_GetITStatus(pios_ppm_cfg.timer, pios_ppm_cfg.ccr) != SET) { - return; - } + + /* If sharing a timer with a servo output the ARR register will + be set according to the PWM period. When timer reaches the + ARR value a timer overflow interrupt will fire. We use the + interrupt accumulate a 32-bit timer. */ + LargeCounter = LargeCounter + pios_ppm_cfg.timer->ARR; } - /* Do this as it's more efficient */ + /* Signal edge interrupt */ if (TIM_GetITStatus(pios_ppm_cfg.timer, pios_ppm_cfg.ccr) == SET) { - PreviousValue = CurrentValue; + PreviousTime = CurrentTime; switch((int32_t) pios_ppm_cfg.ccr) { case (int32_t)TIM_IT_CC1: - CurrentValue = TIM_GetCapture1(pios_ppm_cfg.timer); + CurrentTime = TIM_GetCapture1(pios_ppm_cfg.timer); break; case (int32_t)TIM_IT_CC2: - CurrentValue = TIM_GetCapture2(pios_ppm_cfg.timer); + CurrentTime = TIM_GetCapture2(pios_ppm_cfg.timer); break; case (int32_t)TIM_IT_CC3: - CurrentValue = TIM_GetCapture3(pios_ppm_cfg.timer); + CurrentTime = TIM_GetCapture3(pios_ppm_cfg.timer); break; case (int32_t)TIM_IT_CC4: - CurrentValue = TIM_GetCapture4(pios_ppm_cfg.timer); + CurrentTime = TIM_GetCapture4(pios_ppm_cfg.timer); break; } - CurrentValue+=TimerCounter; - if(CurrentValue > 0xFFFF) { - CurrentValue-=0xFFFF; - } /* Clear TIMx Capture compare interrupt pending bit */ TIM_ClearITPendingBit(pios_ppm_cfg.timer, pios_ppm_cfg.ccr); - /* Capture computation */ - if (CurrentValue > PreviousValue) { - CapturedValue = (CurrentValue - PreviousValue); - } else { - CapturedValue = ((0xFFFF - PreviousValue) + CurrentValue); - } + /* Convert to 32-bit timer result */ + CurrentTime = CurrentTime + LargeCounter; - /* sync pulse */ - if (CapturedValue > 8000) { + /* Capture computation */ + DeltaTime = CurrentTime - PreviousTime; + + PreviousTime = CurrentTime; + + + /* Sync pulse detection */ + if (DeltaTime > PIOS_PPM_IN_MIN_SYNC_PULSE_US) { + Fresh = TRUE; + Tracking = TRUE; PulseIndex = 0; - /* trying to detect bad pulses, not sure this is working correctly yet. I need a scope :P */ - } else if (CapturedValue > 750 && CapturedValue < 2500) { - if (PulseIndex < PIOS_PPM_NUM_INPUTS) { - CaptureValue[PulseIndex] = CapturedValue; - CapCounter[PulseIndex]++; + /* Valid pulse duration 0.75 to 2.5 ms*/ + } else if (Tracking) { + /* Valid pulse duration 0.75 to 2.5 ms*/ + if (DeltaTime > PIOS_PPM_IN_MIN_CHANNEL_PULSE_US + && DeltaTime < PIOS_PPM_IN_MAX_CHANNEL_PULSE_US + && PulseIndex < PIOS_PPM_NUM_INPUTS) { + + CaptureValue[PulseIndex] = DeltaTime; PulseIndex++; + if (PulseIndex == PIOS_PPM_NUM_INPUTS) { + PulseIndex = 0; + } + } else { + /* Not a valid pulse duration */ + Tracking = FALSE; + for (uint32_t i = 0; i < PIOS_PPM_NUM_INPUTS ; i++) { + CaptureValue[PulseIndex] = PIOS_PPM_INPUT_INVALID; + } } } } @@ -241,26 +259,15 @@ static void PIOS_PPM_Supervisor(uint32_t ppm_id) { } supv_timer = 0; - /* Simple state machine */ - if (SupervisorState == 0) { - /* Save this states values */ - for (int32_t i = 0; i < PIOS_PPM_NUM_INPUTS; i++) { - CapCounterPrev[i] = CapCounter[i]; - } + if (!Fresh) { + Tracking = FALSE; - /* Move to next state */ - SupervisorState = 1; - } else { - /* See what channels have been updated */ - for (int32_t i = 0; i < PIOS_PPM_NUM_INPUTS; i++) { - if (CapCounter[i] == CapCounterPrev[i]) { - CaptureValue[i] = 0; - } + for (int32_t i = 0; i < PIOS_PPM_NUM_INPUTS ; i++) { + CaptureValue[PulseIndex] = PIOS_PPM_INPUT_INVALID; } - - /* Move to next state */ - SupervisorState = 0; } + + Fresh = FALSE; } #endif From 7a58b4ccebbac6050385448a5607268b70bcf162 Mon Sep 17 00:00:00 2001 From: James Whitlock Date: Sat, 23 Jul 2011 01:32:57 +0100 Subject: [PATCH 2/9] A quick clean of ppm code to remove white space and duplicated comments --- flight/PiOS/STM32F10x/pios_ppm.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/flight/PiOS/STM32F10x/pios_ppm.c b/flight/PiOS/STM32F10x/pios_ppm.c index 3aafd3f22..df8a62096 100644 --- a/flight/PiOS/STM32F10x/pios_ppm.c +++ b/flight/PiOS/STM32F10x/pios_ppm.c @@ -99,7 +99,6 @@ void PIOS_PPM_Init(void) RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE); break; #ifdef STM32F10X_HD - case (int32_t)TIM5: NVIC_InitStructure.NVIC_IRQChannel = TIM5_IRQn; RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5, ENABLE); @@ -190,10 +189,10 @@ void PIOS_PPM_irq_handler(void) LargeCounter = LargeCounter + pios_ppm_cfg.timer->ARR; } - /* Signal edge interrupt */ if (TIM_GetITStatus(pios_ppm_cfg.timer, pios_ppm_cfg.ccr) == SET) { PreviousTime = CurrentTime; + switch((int32_t) pios_ppm_cfg.ccr) { case (int32_t)TIM_IT_CC1: CurrentTime = TIM_GetCapture1(pios_ppm_cfg.timer); @@ -220,13 +219,11 @@ void PIOS_PPM_irq_handler(void) PreviousTime = CurrentTime; - /* Sync pulse detection */ if (DeltaTime > PIOS_PPM_IN_MIN_SYNC_PULSE_US) { Fresh = TRUE; Tracking = TRUE; PulseIndex = 0; - /* Valid pulse duration 0.75 to 2.5 ms*/ } else if (Tracking) { /* Valid pulse duration 0.75 to 2.5 ms*/ if (DeltaTime > PIOS_PPM_IN_MIN_CHANNEL_PULSE_US From 11c568ec504c1848045577a5d6415fc754c67e58 Mon Sep 17 00:00:00 2001 From: James Whitlock Date: Sat, 23 Jul 2011 01:38:51 +0100 Subject: [PATCH 3/9] Add in a PPM input frame size tracker. Move update of capture values to start of new frame. Fix an issue with setting channels to invalid. --- flight/PiOS/Boards/STM32103CB_CC_Rev1.h | 5 -- flight/PiOS/Boards/STM3210E_OP.h | 6 --- flight/PiOS/STM32F10x/pios_ppm.c | 64 ++++++++++++++++++++----- 3 files changed, 52 insertions(+), 23 deletions(-) diff --git a/flight/PiOS/Boards/STM32103CB_CC_Rev1.h b/flight/PiOS/Boards/STM32103CB_CC_Rev1.h index 38a29868c..fbfe090be 100644 --- a/flight/PiOS/Boards/STM32103CB_CC_Rev1.h +++ b/flight/PiOS/Boards/STM32103CB_CC_Rev1.h @@ -228,11 +228,6 @@ extern uint32_t pios_com_sbus_id; #define PIOS_RCVR_MAX_DEVS 1 #define PIOS_RCVR_MAX_CHANNELS 12 -//------------------------- -// Receiver PPM input -//------------------------- -#define PIOS_PPM_NUM_INPUTS 6 //Could be more if needed - //------------------------- // Receiver PWM input //------------------------- diff --git a/flight/PiOS/Boards/STM3210E_OP.h b/flight/PiOS/Boards/STM3210E_OP.h index c25e6ccfa..9a0eb95db 100644 --- a/flight/PiOS/Boards/STM3210E_OP.h +++ b/flight/PiOS/Boards/STM3210E_OP.h @@ -201,12 +201,6 @@ extern uint32_t pios_com_sbus_id; #define PIOS_RCVR_MAX_DEVS 1 #define PIOS_RCVR_MAX_CHANNELS 12 -//------------------------- -// Receiver PPM input -//------------------------- -#define PIOS_PPM_NUM_INPUTS 8 //Could be more if needed -#define PIOS_PPM_SUPV_ENABLED 1 - //------------------------- // Receiver PWM input //------------------------- diff --git a/flight/PiOS/STM32F10x/pios_ppm.c b/flight/PiOS/STM32F10x/pios_ppm.c index df8a62096..4b60f390e 100644 --- a/flight/PiOS/STM32F10x/pios_ppm.c +++ b/flight/PiOS/STM32F10x/pios_ppm.c @@ -41,6 +41,9 @@ const struct pios_rcvr_driver pios_ppm_rcvr_driver = { .read = PIOS_PPM_Get, }; +#define PIOS_PPM_IN_MIN_NUM_CHANNELS 4 +#define PIOS_PPM_IN_MAX_NUM_CHANNELS 8 +#define PIOS_PPM_STABLE_CHANNEL_COUNT 25 // frames #define PIOS_PPM_IN_MIN_SYNC_PULSE_US 7000 // microseconds #define PIOS_PPM_IN_MIN_CHANNEL_PULSE_US 750 // microseconds #define PIOS_PPM_IN_MAX_CHANNEL_PULSE_US 2400 // microseconds @@ -52,8 +55,12 @@ static uint8_t PulseIndex; static uint32_t PreviousTime; static uint32_t CurrentTime; static uint32_t DeltaTime; -static uint32_t CaptureValue[PIOS_PPM_NUM_INPUTS]; +static uint32_t CaptureValue[PIOS_PPM_IN_MAX_NUM_CHANNELS]; +static uint32_t CaptureValueNewFrame[PIOS_PPM_IN_MAX_NUM_CHANNELS]; static uint32_t LargeCounter; +static int8_t NumChannels; +static int8_t NumChannelsPrev; +static uint8_t NumChannelCounter; static uint8_t supv_timer = 0; static bool Tracking; @@ -71,11 +78,15 @@ void PIOS_PPM_Init(void) CurrentTime = 0; DeltaTime = 0; LargeCounter = 0; + NumChannels = -1; + NumChannelsPrev = -1; + NumChannelCounter = 0; Tracking = FALSE; Fresh = FALSE; - for (i = 0; i < PIOS_PPM_NUM_INPUTS; i++) { + for (i = 0; i < PIOS_PPM_IN_MAX_NUM_CHANNELS; i++) { CaptureValue[i] = 0; + CaptureValueNewFrame[i] = 0; } NVIC_InitTypeDef NVIC_InitStructure = pios_ppm_cfg.irq.init; @@ -159,7 +170,7 @@ void PIOS_PPM_Init(void) static int32_t PIOS_PPM_Get(uint32_t rcvr_id, uint8_t channel) { /* Return error if channel not available */ - if (channel >= PIOS_PPM_NUM_INPUTS) { + if (channel > PIOS_PPM_IN_MAX_NUM_CHANNELS) { return -1; } return CaptureValue[channel]; @@ -221,25 +232,53 @@ void PIOS_PPM_irq_handler(void) /* Sync pulse detection */ if (DeltaTime > PIOS_PPM_IN_MIN_SYNC_PULSE_US) { + if (PulseIndex == NumChannelsPrevFrame + && PulseIndex >= PIOS_PPM_IN_MIN_NUM_CHANNELS + && PulseIndex <= PIOS_PPM_IN_MAX_NUM_CHANNELS) + { + /* If we see n simultaneous frames of the same + number of channels we save it as our frame size */ + if (NumChannelCounter < PIOS_PPM_STABLE_CHANNEL_COUNT) + NumChannelCounter++; + else + NumChannels = PulseIndex; + } else { + NumChannelCounter = 0; + } + + /* Check if the last frame was well formed */ + if (PulseIndex == NumChannels && Tracking) { + /* The last frame was well formed */ + for (uint32_t i = 0; i < NumChannels; i++) { + CaptureValue[i] = CaptureValueNewFrame[i]; + } + for (uint32_t i = NumChannels; + i < PIOS_PPM_IN_MAX_NUM_CHANNELS; i++) { + CaptureValue[i] = 0; + } + } + Fresh = TRUE; Tracking = TRUE; + NumChannelsPrevFrame = PulseIndex; PulseIndex = 0; + + /* We rely on the supervisor to set CaptureValue to invalid + if no valid frame is found otherwise we ride over it */ + } else if (Tracking) { /* Valid pulse duration 0.75 to 2.5 ms*/ if (DeltaTime > PIOS_PPM_IN_MIN_CHANNEL_PULSE_US && DeltaTime < PIOS_PPM_IN_MAX_CHANNEL_PULSE_US - && PulseIndex < PIOS_PPM_NUM_INPUTS) { + && PulseIndex < PIOS_PPM_IN_MAX_NUM_INPUTS) { - CaptureValue[PulseIndex] = DeltaTime; + CaptureValueNewFrame[PulseIndex] = DeltaTime; PulseIndex++; - if (PulseIndex == PIOS_PPM_NUM_INPUTS) { - PulseIndex = 0; - } } else { /* Not a valid pulse duration */ Tracking = FALSE; - for (uint32_t i = 0; i < PIOS_PPM_NUM_INPUTS ; i++) { - CaptureValue[PulseIndex] = PIOS_PPM_INPUT_INVALID; + for (uint32_t i = 0; i < PIOS_PPM_IN_MAX_NUM_CHANNELS ; i++) { + CaptureValueNewFrame[i] = PIOS_PPM_INPUT_INVALID; } } } @@ -259,8 +298,9 @@ static void PIOS_PPM_Supervisor(uint32_t ppm_id) { if (!Fresh) { Tracking = FALSE; - for (int32_t i = 0; i < PIOS_PPM_NUM_INPUTS ; i++) { - CaptureValue[PulseIndex] = PIOS_PPM_INPUT_INVALID; + for (int32_t i = 0; i < PIOS_PPM_IN_MAX_NUM_CHANNELS ; i++) { + CaptureValue[i] = PIOS_PPM_INPUT_INVALID; + CaptureValueNewFrame[i] = PIOS_PPM_INPUT_INVALID; } } From 6a6ec418092f761464a74a94207d4b381bef8400 Mon Sep 17 00:00:00 2001 From: James Whitlock Date: Sat, 23 Jul 2011 22:10:17 +0100 Subject: [PATCH 4/9] Build fixes --- flight/PiOS/Boards/STM32103CB_CC_Rev1.h | 5 +++++ flight/PiOS/Boards/STM3210E_OP.h | 5 +++++ flight/PiOS/STM32F10x/pios_ppm.c | 10 +++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/flight/PiOS/Boards/STM32103CB_CC_Rev1.h b/flight/PiOS/Boards/STM32103CB_CC_Rev1.h index fbfe090be..9b65ffd5a 100644 --- a/flight/PiOS/Boards/STM32103CB_CC_Rev1.h +++ b/flight/PiOS/Boards/STM32103CB_CC_Rev1.h @@ -228,6 +228,11 @@ extern uint32_t pios_com_sbus_id; #define PIOS_RCVR_MAX_DEVS 1 #define PIOS_RCVR_MAX_CHANNELS 12 +//------------------------- +// Receiver PPM input +//------------------------- +#define PIOS_PPM_NUM_INPUTS 8 + //------------------------- // Receiver PWM input //------------------------- diff --git a/flight/PiOS/Boards/STM3210E_OP.h b/flight/PiOS/Boards/STM3210E_OP.h index 9a0eb95db..441d689a7 100644 --- a/flight/PiOS/Boards/STM3210E_OP.h +++ b/flight/PiOS/Boards/STM3210E_OP.h @@ -201,6 +201,11 @@ extern uint32_t pios_com_sbus_id; #define PIOS_RCVR_MAX_DEVS 1 #define PIOS_RCVR_MAX_CHANNELS 12 +//------------------------- +// Receiver PPM input +//------------------------- +#define PIOS_PPM_NUM_INPUTS 8 + //------------------------- // Receiver PWM input //------------------------- diff --git a/flight/PiOS/STM32F10x/pios_ppm.c b/flight/PiOS/STM32F10x/pios_ppm.c index 4b60f390e..7e91766d4 100644 --- a/flight/PiOS/STM32F10x/pios_ppm.c +++ b/flight/PiOS/STM32F10x/pios_ppm.c @@ -42,7 +42,7 @@ const struct pios_rcvr_driver pios_ppm_rcvr_driver = { }; #define PIOS_PPM_IN_MIN_NUM_CHANNELS 4 -#define PIOS_PPM_IN_MAX_NUM_CHANNELS 8 +#define PIOS_PPM_IN_MAX_NUM_CHANNELS PIOS_PPM_NUM_INPUTS #define PIOS_PPM_STABLE_CHANNEL_COUNT 25 // frames #define PIOS_PPM_IN_MIN_SYNC_PULSE_US 7000 // microseconds #define PIOS_PPM_IN_MIN_CHANNEL_PULSE_US 750 // microseconds @@ -59,7 +59,7 @@ static uint32_t CaptureValue[PIOS_PPM_IN_MAX_NUM_CHANNELS]; static uint32_t CaptureValueNewFrame[PIOS_PPM_IN_MAX_NUM_CHANNELS]; static uint32_t LargeCounter; static int8_t NumChannels; -static int8_t NumChannelsPrev; +static int8_t NumChannelsPrevFrame; static uint8_t NumChannelCounter; static uint8_t supv_timer = 0; @@ -79,7 +79,7 @@ void PIOS_PPM_Init(void) DeltaTime = 0; LargeCounter = 0; NumChannels = -1; - NumChannelsPrev = -1; + NumChannelsPrevFrame = -1; NumChannelCounter = 0; Tracking = FALSE; Fresh = FALSE; @@ -254,7 +254,7 @@ void PIOS_PPM_irq_handler(void) } for (uint32_t i = NumChannels; i < PIOS_PPM_IN_MAX_NUM_CHANNELS; i++) { - CaptureValue[i] = 0; + CaptureValue[i] = PIOS_PPM_INPUT_INVALID; } } @@ -270,7 +270,7 @@ void PIOS_PPM_irq_handler(void) /* Valid pulse duration 0.75 to 2.5 ms*/ if (DeltaTime > PIOS_PPM_IN_MIN_CHANNEL_PULSE_US && DeltaTime < PIOS_PPM_IN_MAX_CHANNEL_PULSE_US - && PulseIndex < PIOS_PPM_IN_MAX_NUM_INPUTS) { + && PulseIndex < PIOS_PPM_IN_MAX_NUM_CHANNELS) { CaptureValueNewFrame[PulseIndex] = DeltaTime; PulseIndex++; From 60136f04649def344abc13e87123151bb5846584 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 27 Jul 2011 00:33:32 +0100 Subject: [PATCH 5/9] Add support for PPM transmitters up to 12 channels. Small array indexing issue in PIOS_PPM_Get. --- flight/PiOS/Boards/STM32103CB_CC_Rev1.h | 2 +- flight/PiOS/Boards/STM3210E_OP.h | 2 +- flight/PiOS/STM32F10x/pios_ppm.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flight/PiOS/Boards/STM32103CB_CC_Rev1.h b/flight/PiOS/Boards/STM32103CB_CC_Rev1.h index 9b65ffd5a..018d05be2 100644 --- a/flight/PiOS/Boards/STM32103CB_CC_Rev1.h +++ b/flight/PiOS/Boards/STM32103CB_CC_Rev1.h @@ -231,7 +231,7 @@ extern uint32_t pios_com_sbus_id; //------------------------- // Receiver PPM input //------------------------- -#define PIOS_PPM_NUM_INPUTS 8 +#define PIOS_PPM_NUM_INPUTS 12 //------------------------- // Receiver PWM input diff --git a/flight/PiOS/Boards/STM3210E_OP.h b/flight/PiOS/Boards/STM3210E_OP.h index 441d689a7..16a2e76ef 100644 --- a/flight/PiOS/Boards/STM3210E_OP.h +++ b/flight/PiOS/Boards/STM3210E_OP.h @@ -204,7 +204,7 @@ extern uint32_t pios_com_sbus_id; //------------------------- // Receiver PPM input //------------------------- -#define PIOS_PPM_NUM_INPUTS 8 +#define PIOS_PPM_NUM_INPUTS 12 //------------------------- // Receiver PWM input diff --git a/flight/PiOS/STM32F10x/pios_ppm.c b/flight/PiOS/STM32F10x/pios_ppm.c index 7e91766d4..fe7421a17 100644 --- a/flight/PiOS/STM32F10x/pios_ppm.c +++ b/flight/PiOS/STM32F10x/pios_ppm.c @@ -44,9 +44,9 @@ const struct pios_rcvr_driver pios_ppm_rcvr_driver = { #define PIOS_PPM_IN_MIN_NUM_CHANNELS 4 #define PIOS_PPM_IN_MAX_NUM_CHANNELS PIOS_PPM_NUM_INPUTS #define PIOS_PPM_STABLE_CHANNEL_COUNT 25 // frames -#define PIOS_PPM_IN_MIN_SYNC_PULSE_US 7000 // microseconds +#define PIOS_PPM_IN_MIN_SYNC_PULSE_US 3800 // microseconds #define PIOS_PPM_IN_MIN_CHANNEL_PULSE_US 750 // microseconds -#define PIOS_PPM_IN_MAX_CHANNEL_PULSE_US 2400 // microseconds +#define PIOS_PPM_IN_MAX_CHANNEL_PULSE_US 2250 // microseconds #define PIOS_PPM_INPUT_INVALID 0 /* Local Variables */ @@ -170,7 +170,7 @@ void PIOS_PPM_Init(void) static int32_t PIOS_PPM_Get(uint32_t rcvr_id, uint8_t channel) { /* Return error if channel not available */ - if (channel > PIOS_PPM_IN_MAX_NUM_CHANNELS) { + if (channel >= PIOS_PPM_IN_MAX_NUM_CHANNELS) { return -1; } return CaptureValue[channel]; From ad339d32a6ae6f06fbe3764e19038c41a56b4a8f Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Thu, 28 Jul 2011 23:26:07 +0300 Subject: [PATCH 6/9] gcs: some cosmetic ui text changes --- ground/openpilotgcs/src/plugins/config/cc_hw_settings.ui | 2 +- .../src/plugins/config/config_cc_hw_widget.cpp | 8 ++++---- .../openpilotgcs/src/plugins/config/configinputwidget.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/cc_hw_settings.ui b/ground/openpilotgcs/src/plugins/config/cc_hw_settings.ui index 03d49c965..29052623c 100644 --- a/ground/openpilotgcs/src/plugins/config/cc_hw_settings.ui +++ b/ground/openpilotgcs/src/plugins/config/cc_hw_settings.ui @@ -167,7 +167,7 @@ - Changes on this page require an Hw reboot to be applied + Changes on this page only take effect after board reset or power cycle true diff --git a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp index 03296210b..62e2d59e2 100644 --- a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp +++ b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp @@ -67,19 +67,19 @@ void ConfigCCHWWidget::widgetsContentsChanged() } else if((m_telemetry->cbTele->currentText()=="Spektrum" ||m_telemetry->cbFlexi->currentText()=="Spektrum") && m_telemetry->receiverType->currentText()!="Spektrum") { - m_telemetry->problems->setText("Warning: you have at least one port configured as 'Spektrum' however that is not your selected input type"); + m_telemetry->problems->setText("Warning: you have a port configured as 'Spektrum' however that is not your selected receiver type"); } else if(m_telemetry->cbTele->currentText()=="S.Bus" && m_telemetry->receiverType->currentText()!="S.Bus") { - m_telemetry->problems->setText("Warning: you have at least one port configured as 'S.Bus' however that is not your selected input type"); + m_telemetry->problems->setText("Warning: you have a port configured as 'S.Bus' however that is not your selected receiver type"); } else if(m_telemetry->cbTele->currentText()!="S.Bus" && m_telemetry->receiverType->currentText()=="S.Bus") { - m_telemetry->problems->setText("Warning: you have selected 'S.Bus' as your input type however you have no port configured for that protocol"); + m_telemetry->problems->setText("Warning: you have selected 'S.Bus' as your receiver type however you have no port configured for that protocol"); } else if((m_telemetry->cbTele->currentText()!="Spektrum" && m_telemetry->cbFlexi->currentText()!="Spektrum") && m_telemetry->receiverType->currentText()=="Spektrum") { - m_telemetry->problems->setText("Warning: you have at selected 'Spektrum' as your input type however you have no port configured for that protocol"); + m_telemetry->problems->setText("Warning: you have selected 'Spektrum' as your receiver type however you have no port configured for that protocol"); } else { diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp index 2ca678eae..83e1a02ac 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp @@ -698,7 +698,7 @@ void ConfigInputWidget::receiverHelp() unassigned.append("FlightMode"); } if(unassigned.length()>0) - m_config->lblMissingInputs->setText(QString("Channels left to assign:")+unassigned); + m_config->lblMissingInputs->setText(QString("Channels left to assign: ")+unassigned); else m_config->lblMissingInputs->setText(""); } From 921905bd8ca9e8ed95aea9dc8d03065915159fde Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Thu, 28 Jul 2011 23:28:59 +0300 Subject: [PATCH 7/9] gcs: some cosmetic ui form changes Receiver message font made the same as for other info messages. Changed few label alignments. --- .../openpilotgcs/src/plugins/config/input.ui | 516 +++++++++--------- 1 file changed, 259 insertions(+), 257 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/input.ui b/ground/openpilotgcs/src/plugins/config/input.ui index 8d22b281b..e1eb0b435 100644 --- a/ground/openpilotgcs/src/plugins/config/input.ui +++ b/ground/openpilotgcs/src/plugins/config/input.ui @@ -52,7 +52,6 @@ - 11 75 true @@ -75,6 +74,9 @@ Rev. + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + @@ -90,38 +92,6 @@ - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - - - 1500 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> - - - 1000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -171,38 +141,6 @@ reversal capabilities). - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - - - 1500 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> - - - 1000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -252,38 +190,6 @@ reversal capabilities). - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - - - 1500 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> - - - 1000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -333,38 +239,6 @@ reversal capabilities). - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - - - 1500 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> - - - 1000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -414,38 +288,6 @@ reversal capabilities). - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - - - 1500 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> - - - 1000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -495,38 +337,6 @@ reversal capabilities). - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - - - 1500 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> - - - 1000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -576,38 +386,6 @@ reversal capabilities). - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - - - 1500 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> - - - 1000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -657,38 +435,6 @@ reversal capabilities). - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - - - 1500 - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> - - - 1000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -789,6 +535,262 @@ Neutral should be put at the bottom of the slider for the throttle. + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> + + + 1000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> + + + 1000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> + + + 1000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> + + + 1000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> + + + 1000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> + + + 1000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> + + + 1000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Minimum channel pulse width</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(microseconds)</p></body></html> + + + 1000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> + + + 1500 + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> + + + 1500 + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> + + + 1500 + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> + + + 1500 + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> + + + 1500 + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> + + + 1500 + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> + + + 1500 + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> + + + 1500 + + + From 76b4407d04e1617639baa4352f9ce1b67d2cb349 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Sat, 30 Jul 2011 15:39:39 +0300 Subject: [PATCH 8/9] Update history.txt file (PPM receiver support) --- HISTORY.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/HISTORY.txt b/HISTORY.txt index 45c119602..9eb8aee0f 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -1,5 +1,10 @@ Short summary of changes. For a complete list see the git log. +2011-07-29 +Added support for PPM receivers from James W. Now all 4 interfaces (R/C +standard PWM, combined PPM (MK), Spektrum satellite, Futaba S.Bus) are +supported and configurable through the GCS hardware configuration tab. + 2011-07-17 Updated module initialization from Mathieu which separates the initialization from the task startup. Also implements a method to reclaim unused ram from From 6b1ec9a54e9428a5c2db26e628a8aed7c93e7c3b Mon Sep 17 00:00:00 2001 From: Stacey Sheldon Date: Sat, 30 Jul 2011 16:59:57 -0400 Subject: [PATCH 9/9] bl: fix LED pwm computation with new stopwatch --- flight/Bootloaders/CopterControl/main.c | 12 +++++++----- flight/Bootloaders/PipXtreme/main.c | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/flight/Bootloaders/CopterControl/main.c b/flight/Bootloaders/CopterControl/main.c index d8d06424e..aa375a49c 100644 --- a/flight/Bootloaders/CopterControl/main.c +++ b/flight/Bootloaders/CopterControl/main.c @@ -187,11 +187,13 @@ void jump_to_app() { } } uint32_t LedPWM(uint32_t pwm_period, uint32_t pwm_sweep_steps, uint32_t count) { - uint32_t pwm_duty = ((count / pwm_period) % pwm_sweep_steps) - / (pwm_sweep_steps / pwm_period); - if ((count % (2 * pwm_period * pwm_sweep_steps)) > pwm_period - * pwm_sweep_steps) - pwm_duty = pwm_period - pwm_duty; // negative direction each 50*100 ticks + uint32_t curr_step = (count / pwm_period) % pwm_sweep_steps; /* 0 - pwm_sweep_steps */ + uint32_t pwm_duty = pwm_period * curr_step / pwm_sweep_steps; /* fraction of pwm_period */ + + uint32_t curr_sweep = (count / (pwm_period * pwm_sweep_steps)); /* ticks once per full sweep */ + if (curr_sweep & 1) { + pwm_duty = pwm_period - pwm_duty; /* reverse direction in odd sweeps */ + } return ((count % pwm_period) > pwm_duty) ? 1 : 0; } diff --git a/flight/Bootloaders/PipXtreme/main.c b/flight/Bootloaders/PipXtreme/main.c index 0337c51a5..3f1c4bd54 100644 --- a/flight/Bootloaders/PipXtreme/main.c +++ b/flight/Bootloaders/PipXtreme/main.c @@ -193,11 +193,13 @@ void jump_to_app() { } } uint32_t LedPWM(uint32_t pwm_period, uint32_t pwm_sweep_steps, uint32_t count) { - uint32_t pwm_duty = ((count / pwm_period) % pwm_sweep_steps) - / (pwm_sweep_steps / pwm_period); - if ((count % (2 * pwm_period * pwm_sweep_steps)) > pwm_period - * pwm_sweep_steps) - pwm_duty = pwm_period - pwm_duty; // negative direction each 50*100 ticks + uint32_t curr_step = (count / pwm_period) % pwm_sweep_steps; /* 0 - pwm_sweep_steps */ + uint32_t pwm_duty = pwm_period * curr_step / pwm_sweep_steps; /* fraction of pwm_period */ + + uint32_t curr_sweep = (count / (pwm_period * pwm_sweep_steps)); /* ticks once per full sweep */ + if (curr_sweep & 1) { + pwm_duty = pwm_period - pwm_duty; /* reverse direction in odd sweeps */ + } return ((count % pwm_period) > pwm_duty) ? 1 : 0; }