Avatar for DamianMontero

DamianMontero

Member since Jun 2019 • Last active Nov 2019
  • 5 conversations
  • 36 comments

Javascript developer since I was in my 20's and that was a LOOOOONG time ago

Most recent activity

  • in General
    Avatar for DamianMontero

    I was going to help with the drivers for ST7735 and ST7789V but in searching I see that they're referenced in the "Build config" python code.

    Does Espruino have built in support for these (and all the other) LCD screens?
    https://github.com/espruino/Espruino/blo­b/master/scripts/build_platform_config.p­y#L382

    Any advice on how to use it? I'd like to show off some code?

  • Avatar for DamianMontero

    It's a node version thing. You can see the error is deprication.
    With node it's simple to move to different versions to try. On Mac/Linux use the "n" on windows use "nvm "

    it's common to have to switch versions and if that's all your running then the right version fixes all problems.

    Switch to 6.0

  • in Projects
    Avatar for DamianMontero

    I hate to be one of those... But unless it's a excersize, this solution could be more easily done with a simply raspberry pi (and old one you have lying around somewhere) and the old monitor you think is too small for your computer:

    https://www.instructables.com/id/Raspber­ry-Pi-Wall-Mounted-Google-Calendar/

    Should you insist. I'd suggest having your own API endpoint that your espruino hits and you do all the heavy lifting on a serverless/azure functions/lambda solution hosted somewhere for free:

    https://developers.google.com/calendar/v­3/reference/calendarList/get#examples

  • in ESP8266
    Avatar for DamianMontero

    @FloSax I think you'll agree then that the post I did last month should be pinned to the top so you would have be able to play with your 8266 without waiting for weeks to get it working:

    http://forum.espruino.com/conversations/­337674/#comment14873571

  • in ESP8266
    Avatar for DamianMontero

    @Gordon
    PR Request for the next version of Espruino as you requested:
    https://github.com/espruino/EspruinoDocs­/pull/522

    EDITED
    Thank you for accepting this PR. It's an honor to be an ant on top of a giant.

  • in ESP8266
    Avatar for DamianMontero

    @fanoush you were (of course) correct. My code looks now like this and works flawlessly.

    I'm going to post a modified version of the SSD1603.js module to github for @gordon with full compatibility with this new resolution as well as the other versions of course.

    var C = {
        OLED_WIDTH                 : 64,
        OLED_CHAR                  : 0x40,
        OLED_CHUNK                 : 128
       };
       
       // commands sent when initialising the display
       var extVcc=false; // if true, don't start charge pump 
       var initCmds = new Uint8Array([
        0xAE, // 0 disp off
        0xD5, // 1 clk div
        0x80, // 2 suggested ratio
        0xA8, 63, // 3 set multiplex, height-1
        0xD3,0x0, // 5 display offset
        0x40, // 7 start line
        0x8D, extVcc?0x10:0x14, // 8 charge pump (need 0x14)
        0x20, 0x00, // 10 memory mode
        0xA1,  // 12 seg remap 1 (screen orientation)
        0xC8, // 13 comscandec () screen orientation change to INC to flip)
        0xDA, 0x12, // 14 set compins, height==64 ? 0x12:0x02,
        0x81, extVcc?0x9F:0xCF, // 16 set contrast //0x8F
        0xD9, extVcc?0x22:0xF1, // 18 set precharge
        0xDB, 0x40, // 20 set vcom detect
        0xA4, // 22 display all on
        0xA6, // 23 display normal (non-inverted)
        0xAF // 24 disp on
    ]);
       // commands sent when sending data to the display
       var flipCmds = [
            0x21, // columns
            0x20,0x5f,
            0x22, // pages
            0,7 /* (height>>3)-1 */];
       function update(options) {
         if (options) {
           if (options.height) {
             initCmds[4] = options.height-1;
             initCmds[15] = options.height==64 || options.height== 48 ? 0x12 : 0x02;
             flipCmds[5] = (options.height>>3)-1;
           }
           if (options.contrast!==undefined) initCmds[17] = options.contrast;
         }
       }
    
    
     
    function start(){
      g.clear();
      g.drawString("Hello",0,0);
      g.drawLine(0, 20, g.getWidth(), 20);
      g.setFontVector(10);
      g.drawString("123456789",0,7);
      g.drawString("123456789",0,22);
      g.drawString("123456789",0,35);
      g.flip();
    }
    
    //D1.Mini OLED 64x48
    let SCL = NodeMCU.D1;
    let SDA = NodeMCU.D2;
    I2C1.setup({scl:SCL,sda:SDA});
    var g = connect(I2C1,start, { height : 48 });  
    

  • in ESP8266
    Avatar for DamianMontero

    1) I've changed the WIDTH to 64 (even tried 128)
    2) changed the line you suggested (which made sense) to 31-94 in hex of course.
    Nothing changed.

    var C = {
        OLED_WIDTH                 : 64,
        OLED_CHAR                  : 0x40,
        OLED_CHUNK                 : 64
       };
       
       // commands sent when initialising the display
       var extVcc=false; // if true, don't start charge pump 
       var initCmds = new Uint8Array([
        0xAE, // 0 disp off
        0xD5, // 1 clk div
        0x80, // 2 suggested ratio
        0xA8, 63, // 3 set multiplex, height-1
        0xD3,0x0, // 5 display offset
        0x40, // 7 start line
        0x8D, extVcc?0x10:0x14, // 8 charge pump (need 0x14)
        0x20, 0x00, // 10 memory mode
        0xA1,  // 12 seg remap 1 (screen orientation)
        0xC8, // 13 comscandec () screen orientation change to INC to flip)
        0xDA, 0x12, // 14 set compins, height==64 ? 0x12:0x02,
        0x81, extVcc?0x9F:0xCF, // 16 set contrast //0x8F
        0xD9, extVcc?0x22:0xF1, // 18 set precharge
        0xDB, 0x40, // 20 set vcom detect
        0xA4, // 22 display all on
        0xA6, // 23 display normal (non-inverted)
        0xAF // 24 disp on
    ]);
       // commands sent when sending data to the display
       var flipCmds = [
            0x21, // columns
            0x20, 0x62,
            0x22, // pages
            0,6 /* (height>>3)-1 */];
       function update(options) {
         if (options) {
           if (options.height) {
             initCmds[4] = options.height-1;
             initCmds[15] = options.height==64 || options.height== 48 ? 0x12 : 0x02;
             flipCmds[5] = (options.height>>3)-1;
           }
           if (options.contrast!==undefined) initCmds[17] = options.contrast;
         }
       }
       
       
       connect = function(i2c, callback, options) {
         update(options);
         var oled = Graphics.createArrayBuffer(C.OLED_WIDTH,­initCmds[4]+1,1,{vertical_byte : true});
       
         var addr = 0x3C;
         if(options) {
           if (options.address) addr = options.address;  
           // reset display if 'rst' is part of options 
           if (options.rst) digitalPulse(options.rst, 0, 10); 
         }
         
         setTimeout(function() {
           // configure the OLED
           initCmds.forEach(function(d) {i2c.writeTo(addr, [0,d]);});
         }, 50);
       
         // if there is a callback, call it now(ish)
         if (callback !== undefined) setTimeout(callback, 100);
       
         // write to the screen
         oled.flip = function() { 
           // set how the data is to be sent (whole screen)
           flipCmds.forEach(function(d) {i2c.writeTo(addr, [0,d]);});
           var chunk = new Uint8Array(C.OLED_CHUNK+1);
       
           chunk[0] = C.OLED_CHAR;
           for (var p=0; p<this.buffer.length; p+=C.OLED_CHUNK) {
             chunk.set(new Uint8Array(this.buffer,p,C.OLED_CHUNK), 1);
             i2c.writeTo(addr, chunk);
           } 
         };
       
         // set contrast, 0..255
         oled.setContrast = function(c) { i2c.writeTo(addr, 0, 0x81, c); };
       
         // set off
         oled.off = function() { i2c.writeTo(addr, 0, 0xAE); };
       
         // set on
         oled.on = function() { i2c.writeTo(addr, 0, 0xAF); };
       
         // return graphics
         return oled;
       };
    
    
    
    function start(){
      g.clear();
      g.drawString("Hello",0,0);
      g.drawLine(0, 20, g.getWidth(), 20);
      g.setFontVector(10);
      g.drawString("123456789",0,7);
      g.drawString("123456789",0,22);
      g.drawString("123456789",0,35);
      g.flip();
    }
    // HELTEC 128x32
    /*
    let SCL = D5;
    let SDA = D4;
    I2C1.setup({scl:SCL,sda:SDA});
    var g = require("SSD1306").connect(I2C1, start, { height : 32 });
    */
    //D1.Mini OLED 64x48
    let SCL = NodeMCU.D1;
    let SDA = NodeMCU.D2;
    I2C1.setup({scl:SCL,sda:SDA});
    var g = connect(I2C1,start, { height : 48 });
    
  • in ESP8266
    Avatar for DamianMontero

    @fanoush
    You explained this very well.
    I made the changes and I'm experiencing a shifting every couple of pixels.
    Any advice?

Actions