Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bits_time_of_flight_controller
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
bits_libs
bits_time_of_flight_controller
Commits
018017f2
Commit
018017f2
authored
1 year ago
by
Orhan-Timo Altan
Browse files
Options
Downloads
Patches
Plain Diff
Kommentare ergänzt
parent
f10327e9
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bits_time_of_flight_controller.cpp
+7
-0
7 additions, 0 deletions
bits_time_of_flight_controller.cpp
bits_time_of_flight_controller.h
+6
-3
6 additions, 3 deletions
bits_time_of_flight_controller.h
with
13 additions
and
3 deletions
bits_time_of_flight_controller.cpp
+
7
−
0
View file @
018017f2
...
...
@@ -6,18 +6,23 @@ bits_TimeOfFlightController::bits_TimeOfFlightController(const uint16_t max_dist
void
bits_TimeOfFlightController
::
init
()
{
bool
found_any_sensors
=
false
;
// Deaktivieren aller Sensoren
for
(
int
i
=
0
;
i
<
SENSOR_COUNT
;
i
++
)
{
pinMode
(
sensors
[
i
].
shutdown_pin
,
OUTPUT
);
digitalWrite
(
sensors
[
i
].
shutdown_pin
,
LOW
);
}
delay
(
10
);
// Die Sensoren nach einander aktivieren und initalisieren
for
(
int
i
=
0
;
i
<
SENSOR_COUNT
;
i
++
)
{
digitalWrite
(
sensors
[
i
].
shutdown_pin
,
HIGH
);
delay
(
100
);
if
(
sensors
[
i
].
psensor
->
begin
(
sensors
[
i
].
id
,
false
,
sensors
[
i
].
pwire
,
sensors
[
i
].
sensor_config
))
{
found_any_sensors
=
true
;
...
...
@@ -31,6 +36,7 @@ void bits_TimeOfFlightController::init() {
if
(
!
found_any_sensors
)
{
_println_tof_
(
"No valid sensors found"
);
while
(
1
)
{
;
...
...
@@ -44,6 +50,7 @@ int bits_TimeOfFlightController::get_distance_mm(int index) {
sensors
[
index
].
psensor
->
rangingTest
(
&
measure
,
false
);
// 'true' um debug Informationen auszugeben
int
distance
;
if
((
measure
.
RangeStatus
!=
4
)
&&
(
measure
.
RangeMilliMeter
<
max_distance
))
{
distance
=
measure
.
RangeMilliMeter
;
...
...
This diff is collapsed.
Click to expand it.
bits_time_of_flight_controller.h
+
6
−
3
View file @
018017f2
/*
* Klasse:
BITs
TimeOfFlight
* Klasse:
bits_
TimeOfFlight
Controller
*
* Zur erzeugung eines Arrays gefüllt mit Objekten für die Ansteuerung von mehreren VL53L0X Time of Flight Sensoren
*
...
...
@@ -29,11 +29,12 @@ public:
int
get_distance_mm
(
int
index
);
private:
const
uint16_t
max_distance
=
4000
;
static
const
int
SENSOR_COUNT
=
5
;
const
uint16_t
max_distance
=
4000
;
// Maximal messbare Distanz
static
const
int
SENSOR_COUNT
=
5
;
// Sensoren Anzahl
int
TOF_XSHUTS
[
SENSOR_COUNT
]
=
{
0
,
8
,
9
,
23
,
29
};
// XShut Pins der einzelnen Time of Flight Sensoren
int
TOF_ADDRESSES
[
SENSOR_COUNT
]
=
{
0x30
,
0x31
,
0x32
,
0x33
,
0x34
};
// Adresse der einzelnen Time of Flight Sensoren
// Struktur der Sensor Liste
typedef
struct
{
Adafruit_VL53L0X
*
psensor
;
// Zeiger zum Objekt
...
...
@@ -46,12 +47,14 @@ const uint16_t max_distance = 4000;
uint8_t
sensor_status
;
}
sensorList_t
;
// Sensor Objekte basierend auf der Adafruit Bibliothek
Adafruit_VL53L0X
tof_sensor_1
;
Adafruit_VL53L0X
tof_sensor_2
;
Adafruit_VL53L0X
tof_sensor_3
;
Adafruit_VL53L0X
tof_sensor_4
;
Adafruit_VL53L0X
tof_sensor_5
;
// Liste von Sensor Objekten
sensorList_t
sensors
[
SENSOR_COUNT
]
=
{
{
&
tof_sensor_1
,
&
Wire
,
TOF_ADDRESSES
[
0
],
TOF_XSHUTS
[
0
],
Adafruit_VL53L0X
::
VL53L0X_SENSE_DEFAULT
,
0
,
0
},
...
...
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