Commit Graph
277 Commits
Author SHA1 Message Date
David Lechner f694de2277 pbyricks/resources: new Image and Font classes
This adds API and documentation for the pybricks.resources module
Image and Font classes.
2020-01-13 12:59:07 -06:00
Laurens Valk 5991fb544b config: fix contentui css
The contentui sets the page with to be infinite in order to add a second column.

We do not use this feature, so we set the width back to normal.  Also make sure our theme_overrides are last in conf.py to make sure they override the contentui css.
2020-01-13 14:44:11 +01:00
Laurens Valk 220ad471b8 api/ev3devices: remove duplicate AnalogSensor
This has previously been moved to the iodevices class
2020-01-13 13:30:08 +01:00
Laurens Valk e244f28ddb api/builtins: drop method string override
We had these because enums expanded to numeric values. Because we now have an alternate enum implementation, we don't need these strings anymore.
2020-01-13 12:19:59 +01:00
David Lechner 1b426b90f7 pybricks/parameters: introduce _PybricksEnum class
This adds a _PybricksEnum base class for all enums. In Pybricks
MicroPython, we don't have an Enum class, but rather just simple
lookup tables.

The __repr__() method prints the enum values like the Pybricks
MicroPython implementation and also causes sphinx doc to correctly
print the value when used as a default value for aguments.

The __dir__() method is overloaded for both the instance and the class
to match what is seen in Pybricks MicroPython. This should help hide
things from code Python completion that are not present in MicroPython.
2020-01-11 21:08:24 -06:00
David Lechner 31a639f55b doc/api/conf.py: enable nitpicky
This enables the sphinx doc nitpicky option to detect broken references.

Also fix all of the broken references.
2020-01-11 21:08:20 -06:00
David Lechner 29b012a7d7 vscode: add conf.py path for rst extension
This adds a setting for the VS Code lextudio.restructuredtext extension
that specifices where to find conf.py
2020-01-11 21:06:43 -06:00
David Lechner 6463adab3c CONTRIBUTING: git clone --recursive
we are using submodules, so we need to recursive clone the repo
2020-01-11 21:06:43 -06:00
Laurens Valk cb9393020d api/parameters: bring Port enum back
Move Port from hub classes back to common parameters module.

This would have had too much impact on existing users, so undo it.

Notes if we are ever bringing it back again:
- The idea behind this was to ultimately allow for unique ports in a multi-hub scenario:

ev3 = EV3Brick()
ev3.Port.A # This is port A on this particular instance

This may still be added while leaving the existing Port enum in place, which would then always be the ports of the hub on which the code runs.
2020-01-10 16:39:27 +01:00
Laurens Valk 1bafa67979 api/iodevices: add Ev3devSensor 2020-01-09 22:21:42 +01:00
Laurens Valk 5c2df91bc4 doc/iodevices: split ev3 and pup to subfiles
This allows us to easily exclude a platform if needed.
2020-01-09 22:02:33 +01:00
Laurens Valk 5a2d1f5406 api/iodevices: simplify LUMPDevice API
All these device can do is read or write values at a particular mode. There is also no need for separate mode setters.
2020-01-06 17:48:03 +01:00
Laurens Valk 09d453480b api/robotics: add DriveBase state getters 2020-01-02 16:51:50 +01:00
Laurens Valk 3d9a6f11cc api/robotics: add DriveBase draft
This is a concept for a DriveBase class for common robot tasks.
2020-01-02 16:36:37 +01:00
Laurens Valk af3954989a doc/iodevices: add note about EV3 compatibility.
Some iodevices are only available on EV3 (for now or forever).
2020-01-02 16:02:10 +01:00
Laurens Valk f73e7f08bc api/iodevices: add LUMPDevice
This can be used to interface with LPF2 and EV3 sensors that use the LEGO UART Messaging Protocol.
2020-01-02 15:53:44 +01:00
Laurens Valk 21a0b8766e api: rename customdevices to iodevices
These devices are not always custom. Rather, the classes in this module are very generic and apply to a wide range of input/output devices.
2020-01-01 16:41:29 +01:00
Laurens Valk e74003f5d8 doc/customdevices: add DCMotor 2020-01-01 16:31:19 +01:00
Laurens Valk 46dba95342 api/builtins: add DCMotor
This is a strict subset of Motor, covering functionality of DC motors only. This is useful for motors without encoders, such as train motors.

