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

22
main.py
View File

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