Skip to content

Commit ca42b38

Browse files
authored
Merge pull request #3 from P33ry/master
Fixed Issue with MCP3xxx Sensors
2 parents 549bb14 + b039e90 commit ca42b38

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

mudpi.py

100644100755
+9-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import time
66
import json
77
import sys
8+
import traceback
89
sys.path.append('..')
910
from action import Action
1011
from config_load import loadConfigJson
@@ -63,7 +64,7 @@
6364
print('_________________________________________________')
6465
print('')
6566
print('Eric Davisson @theDavisson')
66-
print('Version: ', CONFIGS.get('version', '0.8.6'))
67+
print('Version: ', CONFIGS.get('version', '0.8.7'))
6768
print('\033[0;0m')
6869

6970
if CONFIGS['debug'] is True:
@@ -135,6 +136,7 @@
135136
threads.append(pw)
136137
except KeyError:
137138
print('No Pi Workers Found to Load or Invalid Type')
139+
traceback.print_exc()
138140

139141

140142
# Worker for relays attached to pi
@@ -157,6 +159,7 @@
157159
threads.append(r)
158160
except KeyError:
159161
print('No Relays Found to Load')
162+
traceback.print_exc()
160163

161164
# Worker for nodes attached to pi via serial or wifi[esp8266]
162165
# Supported nodes: arduinos, esp8266, ADC-MCP3xxx, probably others
@@ -178,8 +181,9 @@
178181
t = t.run()
179182
if t is not None:
180183
threads.append(t)
181-
except KeyError:
184+
except KeyError as e:
182185
print('Invalid or no Nodes found to Load')
186+
traceback.print_exc()
183187

184188

185189
# Load in Actions
@@ -190,6 +194,7 @@
190194
actions[a.key] = a
191195
except KeyError:
192196
print('No Actions Found to Load')
197+
traceback.print_exc()
193198

194199
# Worker for Triggers
195200
try:
@@ -199,6 +204,7 @@
199204
threads.append(t)
200205
except KeyError:
201206
print('No Triggers Found to Load')
207+
traceback.print_exc()
202208

203209

204210
#Decided not to build server worker (this is replaced with nodejs, expressjs)
@@ -254,4 +260,4 @@ def server_worker():
254260

255261
print("MudPi Shutting Down...\t\t\t\033[1;32m Complete\033[0;0m")
256262
print("Mudpi is Now...\t\t\t\t\033[1;31m Offline\033[0;0m")
257-
263+

sensors/MCP3xxx/sensor.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
class Sensor:
66

77
PINS = {
8-
'0': MCP.P0,
9-
'1': MCP.P1,
10-
'2': MCP.P2,
11-
'3': MCP.P3,
12-
'4': MCP.P4,
13-
'5': MCP.P5,
14-
'6': MCP.P6,
15-
'7': MCP.P7,
8+
0: MCP.P0,
9+
1: MCP.P1,
10+
2: MCP.P2,
11+
3: MCP.P3,
12+
4: MCP.P4,
13+
5: MCP.P5,
14+
6: MCP.P6,
15+
7: MCP.P7,
1616
}
1717

1818
def __init__(self, pin: int, mcp, name='Sensor', key=None):

0 commit comments

Comments
 (0)