@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 });
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@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.