Most recent activity
-
Sorry, yes, you're right about initCmds[4].
I didn't work at the time. But I just plugged in the board this morning and it worked. So I don't know what was wrong before...probably user error ;) I don't know if I didn't save() before but I've reloaded the code (using the Github module) to the pico and it I can confirm it works! :) Thanks Gordon!
-
ahh...yes... I thought I must have missed something crucial! :)
function update(options) { if (options && options.height) { initCmds[4] = options.height-1; initCmds[15] = options.height==64 ? 0x12 : 0x02; flipCmds[5] = (options.height>>3)-1; } }
Line 3 should be:
initCmds[3] = options.height-1;
...and won't that break backwards-compatibility? I think if no options are set you should create one and default in options.height = 64.
-
That doesn't work I'm afraid:
var initCmds = new Uint8Array([ 0xAe, // 0 disp off 0xD5, // 1 clk div 0x80, // 2 suggested ratio 0xA8, 0, // 3 set multiplex, height-1 0xD3,0x0, // 5 display offset 0x40, // 7 start line 0x8D, extVcc?0x10:0x14, // 8 charge pump 0x20,0x0, // 10 memory mode 0xA1, // 12 seg remap 1 0xC8, // 13 comscandec 0xDA, 0x12, // 14 set compins, height==64 ? 0x12:0x02, 0x81, extVcc?0x9F:0xCF, // 16 set contrast 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 ]);
Line 5 should be the height-1 and line 12 is hardcoded to 0x12 (should be 0x02 for 32 lines) .
// commands sent when sending data to the display var flipCmds = [ 0x21, // columns 0, C.OLED_WIDTH-1, 0x22, // pages 0, 7];
Line 6 should be 3 for 32 lines and 7 for 64.
exports.connectSPI = function(spi, dc, rst, callback, options) { update(options); var cs = options?options.cs:undefined; var oled = Graphics.createArrayBuffer(C.OLED_WIDTH,C.OLED_HEIGHT,1,{vertical_byte : true});
This code does not take into account a height set in the options.
-
Yes, Adafruit's BMP183 sensor - the existing BMP085/BMP180 module is of course I2C. I have modified the existing module to use SPI but I haven't tested it and the display at the same time yet. At some point I will create a "BMP183" module for it.
-
Almost! You should also change the page max in flipCmds from 7 to 3 (but if you're just sending a 128x32 buffer then it still displays ok):
var initCmds = new Uint8Array([ 0xAe, // disp off 0xD5, // clk div 0x80, // suggested ratio 0xA8, C.OLED_HEIGHT-1, 0xD3,0x0, // display offset 0x40, // start line 0x8D,extVcc?0x10:0x14, // charge pump 0x20,0x0, // memory mode 0xA1, // seg remap 1 (use 0xA0 to flip horizontally) 0xC8, // comscandec (use 0xC0 to flip vertically) 0xDA, (C.OLED_HEIGHT==64)?0x12:0x02, 0x81,extVcc?0x9F:0xCF, // set contrast 0xD9,extVcc?0x22:0xF1, // set precharge 0xDb,0x40, // set vcom detect 0xA4, // display all on 0xA6, // display normal (non-inverted) 0xAf // disp on ]); var flipCmds = [0x21, // columns 0, C.OLED_WIDTH-1, 0x22, // pages 0, (C.OLED_HEIGHT==64)?0x7:0x03];
The only other issue I had with the module was a lack of support for a CS pin. Adding that would be nice.
-
In case there are others who (like me) got stumped by this these settings worked for me by referencing the arduino code @Gordon refers to above (thanks Gordon!)
var initCmds = new Uint8Array([ 0xAe, // disp off 0xD5, // clk div 0x80, // suggested ratio 0xA8, 0x1F, // set multiplex: 0x1F for 128x32, 0x3F for 128x64 0xD3,0x0, // display offset 0x40, // start line 0x8D,extVcc?0x10:0x14, // charge pump 0x20,0x0, // memory mode 0xA1, // seg remap 1 0xC8, // comscandec 0xDA,0x02, // set compins - use 0x12 for 128x64 0x81,extVcc?0x9F:0xCF, // set contrast 0xD9,extVcc?0x22:0xF1, // set precharge 0xDb,0x40, // set vcom detect 0xA4, // display all on 0xA6, // display normal (non-inverted) 0xAf // disp on ]);
-
-
-
On the subject of "ghost code" make sure you haven't created a reset function. I accidentally did this and then new code downloads were not replacing the code on the pico but adding to it!
I have also been experiencing some different behaviour on battery. A fairly simple blinking light program is running significantly faster on 4xAAA than on USB and on a CR2032 (for which the timing seems to be ok). Is that to be expected?
Happy to help!
I think my issue before was that I was maybe trying to write to the display too soon. The display's datasheet (page 15) mentions a 100ms delay in the power-up sequence. The breakout board has only a VIN which I guess is attached to both VCC and VDD. So I can't attach VCC 100ms after VDD.
With further testing I intermittently had the screen not turn on. While it looked like the connectSPI() completed (I switch off LED1/2 in the callback) nothing displayed. When it didn't work no commands I sent over SPI and operations on "g" seemed to get it to display.
By doing a setTimeout() with a 100ms delay before initialising the display I seem to have got around the issue - I've tested it about 30 times and I haven't had a failure to get the display to work.