Skip to content

Commit bb21868

Browse files
authored
Merge pull request adafruit#291 from dastels/master
Switch log control to a global constant
2 parents 1affd55 + 65d4058 commit bb21868

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

IrRobotControl/glove.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import adafruit_irremote
66
import adafruit_lis3dh
77

8+
# Control debug output: it takes time so don't unless you're debugging
9+
DEBUG_LOG = False
10+
811
# Control codes
912
STOP = 0x01
1013
ROTATE_LEFT = 0x02
@@ -32,17 +35,12 @@
3235
zero=[550, 1700],
3336
trail=0)
3437

35-
# pylint: disable=unused-argument
36-
# pylint: disable=pointless-statement
3738
def log(s):
3839
"""Optionally output some text.
3940
:param string s: test to output
4041
"""
41-
# swap the comments on the next two lines to enable/disable logging output
42-
pass
43-
# print(s)
44-
# pylint: enable=pointless-statement
45-
# pylint: enable=unused-argument
42+
if DEBUG_LOG:
43+
print(s)
4644

4745

4846
while True:

IrRobotControl/robot.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import adafruit_irremote
44
from adafruit_crickit import crickit
55

6+
# Control debug output: it takes time so don't unless you're debugging
7+
DEBUG_LOG = False
8+
69
# Control codes
710
STOP = 0x01
811
ROTATE_LEFT = 0x02
@@ -18,17 +21,12 @@
1821
right_wheel = crickit.dc_motor_2
1922

2023

21-
# pylint: disable=unused-argument
22-
# pylint: disable=pointless-statement
2324
def log(s):
2425
"""Optionally output some text.
2526
:param string s: test to output
2627
"""
27-
# swap the comments on the next two lines to enable/disable logging output
28-
pass
29-
# print(s)
30-
# pylint: enable=pointless-statement
31-
# pylint: enable=unused-argument
28+
if DEBUG_LOG:
29+
print(s)
3230

3331

3432
# These allow easy correction for motor speed variation.

0 commit comments

Comments
 (0)