B4R Question exit from loopers, wait and resume code

Mostez

Well-Known Member
Licensed User
Longtime User
Hello,
In this code i call a sub to input password and wait for 'Enter' keycode or time out occur, this scenario works very well using Addlooper method with single input request.

Now i need to call the same input sub again after the first one, i.e enter password, then confirm password. but i cant make 'wait' status after calling addlooper!
how can i return from looper to next line of the sub that called the looper!

Thanks

B4X:
private Sub MenuHandler_GotoSettings()
        InputBox("Admin Password:",True)
        StartScreenTimeoutCount(180,DWIN_SCREEN_DESKTOP) 'wait 3 minuts, or return to desktop
        AddLooper("Looper_MenuHandler_GotoSettings")
    End Sub

    private Sub Looper_MenuHandler_GotoSettings()
        If DWIN_VALID_PACKET = True Then
            'Log(DWIN_KEY_CODE)
            If DWIN_KEY_CODE = DWIN_KEY_ENTER Then
                ReadVPRigister(DWIN_VP_INPUTBOX_DISPLAY,DWIN_TEXT_FIELD_SIZE) 'read 50 bytes
                Delay (10) ' wait for DWIN to get stable
                ResetDWINstreamingFlags
                'check password validity here
               
                MenuHandler_Settings
            Else if DWIN_KEY_CODE = DWIN_KEY_CANCEL Then
                ResetDWINstreamingFlags
                MenuHandler_GotoDesktop
            End If       
        End If
    End Sub

    private Sub MenuHandler_GotoAttendance()
        StartScreenTimeoutCount(255,0) 'this will disable the timeout count
        GotoPage(DWIN_SCREEN_ATTENDANCE)
    End Sub


Private Sub StartScreenTimeoutCount(sSeconds As Byte,ReturnScreenID As UInt)
    ScreenTimeoutSeconds = sSeconds
    ScreenTimeoutTimerTicks = 0
    DWIN_TIMEOUT_RETURN_SCREEN = ReturnScreenID
End Sub

private Sub ScreenTimeoutTimer_Tick()
    Select True
        Case ScreenTimeoutTimerTicks > 240 'if >240 i.e 255 then stop counting, use to stop count in no timeout screens, i.e desktop
            ScreenTimeoutTimerTicks = 0
            Return
        Case ScreenTimeoutTimerTicks = ScreenTimeoutSeconds And ScreenTimeoutSeconds <> 0
            GotoPage(DWIN_TIMEOUT_RETURN_SCREEN)
    End Select
    ScreenTimeoutTimerTicks = ScreenTimeoutTimerTicks + 1
End Sub
 

Mostez

Well-Known Member
Licensed User
Longtime User
arduino is connected to DWIN HMI-LCD serial device, DWIN_VALID_PACKET it is set true if I receive 0x5AA5 from asyncstreams and so is DWIN_KEY_CODE
, i use looper to wait for user to send DWIN_KEY_ENTER (asyncstreams also), then i get password string from HMI register, or timeout occur in this case, go back to main screen on HMI device. I could not use do..while, while timeout timer is running, timer not updated!
 
Upvote 0
Top