Skip to content

Commit

Permalink
solved issue 20209090003 and 20200909005, refine the cake backend, de…
Browse files Browse the repository at this point in the history
…lete the unnecessary files in sh folder, solved issue 20200909003, 20200909004, 20200909005, 20200917001, 20200917002
  • Loading branch information
guesswho461 committed Sep 20, 2020
1 parent 9ca6470 commit f2ac18e
Show file tree
Hide file tree
Showing 22 changed files with 265 additions and 1,606 deletions.
15 changes: 15 additions & 0 deletions recipe/py/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
1 change: 0 additions & 1 deletion recipe/py/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"python.pythonPath": "/usr/bin/python2.7",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
}
26 changes: 24 additions & 2 deletions recipe/py/dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ class machineStatus:
strArmPos = "0"
strCvtPos = "0"
ovenOpMode = "manual"
bucketOpMode = "manual"
robotOpMode = "manual"
allModuleGood2Go = False
modeRecheckCnt = 0


macst = machineStatus()
Expand Down Expand Up @@ -602,7 +606,19 @@ def ctrl_latch():
mqttc.connect("localhost", 1883, 60)
mqttc.loop_start()

if macst.ovenOpMode == "remote":
while True:
if macst.ovenOpMode == "remote" and macst.bucketOpMode == "remote" and macst.robotOpMode == "remote":
macst.allModuleGood2Go = True
break
else:
macst.allModuleGood2Go = False
if macst.modeRecheckCnt >= 3:
break
else:
macst.modeRecheckCnt = macst.modeRecheckCnt + 1
time.sleep(1)

if macst.allModuleGood2Go == True:
thread1 = threading.Thread(target=ctrl_oven_and_robot)
thread2 = threading.Thread(target=ctrl_latch)

Expand All @@ -614,7 +630,13 @@ def ctrl_latch():

mqttc.publish("gate/cmd/open", "true")
else:
logger.fatal("the mode of oven is not remote")
msg = ("recipe: the modules are not all in the remote mode" +
", modeRecheckCnt: " + str(macst.modeRecheckCnt) +
", ovenOpMode: " + str(macst.ovenOpMode) +
", bucketOpMode: " + str(macst.bucketOpMode) +
", robotOpMode: " + str(macst.robotOpMode))
logger.fatal(msg)
mqttc.publish("bucket/status/alarm", msg)

mqttc.disconnect()
mqttc.loop_stop()
Expand Down
Loading

0 comments on commit f2ac18e

Please sign in to comment.