-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kurze Frage / short Question #509
Comments
Hallo Maik There are multiple ways to solve this problem. Here is one suggestion:
char msg[32];
void onIasUsChange(char* newValue) {
strncpy(msg, newValue, 32);
msg[31] = '\0';
} Then later, do something like this: void loop(void) {
DcsBios::loop();
// picture loop
u8g.setFont(u8g_font_unifont);
u8g.firstPage();
do {
u8g2.drawStr(0, 22, msg);
} while (u8g.nextPage());
} I do not exactly know the ::loop function, but maybe the following might improve reaction time for DcsBios: void loop(void) {
DcsBios::loop();
u8g.setFont(u8g_font_unifont);
u8g.firstPage();
do {
DcsBios::loop();
u8g2.drawStr(0, 22, msg);
} while (u8g.nextPage());
} |
Hey Oli, it works exactly the way you showed! Big thanks to you for sharing your knowledge! I owe you some beer |
Okay Oli, the programming got me another time.
Okay, this time I got another datacall which seems to be an integer output. I am looking if there is any other surprise datatype. no... "unsigned int" is common, "char" is rare. How do I get this into the draw loop? |
The msg[32] only was a example. You can use any data. unsigned int n;
void onAltMslFtChange(unsigned int* newValue) {
n = newValue;
} Then later, do something like this: void loop(void) {
DcsBios::loop();
// picture loop
u8g.setFont(u8g_font_unifont);
u8g.firstPage();
do {
DcsBios::loop();
u8g2.setCursorPos(0,22);
u8g2.print(x);
} while (u8g.nextPage());
} |
hey ho, I got it,
don´t work. After studying the u8g wiki I used Thank you oli. I swear I read the fucking manual first next time, but I feared of having no basic knowledge of c programming. |
Maybe my mistake. I do not support u8g any more, instead u8g2 is out since several years and I guess I changed the function name here.. |
Grüß dich Oli,
I am a greenhorn in Arduino and programming. Hours of hard testing I then finally got it. A teensy 3.2 board runs the "Hello World" sketch on a Nokia 5110 display. Now to the point. The task is to join two functions: To draw with u8glib to the display data from another library by getting these data with a function.
function of the other library (DcsBios.h) for example is this:
Background: Its a flight simulator (DCS World) and the DcsBios.h reads data from the sim and I want to show parts of this data from the sim on the display. The above showed code calls the indicated airspeed from the sim.
So here is the conflict. The u8glib starts drawing by:
void draw(void) {
I am not able to integrate the two functions to work with. My first intention dont work:
This function calls the value of the indicated airspeed to "newValue" and u8g should print the value at 0, 22. On column 40 starts the text to indicate the value as knots per hour indicated airspeed.
An alternate and the full code also does not work:
Can anyone support with his magic?
thanks in advance
Maik
The text was updated successfully, but these errors were encountered: