Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Hideaki Tai
/
omni_main
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
25a6b60b
authored
Apr 02, 2019
by
Hideaki Tai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add remote cmd to change xbee timeout (ms)
parent
c389ae74
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
include/global.h
+1
-1
include/main.h
+1
-1
lib/BorderXBeePacketizer/BorderXBeePacketizer.h
+26
-0
No files found.
include/global.h
View file @
25a6b60b
...
@@ -12,7 +12,7 @@ static constexpr uint32_t WHILL_SERIAL_BAUD = 38400;
...
@@ -12,7 +12,7 @@ static constexpr uint32_t WHILL_SERIAL_BAUD = 38400;
static
constexpr
uint32_t
XBEE_SERIAL_BAUD
=
38400
;
static
constexpr
uint32_t
XBEE_SERIAL_BAUD
=
38400
;
static
constexpr
uint16_t
WHILL_INFO_INTERVAL_MS
=
500
;
static
constexpr
uint16_t
WHILL_INFO_INTERVAL_MS
=
500
;
static
constexpr
double
XBEE_COMMAND_TIMEOUT_MS
=
10
00
.;
static
double
xbee_cmd_timeout_ms
=
3
00
.;
uint8_t
HARDWARE_ID
=
0xFF
;
uint8_t
HARDWARE_ID
=
0xFF
;
bool
b_need_xbee_init
=
false
;
bool
b_need_xbee_init
=
false
;
...
...
include/main.h
View file @
25a6b60b
...
@@ -265,7 +265,7 @@ void setVelocity()
...
@@ -265,7 +265,7 @@ void setVelocity()
fps
.
update
();
fps
.
update
();
if
(
stopwatch
.
isRunning
())
if
(
stopwatch
.
isRunning
())
{
{
if
(
stopwatch
.
ms
()
<
XBEE_COMMAND_TIMEOUT_MS
)
if
(
stopwatch
.
ms
()
<
xbee_cmd_timeout_ms
)
{
{
if
(
b_motor_active
)
if
(
b_motor_active
)
{
{
...
...
lib/BorderXBeePacketizer/BorderXBeePacketizer.h
View file @
25a6b60b
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
#include <queue>
#include <queue>
#include <array>
#include <array>
#include "../../include/global.h" // TODO: dirty
namespace
BorderXBeeProtocol
namespace
BorderXBeeProtocol
{
{
static
constexpr
uint8_t
BYTE_HEDADER
=
0xFF
;
static
constexpr
uint8_t
BYTE_HEDADER
=
0xFF
;
...
@@ -133,6 +135,30 @@ public:
...
@@ -133,6 +135,30 @@ public:
buffer
.
data
[
buffer
.
size
]
=
data
;
buffer
.
data
[
buffer
.
size
]
=
data
;
++
buffer
.
size
;
++
buffer
.
size
;
}
}
else
if
(
buffer
.
id
==
252
)
// change XBee timeout interval
{
if
(
data
==
BorderXBeeProtocol
::
BYTE_FOOTER
)
{
if
(
buffer
.
size
!=
2
)
{
Serial
.
print
(
"XBee Timeout Interval recv data size error!!!! size = "
);
Serial
.
println
(
buffer
.
size
);
++
error_count
;
}
else
{
uint16_t
ms
=
(
uint16_t
)(
buffer
.
data
[
1
]
<<
8
);
ms
|=
(
uint16_t
)(
buffer
.
data
[
0
]
<<
0
);
xbee_cmd_timeout_ms
=
(
double
)
ms
;
Serial
.
print
(
"xbee timeout is changed to "
);
Serial
.
println
(
xbee_cmd_timeout_ms
);
}
clearPacket
();
break
;
}
buffer
.
data
[
buffer
.
size
]
=
data
;
++
buffer
.
size
;
}
else
else
{
{
Serial
.
print
(
"undefined CMD error!!!! CMD ID = "
);
Serial
.
print
(
"undefined CMD error!!!! CMD ID = "
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment