File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
# We have a sleep later on, so we need time
2
2
import time
3
+ # And an exit
4
+ import sys
3
5
4
6
# In addition to the classes inside here, you can use the picorpcserver
5
7
# import itself as a wrapper around the classes inside, the end goal
@@ -27,17 +29,18 @@ def rpc_ping(v):
27
29
# This function actually stops the netowrk loop, and shows one of the functions
28
30
# exposed by the back end.
29
31
def rpc_exit (v ):
32
+ del v
30
33
picorpcserver .stop_listening ()
31
34
return "Stopping"
32
35
33
36
# This makes sure that the value passed in is a list of numbers
34
37
# and adds them all up, otherwise returns 0
35
- def rpc_add (v ):
38
+ def rpc_add (v ):
36
39
if str (type (v )) != "<class 'list'>" :
37
- return 0
40
+ return 0
38
41
rv = 0
39
42
for val in v :
40
- rv += val
43
+ rv += val
41
44
return rv
42
45
43
46
# By setting verbose, you see most of the internals of the communication
@@ -49,7 +52,7 @@ def rpc_add(v):
49
52
# otherwise, it uses DHCP after authenticating with your network
50
53
if not picorpcserver .init (WIFI_SSID ,WIFI_PASSWD ):
51
54
print ("Network init failed!" )
52
- exit (1 )
55
+ sys . exit (1 )
53
56
54
57
# Bind a few of our functions, the format is "method",function
55
58
# there is no reason these cant be functions inside a package
You can’t perform that action at this time.
0 commit comments