|
@@ -156,10 +156,14 @@ def board_programmer():
|
|
|
# print("MQTT_dict: ", MQTT_dict) # MQTT_dict: {'command': 'Code_upload', 'tank_num': 'F1', 'url': ':020000040801F1\n:1000
|
|
|
# print("json: ", json) # json: {"command": "Code_upload", "tank_num": "F1", "url": ":020000040801F1\n:1000
|
|
|
|
|
|
- topic = 'AISKY/Coffee/MK-G/b8:27:eb:7e:24:78'
|
|
|
- # topic = 'AISKY/Coffee/MK-G/' + str(prog_data['burner_mac'])
|
|
|
+ # topic = 'AISKY/Coffee/MK-G/b8:27:eb:7e:24:78'
|
|
|
+ topic = 'AISKY/Coffee/MK-G/' + str(prog_data['burner_mac'])
|
|
|
mqtt.publish(topic, json)
|
|
|
- time.sleep(1)
|
|
|
+ time.sleep(3)
|
|
|
+
|
|
|
+ if board_prog[prog_data['tank']] == 'no reply':
|
|
|
+ board_prog[prog_data['tank']] = '0'
|
|
|
+ return 'no reply'
|
|
|
|
|
|
print("===== 下載 Git CoffeeProject_SourceCode ==========================================================")
|
|
|
# # 先下載 Git CoffeeProject_SourceCode
|
|
@@ -222,9 +226,6 @@ def board_programmer():
|
|
|
print("===== SDIO.hex 燒錄等待中 =====================================================")
|
|
|
res = board_prog[prog_data['tank']]
|
|
|
print("res: ", res)
|
|
|
- if board_prog[prog_data['tank']] == 'no reply':
|
|
|
- board_prog[prog_data['tank']] = '0'
|
|
|
- return 'no reply'
|
|
|
return "燒錄中..."
|
|
|
# time.sleep(60)
|
|
|
|
|
@@ -247,6 +248,7 @@ def board_programmer():
|
|
|
def board_programmer_result(tid):
|
|
|
if board_prog[tid] == 'no reply':
|
|
|
board_prog[tid] = '0'
|
|
|
+ # return board_prog[tid] # 錯誤
|
|
|
return 'no reply'
|
|
|
elif board_prog[tid] == 'success':
|
|
|
board_prog[tid] = '0'
|
|
@@ -254,6 +256,8 @@ def board_programmer_result(tid):
|
|
|
elif board_prog[tid] == 'upload error':
|
|
|
board_prog[tid] = '0'
|
|
|
return 'upload error'
|
|
|
+ elif board_prog[tid] == '0':
|
|
|
+ return board_prog[tid]
|
|
|
else:
|
|
|
# res = "Code_upload " + tid + " signal was not received"
|
|
|
return board_prog[tid]
|