Announcement

Collapse
No announcement yet.

What can wake a screen from sys_Sleep(10)?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • What can wake a screen from sys_Sleep(10)?

    Been trying to find the answer to this but I must finally ask.

    What causes a gen4-uLCD-70DT to wake up from sys_Sleep(10) besides touch or running out of time?

    I have a sleep button that, when I press it, should make the screen go to sleep for 10 seconds.
    I hit the button and the screen blinks off for a second then back on.
    I thought maybe it was my timers, so I set all their events to 0x00 and then their times' to 0msec before calling sys_Sleep(10) but it still turns back on immediately.
    I thought maybe I was "tapping the screen twice" so I put in a 500msec pause before sys_Sleep(10) but it still wakes up instantly.

    Is there anything with receiving comms? If the RX pin gets hit while in sleep, does the screen turn back on?

    Code:
    if(n == iSleep_btn)
        sys_SetTimerEvent(TIMER0, 0);
        sys_SetTimerEvent(TIMER1, 0);
        sys_SetTimerEvent(TIMER2, 0);
        sys_SetTimerEvent(TIMER3, 0);
        sys_SetTimerEvent(TIMER4, 0);
        sys_SetTimerEvent(TIMER5, 0);
        sys_SetTimer(TIMER0, 0);
        sys_SetTimer(TIMER1, 0);
        sys_SetTimer(TIMER2, 0);
        sys_SetTimer(TIMER3, 0);
        sys_SetTimer(TIMER4, 0);
        sys_SetTimer(TIMER5, 0);
    
        pause(500);
                        
        sys_Sleep(10);
    endif
    I can email the full code or something, but beware it is a very big project...

    Thanks.

  • #2
    One more quick question on the sleep functionality, it essentially acts as a pause(), but the screen is off and it's waiting for touch, correct?

    But I found a solution to my problem. I made a global boolean isSleeping that get's set to true when the button is pressed, then at the end of my main I put an if to catch that, so:
    Code:
    func checkForPress()
    ...
        if(n == iSleep_btn)
            isSleeping := 1;
        endif
    endfunc
    
    main()
    ...
        repeat
        ...
            if(isSleeping)
                sys_Sleep(10);
                isSleeping = 0;
            endif
        forever
    endfunc

    Comment


    • #3

      Hello,

      One more quick question on the sleep functionality, it essentially acts as a pause(), but the screen is off and it's waiting for touch, correct?
      The pause() function stops the execution of the user program, so all the processes, as well as the touch, will be unresponsive in this case.

      You could try this code snippet
      Code:
      func main()
        sys_SetTimerEvent(TIMER0,SleepFunction);
       repeat
      
          switch(touch_Get(TOUCH_STATUS))
          case TOUCH_RELEASED:
              if (img_Touched(hndl,-1) == iWinbutton1)sys_SetTimer(TIMER0,100);
          break;
      
          endswitch
      
          forever
      endfunc
      
      
      func SleepFunction()
          sys_Sleep(10);
      endfunc
      Since the sys_Sleep will be active once the screen is touched, you need to add a 'delay' which will enable you
      to enter the sleep mode once the button has been pressed.

      I hope this helps.
      Best Regards,
      Kevin

      Comment

      Working...
      X