From 797816a6f56252834701aba381853d8e9f61ccbe Mon Sep 17 00:00:00 2001 From: "support.sampyo" Date: Thu, 4 Jul 2024 06:14:16 +0000 Subject: [PATCH] Commit message --- framework.yaml | 2 +- main.py | 54 ++++++++++++++++++++++---------------------------- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/framework.yaml b/framework.yaml index d1bd1ea..344f52b 100644 --- a/framework.yaml +++ b/framework.yaml @@ -7,5 +7,5 @@ spec: virtualEnv: base # 사용할 가상환경 이름입니다. package: requirements.txt # 설치할 Python 패키지 정보 파일입니다.(기본 값은 requirement.txt 입니다.) stackbase: - tagName: v0.0.44 # Stackbase(gitea)에 릴리즈 태그명 입니다. + tagName: v0.0.45 # Stackbase(gitea)에 릴리즈 태그명 입니다. repoName: sampyo-dio # Stackbase(gitea)에 저장될 저장소 이릅니다. diff --git a/main.py b/main.py index bdd8d41..813c4d3 100644 --- a/main.py +++ b/main.py @@ -43,30 +43,27 @@ def Valve_PureWater(chip, status, action, duration=7): chip.set_values(status) time.sleep(0.05) - if action == 'On': + if pure_valve_status != 0 and action == 'Off': + status[2] = 0 + status[3] = 1 + chip.set_values(status) + time.sleep(7) + pure_valve_status = 0 + elif pure_valve_status == 0 and action == 'On': status[2] = 1 status[3] = 0 chip.set_values(status) time.sleep(duration) - else: # 'Off' - if pure_value_status != 0: - status[2] = 0 - status[3] = 1 - chip.set_values(status) - time.sleep(7) - + if duration >= 7: + pure_valve_status = 2 + elif duration < 7: + pure_valve_status = 1 + status[2] = 0 status[3] = 0 chip.set_values(status) time.sleep(0.05) - if action == 'On' and duration >= 7: - pure_valve_status = 2 - elif action == 'On' and duration < 7: - pure_valve_status = 1 - else: - pure_valve_status = 0 - def Valve_EnterWater(chip, status, action): if action == 'On': status[4] = 1 @@ -83,30 +80,27 @@ def Valve_MainWater(chip, status, action, duration=7): chip.set_values(status) time.sleep(0.05) - if action == 'On': + if main_valve_status != 0 and action == 'Off': + status[5] = 0 + status[6] = 1 + chip.set_values(status) + time.sleep(7) + main_valve_status = 0 + elif main_valve_status == 0 and action == 'On': status[5] = 1 status[6] = 0 chip.set_values(status) time.sleep(duration) - else: # 'Off' - if main_valve_status != 0: - status[5] = 0 - status[6] = 1 - chip.set_values(status) - time.sleep(7) - + if duration >= 7: + main_valve_status = 2 + elif duration < 7: + main_valve_status = 1 + status[5] = 0 status[6] = 0 chip.set_values(status) time.sleep(0.05) - if action == 'On' and duration >= 7: - main_valve_status = 2 - elif action == 'On' and duration < 7: - main_valve_status = 1 - else: - main_valve_status = 0 - def Measure_Weight(client): # print('in') val = 0