Skip to content

Commit

Permalink
Shorten some lines to make PDF documentation look nice
Browse files Browse the repository at this point in the history
  • Loading branch information
tuomas2 committed Jul 14, 2015
1 parent f369095 commit eddd819
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
15 changes: 12 additions & 3 deletions docs/source/official_extensions/arduino_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ class MySystem(System):
d12 = ArduinoDigitalSensor(dev=0, pin=12)

d13 = ArduinoDigitalActuator(dev=0, pin=13) # LED on Arduino board
servo = ArduinoServoActuator(min_pulse=200, max_pulse=8000, dev=0, pin=3, default=50, slave=True)
servo = ArduinoServoActuator(min_pulse=200,
max_pulse=8000,
dev=0,
pin=3,
default=50,
slave=True)

interp = ConstantTimeActuator(change_time=2., change_frequency=20., slave_actuator=servo)
interp = ConstantTimeActuator(change_time=2.,
change_frequency=20.,
slave_actuator=servo)

prog = Program(
on_update=Run(Log("Value: %s", Value(a1)), SetStatus(d13, d12), SetStatus(interp, Value(180) * Value(a1)))
on_update=Run(Log("Value: %s", Value(a1)),
SetStatus(d13, d12),
SetStatus(interp, Value(180) * Value(a1)))
)

my_arduino = ArduinoService(
Expand Down
4 changes: 2 additions & 2 deletions docs/source/statusobjects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ As an example, we will define one of each:
.. code-block:: python
# imports from your own library that you are using to define your sensor & actuator
from mylibrary import (setup_data_changed_callback, fetch_data_from_my_datasource, initialize_my_actuator_device,
change_status_in_my_actuator_device)
from mylibrary import (setup_data_changed_callback, fetch_data_from_my_datasource,
initialize_my_actuator_device, change_status_in_my_actuator_device)
class MySensor(AbstractSensor):
"""
Expand Down
32 changes: 20 additions & 12 deletions src/automate/callables/builtin_callables.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ class Shell(AbstractAction):
Usage examples::
Shell('/bin/echo test', output=True) # returns 'test'
Shell('mplayer something.mp3', no_wait=True) # returns PID of mplayer process that keeps running
Shell('mplayer something.mp3', no_wait=True) # returns PID of mplayer
# process that keeps running
Shell('/bin/cat', input='test', output=True) # returns 'test'.
"""

Expand Down Expand Up @@ -318,7 +319,8 @@ class SetStatus(AbstractAction):
SetStatus(target, source)
# sets status of target to the status of source.
SetStatus([actuator1, actuator2], [sensor1, sensor2])
# sets status of actuator 1 to status of sensor1 and status of actuator2 to status of sensor2.
# sets status of actuator 1 to status of sensor1 and
# status of actuator2 to status of sensor2.
"""

def call(self, caller=None, trigger=None, **kwargs):
Expand Down Expand Up @@ -573,7 +575,8 @@ class IfElse(AbstractCallable):
Usage::
IfElse(x, y, z) # if x, then run y, else run z, where x, y, and z are Callables or StatusObjects
IfElse(x, y, z) # if x, then run y, else run z, where x, y,
# and z are Callables or StatusObjects
IfElse(x, y)
"""

Expand Down Expand Up @@ -605,8 +608,9 @@ class Switch(AbstractCallable):
Usage::
Switch(criterion, choice1, choice2...) # where criteria is integer-valued (Callable or StatusObject etc.)
# and choice1, 2... are Callables.
Switch(criterion, choice1, choice2...) # where criteria is integer-valued
# (Callable or StatusObject etc.)
# and choice1, 2... are Callables.
Switch(criterion, {'value1': callable1, 'value2': 'callable2'})
"""
Expand Down Expand Up @@ -655,7 +659,8 @@ class Min(AbstractMathematical):
Usage::
Min(x, y, z...)
# where x,y,z are anything that can be evaluated as number (Callables, Statusobjects etc).
# where x,y,z are anything that can be
# evaluated as number (Callables, Statusobjects etc).
"""

def call(self, caller=None, **kwargs):
Expand All @@ -672,7 +677,8 @@ class Max(AbstractMathematical):
Usage::
Max(x, y, z...)
# where x,y,z are anything that can be evaluated as number (Callables, Statusobjects etc).
# where x,y,z are anything that can be
# evaluated as number (Callables, Statusobjects etc).
"""

def call(self, caller=None, **kwargs):
Expand All @@ -689,7 +695,8 @@ class Sum(AbstractMathematical):
Usage::
Sum(x, y, z...)
# where x,y,z are anything that can be evaluated as number (Callables, Statusobjects etc).
# where x,y,z are anything that can be
# evaluated as number (Callables, Statusobjects etc).
"""

def call(self, caller=None, **kwargs):
Expand All @@ -706,7 +713,8 @@ class Product(AbstractMathematical):
Usage::
Product(x, y, z...)
# where x,y,z are anything that can be evaluated as number (Callables, Statusobjects etc).
# where x,y,z are anything that can be
# evaluated as number (Callables, Statusobjects etc).
"""

Expand Down Expand Up @@ -863,9 +871,9 @@ class Value(AbstractLogical):
Usage::
Value(x) # returns value of x. Used to convert StatusObject into Callable, for example,
# if StatusObject status needs to be used directly as a condition of
# Program condition attributes.
Value(x) # returns value of x. Used to convert StatusObject into Callable,
# for example, if StatusObject status needs to be used directly
# as a condition of Program condition attributes.
"""
_args = CList
Expand Down

0 comments on commit eddd819

Please sign in to comment.