Paul__B:
Well, many or most of us are not enthusiastic about ferreting through your repository to find the code. How about citing it here (I know you know how to - is it what you posted here)?
I am sure you could - and should - thread the display code, it just means you have to unwind the library yourself and turn it into a state machine using only the individual I2C calls.
Thank you for your positive critic. I didn't want to quote my source code because i thought there is no specific problem with the source code. I need some general advice, because i searched a lot about threading display output on an arduino but i couldn't find any general explanation on how to do it.
So based on you answer i think there is no threading solution on one arduino.
Could you please explain me what do you mean by state machine? I am currently only updating the display if an update is neccessary.
void refreshDisplayValues() {
if (updateDisplay == true) {
updateDisplay = false;
u8g.firstPage();
do {
u8g.setFont(u8g_font_6x10);
u8g.setPrintPos(0, 10);
u8g.print(teams[currentTeam].name);
String temp = markers[currentMarker].name;
u8g.setFont(u8g_font_5x7);
u8g.drawStr(6, 25, F("Charges"));
u8g.drawStr(78, 25, F("Energy"));
u8g.setPrintPos((128 - ((temp.length() * 6) + 1)), 10);
u8g.print(temp);
u8g.drawStr(34, 62, F("Hit by "));
u8g.setPrintPos(69, 62);
u8g.print(hitByName);
u8g.setFont(u8g_font_9x15);
if (markers[currentMarker].type == 'P') {
u8g.setPrintPos(14, 38);
u8g.print("o");
u8g.setPrintPos(21, 38);
u8g.print("o");
} else {
u8g.setPrintPos(0, 38);
u8g.print(currentCharge);
u8g.drawStr(18, 38, "/");
u8g.setPrintPos(27, 38);
u8g.print(markers[currentMarker].charges);
}
u8g.setPrintPos(60, 38);
u8g.print(currentEnergy);
u8g.setPrintPos(87, 38);
u8g.print("/120");
} while (u8g.nextPage());
}
}
Grumpy_Mike:
That chip can take I2C at 400KHz so you can up the speed of that interface for a 4 times speed up.
You could also use the SPI interface and that would be even faster.
Thank you for your answer, thats a really good hint. I wasn't aware that i am able to speed up the i2c connction. I will have a closer look at the u8glib and if it possible with my current setup.
Cheers
regnets