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
f2ef8708
Commit
f2ef8708
authored
6 years ago
by
Daniel Agar
Browse files
Options
Downloads
Patches
Plain Diff
tfmini cleanup unnecessary Device CDev usage
parent
483bacad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/drivers/distance_sensor/tfmini/tfmini.cpp
+7
-13
7 additions, 13 deletions
src/drivers/distance_sensor/tfmini/tfmini.cpp
with
7 additions
and
13 deletions
src/drivers/distance_sensor/tfmini/tfmini.cpp
+
7
−
13
View file @
f2ef8708
...
...
@@ -85,7 +85,7 @@
# error This requires CONFIG_SCHED_WORKQUEUE.
#endif
class
TFMINI
:
public
dev
ice
::
CDev
class
TFMINI
:
public
c
dev
::
CDev
{
public:
TFMINI
(
const
char
*
port
,
uint8_t
rotation
=
distance_sensor_s
::
ROTATION_DOWNWARD_FACING
);
...
...
@@ -107,7 +107,7 @@ private:
float
_min_distance
;
float
_max_distance
;
int
_conversion_interval
;
work_s
_work
;
work_s
_work
{}
;
ringbuffer
::
RingBuffer
*
_reports
;
int
_measure_ticks
;
bool
_collect_phase
;
...
...
@@ -170,7 +170,7 @@ private:
extern
"C"
__EXPORT
int
tfmini_main
(
int
argc
,
char
*
argv
[]);
TFMINI
::
TFMINI
(
const
char
*
port
,
uint8_t
rotation
)
:
CDev
(
"tfmini"
,
RANGE_FINDER0_DEVICE_PATH
),
CDev
(
RANGE_FINDER0_DEVICE_PATH
),
_rotation
(
rotation
),
_min_distance
(
0.30
f
),
_max_distance
(
12.0
f
),
...
...
@@ -192,12 +192,6 @@ TFMINI::TFMINI(const char *port, uint8_t rotation) :
strncpy
(
_port
,
port
,
sizeof
(
_port
));
/* enforce null termination */
_port
[
sizeof
(
_port
)
-
1
]
=
'\0'
;
// disable debug() calls
_debug_enabled
=
false
;
// work_cancel in the dtor will explode if we don't do this...
memset
(
&
_work
,
0
,
sizeof
(
_work
));
}
TFMINI
::~
TFMINI
()
...
...
@@ -226,7 +220,7 @@ TFMINI::init()
switch
(
hw_model
)
{
case
0
:
DEVICE_LOG
(
"disabled."
);
PX4_WARN
(
"disabled."
);
return
0
;
case
1
:
/* TFMINI (12m, 100 Hz)*/
...
...
@@ -236,7 +230,7 @@ TFMINI::init()
break
;
default:
DEVICE_LOG
(
"invalid HW model %d."
,
hw_model
);
PX4_ERR
(
"invalid HW model %d."
,
hw_model
);
return
-
1
;
}
...
...
@@ -329,7 +323,7 @@ TFMINI::init()
&
_orb_class_instance
,
ORB_PRIO_HIGH
);
if
(
_distance_sensor_topic
==
nullptr
)
{
DEVICE_LOG
(
"failed to create distance_sensor object. Did you start uOrb?"
);
PX4_ERR
(
"failed to create distance_sensor object. Did you start uOrb?"
);
}
}
while
(
0
);
...
...
@@ -581,7 +575,7 @@ TFMINI::collect()
}
/* publish most recent valid measurement from buffer */
struct
distance_sensor_s
report
;
distance_sensor_s
report
{}
;
report
.
timestamp
=
hrt_absolute_time
();
report
.
type
=
distance_sensor_s
::
MAV_DISTANCE_SENSOR_LASER
;
...
...
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