Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fadecandy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scanlime
Fadecandy
Commits
af04415d
Commit
af04415d
authored
7 years ago
by
Micah Elizabeth Scott
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #81 from heysl/master
Python: opc.py - added set_interpolation
parents
14da630a
a336e0bc
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
examples/python/opc.py
+32
-0
32 additions, 0 deletions
examples/python/opc.py
with
32 additions
and
0 deletions
examples/python/opc.py
+
32
−
0
View file @
af04415d
...
...
@@ -178,4 +178,36 @@ class Client(object):
return
True
def
set_interpolation
(
self
,
enabled
=
True
):
"""
Enables or disables frame interpolation on runtime.
Return True on success.
"""
self
.
_debug
(
'
set_interpolation: connecting
'
)
is_connected
=
self
.
_ensure_connected
()
if
not
is_connected
:
self
.
_debug
(
'
set_interpolation: not connected. ignoring reconfiguration.
'
)
return
False
#build firmaware configuration message as documented on
#https://github.com/scanlime/fadecandy/blob/master/doc/fc_protocol_opc.md#set-firmware-configuration
if
enabled
:
config_bit
=
0
else
:
config_bit
=
2
message
=
struct
.
pack
(
'
BBBBBBBBB
'
,
0
,
255
,
0
,
5
,
0
,
1
,
0
,
2
,
config_bit
)
self
.
_debug
(
'
set_interpolation: sending firmware configuration
'
)
try
:
self
.
_socket
.
send
(
message
)
except
socket
.
error
:
self
.
_debug
(
'
set_interpolation: connection lost. could not send firmware configuration.
'
)
self
.
_socket
=
None
return
False
if
not
self
.
_long_connection
:
self
.
_debug
(
'
set_interpolation: disconnecting
'
)
self
.
disconnect
()
return
True
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