Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Ardupilot
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
Ardupilot
Commits
4013cbeb
Commit
4013cbeb
authored
13 years ago
by
John Arne Birkeland
Browse files
Options
Downloads
Patches
Plain Diff
V2.2.67 - Implemented detection and failsafe (throttle = 900us) for missing throttle signal.
parent
080c5184
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tools/ArduPPM/Libraries/PPM_Encoder.h
+25
-8
25 additions, 8 deletions
Tools/ArduPPM/Libraries/PPM_Encoder.h
with
25 additions
and
8 deletions
Tools/ArduPPM/Libraries/PPM_Encoder.h
+
25
−
8
View file @
4013cbeb
// -------------------------------------------------------------
// PPM ENCODER V2.2.6
6
(
15-03
-2012)
// PPM ENCODER V2.2.6
7
(
03-06
-2012)
// -------------------------------------------------------------
// Improved servo to ppm for ArduPilot MEGA v1.x (ATmega328p),
// PhoneDrone and APM2 (ATmega32u2)
...
...
@@ -54,6 +54,9 @@
// - <RX>: <OFF> = no pwm input detected, <TOGGLE> = speed of toggle indicate how many channel are active, <ON> = input lost (failsafe)
// - <TX>: <OFF> = ppm output not started, <FAST TOGGLE> = normal PWM->PPM output or PPM passtrough failsafe, <SLOW TOGGLE> = PPM passtrough
// 03-06-2012
// V2.2.67 - Implemented detection and failsafe (throttle = 900us) for missing throttle signal.
// -------------------------------------------------------------
#ifndef _PPM_ENCODER_H_
...
...
@@ -438,7 +441,10 @@ ISR( SERVO_INT_VECTOR )
// Toggle LED delay
static
uint8_t
led_delay
=
0
;
#endif
// Missing throttle signal failsafe
static
uint8_t
throttle_timeout
=
0
;
// Servo input pin storage
static
uint8_t
servo_pins_old
=
0
;
...
...
@@ -547,7 +553,8 @@ CHECK_PINS_LOOP: // Input servo pin check loop
// Update ppm[..]
ppm
[
_ppm_channel
]
=
servo_width
;
//Reset throttle failsafe timeout
if
(
_ppm_channel
==
5
)
throttle_timeout
=
0
;
}
}
...
...
@@ -592,11 +599,6 @@ CHECK_PINS_DONE:
// Start PPM generator if not already running
if
(
ppm_generator_active
==
false
)
ppm_start
();
//Has servo input changed while processing pins, if so we need to re-check pins
if
(
servo_pins
!=
SERVO_INPUT
)
goto
CHECK_PINS_START
;
// Clear interrupt event from already processed pin changes
PCIFR
|=
(
1
<<
SERVO_INT_CLEAR_FLAG
);
#if defined (__AVR_ATmega16U2__) || defined (__AVR_ATmega32U2__)
// Toggle RX LED when finished receiving servo pulses
...
...
@@ -606,6 +608,21 @@ CHECK_PINS_DONE:
led_delay
=
0
;
}
#endif
// Throttle failsafe
if
(
throttle_timeout
++
>=
128
)
{
// Reset throttle timeout
throttle_timeout
=
0
;
// Set throttle failsafe value
ppm
[
5
]
=
PPM_THROTTLE_FAILSAFE
;
}
//Has servo input changed while processing pins, if so we need to re-check pins
if
(
servo_pins
!=
SERVO_INPUT
)
goto
CHECK_PINS_START
;
// Clear interrupt event from already processed pin changes
PCIFR
|=
(
1
<<
SERVO_INT_CLEAR_FLAG
);
}
// ------------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment