Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Arpist
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
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Autonomous Rocket Pointer
Arpist
Commits
350e5200
Commit
350e5200
authored
1 year ago
by
Federico Lolli
Browse files
Options
Downloads
Patches
Plain Diff
Added sync mode
And made non-sync mode default (this should solve Win system issues with ACK receiving)
parent
b9da0b28
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
on-host/src/cli.rs
+5
-0
5 additions, 0 deletions
on-host/src/cli.rs
on-host/src/main.rs
+28
-20
28 additions, 20 deletions
on-host/src/main.rs
with
33 additions
and
20 deletions
on-host/src/cli.rs
+
5
−
0
View file @
350e5200
...
@@ -21,6 +21,11 @@ pub struct Cli {
...
@@ -21,6 +21,11 @@ pub struct Cli {
/// baud rate
/// baud rate
#[clap(short,
long,
default_value
=
"115200"
)]
#[clap(short,
long,
default_value
=
"115200"
)]
pub
baud_rate
:
u32
,
pub
baud_rate
:
u32
,
/// SYNC-MODE: for each packet sent wait for a signal from the device before
/// sending the next one
#[clap(short,
long)]
pub
sync
:
bool
,
}
}
pub
fn
get_styles
()
->
Styles
{
pub
fn
get_styles
()
->
Styles
{
...
...
This diff is collapsed.
Click to expand it.
on-host/src/main.rs
+
28
−
20
View file @
350e5200
...
@@ -81,9 +81,21 @@ fn main() {
...
@@ -81,9 +81,21 @@ fn main() {
packets
.total_packets
()
packets
.total_packets
()
);
);
// if sync mode is enabled then wait for ACK
if
args
.sync
{
wait_for_ack
(
&
mut
port
,
&
mut
buffer
);
}
}
info!
(
"sent {} packets"
,
packets
.sent_packets
());
print_stats
(
times
);
}
/// Wait for ACK signal from the device
fn
wait_for_ack
(
port
:
&
mut
Box
<
dyn
SerialPort
>
,
buffer
:
&
mut
[
u8
])
{
// wait ACK
// wait ACK
loop
{
loop
{
match
port
.read
(
&
mut
buffer
)
{
match
port
.read
(
buffer
)
{
Ok
(
t
)
=>
{
Ok
(
t
)
=>
{
// eprint!("{}", String::from_utf8_lossy(&buffer[..t]));
// eprint!("{}", String::from_utf8_lossy(&buffer[..t]));
// if didn't get the signal then print the buffer and exit with error
// if didn't get the signal then print the buffer and exit with error
...
@@ -104,10 +116,6 @@ fn main() {
...
@@ -104,10 +116,6 @@ fn main() {
// eprintln!();
// eprintln!();
}
}
info!
(
"sent {} packets"
,
packets
.sent_packets
());
print_stats
(
times
);
}
trait
MavLinkPort
{
trait
MavLinkPort
{
fn
write_packet
(
&
mut
self
,
packet
:
MavMessage
);
fn
write_packet
(
&
mut
self
,
packet
:
MavMessage
);
}
}
...
...
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