ok @SmashedTransistors so what i did is hack your OLED object, currently ignores modes and all text stuff and just copies 128 bytes for each of the 8 pages, from an objref "t" array that now is [8][128]. then i started doing some basic pixel routines so you can manipulate them in a normal [128,64] pixel adressing. stole a line algorithm from adafruit, somewhat working. i'll post code snippets later in casee someone wants to investige further. it's really quick and dirty though and i am sure very inefficiently written. no overflow protection or whatever. memory use should remain at 1kB though.
main Thread (reduced the thdSleep from iirc 32 to 4 for smooth updates, tradeoff probably more audio glitches, less cpu left). might need a double buffer or some syncing to avoid the current screen tearing when OLED gets updated while buffer changes are happening.
msg_t ThreadX2()
{
setup();
while (!chThdShouldTerminate()) {
if(!disable){
for(int i = 0; i < 8; i++){
memcpy(tY, &attr_scope.t[i][0],128);
sendPage(i);
}
}
chThdSleepMilliseconds(4);
}
chThdExit((msg_t)0);
}
and for the sendPage i just ripped out all the text/scope/mode stuff and again just copied memory from temp buffer to tx buffer (i guess one could avoid the temp buffer with this method altogether since all actual rendering has to happen somewhere else anyways haha. saves 128B memory.
void sendPage(int page){
i2cAcquireBus(&I2CD1);
//prepare transmission to the "page"
cmd(COLUMNADDR, 0, 127); // Column start end
cmd(PAGEADDR, page, page); // Page start end
if(attr_type == 1106){
cmd(0xB0 + page);//set page address
cmd(2 & 0xf);//set lower column address
cmd(0x10 | (2 >> 4));//set higher column address
}
i2cReleaseBus(&I2CD1);
//
memcpy(txbuf, tY, 128);
//
//transmit the page
txbuf[0] = 0x40;
i2cAcquireBus(&I2CD1);
i2cMasterTransmitTimeout(&I2CD1, attr_I2CADDR, txbuf, 129, rxbuf, 0, 30);
i2cReleaseBus(&I2CD1);
}
.
temporary gfx code. forum software blockquote sucks for spacing. that being said, i wish the axo patcher had an auto-format function.
uint8_t t[8][128];
//
void clearDisplay (void){
for (int i=0; i<8; i++){
for (int j=0; j<128; j++){
t[i][j]=0b00000000;
}
}
}
//
void writePixel (uint8_t x, uint8_t y){
uint8_t ppage = y>>3;
uint8_t prow = y & 0b00000111;
//LogTextMessage("page %d - row %d", ppage, prow);
t[ppage][x] += (1<<prow);
}
all this being said and done i agree 100% that any more elaborate GFX/UI tasks are better offloaded to an external teensy or whatever MCU, and not hog your precious DSP board with that.