Middlefart Posted January 10, 2020 Author Share Posted January 10, 2020 I haven’t forgotten about this. I’ve just ignored it I need to put together a sketch that can be run on an Arduino and an oled without all my extra stuff. Will try to fix it this weekend. Link to comment Share on other sites More sharing options...
lesthegrngo Posted January 11, 2020 Share Posted January 11, 2020 (edited) I have to say that you are going to be doing exactly what I planned to do, so I am pulling up a chair! After the success with the 5" CDU, little details like this make all the difference. I have three different OLED displays, for the altitude and pressure, like you have, plus the fuel quantity indication. I don’t suppose you could share the altimeter OLED sketch could you? Cheers, and nice job! Les Edited January 11, 2020 by lesthegrngo Link to comment Share on other sites More sharing options...
lesthegrngo Posted January 18, 2020 Share Posted January 18, 2020 I have managed to get the OLED's working, however they don't look as good as what you have in your video - the way you have the text scrolling looks much better than my effort. How did you manage to get it to scroll so well? Cheers Les Link to comment Share on other sites More sharing options...
SteenosMT Posted February 1, 2020 Share Posted February 1, 2020 And here is the PCB for the Master, Arduino Mega [ATTACH]216898[/ATTACH] [ATTACH]216899[/ATTACH] Does that PCB have a max487 for the networking? Nice job. Wish I had your brain :) Link to comment Share on other sites More sharing options...
Middlefart Posted February 1, 2020 Author Share Posted February 1, 2020 Have forgotten about the OLED-sketch. Sorry! Will try to fix it tomorrow and share it. Link to comment Share on other sites More sharing options...
Middlefart Posted February 1, 2020 Author Share Posted February 1, 2020 Does that PCB have a max487 for the networking? Nice job. Wish I had your brain :) Yes it does. Thanks! But it isn’t hard. Just take your time and learn on the way. That’s what I do. Link to comment Share on other sites More sharing options...
Middlefart Posted February 1, 2020 Author Share Posted February 1, 2020 I have started to put together a sketch that I can share but I have a strange problem with the values from DCS jumping all over the place. Have to look at it tomorrow. Link to comment Share on other sites More sharing options...
Middlefart Posted February 1, 2020 Author Share Posted February 1, 2020 (edited) I couldn't go to sleep before I fixed the problem :) Finally got it working! To create the characters i wrote a C# program that analysed a bitmap of the digits with font MS 33558 and generated the char array in characters.h :thumbup: Below are the two files needed for the sketch. There are some comments in it but most of it is uncommented. Sorry :music_whistling: characters.h static const unsigned char PROGMEM c24_0[] = { B00000000, B00111100, B00000000, B00000000, B11111111, B00000000, B00000001, B11111111, B10000000, B00000011, B11111111, B11000000, B00000111, B11111111, B11100000, B00000111, B11000011, B11100000, B00001111, B10000001, B11110000, B00001111, B10000001, B11110000, B00011111, B00000000, B11111000, B00011111, B00000000, B11111000, B00011110, B00000000, B01111000, B00011110, B00000000, B01111000, B00111110, B00000000, B01111100, B00111110, B00000000, B01111100, B00111110, B00000000, B01111100, B00111110, B00000000, B01111100, B00111110, B00000000, B01111100, B00111110, B00000000, B01111100, B00111110, B00000000, B01111100, B00111110, B00000000, B01111100, B00011110, B00000000, B01111000, B00011110, B00000000, B01111000, B00011111, B00000000, B11111000, B00011111, B00000000, B11111000, B00001111, B10000001, B11110000, B00001111, B10000001, B11110000, B00000111, B11000011, B11100000, B00000111, B11111111, B11100000, B00000011, B11111111, B11000000, B00000001, B11111111, B10000000, B00000000, B11111111, B00000000, B00000000, B00111100, B00000000}; static const unsigned char PROGMEM c24_1[] = { B00000000, B00111000, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B00111000, B00000000}; static const unsigned char PROGMEM c24_2[] = { B00000000, B01111111, B10000000, B00000001, B11111111, B11100000, B00000011, B11111111, B11110000, B00000111, B11111111, B11111000, B00000111, B11110011, B11111000, B00001111, B11000000, B11111000, B00001111, B10000000, B01111100, B00001111, B10000000, B01111100, B00001111, B10000000, B01111100, B00001111, B10000000, B01111100, B00000111, B00000000, B01111100, B00000000, B00000000, B11111000, B00000000, B00000001, B11111000, B00000000, B00000011, B11110000, B00000000, B00001111, B11100000, B00000000, B00111111, B11000000, B00000000, B01111111, B10000000, B00000000, B11111111, B00000000, B00000001, B11111100, B00000000, B00000011, B11110000, B00000000, B00000111, B11100000, B00000000, B00000111, B11000000, B00000000, B00001111, B11000000, B00000000, B00001111, B10000000, B00000000, B00011111, B00000000, B00000000, B00011111, B00000000, B00000000, B00011110, B00000000, B00000000, B00111111, B11111111, B11111000, B00111111, B11111111, B11111100, B00111111, B11111111, B11111100, B00111111, B11111111, B11111100, B00011111, B11111111, B11111000}; static const unsigned char PROGMEM c24_3[] = { B00001111, B11111111, B11100000, B00011111, B11111111, B11110000, B00011111, B11111111, B11110000, B00001111, B11111111, B11100000, B00000000, B00001111, B11100000, B00000000, B00001111, B11000000, B00000000, B00011111, B10000000, B00000000, B00111111, B00000000, B00000000, B00111110, B00000000, B00000000, B01111110, B00000000, B00000000, B11111100, B00000000, B00000001, B11111111, B00000000, B00000001, B11111111, B10000000, B00000001, B11111111, B11100000, B00000001, B11111111, B11110000, B00000000, B00000011, B11110000, B00000000, B00000001, B11111000, B00000000, B00000000, B11111000, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B00111100, B00111100, B00000000, B00111100, B00111100, B00000000, B01111100, B00111110, B00000000, B01111100, B00111110, B00000000, B01111100, B00011111, B00000000, B11111000, B00011111, B10000001, B11111000, B00001111, B11100111, B11110000, B00000111, B11111111, B11100000, B00000011, B11111111, B11000000, B00000001, B11111111, B10000000, B00000000, B01111110, B00000000}; static const unsigned char PROGMEM c24_4[] = { B00000000, B01110000, B00000000, B00000000, B11111000, B00000000, B00000000, B11111000, B00000000, B00000001, B11111000, B00000000, B00000001, B11111000, B00000000, B00000001, B11110000, B00000000, B00000011, B11110000, B00000000, B00000011, B11110000, B00000000, B00000011, B11100000, B00000000, B00000111, B11100000, B00000000, B00000111, B11100000, B00000000, B00000111, B11000000, B00000000, B00000111, B11000000, B00000000, B00001111, B11000011, B10000000, B00001111, B10000111, B11000000, B00001111, B10000111, B11000000, B00011111, B10000111, B11000000, B00011111, B00000111, B11000000, B00011111, B00000111, B11000000, B00111111, B00000111, B11000000, B00111110, B00000111, B11000000, B00111110, B00000111, B11000000, B01111111, B11111111, B11111100, B01111111, B11111111, B11111110, B01111111, B11111111, B11111110, B01111111, B11111111, B11111110, B00111111, B11111111, B11111100, B00000000, B00000111, B11000000, B00000000, B00000111, B11000000, B00000000, B00000111, B11000000, B00000000, B00000111, B11000000, B00000000, B00000011, B10000000}; static const unsigned char PROGMEM c24_5[] = { B00001111, B11111111, B10000000, B00011111, B11111111, B11000000, B00011111, B11111111, B11000000, B00011111, B11111111, B11000000, B00011111, B11111111, B10000000, B00011111, B00000000, B00000000, B00011111, B00000000, B00000000, B00011111, B00000000, B00000000, B00011111, B00000000, B00000000, B00011111, B00000000, B00000000, B00011111, B00000000, B00000000, B00011111, B11111110, B00000000, B00011111, B11111111, B10000000, B00011111, B11111111, B11000000, B00011111, B11111111, B11100000, B00011111, B10000111, B11110000, B00001110, B00000001, B11111000, B00000000, B00000000, B11111000, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B00111100, B00000000, B00000000, B00111100, B00000000, B00000000, B00111100, B00000000, B00000000, B01111100, B00011000, B00000000, B01111100, B00111100, B00000000, B11111000, B00111111, B00000001, B11111000, B00111111, B11000111, B11110000, B00011111, B11111111, B11100000, B00001111, B11111111, B11000000, B00000011, B11111111, B10000000, B00000000, B11111110, B00000000}; static const unsigned char PROGMEM c24_6[] = { B00000000, B00000111, B00000000, B00000000, B00001111, B10000000, B00000000, B00011111, B10000000, B00000000, B00111111, B00000000, B00000000, B01111110, B00000000, B00000000, B11111100, B00000000, B00000001, B11111000, B00000000, B00000011, B11110000, B00000000, B00000111, B11100000, B00000000, B00000111, B11000000, B00000000, B00001111, B10000000, B00000000, B00001111, B11111110, B00000000, B00011111, B11111111, B10000000, B00011111, B11111111, B11000000, B00111111, B11111111, B11100000, B00111111, B11000111, B11110000, B00111111, B00000001, B11111000, B01111110, B00000000, B11111000, B01111100, B00000000, B01111100, B01111100, B00000000, B01111100, B01111000, B00000000, B00111100, B01111000, B00000000, B00111100, B01111000, B00000000, B00111100, B01111100, B00000000, B01111100, B01111100, B00000000, B01111100, B00111110, B00000000, B11111000, B00111111, B00000001, B11111000, B00011111, B11000111, B11110000, B00001111, B11111111, B11100000, B00000111, B11111111, B11000000, B00000011, B11111111, B10000000, B00000000, B11111110, B00000000}; static const unsigned char PROGMEM c24_7[] = { B00001111, B11111111, B11110000, B00011111, B11111111, B11111000, B00011111, B11111111, B11111000, B00011111, B11111111, B11111000, B00001111, B11111111, B11111000, B00000000, B00000001, B11110000, B00000000, B00000001, B11110000, B00000000, B00000011, B11110000, B00000000, B00000011, B11100000, B00000000, B00000011, B11100000, B00000000, B00000111, B11100000, B00000000, B00000111, B11000000, B00000000, B00000111, B11000000, B00000000, B00001111, B11000000, B00000000, B00001111, B10000000, B00000000, B00001111, B10000000, B00000000, B00011111, B10000000, B00000000, B00011111, B00000000, B00000000, B00011111, B00000000, B00000000, B00111111, B00000000, B00000000, B00111110, B00000000, B00000000, B00111110, B00000000, B00000000, B01111110, B00000000, B00000000, B01111100, B00000000, B00000000, B01111100, B00000000, B00000000, B11111100, B00000000, B00000000, B11111000, B00000000, B00000000, B11111000, B00000000, B00000001, B11111000, B00000000, B00000001, B11110000, B00000000, B00000001, B11110000, B00000000, B00000000, B11100000, B00000000}; static const unsigned char PROGMEM c24_8[] = { B00000000, B01111110, B00000000, B00000001, B11111111, B10000000, B00000011, B11111111, B11000000, B00000111, B11111111, B11100000, B00001111, B11100111, B11110000, B00001111, B10000001, B11110000, B00011111, B00000000, B11111000, B00011111, B00000000, B11111000, B00011110, B00000000, B01111000, B00011110, B00000000, B01111000, B00011111, B00000000, B11111000, B00011111, B00000000, B11111000, B00001111, B10000001, B11110000, B00001111, B11100111, B11110000, B00000111, B11111111, B11100000, B00000011, B11111111, B11000000, B00000011, B11111111, B11000000, B00000111, B11111111, B11100000, B00001111, B11100111, B11110000, B00001111, B10000001, B11110000, B00011111, B00000000, B11111000, B00011111, B00000000, B11111000, B00011110, B00000000, B01111000, B00011110, B00000000, B01111000, B00011111, B00000000, B11111000, B00011111, B00000000, B11111000, B00001111, B10000001, B11110000, B00001111, B11100111, B11110000, B00000111, B11111111, B11100000, B00000011, B11111111, B11000000, B00000001, B11111111, B10000000, B00000000, B01111110, B00000000}; static const unsigned char PROGMEM c24_9[] = { B00000000, B11111110, B00000000, B00000011, B11111111, B10000000, B00000111, B11111111, B11000000, B00001111, B11111111, B11100000, B00011111, B11000111, B11110000, B00111111, B00000001, B11111000, B00111110, B00000000, B11111000, B01111100, B00000000, B01111100, B01111100, B00000000, B01111100, B01111000, B00000000, B00111100, B01111000, B00000000, B00111100, B01111000, B00000000, B00111100, B01111100, B00000000, B01111100, B01111100, B00000000, B01111100, B00111110, B00000000, B11111100, B00111111, B00000001, B11111000, B00011111, B11000111, B11111000, B00001111, B11111111, B11110000, B00000111, B11111111, B11110000, B00000011, B11111111, B11100000, B00000000, B11111111, B11100000, B00000000, B00001111, B11000000, B00000000, B00001111, B10000000, B00000000, B00011111, B10000000, B00000000, B00111111, B00000000, B00000000, B11111110, B00000000, B00000001, B11111100, B00000000, B00000111, B11111000, B00000000, B00001111, B11110000, B00000000, B00011111, B11000000, B00000000, B00011111, B10000000, B00000000, B00001110, B00000000, B00000000}; static const unsigned char PROGMEM c24_Empty[] = { B00111000, B00001111, B11000000, B00111100, B00000111, B11100000, B00111110, B00000011, B11110000, B00111111, B00000001, B11111000, B00011111, B10000000, B11111100, B00001111, B11000000, B01111100, B00000111, B11100000, B00111100, B00000011, B11110000, B00011100, B00000001, B11111000, B00001100, B00000000, B11111100, B00000100, B00000000, B01111110, B00000000, B00100000, B00111111, B00000000, B00110000, B00011111, B10000000, B00111000, B00001111, B11000000, B00111100, B00000111, B11100000, B00111110, B00000011, B11110000, B00111111, B00000001, B11111000, B00011111, B10000000, B11111100, B00001111, B11000000, B01111100, B00000111, B11100000, B00111100, B00000011, B11110000, B00011100, B00000001, B11111000, B00001100, B00000000, B11111100, B00000100, B00000000, B01111110, B00000000, B00100000, B00111111, B00000000, B00110000, B00011111, B10000000, B00111000, B00001111, B11000000, B00111100, B00000111, B11100000, B00111110, B00000011, B11110000, B00111111, B00000001, B11111000, B00011111, B10000000, B11111100, B00001111, B11000000, B01111100 }; static const unsigned char PROGMEM c16_0[] = { B00000011, B11000000, B00000111, B11100000, B00001111, B11110000, B00011111, B11111000, B00011110, B01111000, B00111100, B00111100, B00111000, B00011100, B01111000, B00011110, B01110000, B00001110, B01110000, B00001110, B01110000, B00001110, B01110000, B00001110, B01110000, B00001110, B01110000, B00001110, B01110000, B00001110, B01110000, B00001110, B01111000, B00011110, B00111000, B00011100, B00111100, B00111100, B00011110, B01111000, B00011111, B11111000, B00001111, B11110000, B00000111, B11100000, B00000011, B11000000 }; static const unsigned char PROGMEM c16_1[] = { B00000001, B10000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000001, B10000000 }; static const unsigned char PROGMEM c16_2[] = { B00000011, B11110000, B00001111, B11111000, B00011111, B11111100, B00011110, B00111110, B00111100, B00011110, B00111000, B00001111, B00111000, B00001111, B00010000, B00001111, B00000000, B00011110, B00000000, B00111110, B00000000, B01111100, B00000001, B11111000, B00000011, B11110000, B00000111, B11100000, B00001111, B10000000, B00011111, B00000000, B00111110, B00000000, B00111100, B00000000, B01111100, B00000000, B01111000, B00000000, B11111111, B11111100, B11111111, B11111110, B11111111, B11111110, B01111111, B11111100 }; static const unsigned char PROGMEM c16_3[] = { B00111111, B11111000, B01111111, B11111100, B01111111, B11111000, B00111111, B11111000, B00000000, B11110000, B00000001, B11100000, B00000011, B11000000, B00000111, B10000000, B00001111, B11100000, B00001111, B11110000, B00001111, B11111000, B00000000, B01111100, B00000000, B00111100, B00000000, B00011110, B00000000, B00011110, B00000000, B00001110, B11100000, B00001110, B11110000, B00001110, B11110000, B00011110, B01111000, B00111100, B01111100, B01111100, B00111111, B11111000, B00011111, B11110000, B00001111, B11100000 }; static const unsigned char PROGMEM c16_4[] = { B00000001, B10000000, B00000011, B11000000, B00000011, B11000000, B00000111, B11000000, B00000111, B10000000, B00000111, B10000000, B00001111, B10000000, B00001111, B00000000, B00001111, B00000000, B00011111, B00000000, B00011110, B00110000, B00011110, B01111000, B00111110, B01111000, B00111100, B01111000, B00111100, B01111000, B01111100, B01111000, B01111111, B11111110, B01111111, B11111111, B01111111, B11111111, B00111111, B11111110, B00000000, B01111000, B00000000, B01111000, B00000000, B01111000, B00000000, B00110000 }; static const unsigned char PROGMEM c16_5[] = { B00111111, B11100000, B01111111, B11110000, B01111111, B11110000, B01111111, B11100000, B01110000, B00000000, B01110000, B00000000, B01110000, B00000000, B01110000, B00000000, B01111111, B11100000, B01111111, B11110000, B01111111, B11111000, B01111000, B01111100, B00110000, B00111110, B00000000, B00011110, B00000000, B00001110, B00000000, B00001110, B00000000, B00001110, B00000000, B00001110, B01110000, B00011110, B01111000, B00111100, B01111100, B01111100, B00111111, B11111000, B00011111, B11110000, B00001111, B11100000 }; static const unsigned char PROGMEM c16_6[] = { B00000000, B11100000, B00000001, B11110000, B00000011, B11100000, B00000111, B11000000, B00001111, B10000000, B00011111, B00000000, B00011110, B00000000, B00111100, B00000000, B00111111, B11000000, B01111111, B11110000, B01111111, B11111000, B11111100, B01111100, B11111000, B00111100, B11110000, B00011110, B11100000, B00001110, B11100000, B00001110, B11100000, B00001110, B11100000, B00001110, B11110000, B00011110, B01111000, B00111100, B01111100, B01111100, B00111111, B11111000, B00011111, B11110000, B00000111, B11000000 }; static const unsigned char PROGMEM c16_7[] = { B00111111, B11111100, B01111111, B11111110, B01111111, B11111110, B00111111, B11111100, B00000000, B00111100, B00000000, B00111100, B00000000, B01111000, B00000000, B01111000, B00000000, B01111000, B00000000, B11110000, B00000000, B11110000, B00000000, B11110000, B00000001, B11100000, B00000001, B11100000, B00000001, B11100000, B00000011, B11000000, B00000011, B11000000, B00000011, B11000000, B00000111, B10000000, B00000111, B10000000, B00000111, B10000000, B00001111, B00000000, B00001111, B00000000, B00000110, B00000000 }; static const unsigned char PROGMEM c16_8[] = { B00000111, B11100000, B00001111, B11110000, B00011111, B11111000, B00111110, B01111100, B01111000, B00011110, B01111000, B00011110, B01110000, B00001110, B01110000, B00001110, B01111000, B00011110, B00111000, B00011100, B00111110, B01111100, B00011111, B11111000, B00011111, B11111000, B00111110, B01111100, B00111000, B00011100, B01111000, B00011110, B01110000, B00001110, B01110000, B00001110, B01111000, B00011110, B01111000, B00011110, B00111110, B01111100, B00011111, B11111000, B00001111, B11110000, B00000111, B11100000 }; static const unsigned char PROGMEM c16_9[] = { B00000111, B11000000, B00011111, B11110000, B00111111, B11111000, B01111100, B01111100, B01111000, B00111100, B11110000, B00011110, B11100000, B00001110, B11100000, B00001110, B11100000, B00001110, B11100000, B00001110, B11110000, B00011110, B01111000, B00111110, B01111100, B01111100, B00111111, B11111100, B00011111, B11111000, B00000111, B11111000, B00000000, B11110000, B00000001, B11110000, B00000011, B11100000, B00000111, B11000000, B00001111, B10000000, B00011111, B00000000, B00111110, B00000000, B00111100, B00000000 }; static const unsigned char PROGMEM c16_Empty[] = { B00110000, B01111100, B00111000, B00111100, B00111100, B00011100, B00111110, B00001100, B00011111, B00000100, B00001111, B10000000, B00000111, B11000000, B00000011, B11100000, B00000001, B11110000, B00100000, B11111000, B00110000, B01111100, B00111000, B00111100, B00111100, B00011100, B00111110, B00001100, B00011111, B00000100, B00001111, B10000000, B00000111, B11000000, B00000011, B11100000, B00000001, B11110000, B00100000, B11111000, B00110000, B01111100, B00111000, B00111100, B00111100, B00011100, B00111110, B00001100 }; Displays.ino #define DCSBIOS_DEFAULT_SERIAL #include "DcsBios.h" #include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include "characters.h" #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 32 // OLED display height, in pixels #define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin) //Comment for barometric pressure #define ALTIMETER int updateInterval = 100; //the number of milliseconds between updates struct scrollDigit { int digit; //The digit that is displayed int y; // The vertical position of the digit }; struct disp { Adafruit_SSD1306 display; int width; int numberOfDigits; scrollDigit digits[5]; }; #ifdef ALTIMETER disp oled = {Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET), 24, 5, {{0,0},{0,0},{0,0},{0,0},{0,0}}}; #else disp oled = {Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET), 16, 4, {{0,0},{0,0},{0,0},{0,0},{0,0}}}; #endif void setup() { if(!oled.display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32 for(;;); // Don't proceed, loop forever } DcsBios::setup(); } void UpdateDisplay() { oled.display.clearDisplay(); for (int i = 0; i < oled.numberOfDigits; i++) { printScrollingDigit(oled.digits[i].digit, oled.width, oled.digits[i].y, i + 1, &oled); } //Clear the area below the the numbers if we are using the small font if (oled.width == 16) { oled.display.fillRect(0, 25, 67, 7, BLACK); } oled.display.display(); } int YPos() { return (oled.width + 9) * -1; } void printScrollingDigit(int digit, int width, int y, int pos, disp *oled) { int x = (width * pos) - width + pos; #ifdef ALTIMETER switch (digit) { case -1: oled->display.drawBitmap(x, y, c24_Empty, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_1, 24, 32, 1); break; case 1: oled->display.drawBitmap(x, y, c24_1, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_2, 24, 32, 1); break; case 2: oled->display.drawBitmap(x, y, c24_2, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_3, 24, 32, 1); break; case 3: oled->display.drawBitmap(x, y, c24_3, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_4, 24, 32, 1); break; case 4: oled->display.drawBitmap(x, y, c24_4, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_5, 24, 32, 1); break; case 5: oled->display.drawBitmap(x, y, c24_5, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_6, 24, 32, 1); break; case 6: oled->display.drawBitmap(x, y, c24_6, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_7, 24, 32, 1); break; case 7: oled->display.drawBitmap(x, y, c24_7, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_8, 24, 32, 1); break; case 8: oled->display.drawBitmap(x, y, c24_8, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_9, 24, 32, 1); break; case 9: oled->display.drawBitmap(x, y, c24_9, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_0, 24, 32, 1); break; default: oled->display.drawBitmap(x, y, c24_0, 24, 32, 1); oled->display.drawBitmap(x, y+33, c24_1, 24, 32, 1); break; } #else switch (digit) { case -1: oled->display.drawBitmap(x, y, c16_Empty, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_1, 16, 24, 1); break; case 1: oled->display.drawBitmap(x, y, c16_1, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_2, 16, 24, 1); break; case 2: oled->display.drawBitmap(x, y, c16_2, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_3, 16, 24, 1); break; case 3: oled->display.drawBitmap(x, y, c16_3, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_4, 16, 24, 1); break; case 4: oled->display.drawBitmap(x, y, c16_4, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_5, 16, 24, 1); break; case 5: oled->display.drawBitmap(x, y, c16_5, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_6, 16, 24, 1); break; case 6: oled->display.drawBitmap(x, y, c16_6, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_7, 16, 24, 1); break; case 7: oled->display.drawBitmap(x, y, c16_7, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_8, 16, 24, 1); break; case 8: oled->display.drawBitmap(x, y, c16_8, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_9, 16, 24, 1); break; case 9: oled->display.drawBitmap(x, y, c16_9, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_0, 16, 24, 1); break; default: oled->display.drawBitmap(x, y, c16_0, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_1, 16, 24, 1); break; } #endif } #ifdef ALTIMETER void onAlt10000FtChange(unsigned int newValue) { if (newValue == 6553) { oled.digits[0].digit = 1; oled.digits[0].y = 0; } else if (newValue == 0) { oled.digits[0].digit = -1; oled.digits[0].y = 0; } else { oled.digits[0].digit = -1; oled.digits[0].y = map(newValue, 0, 6553, 0, YPos()); } } void onAlt1000FtChange(unsigned int newValue) { unsigned int mappedValue = newValue / 6553; unsigned int y = map(newValue, mappedValue * 6553, mappedValue * 6553 + 6553, 0, YPos()); oled.digits[1].digit = mappedValue; oled.digits[1].y = y; } void onAlt100FtChange(unsigned int newValue) { unsigned int mappedValue = newValue / 6553; unsigned int y = map(newValue, mappedValue * 6553, mappedValue * 6553 + 6553, 0, YPos()); oled.digits[2].digit = mappedValue; oled.digits[2].y = y; } DcsBios::IntegerBuffer Alt10000FtBuffer(0x1080, 0xffff, 0, onAlt10000FtChange); DcsBios::IntegerBuffer Alt1000FtBuffer(0x1082, 0xffff, 0, onAlt1000FtChange); DcsBios::IntegerBuffer Alt100FtBuffer(0x1084, 0xffff, 0, onAlt100FtChange); #else void onBaro0Change(unsigned int newValue) { unsigned int mappedValue = newValue / 6554; unsigned int y = map(newValue, mappedValue * 6554, mappedValue * 6554 + 6554, 0, YPos()); oled.digits[3].digit = mappedValue; oled.digits[3].y = y; } void onBaro1Change(unsigned int newValue) { unsigned int mappedValue = newValue / 6554; unsigned int y = map(newValue, mappedValue * 6554, mappedValue * 6554 + 6554, 0, YPos()); oled.digits[2].digit = mappedValue; oled.digits[2].y = y; } void onBaro2Change(unsigned int newValue) { unsigned int mappedValue = newValue / 6554; unsigned int y = map(newValue, mappedValue * 6554, mappedValue * 6554 + 6554, 0, YPos()); oled.digits[1].digit = mappedValue; oled.digits[1].y = y; } void onBaro3Change(unsigned int newValue) { unsigned int mappedValue = newValue / 6554; unsigned int y = map(newValue, mappedValue * 6554, mappedValue * 6554 + 6554, 0, YPos()); oled.digits[0].digit = mappedValue; oled.digits[0].y = y; } DcsBios::IntegerBuffer Baro0Buffer(0x1086, 0xffff, 0, onBaro0Change); DcsBios::IntegerBuffer Baro1Buffer(0x1088, 0xffff, 0, onBaro1Change); DcsBios::IntegerBuffer Baro2Buffer(0x108a, 0xffff, 0, onBaro2Change); DcsBios::IntegerBuffer Baro3Buffer(0x108c, 0xffff, 0, onBaro3Change); #endif unsigned long time = 0; void loop() { DcsBios::loop(); time = millis(); if (time % updateInterval == 0) { UpdateDisplay(); } } Edited February 1, 2020 by Middlefart Link to comment Share on other sites More sharing options...
Middlefart Posted February 1, 2020 Author Share Posted February 1, 2020 (edited) Middlefart’s A-10 build I have to say that you are going to be doing exactly what I planned to do, so I am pulling up a chair! After the success with the 5" CDU, little details like this make all the difference. I have three different OLED displays, for the altitude and pressure, like you have, plus the fuel quantity indication. I don’t suppose you could share the altimeter OLED sketch could you? Cheers, and nice job! Les Sorry about the delay but I've finally have the sketch you asked for if you look in the post prior to his one. Edited February 2, 2020 by Middlefart Link to comment Share on other sites More sharing options...
lesthegrngo Posted February 2, 2020 Share Posted February 2, 2020 Sorry about the delay but I've finally have the sketch you asked for if you look in the post prior to his one. Thanks! I'm currently away from home on a short holiday, but you can bet that this will be one of the first things I get to when I'm back! How's the rest of your rig getting on? Cheers Les Link to comment Share on other sites More sharing options...
BravoYankee4 Posted February 3, 2020 Share Posted February 3, 2020 Imponerande! :) Somehow I have missed this thread until now... get's me inspired to continue with my DCS project I started a couple of years ago. Link to comment Share on other sites More sharing options...
Middlefart Posted February 4, 2020 Author Share Posted February 4, 2020 Its getting along I’ve started with the left console. Ordered 2 Leo Bodnar BBI-64 for the inputs but they where broken upon arrival. They sent me new ones and I managed to repair the 2 first ones so now I have 4 Link to comment Share on other sites More sharing options...
Middlefart Posted February 4, 2020 Author Share Posted February 4, 2020 Imponerande! :) Somehow I have missed this thread until now... get's me inspired to continue with my DCS project I started a couple of years ago. Tack! Link to comment Share on other sites More sharing options...
lesthegrngo Posted February 5, 2020 Share Posted February 5, 2020 Its getting along I’ve started with the left console. Ordered 2 Leo Bodnar BBI-64 for the inputs but they where broken upon arrival. They sent me new ones and I managed to repair the 2 first ones so now I have 4 I've got quite a few Bodnar boards, I got them for the race car sim I built a few years ago, and I was lucky that none ever arrived damaged Having said that, looks like you got lucky in managing to have ones that were repairable, and from my experience with them they will do a great job. It's also heartening to see that their customer support is equally good Cheers Les Link to comment Share on other sites More sharing options...
Middlefart Posted February 7, 2020 Author Share Posted February 7, 2020 (edited) Middlefart’s A-10 build I have gotten some requests for my PCB's. I've put them up on DropBox. https://www.dropbox.com/sh/mvq1unpin486cq2/AABHh8ZgI4w9O59qV5Jn6Ogya?dl=0 They are created in Fritzing, so you need to get that. It was free when I started using it but now it costs $8 https://fritzing.org/download/ Note that the Nano-board is not tested yet. I'll add a list of components later. But I'ts really not much. Some RJ45 contacts, MAX487 Chip, 220Ohm resistors and a trim potentiometer of your choice :) In the dropbox folder there is also a RJ45 Pinout. You need to create some sort of main board where you can connect all cards to eachother and provide them with Ground and +5V. +12 V is not being used at the moment but can be provided for future use. The Nano and the Engline Cluster boards have 2 RJ45 connectors so that they can be daisy chained. Edited February 8, 2020 by Middlefart Link to comment Share on other sites More sharing options...
Vinc_Vega Posted February 7, 2020 Share Posted February 7, 2020 ...It was free when I started using it but now it costs $8 But if you have a previous version (e.g. 0.9.3b) the upgrade is still free :thumbup: Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
SteenosMT Posted February 19, 2020 Share Posted February 19, 2020 https://prnt.sc/r4s9ur The PCB's turned out awesome! Link to comment Share on other sites More sharing options...
Middlefart Posted February 21, 2020 Author Share Posted February 21, 2020 Cool I realized that I should have turned the nano 180 degrees. Now it is colliding with the RJ45 contacts. It works but is annoying. Your PCB’s looks slightly different from mine... mine have my name on them ;-) Link to comment Share on other sites More sharing options...
Middlefart Posted February 21, 2020 Author Share Posted February 21, 2020 Link to comment Share on other sites More sharing options...
SteenosMT Posted February 24, 2020 Share Posted February 24, 2020 Am I able just to rotate the nano 180 degrees? or does it have to go towards the rj45 connectors? Link to comment Share on other sites More sharing options...
Middlefart Posted February 25, 2020 Author Share Posted February 25, 2020 No, you can’t rotate the nano. It has to be positioned towards the RJ45’s. Maybe I’ll update the pcb’s if I need more. I have 15 of these made so I’m not sure I need any more of them. Link to comment Share on other sites More sharing options...
SteenosMT Posted February 26, 2020 Share Posted February 26, 2020 No worries at all. Wonder if they'd have taller headers for the nano so it wouldn't be an issue. Link to comment Share on other sites More sharing options...
lesthegrngo Posted March 3, 2020 Share Posted March 3, 2020 Sorry about the delay but I've finally have the sketch you asked for if you look in the post prior to his one. Hi there again Finally back with my rig and tried out your sketch, and it works, I can see the text and it scrolls nicely. However the OLED panel I am using must be slightly different, as there is a wrapping effect, presumably where the text size is too big for my OLED I'm using a 128 x 32 pixel display from Buydisplay. Is there a way to reduce the character size within the sketch, or is that set but the Characters.h file? Cheers! Les Link to comment Share on other sites More sharing options...
Middlefart Posted March 3, 2020 Author Share Posted March 3, 2020 I’m also using 128x32 so that should work. You need to change characters.h if you want to change the font size but there are also some places (pretty many) in the sketch where the size is hard coded. Could you show a photo of the problem? Maybe it is something I can fix Link to comment Share on other sites More sharing options...
lesthegrngo Posted March 4, 2020 Share Posted March 4, 2020 (edited) Here you go. It looks like the OLED is displaying the characters too wide, so they are overlapping. Maybe by not displaying the last two zeros it will fit, the two missing zeros can be added to the gauge face. I'd still be interested in knowing how to reduce the text width though ***Edit**** I am convinced that the OLED that I am trying to use is the cause of my errors on this, rather than your code. I can play around with the code and I can improve it, but I have come to the conclusion that the OLED's I have from Buydisplay use a different coding and library set. If nothing else, everything is displayed back to front, mirror style . Can I ask you what the OLED module you have is? Was it purchased from anywhere in particular? I would like to get one to try it out, as I think it will same me a load of hassle. My ones are the 0.91 in versions, the one in the video looks larger (maybe 2.2 inch?) Cheers Les Edited March 4, 2020 by lesthegrngo Link to comment Share on other sites More sharing options...
Recommended Posts