It is inherited by Motor, which adds functionality that requires encoders.
2020-01-01 13:18:41 +01:00
Laurens Valk 990527c12a api/builtins/Motor: update reset_angle text
Control+ motors have absolute encoders, but no marker on the shaft. This revises the text accordingly.
2019-12-28 14:07:39 +01:00
Laurens Valk e183f73d4e doc/customdevices: replace example by include
This makes examples more maintainable.
2019-12-10 15:34:41 +01:00
Laurens Valk d975974d07 snippets: add uart example 2019-12-10 13:29:41 +01:00
Laurens Valk d78db6aefb doc/customdevices: use correct default argument
Make it match the implementation.
2019-12-10 13:25:06 +01:00
Laurens Valk 2e530a4b30 doc/hubs: toggle example snippet
This shows how to add and include an example project as a snippet.
2019-12-10 09:28:08 +01:00
Laurens Valk 613998661e config: fix contentui css
The extension CSS does not get included correctly. Fix html context so we don't have to copy the css.
2019-12-09 17:08:12 +01:00
Laurens Valk 61bfd359f1 doc: remove example projects
Full project examples are not included in the API.
2019-12-09 16:53:12 +01:00
Laurens Valk 7ca33d8b97 projects: add submodule
This will contain the code snippets included by the docs.
2019-12-09 16:47:40 +01:00
Laurens Valk 8acab1898a doc: delete existing inline examples
Those should be included as working and tested Python files instead. They should be toggled on/off.
2019-12-09 14:31:53 +01:00
Laurens Valk 893b23ce90 api/builtins/Speaker: add speech 2019-12-09 14:15:43 +01:00
Laurens Valk be1522ad04 api/builtins: Update speaker API
- Volume is a setting.
- Remove beeps method. To do multiple beeps, users can make their own loop.
- Rename file to play.
2019-12-09 13:13:06 +01:00
Laurens Valk 3afaa83ba0 doc/hubs: add note to say screen not implemented
This will be unhidden/updated later.
2019-12-09 13:00:59 +01:00
Laurens Valk 2e78033720 doc/devices: simplify motor docs, reduce detail
Previously, we simplified the docs for initializing a motor. This commit also simplifies the docstrings for common motor methods, by leaving out details and optional arguments. Full details are still available on the dedicated motor page.
2019-12-09 11:09:11 +01:00
Laurens Valk 709659ffbf doc/hubs: remove builtins section
This will not be used in the next release.
2019-12-09 10:43:28 +01:00
Laurens Valk be667caa7b doc/signaltypes: move scalars and vectors
This makes it possible to exclude this information from releases that do not use it.
2019-12-09 10:31:22 +01:00
Laurens Valk e7c63533b0 doc/parameters: remove unused parameters
Ports are accessed through hub instance.

The Axis and Side parameters will not be implemented for the next release, so we remove them for now.
2019-12-09 10:21:36 +01:00
Laurens Valk 184763e81a Revert "add option to enable/disable encoders"
Encoderless motors are more an exception than the rule, so they will get a separate class.

This reverts commit 6f68c60d3b.
2019-12-06 15:19:18 +01:00
Laurens Valk 22bbca3e24 doc/customdevices: simplify I2C docs
remove smbus information, point to source code instead.
2019-12-06 15:16:06 +01:00
Laurens Valk 1187f059fa api/customdevices: add UARTDevice 2019-12-06 14:57:43 +01:00
Laurens Valk 3143b28be1 doc/customdevices: remove custom init string
We only need this if the string is different from the auto-generated default, such as when we want to prevent expansion of an enum to a number.
2019-12-06 14:35:16 +01:00
Laurens Valk 4086ee67ac api/customdevices: use bytes for I2C
This is a more natural data type than tuples or ints for this class.
2019-12-06 14:31:53 +01:00
Laurens Valk e6a1ae78ca doc+api/customdevices: add I2CDevice 2019-11-14 12:56:53 +01:00
Laurens Valk 653aa669b2 doc+api/customdevices: move AnalogSensor
Generic and custom devices like the AnalogSensor will live in a dedicated module.
2019-11-14 08:47:30 +01:00
Laurens Valk 6f68c60d3b api/builtins/Motor: add option to enable/disable encoders 2019-11-11 15:51:25 +01:00
Laurens Valk 63992c7ad0 doc/ev3devices/AnalogSensor: add passive/active methods 2019-11-11 15:29:39 +01:00
Laurens Valk 1be5beb54e doc/ev3devices/AnalogSensor: update type check
We no longer have to tell people to reboot the brick after changing the port mode. This is all done automatically now.
2019-11-11 15:22:41 +01:00
Laurens Valk f03970a77e doc/motors: rename direction to positive_direction
While being longer, this reflects more accurately what this setting does.
2019-11-11 15:19:25 +01:00
Laurens Valk 69216abc8a api/pupdevices: fix line break
This caused the init arguments to be displayed incorrectly.

Also, fix whitespaces and line ends.
2019-11-11 15:13:13 +01:00
Laurens Valk d172780508 doc/motors: add stalled section
By moving some of the technical details to dedicated sections of the docs, we can add more (or simplified, less technical) information without cluttering the API commands.
2019-11-11 15:08:08 +01:00
Laurens Valk d6f25acce8 doc/motors: add gears section
Explain the setting using an example.
2019-11-11 14:50:30 +01:00
Laurens Valk ada319f88d doc/pupdevices: drop gears example
This is reserved for the detailed Motor page.
2019-11-11 13:30:08 +01:00