🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Paper partial Update Canvas

    Cores
    core
    3
    7
    10.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Powersoft
      last edited by

      Found in the documentation the command
      Function: flushes the data in the buffer to the specified area of the screen in the specified mode.

      m5epd_err_t UpdateArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h, m5epd_update_mode_t mode);

      Can I use it for partial updating the canvas, if yes how to use this command?

      Cheers,
      Jan

      1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3
        last edited by

        m5epd_err_t UpdateArea(100,100,100,100)
        would update an area of 100 px X 100px with the top left corner starting at position X=100, Y=100.

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        P 1 Reply Last reply Reply Quote 0
        • P
          Powersoft @ajb2k3
          last edited by

          @ajb2k3
          Thanks, I wont to update (redraw) every time a new character, without updating the whole screen. But the command is not do that what I expect.
          Her my short test program. What is wrong ont it?

          #include <M5EPD.h>
          M5EPD_Canvas canvas1(&M5.EPD);

          String testString[]={"A","B","C","D","E","F","G"};

          void setup() {
          M5.begin();
          M5.TP.SetRotation(180);
          M5.EPD.SetRotation(180);
          M5.EPD.Clear(true);
          canvas1.createCanvas(960, 540);
          canvas1.loadFont("/fonts/GenSenRounded-R.ttf", SD);
          canvas1.createRender(60);
          canvas1.setTextSize(60);
          canvas1.drawString("A",20,20);
          canvas1.pushCanvas(0, 0, UPDATE_MODE_GL16);
          }

          void loop() {
          for (int i=1; i<7; i++)
          {
          canvas1.drawString(testString[i],20,20);
          /* m5epd_err_t UpdateArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h, m5epd_update_mode_t mode); */
          M5.EPD.UpdateArea(0,0,100,100,UPDATE_MODE_GL16);
          delay(1000);
          }
          }

          Cheers
          Jan.

          1 Reply Last reply Reply Quote 0
          • ajb2k3A
            ajb2k3
            last edited by ajb2k3

            You need to also include the M5stack libraries.
            What do you mean "not what you expect"
            any error message?
            Can you post a picture of the screen?

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

            P 1 Reply Last reply Reply Quote 0
            • P
              Powersoft
              last edited by

              @ajb2k3 said in M5Paper partial Update Canvas:

              You need to also include the M5stack libraries.

              Wat do you mean with that? This simple program is complete or not?

              1 Reply Last reply Reply Quote 0
              • P
                Powersoft @ajb2k3
                last edited by

                @ajb2k3
                I espect to see the characters be changed at the fix place. Do you have try to run my simple program?

                1 Reply Last reply Reply Quote 0
                • M
                  murraypaul
                  last edited by

                  As mentioned in the other thread, the missing step is transferring the canvas framebuffer to the EPD.
                  If your loop function is changed as below, it works as you expect.

                  void loop() {
                    for (int i=1; i<7; i++)
                    {
                      canvas1.drawString(testString[i],20,20);
                      /* m5epd_err_t UpdateArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h, m5epd_update_mode_t mode); */
                      M5.EPD.WriteFullGram4bpp((uint8_t*)canvas1.frameBuffer());
                      M5.EPD.UpdateArea(0,0,100,100,UPDATE_MODE_GL16);
                      delay(1000);
                    }
                  }
                  
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post