Can't display converted image to SSD1306.

Posted on
  • Hello,

    I'm totally newbies with Espruino and i'm trying to display my converted image on my SSD1306 but no success.

    I tryed several times but it don't work.

    This my code :

    var mylogo = {
      width : 34, height : 38, bpp : 1,
      transparent : 1,
      palette : new Uint16Array([65535,65535]),
      buffer : E.toArrayBuffer(atob("//4f////A////4B///­/AD///4AH///AAP//wAAP/gAAAB4AECABAAQIAAA­CAQAAA4BwAAHADgAAcAOAIDgAcBgODBwHB4MDg8H­AwODwcHg4PBgeBg8GAAGDwQAAIOBAAAgYAAAABAA­f4AAAD/wAAAP/AAAA/8AAAE/IAIAAAAB4AAAAf/A­AA///AAP//+AB///8AP///4B////wP////h//w")­)
    };
    
      function LogoDisplay(){
        if (!display) {
          NumControl();
          return;
        }
        var x1x2 = 1;
        g.clear();
        g.drawImage(mylogo, 15, 15);
        g.flip();
        var preloader = setInterval(function () {
          g.setContrast(x1x2);
          g.drawLine(x1x2, 50, x1x2, 60);
          x1x2 += 2;
          g.drawLine(x1x2, 50, x1x2, 60);
          x1x2 += 2;
          g.drawLine(x1x2, 50, x1x2, 60);
          x1x2 += 2;
          g.drawLine(x1x2, 50, x1x2, 60);
          x1x2 += 2;
          g.drawLine(x1x2, 50, x1x2, 60);
          x1x2 += 2;
          g.drawLine(x1x2, 50, x1x2, 60);
          x1x2 += 2;
          g.flip();
          if (x1x2 > 126) {
            clearInterval(preloader);
            NumControl();
            StartDisplay();
            wifiConnect();
          }
        }, 10);
      }
    

    Someone to help me please?

    EDIT: My board is R1 32 Espruino

  • Sun 2021.08.08

    Has an attempt been made using a proven tutorial example to rule out whether we are dealing with a buffer creation issue, an atob() data conversion issue or the actual comm with the SSD1306?

    http://www.espruino.com/Graphics

    See the 8x8 pixel smiley face example below heading 'Images / Bitmaps'

    What are the results of that proven example?

  • Hey @Robin

    Thank you for your help, but exactly same result!

    Nothing... the smiley face don't appear!

    Just for your informations, i use the 1V95 of Espruino firmware because the code that i use isn't updated to work with the last firmware.

  • Although I haven't given this a go, as a S.W.A.G. guess, (Silly Wild Arse Guess) @BullzLabz

    Are any errors thrown (missed bubbling up) if placing your code inside a try/catch block? L8a and L38a

    That Uint16Array declaration L4 may be too large for the device memory capacity.

    http://www.espruino.com/Reference#Uint16­Array



    Have any of the tutorial examples yielded any success? e.g. has anything (ex: text) been able to be displayed?

    If not, then maybe a wiring issue? Let's rule this one out.



    Might be of use in future reference

    http://www.espruino.com/Image+Converter

  • Is that code block post 1 the entire project? Although defined, I'm not seeing a call to LogoDisplay()

  • With my first test, the image was successfully converted using the Espruino converter!

    Otherwise, yes, everything else displays fine, there is static text and dynamic text which displays fine.

    For the moment, I have just replaced this image with a simple text and everything works very well!

    Here is the screenshot of error!

    PS: I'll upload the full code later


    1 Attachment

    • Capture d’écran 2021-08-09 005950.png
  • And this is my board :

    ESP32-D0WDQ6 (revision 1)
    Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
    Crystal is 40MHz
    MAC: xxxxxxxx
    
  • Mon 2021.08.09

    From post #1 'EDIT: My board is R1 32 Espruino'

    There is a mention of an R1 32 board and software ver 1v95

    @BullzLabz I'm not in sync with what is meant by R1 here. Would you mind posting the results of process.env and process.memory() so that we may better visualize your board environment. Seeking memory availability confirmation with that version of Espruino.

    http://www.espruino.com/Reference#l_proc­ess_env

  • Hi @Robin

    For the process.memory :

    "free": 983, "usage": 4017, "total": 5000, "history": 33, "gc": 45, "gctime": 2.454
    

    For the process.env :

    BOARD: ESP32
    CHIP: ESP32
    CHIP_FAMILY:ESP32
    FLASH:0
    RAM: 524288
    
  • I tried a different ways for display my image, with a custom font, and the result is the same !! Don't work ! Grrr

     function LogoDisplay(){
        if (!display) {
          NumControl();
          return;
        }
        var x1x2 = 1;
        g.clear();
        var font = atob("AAAAfgH+/gH//nn//nn/8HgP8HgP//////­//////f//+AAAAAAAAf//+////////////8HgP8H­gP/n///n///n//fj/+AAAAAAAAf//+//////////­//8AAP8AAP////////////f//+AAAAAAAA//////­//////////AAAPAAAPAAAPAAAAAAAAAeH+A+P/B+­f/B+f/B48PB48OB///B///A///Af//AAAAAAAA//­//////////////A4AOB4APB///B///B///A//+AA­AAAAAAB4APB4B/B4H/B4f/B7//B//PB/8PB/wPB+­APAAAAAAAAAAAAAAAAAAAA");
        g.setFontCustom(font, 49, 12, 24);
        
        g.drawRect(22, 4, 107, 43);
        g.drawString("123", 25, 8);
        g.drawString("4567", 61, 16);
        g.drawLine(26, 34, 59, 34);
        g.drawLine(26, 35, 59, 35);
        g.drawLine(26, 36, 59, 36);
        g.drawLine(26, 37, 59, 37);
        g.drawLine(26, 38, 59, 38);
        g.drawLine(26, 39, 59, 39);
        g.flip();
        var preloader = setInterval(function () {
          g.setContrast(x1x2);
          g.drawLine(x1x2, 48, x1x2, 58);
          x1x2 += 2;
          g.drawLine(x1x2, 48, x1x2, 58);
          x1x2 += 2;
          g.drawLine(x1x2, 48, x1x2, 58);
          x1x2 += 2;
          g.drawLine(x1x2, 48, x1x2, 58);
          x1x2 += 2;
          g.drawLine(x1x2, 48, x1x2, 58);
          x1x2 += 2;
          g.drawLine(x1x2, 48, x1x2, 58);
          x1x2 += 2;
          g.flip();
          if (x1x2 > 126) {
            clearInterval(preloader);
            NumControl();
            StartDisplay();
            wifiConnect();
          }
        }, 10);
      }
    
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Can't display converted image to SSD1306.

Posted by Avatar for BullzLabz @BullzLabz

Actions