Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
20c7387c
Commit
20c7387c
authored
7 years ago
by
Beat Küng
Committed by
Roman Bapst
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
snapdragon_pwm_out: add MC_AIRMODE support
parent
2b6ca2cf
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
src/drivers/snapdragon_pwm_out/snapdragon_pwm_out.cpp
+41
-9
41 additions, 9 deletions
src/drivers/snapdragon_pwm_out/snapdragon_pwm_out.cpp
with
41 additions
and
9 deletions
src/drivers/snapdragon_pwm_out/snapdragon_pwm_out.cpp
+
41
−
9
View file @
20c7387c
...
...
@@ -44,6 +44,7 @@
#include
<uORB/topics/actuator_controls.h>
#include
<uORB/topics/actuator_outputs.h>
#include
<uORB/topics/actuator_armed.h>
#include
<uORB/topics/parameter_update.h>
#include
<drivers/drv_hrt.h>
#include
<drivers/drv_mixer.h>
...
...
@@ -117,23 +118,25 @@ MultirotorMixer *_mixer = nullptr;
* forward declaration
*/
void
usage
();
static
void
usage
();
void
start
();
static
void
start
();
void
stop
();
static
void
stop
();
int
pwm_initialize
(
const
char
*
device
);
static
int
pwm_initialize
(
const
char
*
device
);
void
pwm_deinitialize
();
static
void
pwm_deinitialize
();
void
send_outputs_pwm
(
const
uint16_t
*
pwm
);
static
void
send_outputs_pwm
(
const
uint16_t
*
pwm
);
void
task_main_trampoline
(
int
argc
,
char
*
argv
[]);
static
void
task_main_trampoline
(
int
argc
,
char
*
argv
[]);
void
subscribe
();
static
void
subscribe
();
void
task_main
(
int
argc
,
char
*
argv
[]);
static
void
task_main
(
int
argc
,
char
*
argv
[]);
static
void
update_params
(
bool
&
airmode
);
int
initialize_mixer
(
const
char
*
mixer_filename
);
...
...
@@ -157,6 +160,17 @@ int mixer_control_callback(uintptr_t handle,
return
0
;
}
void
update_params
(
bool
&
airmode
)
{
// multicopter air-mode
param_t
param_handle
=
param_find
(
"MC_AIRMODE"
);
if
(
param_handle
!=
PARAM_INVALID
)
{
int32_t
val
;
param_get
(
param_handle
,
&
val
);
airmode
=
val
>
0
;
}
}
int
initialize_mixer
(
const
char
*
mixer_filename
)
{
...
...
@@ -343,6 +357,10 @@ void task_main(int argc, char *argv[])
// subscribe and set up polling
subscribe
();
bool
airmode
=
false
;
update_params
(
airmode
);
int
params_sub
=
orb_subscribe
(
ORB_ID
(
parameter_update
));
// Start disarmed
_armed
.
armed
=
false
;
_armed
.
prearmed
=
false
;
...
...
@@ -355,6 +373,10 @@ void task_main(int argc, char *argv[])
// Main loop
while
(
!
_task_should_exit
)
{
if
(
_mixer
)
{
_mixer
->
set_airmode
(
airmode
);
}
/* wait up to 10ms for data */
int
pret
=
px4_poll
(
_poll_fds
,
_poll_fds_num
,
10
);
...
...
@@ -438,6 +460,15 @@ void task_main(int argc, char *argv[])
_outputs_pub
=
orb_advertise
(
ORB_ID
(
actuator_outputs
),
&
_outputs
);
}
/* check for parameter updates */
bool
param_updated
=
false
;
orb_check
(
params_sub
,
&
param_updated
);
if
(
param_updated
)
{
struct
parameter_update_s
update
;
orb_copy
(
ORB_ID
(
parameter_update
),
params_sub
,
&
update
);
update_params
(
airmode
);
}
}
pwm_deinitialize
();
...
...
@@ -449,6 +480,7 @@ void task_main(int argc, char *argv[])
}
orb_unsubscribe
(
_armed_sub
);
orb_unsubscribe
(
params_sub
);
_is_running
=
false
;
}
...
...
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