Announcement

Collapse
No announcement yet.

sleep mode

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

  • sleep mode

    Hello

    Now, my project seems to work fine.

    But it has to work all time (24h/24)…
    So I’d like to put my µLCD32” PT in sleep mode when no touch comes after a long time.

    I saw the methods in serial mode, but in Visi-Genie with serial commands like in this example: 4D-AN-P4010-ViSi-Genie-Connection-to-a-Host-with-Red-Green-Blue-LED-Control-REV1.1.pdf
    it's different.


    I know how test the inactivity. And I’ve made a form (5) with a black winbutton on the entire screen to leave it.

    But I don’t know how send commands to put it in sleep. I want to send commands to put the form (5), and change the contrast. But the results are bad. The dialog between µLCD and Arduino seams to stop.

    The commands I sent:

    If (Time > inactivity) {
    (sendMessage( 0x01, 0A, 05); // Put black form 5
    (sendMessage( 0x04, 0, 0); // decrease contrast
    }



    If (restartLCD) {
    (sendMessage( 0x01, 0A, 00); // call the main form 0
    (sendMessage( 0x04, 01, 00); // increase contrast
    }
    I think my commands are wrong.
    Do you know if the sendMessage function is able to send this kind of message ? And also if the µLCD is able to receive them ?
    Is there an other and better method in VisieGenie ?

    Franck

  • #2


    Yes, the send message function produces a 5 byte message and a 1 byte checksum from the supplied parameters.

    You need a different function that produces a 2 byte message and a 1 byte checksum
    Mark

    Comment


    • #3
      ThanksSo, I wrote this new function for that, like this :
      HTML Code:
      bool sendContrast (uint8_t command0, uint8_t value) {
          
             bool flag0 = false;
             uint8_t buffer[3];
             uint8_t checksum = 0x00;
             uint8_t i=0;
             
             buffer[i] = command0;
             checksum = command0;
             i++;
      
             buffer[i] = value;
             checksum = value;
             i++;
             
             buffer[i] = checksum;
             i++;
      
             mySerial.write(buffer, i);
          
          return (nacAck()==0x06);
       }And in the loop this kind of command.if (sleep) {
          sendContrast(0x04,0x00);
         }
      But it doesn't work. Could you help me ?

      Comment


      • #4


        Are you getting back a NAK?

        The only obvious thing I can see is that
        checksum = value;
        should be
        checksum ^= value;
        Mark

        Comment


        • #5
          Hy
          Are you getting back a NAK?Yes, I let this part of code (also to send normal messages)
          HTML Code:
            uint8_t nacAck() {  
            delay(10);
            while (!mySerial.available());
            return mySerial.read(); // 0xc6 or 0xd5
            
           }
          checksum ^= value;
          It seems to work like thisThanks a lot !!!Franck

          Comment


          • #6


            Hello,

            i'm a new here, so maybe my question will for somebody stupid, but how i can to put display to after some inactivity time in Visi-Genie?My project is aquarium controller with arduino + µLCD28 PTU in Visi-Genie. Put arduino to is not problem, but i really don't know how i can put display to after some inactivity time in Visi-Genie.Can somebody help me?

            Comment


            • #7


              In Genie you need to tell the display to go to sleep, you do that by setting contrast to 0. You wake it up by setting contrast to non 0 (eg 15)
              Mark

              Comment


              • #8


                So easy

                if(Event.reportObject.object == GENIE_OBJ_WINBUTTON) { if(Event.reportObject.index == 0) { //sleep button genieWriteObject(GENIE_OBJ_FORM, 1, 0); //open screen saver form genieWriteContrast(0); } } else if(Event.reportObject.object == GENIE_OBJ_USERBUTTON) { if(Event.reportObject.index == 0) { //wakeup button genieWriteObject(GENIE_OBJ_FORM, 0, 0); //open default form genieWriteContrast(1); wakeup = 1; } } so now it works perfectlyreally thanks for answeri like this display with this software

                Comment


                • #9


                  Any idea on the power consumption with the contrast method ?

                  Comment


                  • #10


                    Depends a lot on the display model, a uLCD-32PTU is about 50ma
                    Mark

                    Comment


                    • #11


                      Is there a method to turn the display completely off for battery-powered devices while not in use, but which also need to be powered on by touching the screen?

                      If it can't be done via software when using the Visi-Genie Environment, how about a hardware method, such as using a host controller with a connection to a pin on the display board to turn off just the display?

                      Or using a host controller with separate connection to the resistive touch panel to sense touch while the display is off?

                      Comment


                      • #12


                        The display is fully turned off, what isn't turned off is Picaso.

                        sys_Sleep and sys_DeepSleep also put Picaso to Sleep and the only way to wake it is via touch. Of course this state isn't really 'compatible' with Genie as the display will not respond to the serial port.

                        So normally you'd do this sort of thing in ViSi where you'd be able to control what and how everything reacts.

                        You could, of course 'tweak' Genie to respond to a set contrast 0 command. Perhaps go to sleep and not respond with the ACK until it is awoken, or something like that.
                        Mark

                        Comment


                        • #13


                          This sounds promising. Where would I begin to explore the possibility of 'tweaking' Genie to respond to a set contrast 0 command?

                          Comment


                          • #14


                            Build your Genie program, then 'Save As' ViSi.

                            Do a find on gfx_Contrast and put some code after that. Note that you will have to check for the contrast being set to 0 and only sleeping then
                            Mark

                            Comment


                            • #15


                              Thanks!

                              Comment

                              Working...
                              X