Commit message

This commit is contained in:
support.sampyo 2024-03-26 09:27:51 +00:00
parent febe5dcf33
commit b204963582
2 changed files with 15 additions and 9 deletions

View File

@ -7,5 +7,5 @@ spec:
virtualEnv: base # 사용할 가상환경 이름입니다.
package: requirements.txt # 설치할 Python 패키지 정보 파일입니다.(기본 값은 requirement.txt 입니다.)
stackbase:
tagName: v0.0.7 # Stackbase(gitea)에 릴리즈 태그명 입니다.
tagName: v0.0.8 # Stackbase(gitea)에 릴리즈 태그명 입니다.
repoName: sampyo-dio # Stackbase(gitea)에 저장될 저장소 이릅니다.

16
main.py
View File

@ -125,6 +125,8 @@ def Command_Read():
Valve_Vent(chip=output_lines, status=status, action='Off')
time.sleep(1)
return 1
else: # cmd['type'] == 'manual'
Motor(chip=output_lines, status=status, action=cmd['device']['motor']['action'])
Valve_Vent(chip=output_lines, status=status, action=cmd['device']['vent']['action'])
@ -133,9 +135,13 @@ def Command_Read():
if cmd['device']['measure']['action'] == 'On':
result = Measure_Weight(client=client)
Calculate_Concentration(result)
return 1
if cmd['device']['setzero']['action'] == 'On':
Set_Zero(client=client)
return 0
def runAction():
# Write the app's actions in the "runAction" function.
@ -163,16 +169,16 @@ def runAction():
cnt = 0
while True:
start = time.time()
Command_Read()
result = Command_Read()
if result:
data['timestamp'] = int(time.time() * 1000)
sdtcloud.pubMessage(mqttlist[cnt], data)
end = time.time()
cnt += 1
if cnt == 5:
cnt = 0
end = time.time()
diff = end - start
if diff < 3:
time.sleep(3 - diff)