Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fleur
firmware
Commits
1f488472
Commit
1f488472
authored
5 years ago
by
rahix
Browse files
Options
Downloads
Plain Diff
Merge 'Add flag to pycard10 to set time'
See merge request
card10/firmware!342
parents
c3c5a5f8
110b71c5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/pycard10.py
+16
-1
16 additions, 1 deletion
tools/pycard10.py
with
16 additions
and
1 deletion
tools/pycard10.py
+
16
−
1
View file @
1f488472
...
...
@@ -213,6 +213,11 @@ def main():
"
--device
"
,
default
=
"
/dev/ttyACM0
"
,
help
=
"
the serial device of the card10
"
)
cmd_parser
.
add_argument
(
"
-c
"
,
"
--command
"
,
help
=
"
program passed in as string
"
)
cmd_parser
.
add_argument
(
"
--set-time
"
,
action
=
"
store_true
"
,
help
=
"
Set card10 system time to this host
'
s time
"
,
)
cmd_parser
.
add_argument
(
"
-w
"
,
"
--wait
"
,
...
...
@@ -241,7 +246,7 @@ def main():
if
args
.
reset
:
card10
.
soft_reset
()
elif
args
.
command
is
not
None
or
len
(
args
.
files
):
elif
args
.
set_time
or
args
.
command
is
not
None
or
len
(
args
.
files
):
# we must enter raw-REPL mode to execute commands
# this will do a soft-reset of the board
try
:
...
...
@@ -268,6 +273,16 @@ def main():
stdout_write_bytes
(
ret_err
)
sys
.
exit
(
1
)
# Set card10 system time
if
args
.
set_time
:
now
=
round
(
time
.
time
())
code
=
"""
\
import utime
utime.set_unix_time({time})
print(
"
Time was set to {time}!
"
)
"""
execbuffer
(
code
.
format
(
time
=
now
))
# run the command, if given
if
args
.
command
is
not
None
:
execbuffer
(
args
.
command
.
encode
(
"
utf-8
"
))
...
...
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