Use a global constant to control logging
This commit is contained in:
parent
cfa378d6a3
commit
4fdc087f10
2 changed files with 10 additions and 14 deletions
|
|
@ -5,6 +5,9 @@ import pulseio
|
||||||
import adafruit_irremote
|
import adafruit_irremote
|
||||||
import adafruit_lis3dh
|
import adafruit_lis3dh
|
||||||
|
|
||||||
|
# Control debug output: it takes time so don't unless you're debugging
|
||||||
|
DEBUG_LOG = False
|
||||||
|
|
||||||
# Control codes
|
# Control codes
|
||||||
STOP = 0x01
|
STOP = 0x01
|
||||||
ROTATE_LEFT = 0x02
|
ROTATE_LEFT = 0x02
|
||||||
|
|
@ -32,17 +35,12 @@ encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500],
|
||||||
zero=[550, 1700],
|
zero=[550, 1700],
|
||||||
trail=0)
|
trail=0)
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
|
||||||
# pylint: disable=pointless-statement
|
|
||||||
def log(s):
|
def log(s):
|
||||||
"""Optionally output some text.
|
"""Optionally output some text.
|
||||||
:param string s: test to output
|
:param string s: test to output
|
||||||
"""
|
"""
|
||||||
# swap the comments on the next two lines to enable/disable logging output
|
if DEBUG_LOG:
|
||||||
pass
|
print(s)
|
||||||
# print(s)
|
|
||||||
# pylint: enable=pointless-statement
|
|
||||||
# pylint: enable=unused-argument
|
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@ import pulseio
|
||||||
import adafruit_irremote
|
import adafruit_irremote
|
||||||
from adafruit_crickit import crickit
|
from adafruit_crickit import crickit
|
||||||
|
|
||||||
|
# Control debug output: it takes time so don't unless you're debugging
|
||||||
|
DEBUG_LOG = False
|
||||||
|
|
||||||
# Control codes
|
# Control codes
|
||||||
STOP = 0x01
|
STOP = 0x01
|
||||||
ROTATE_LEFT = 0x02
|
ROTATE_LEFT = 0x02
|
||||||
|
|
@ -18,17 +21,12 @@ left_wheel = crickit.dc_motor_1
|
||||||
right_wheel = crickit.dc_motor_2
|
right_wheel = crickit.dc_motor_2
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
|
||||||
# pylint: disable=pointless-statement
|
|
||||||
def log(s):
|
def log(s):
|
||||||
"""Optionally output some text.
|
"""Optionally output some text.
|
||||||
:param string s: test to output
|
:param string s: test to output
|
||||||
"""
|
"""
|
||||||
# swap the comments on the next two lines to enable/disable logging output
|
if DEBUG_LOG:
|
||||||
pass
|
print(s)
|
||||||
# print(s)
|
|
||||||
# pylint: enable=pointless-statement
|
|
||||||
# pylint: enable=unused-argument
|
|
||||||
|
|
||||||
|
|
||||||
# These allow easy correction for motor speed variation.
|
# These allow easy correction for motor speed variation.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue