taobin_project/inc/remove_cup_on_arm_step.inc

249 lines
6.1 KiB
PHP
Raw Normal View History

2025-06-05 11:33:29 +07:00
2025-06-13 10:55:49 +07:00
;setvarint DebugRemoveCup 1
2025-06-06 17:30:21 +07:00
;Var DebugRemoveCup = 1
2025-06-04 22:08:49 +07:00
If DebugRemoveCup = 1 Then
DEBUGVAR TimeoutForProtectButtonHideLongTime
DEBUGVAR TimeoutForDoorCupOpenLongTime
DEBUGVAR CupOnArm
DEBUGVAR DoorCupPosition
DEBUGVAR CupChecking
DEBUGVAR CupArmMove
DEBUGVAR buttonRemoveCupOnArm
2025-06-06 17:30:21 +07:00
DEBUGVAR Seeker
DEBUGVAR CountDownCupOnArmCertainStage
2025-06-09 10:47:12 +07:00
2025-06-13 10:55:49 +07:00
DEBUGVAR CountDownCupOnArmSuccessDelay
2025-06-09 10:47:12 +07:00
DEBUGVAR CH9991_Status
DEBUGVAR CH9992_Status
DEBUGVAR CH9993_Status
DEBUGVAR CH9994_Status
2025-06-04 22:08:49 +07:00
EndIf
2025-06-06 17:30:21 +07:00
2025-06-04 22:08:49 +07:00
If TimeoutForDoorCupOpenLongTime = "" Then
Var TimeoutForDoorCupOpenLongTime = 1
EndIf
2025-06-06 17:30:21 +07:00
If TimeoutInstance0 = "" Then
Var TimeoutInstance0 = 0
Var CountDownCupOnArmCertainStage = 0
2025-06-13 10:55:49 +07:00
Var CountDownCupOnArmSuccessDelay = 8
Var CountDownDrinkOK = 8
2025-06-06 17:30:21 +07:00
EndIf
2025-06-04 22:08:49 +07:00
If TimeoutInstance0 = 3 Then
2025-06-13 10:55:49 +07:00
SAVELOG "remove cup on arm 1.4"
2025-06-06 17:30:21 +07:00
EndIf
Var CupOnAnyArm = 0
If CH9991_Status = "SUCCESS" Then
Var CupOnAnyArm = 1
EndIf
If CH9992_Status = "SUCCESS" Then
Var CupOnAnyArm = 1
EndIf
If CH9993_Status = "SUCCESS" Then
Var CupOnAnyArm = 1
EndIf
If CH9994_Status = "SUCCESS" Then
Var CupOnAnyArm = 1
EndIf
2025-06-13 10:55:49 +07:00
; from drink_ok.xml break show button.
If CountDownDrinkOK > 0 Then
If DoorCupPosition = "bottom" Then
Var CountDownDrinkOK = CountDownDrinkOK - 1
DEBUGVAR CountDownDrinkOK
Var CountDownCupOnArmSuccessDelay = 10
EndIf
Var CupOnAnyArm = 0
Else
EndIf
If CupOnAnyArm = 1 Then
If CountDownCupOnArmSuccessDelay = 0 Then
Else
Var CountDownCupOnArmSuccessDelay = CountDownCupOnArmSuccessDelay - 1
Var CupOnAnyArm = 0
DEBUGVAR CountDownCupOnArmSuccessDelay
EndIf
EndIf
2025-06-06 17:30:21 +07:00
If CupOnAnyArm = 0 Then
If Seeker = "curr" Then
If CupOnArm = "true" Then
Var CupOnAnyArm = 1
EndIf
EndIf
EndIf
If CurrentXMLFileName0 = "/mnt/sdcard/coffeevending/taobin_project/xml/page_remove_cup.xml" Then
Var CupOnAnyArm = 0
2025-06-04 22:08:49 +07:00
EndIf
2025-06-06 17:30:21 +07:00
DEBUGVAR CupOnAnyArm
2025-06-04 22:08:49 +07:00
2025-06-06 17:30:21 +07:00
If CupOnAnyArm = 1 Then
Var CountDownCupOnArmCertainStage = 3
2025-06-04 22:08:49 +07:00
If buttonRemoveCupOnArm = "Enable" Then
Else
2025-06-06 17:30:21 +07:00
Var TimeoutForProtectButtonHideLongTime = TimeoutForProtectButtonHideLongTime + 1
If TimeoutForProtectButtonHideLongTime > 60 Then
Var TimeoutForProtectButtonHideLongTime = 0
If DoorCupPosition = "bottom" Then
SAVELOG "Check Cup all from Long time button cup on arm hide"
Var buttonRemoveCupOnArm = "Enable"
2025-06-04 22:08:49 +07:00
EndIf
EndIf
EndIf
If DoorCupPosition = "bottom" Then
Var TimeoutForDoorCupOpenLongTime = 0
Else
Var TimeoutForDoorCupOpenLongTime = TimeoutForDoorCupOpenLongTime + 1
EndIf
If TimeoutForDoorCupOpenLongTime > 40 Then
Var TimeoutForDoorCupOpenLongTime = 0
If DoorCupPosition = "bottom" Then
Var TimeoutForDoorCupOpenLongTime = 0
Else
Machine DoorClose
Var DoorCloseFromTimeout = "set"
EndIf
EndIf
2025-06-06 17:30:21 +07:00
; check cup now after door closed
2025-06-04 22:08:49 +07:00
If PreviseDoorCupPosition = DoorCupPosition Then
Else
DEBUGVAR PreviseDoorCupPosition
DEBUGVAR DoorCupPosition
If DoorCupPosition = "bottom" Then
Machine CheckCupLastIDProcess
EndIf
Var PreviseDoorCupPosition = DoorCupPosition
EndIf
2025-06-06 17:30:21 +07:00
; sound play
2025-06-04 22:08:49 +07:00
If show_eng = "true" Then
Else
2025-06-06 17:30:21 +07:00
If TimeoutInstance0 = 14 Then
2025-06-04 22:08:49 +07:00
If buttonRemoveCupOnArm = "Enable" Then
If CupChecking = "false" Then
If DoorCupPosition = "bottom" Then
If InternationalEnable = 1 Then
Else
Play "/mnt/sdcard/coffeevending/taobin_project/sound_thai/remove_cup.mp3"
EndIf
EndIf
EndIf
If CupArmMove = "false" Then
If DoorCupPosition = "bottom" Then
If InternationalEnable = 1 Then
Else
Play "/mnt/sdcard/coffeevending/taobin_project/sound_thai/remove_cup.mp3"
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
Var TimeoutInstance0 = TimeoutInstance0 + 1
; Logic have differrent drinkfail3.xml
; protect lock
;
If CheckCupStateDoorCupCloseCnt > 0 Then
Var CheckCupStateDoorCupCloseCnt = CheckCupStateDoorCupCloseCnt - 1
DEBUGVAR CheckCupStateDoorCupCloseCnt
If CheckCupStateDoorCupCloseCnt = 0 Then
Var CheckCupStateDoorCupClose = ""
EndIf
EndIf
2025-06-05 21:43:07 +07:00
If CoundUpDelayCertainStage = "" Then
Var CoundUpDelayCertainStage = 0
EndIf
2025-06-04 22:08:49 +07:00
2025-06-06 17:30:21 +07:00
If DoorCupPosition = "bottom" Then
Var CoundUpDelayCertainStage = CoundUpDelayCertainStage + 1
DEBUGVAR CoundUpDelayCertainStage
If CoundUpDelayCertainStage > 10 Then
2025-06-05 11:33:29 +07:00
2025-06-06 17:30:21 +07:00
Var buttonRemoveCupOnArm = "Invisible"
2025-06-04 22:08:49 +07:00
EndIf
2025-06-06 17:30:21 +07:00
2025-06-04 22:08:49 +07:00
Else
Var CoundUpDelayCertainStage = 0
2025-06-05 21:43:07 +07:00
2025-06-04 22:08:49 +07:00
EndIf
; zone cup on arm
If buttonRemoveCupOnArm = "Enable" Then
2025-06-05 21:43:07 +07:00
If DoorCupPosition = "top" Then
Var buttonRemoveCupOnArm = "Invisible"
EndIf
2025-06-04 22:08:49 +07:00
Else
2025-06-05 21:43:07 +07:00
If DoorCupPosition = "top" Then
Var buttonRemoveCupOnArm = "Invisible"
Else
2025-06-06 17:30:21 +07:00
If CheckCupStateDoorCupClose = "" Then
Var buttonRemoveCupOnArm = "Enable"
EndIf
2025-06-04 22:08:49 +07:00
2025-06-06 17:30:21 +07:00
If CheckCupStateDoorCupClose = "done" Then
Var buttonRemoveCupOnArm = "Enable"
2025-06-04 22:08:49 +07:00
EndIf
EndIf
2025-06-05 21:43:07 +07:00
2025-06-04 22:08:49 +07:00
EndIf
2025-06-06 17:30:21 +07:00
DEBUGVAR buttonRemoveCupOnArm
2025-06-04 22:08:49 +07:00
Else
2025-06-05 21:43:07 +07:00
2025-06-06 17:30:21 +07:00
If CountDownCupOnArmCertainStage > 0 Then
Var CountDownCupOnArmCertainStage = CountDownCupOnArmCertainStage - 1
EndIf
2025-06-05 21:43:07 +07:00
2025-06-04 22:08:49 +07:00
; Next hide away
2025-06-06 17:30:21 +07:00
If CountDownCupOnArmCertainStage = 0 Then
Var buttonRemoveCupOnArm = "Invisible"
EndIf
2025-06-04 22:08:49 +07:00
EndIf
2025-06-05 11:33:29 +07:00
; cfe cup-on-arm-reset
; cfe cup-on-arm-flag
; setvarint DebugRemoveCup 1