Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
robotis_tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
humanoides
robotis_tools
Commits
8198a982
Commit
8198a982
authored
9 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Added the command to set the application mode before executing the go command.
parent
e1d736c6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/fw_downloader/fw_downloader.cpp
+21
-1
21 additions, 1 deletion
src/fw_downloader/fw_downloader.cpp
with
21 additions
and
1 deletion
src/fw_downloader/fw_downloader.cpp
+
21
−
1
View file @
8198a982
...
@@ -16,6 +16,7 @@ const unsigned char bootloader_load='l';
...
@@ -16,6 +16,7 @@ const unsigned char bootloader_load='l';
const
unsigned
char
bootloader_go
=
'g'
;
const
unsigned
char
bootloader_go
=
'g'
;
const
unsigned
char
bootloader_dump
=
'd'
;
const
unsigned
char
bootloader_dump
=
'd'
;
const
unsigned
char
bootloader_clear
=
'c'
;
const
unsigned
char
bootloader_clear
=
'c'
;
const
unsigned
char
bootloader_app
=
'a'
;
typedef
enum
{
original_protocol
=
0
,
new_protocol
=
1
}
protocol_t
;
typedef
enum
{
original_protocol
=
0
,
new_protocol
=
1
}
protocol_t
;
...
@@ -133,7 +134,7 @@ int main(int argc,char *argv[])
...
@@ -133,7 +134,7 @@ int main(int argc,char *argv[])
{
{
try
{
try
{
if
((
num_data
=
serial_port
.
get_num_data
()
==
0
))
if
((
num_data
=
serial_port
.
get_num_data
()
==
0
))
event_server
->
wait_all
(
events
,
10
0
);
event_server
->
wait_all
(
events
,
2
0
);
num_data
=
serial_port
.
get_num_data
();
num_data
=
serial_port
.
get_num_data
();
serial_port
.
read
((
unsigned
char
*
)
bootloader_data
,
num_data
);
serial_port
.
read
((
unsigned
char
*
)
bootloader_data
,
num_data
);
bootloader_data
[
num_data
]
=
'\0'
;
bootloader_data
[
num_data
]
=
'\0'
;
...
@@ -357,6 +358,25 @@ int main(int argc,char *argv[])
...
@@ -357,6 +358,25 @@ int main(int argc,char *argv[])
}
}
}
}
}
}
// go to application mode
serial_port
.
write
((
unsigned
char
*
)
&
bootloader_app
,
1
);
if
(
protocol
==
new_protocol
)
serial_port
.
write
((
unsigned
char
*
)
&
bootloader_ack
,
1
);
end
=
false
;
while
(
!
end
)
{
try
{
event_server
->
wait_all
(
events
,
300
);
// there has been an error
num_data
=
serial_port
.
get_num_data
();
serial_port
.
read
(
bootloader_data
,
num_data
);
bootloader_data
[
num_data
]
=
'\0'
;
printf
(
"%s"
,
bootloader_data
);
}
catch
(
CEventTimeoutException
&
e
){
// no error to report
end
=
true
;
}
}
// start the loaded program
// start the loaded program
serial_port
.
write
((
unsigned
char
*
)
&
bootloader_go
,
1
);
serial_port
.
write
((
unsigned
char
*
)
&
bootloader_go
,
1
);
if
(
protocol
==
new_protocol
)
if
(
protocol
==
new_protocol
)
...
...
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