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

    Let's speed up DrawLine and DrawPixel?

    FAQS
    5
    11
    26.0k
    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.
    • dasloloD
      daslolo
      last edited by

      The esp32 is a beast and can fill byte arrays in a blink and the ILI is a fast controller when sent tons of data in one batch, as proof is the arkanoid example, and all other bitmap based M5 games.
      So I'm thinking that the Display.cpp library is doing things inefficiently. DrawPixel is writing to the SPI (hardware?) byte by byte as we send them.
      So a better way to feed the screen would be to batch commands.
      Display.BeginCommand();
      do the draw thingies and then
      Display.Dispatch()
      so DrawPixel would only fill a static array and the Dispatch command sends that to the ILI frame buffer.
      There are libraries for arduino that do just that.
      And if I know it, someone else already ported it over to M5. Google not collaborating, anyone has seen that?

      1 Reply Last reply Reply Quote 0
      • dasloloD
        daslolo
        last edited by

        It looks like someone already did it
        https://github.com/Bodmer/TFT_eSPI

        D 1 Reply Last reply Reply Quote 1
        • D
          dda @daslolo
          last edited by

          @daslolo Yep. And I managed to integrate this to the M5Stack library. I am doing tests, but so far so good. I've run a few modified sketches without issue. The TFT_ArcFill example is quite impressive.

          Replacing the Display.h/.cpp files with the TFT_eSPI library was pretty easy. The Display library has a couple of M5-specific functions, but once added to the driver, everything works well:

          void setBrightness(uint8_t); //Specific to M5Stack
          void sleep();                //Specific to M5Stack
          

          There may be others, I'll see what happens when I compile the non-touch examples.

          dasloloD 1 Reply Last reply Reply Quote 3
          • reaper7R
            reaper7
            last edited by reaper7

            @dda 在 Let's speed up DrawLine and DrawPixel? 中说:

            Yep. And I managed to integrate this to the M5Stack library. I am doing tests, but so far so good. I've run a few modified sketches without issue. The TFT_ArcFill example is quite impressive.
            .
            .
            .
            There may be others, I'll see what happens when I compile the non-touch examples.

            TFT_eSPI is the best lib, we added m5stack support some time ago:
            https://github.com/Bodmer/TFT_eSPI/pull/88
            btw, m5stack display lib based on the early version of TFT_eSPI
            but since then, TFT_eSPI has developed a LOT!!!

            P.S. for advanced GUI we also added m5stack support for GUIslice:
            https://github.com/ImpulseAdventure/GUIslice/pull/34
            which uses TFT_eSPI as display driver.

            MY GITHUB: https://github.com/reaper7/

            JJJ 1 Reply Last reply Reply Quote 3
            • JJJ
              JJ @reaper7
              last edited by

              @reaper7 @dda

              Nice work dda !

              Reaper those gui slice screens look awesome !! Glad you added M5Stack support and thanks for pointing them out

              D 1 Reply Last reply Reply Quote 2
              • D
                dda @JJ
                last edited by

                @jimit Now all we need is to have that officially included in the M5Stack library.

                1 Reply Last reply Reply Quote 2
                • reaper7R
                  reaper7
                  last edited by

                  @dda - good point!

                  MY GITHUB: https://github.com/reaper7/

                  1 Reply Last reply Reply Quote 0
                  • dasloloD
                    daslolo @dda
                    last edited by daslolo

                    @dda how much faster is it?

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

                      I compiled the first example after making the necessary changes doe the M5Stack without errors. However, it would not load onto my M5Stack.

                      1 Reply Last reply Reply Quote 1
                      • dasloloD
                        daslolo
                        last edited by daslolo

                        @pkourany inside user_setup.h comment out the generic setups and uncomment m5. Then most examples work.
                        Result: same performances as m5 lib.
                        EDIT: even with SPI_FREQUENCY at 80,000,000 ... weird

                        1 Reply Last reply Reply Quote 1
                        • dasloloD
                          daslolo
                          last edited by

                          Bodmer wrote a nice article on this https://github.com/Bodmer/TFT_eSPI/issues/121#issuecomment-380245040
                          When un-commenting Display.h/#define SPI_FREQUENCY 40000000, fillscreen nearly doubles.
                          80M doesn't work on some M5.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post