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

    How to drawColorBitmap on M5STACK Core2 in Arduino IDE / PlatformIO?

    Scheduled Pinned Locked Moved General
    1 Posts 1 Posters 3.3k Views
    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.
    • S Offline
      swasi
      last edited by

      Hello everyone

      I'm playing with my new Core2 and i saw the pretty display of the factory default.
      Now i want to create my own Output on the LCD. I would like to drawColorBitmap like in the clock example of the factory default.

      TFT_eSprite DisClockbuff = TFT_eSprite(&M5.Lcd);
      
      void clockSetup()
      {
          DisClockbuff.createSprite(164,101);
          DisClockbuff.drawJpg(clockImage,18401,0,0,163,101);
      }
      
      void clockFlush()
      {
          uint16_t posx[6] = { 4, 28, 66, 90, 127, 144 };
      
          // colon between the numbers
          DisClockbuff.fillRect(0, 20, 162, 50, DisClockbuff.color565(0x1a, 0x11, 0x00));
          DisClockbuff.fillRect(0, 25, 2  , 45, DisClockbuff.color565(0xff, 0x9c, 0x00));
      
          DisClockbuff.fillRect(56,35, 5  , 5 , DisClockbuff.color565(0xff, 0x9c, 0x00));
          DisClockbuff.fillRect(56,54, 5  , 5 , DisClockbuff.color565(0xff, 0x9c, 0x00));
      
          DisClockbuff.fillRect(118,40, 5  , 5 , DisClockbuff.color565(0xff, 0x9c, 0x00));
          DisClockbuff.fillRect(118,57, 5  , 5 , DisClockbuff.color565(0xff, 0x9c, 0x00));
      
          M5.Rtc.GetTime(&sytState.Rtctime);
          
          // digits
          DisClockbuff.drawColorBitmap(posx[0],26,24,42,
                              DigNumber[ sytState.Rtctime.Hours / 10 ],
                              0xff9c00,
                              0x1a1100);
          DisClockbuff.drawColorBitmap(posx[1],26,24,42,
                              DigNumber[ sytState.Rtctime.Hours % 10 ],
                              0xff9c00,
                              0x1a1100);
          DisClockbuff.drawColorBitmap(posx[2],26,24,42,
                              DigNumber[ sytState.Rtctime.Minutes / 10 ],
                              0xff9c00,
                              0x1a1100);
          DisClockbuff.drawColorBitmap(posx[3],26,24,42,
                              DigNumber[ sytState.Rtctime.Minutes % 10 ],
                              0xff9c00,
                              0x1a1100);
          DisClockbuff.drawColorBitmap(posx[4],33,18,35,
                              DigNumber_35px[ sytState.Rtctime.Seconds / 10 ],
                              0xff9c00,
                              0x1a1100);
          DisClockbuff.drawColorBitmap(posx[5],33,18,35,
                              DigNumber_35px[ sytState.Rtctime.Seconds % 10 ],
                              0xff9c00,
                              0x1a1100);
          
          sytState.clockCount ++;
          sytState.clockCount %= 6;
      
          // this i don't know what it's for
          DisClockbuff.drawColorBitmap(0,0,164,17,
                                  rectptrBuff[sytState.clockCount],
                                  0xff9c00,
                                  0x000000);
      
          // maybe this code will actually display the created image?
          DisClockbuff.pushSprite(72,4);
      }
      

      And yes, i know there is some more code for Image representation needed. I've added this to ask how it's working.

      First i tried to remove a single digit. Then i registered that the code won't run on the device.
      Can somebody please explain how this code is working?
      Why can't i remove a single digit?
      What is the minimum requirement to draw a single digit?

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post