Skip to content

Commit 0e34b85

Browse files
Jotham-Bclaude
andcommitted
Merge PR LiamBindle#38 (lukedempsey/PyVESC): interface update, firmware flashing, params
Resolves the modify/delete conflicts by porting master's changes into the PR's flattened layout (pyvesc/VESC.py + pyvesc/messages/): - multi-CAN-ID heartbeat (PR LiamBindle#37): alive message list, start_heartbeat(can_id=) - **kwargs (can_id) passthrough on set_rpm/set_current/set_duty_cycle/set_servo - COMM_FORWARD_CAN = 34 (verified against current vedderb/bldc datatypes.h) - drop module-level alive_msg from setters Fixes on top of the PR: - restore the public API (pyvesc.encode/decode/messages/VESC) gutted by the emptied __init__.py files; simple.py and docs autoclass refs work again - decode(): skip unparseable garbage instead of TypeError/infinite loop; forward recv= to VESCMessage.unpack - move dummy test-message IDs to 0xE0+ so they don't collide with real registered commands; all 9 tests + params self-tests pass - setup.py: package list for the new layout, python_requires>=3.6 - update examples/docs for scalar'd SetDutyCycle (fraction) and 3-tuple decode - remove .DS_Store, ignore .venv Co-Authored-By: Claude Fable 5 <[email protected]>
2 parents d2f2076 + d3b9d43 commit 0e34b85

31 files changed

Lines changed: 2366 additions & 459 deletions

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ docs/build/
55
MANIFEST
66
dist/
77
pyvesc.egg-info/
8+
build/
9+
unit_test_report.xml
10+
.DS_Store
11+
.venv/

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python3
2+
# flake8: noqa
23
# -*- coding: utf-8 -*-
34
#
45
# PyVESC documentation build configuration file, created by

docs/source/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ PyVESC can be used to go from a message (VESCMessage) to a packet (bytes).
3636

3737
.. code-block:: python
3838
39-
# make a SetDutyCycle message
40-
my_msg = pyvesc.SetDutyCycle(1e5)
39+
# make a SetDutyCycle message (duty cycle is a fraction in [-1, 1])
40+
my_msg = pyvesc.SetDutyCycle(0.5)
4141
print(my_msg.duty_cycle) # prints value of my_msg.duty_cycle
4242
my_packet = pyvesc.encode(my_msg)
4343
# my_packet (type: bytes) can now be sent over your UART connection
@@ -48,7 +48,7 @@ being filled by your UART connection)
4848
.. code-block:: python
4949
5050
# buff is bytes filled from your UART connection
51-
my_msg, consumed = pyvesc.decode(buff)
51+
my_msg, consumed, _ = pyvesc.decode(buff)
5252
buff = buff[consumed:] # remove consumed bytes from the buffer
5353
if my_msg:
5454
print(my_msg.duty_cycle) # prints value of my_msg.duty_cycle

0 commit comments

Comments
 (0)