-
Posts
640 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by Vinc_Vega
-
Yeah that's right. Sorry, but I'm not a programmer and without hardware it makes less sense to me. You first should use one of the text examples coming with the library to write some own text on your screen. I recommend to use the Adafruit library, as it is working togheter with their GFX library. If you understand the syntax, your code can be expanded to show some text from DCS (a line from the CDU or CMSP). Maybe you can find the issue and can use the above CDU code snippets again. .
-
This is how it should look like without the DCS BIOS stuff. A welcome screen going into black after 1 1/2 seconds. #include <SPI.h> //#include <RA8875.h> #include "Adafruit_RA8875.h" #include <Adafruit_GFX.h> //Arduino DUE,Arduino mega2560,Arduino UNO #define RA8875_INT 4 #define RA8875_CS 10 #define RA8875_RST 9 // RA8875 tft = RA8875(RA8875_CS,RA8875_RST); Adafruit_RA8875 tft = Adafruit_RA8875(RA8875_CS, RA8875_RST); void setup() { SPI.begin(); tft.begin(RA8875_800x480); // set landscape mode tft.setRotation(1); // --------------- section can be deletet if it works // print welcome screen tft.fillScreen(RA8875_BLACK); // fast "clear screen" tft.drawRoundRect(0, 0, 799, 479, 10, RA8875_GREEN); delay(300); tft.setTextColor(RA8875_GREEN); tft.setTextSize(3); tft.setCursor(100, 260); tft.print("DCS World: A-10C"); tft.setCursor(100, 285); tft.print("CDU Display Test"); delay(1500); tft.fillScreen(RA8875_BLACK); // --------------------------------------------------- } void loop() { } EDIT: You can also try to replace all your RA8875_RST statements with RA8875_RESET
-
Sorry Les, but there is no hint in the error file that helps. Maybe the problem is, that you have two different Adafruit_RA8875 libraries installed? If I get those "Error compiling for Board Arduino/something" messages I usually replug the board and/or restart the GUI. Mostly that helps. I just copied the code from the post above again, put it into the arduino GUI and compiled/uploaded it without any errors. The "ino" file is zipped and attached hereunder for info. My System is Windows 7 64bit and I use Arduino GUI 1.8.10 with latest board definitions. . CDU_DISPLAY_LES_Test02a.rar
-
Hi Les, the printChar() object has been declarated twice within your code, but this relates not the compiling error. It's the missing drawChar decleration within the used RA8875 driver. By changing to the Adafruit_RA8875 driver the drawChar function seems to work. It is essential to the code because only this statement prints the characters on display. I used the driver from your download link and it compiles well, but without the related hardware I can't proof it. I put the Adafruit driver into your code and did a little welcome screen to the setup function (that can be deleted if the code works). Furthermore I changed the colors back to the color definitions from the RA8875 example. I'm not shure if "setRotation" is declared within the driver, but this can be adjusted later, same for the text size and line distances. I hope that the code now works for you. /* Tell DCS-BIOS to use a serial connection and use the default Arduino Serial library. This will work on the vast majority of Arduino-compatible boards, but you can get corrupted data if you have too many or too slow outputs (e.g. when you have multiple character displays), because the receive buffer can fill up if the sketch spends too much time updating them. If you can, use the IRQ Serial connection instead. */ #define DCSBIOS_IRQ_SERIAL #include <SPI.h> [color=gray]//#include <RA8875.h>[/color] [color=Red]#include "Adafruit_RA8875.h"[/color] #include "DcsBios.h" #include <Adafruit_GFX.h> //Arduino DUE,Arduino mega2560,Arduino UNO #define RA8875_INT 4 #define RA8875_CS 10 #define RA8875_RST 9 [color=Gray]// RA8875 tft = RA8875(RA8875_CS,RA8875_RST);[/color] [color=Red]Adafruit_RA8875 tft = Adafruit_RA8875(RA8875_CS, RA8875_RST);[/color] void printChar(int row, int col, unsigned char c) { int16_t x = 13 + col * 19; int16_t y = row * 32 + 6; tft.drawChar(x, y, c, RA8875_GREEN, RA8875_BLACK, 3); } /* paste code snippets from the reference documentation here */ void onCduLine0Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(0, i, newValue[i]); } } DcsBios::StringBuffer<24> cduLine0Buffer(0x11c0, onCduLine0Change); void onCduLine1Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(1, i, newValue[i]); } } DcsBios::StringBuffer<24> cduLine1Buffer(0x11d8, onCduLine1Change); void onCduLine2Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(2, i, newValue[i]); } } DcsBios::StringBuffer<24> cduLine2Buffer(0x11f0, onCduLine2Change); void onCduLine3Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(3, i, newValue[i]); } } DcsBios::StringBuffer<24> cduLine3Buffer(0x1208, onCduLine3Change); void onCduLine4Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(4, i, newValue[i]); } } DcsBios::StringBuffer<24> cduLine4Buffer(0x1220, onCduLine4Change); void onCduLine5Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(5, i, newValue[i]); } } DcsBios::StringBuffer<24> cduLine5Buffer(0x1238, onCduLine5Change); void onCduLine6Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(6, i, newValue[i]); } } DcsBios::StringBuffer<24> cduLine6Buffer(0x1250, onCduLine6Change); void onCduLine7Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(7, i, newValue[i]); } } DcsBios::StringBuffer<24> cduLine7Buffer(0x1268, onCduLine7Change); void onCduLine8Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(8, i, newValue[i]); } } DcsBios::StringBuffer<24> cduLine8Buffer(0x1280, onCduLine8Change); void onCduLine9Change(char* newValue) { for(int i = 0; i < 24; i++){ printChar(9, i, newValue[i]); } } DcsBios::StringBuffer<24> cduLine9Buffer(0x1298, onCduLine9Change); void setup() { DcsBios::setup(); //Serial.begin(9600); //while (!Serial) {;} SPI.begin(); tft.begin(RA8875_800x480); // set landscape mode tft.setRotation(1); [color=gray]// --------------- section can be deletet if it works // print welcome screen tft.fillScreen(RA8875_BLACK); // fast "clear screen" tft.drawRoundRect(0, 0, 799, 479, 10, RA8875_GREEN); delay(300); tft.setTextColor(RA8875_GREEN); tft.setTextSize(3); tft.setCursor(100, 260); tft.print("DCS World: A-10C"); tft.setCursor(100, 285); tft.print("CDU Display Test"); delay(1500); tft.fillScreen(RA8875_BLACK); // ---------------------------------------------------[/color] } void loop() { DcsBios::loop(); }
-
Hi Les, Within the declaration of you printChar() object an essential token is missing. Put the red line in your code and it should work. To simplify things, before that a text color should be defined (else use hex 0x07E0). [b][color=SeaGreen]#define GREEN 0x07E0[/color][/b] void printChar(int row, int col, unsigned char c) { int16_t x = 13 + col * 19; int16_t y = row * 32 + 6; [color=Red][b]tft.drawChar(x, y, c, GREEN, 0x0, 3);[/b][/color] } Here is how the object constructor works for your information: drawChar(x position, y position, character to print, text color, bg color, text size); Edit: If your display really use a resolution of 480 x 272, text size and / or space between the lines (rows) should be reduced. .
-
Hi Les, would you please give a link to the sketch you have uploaded sucessfully or better post the working sketch here? What driver library do you have installed (Adafruit_RA8875 or plain RA8875)?
-
Sounds great! At the weekend I transformed my script from a 3.5" mcufriend Display to the 4" waveshare SPI display. As processor I use a NANO connectet via USB and not RS485. I wonder if the Duo or Zero would give faster refresh time when flipping the pages of the CDU than the UNO/NANO? For the CDU button matrix I'm still looking for a suitable solution.
-
Hi Les, have you ever tryed Max485 breakout boards like this: https://www.pollin.de/p/schnittstellen-modul-daypower-lc-ttl-max485csa-810571 For me they do a good job.
-
Hello Les, you also have to include the GFX library. #include <Adafruit_GFX.h>Than try it after excluding all the "serial" statements within the setup block. Like this: void setup() { DcsBios::setup(); // Setup the LCD // Serial.begin(9600); // while (!Serial); SPI.begin(); tft.begin(); // set landscape mode tft.setRotation(1); ...
-
Advice on using LED's for warning light panel
Vinc_Vega replied to lesthegrngo's topic in Home Cockpits
No, it's not that simple. You have to adjust forward voltage and current of the LEDs by using a single resistor for the chip. Read the documentation within the link I post hereunder. In the part "Selecting RSet" it is well explained. There is also an example how to choose the set-resistor. . http://wayoda.github.io/LedControl/pages/hardware.html#SelectRSet . . . -
Advice on using LED's for warning light panel
Vinc_Vega replied to lesthegrngo's topic in Home Cockpits
For the MAX7219 solution you don't have to use any resistors for the LEDs. Only one resistor is needed for the chip to adjust the current. For more advise see here: http://wayoda.github.io/LedControl/pages/hardware.html -
Modular A-10C gauge controller for DCS Bios
Vinc_Vega replied to lesthegrngo's topic in Home Cockpits
Confirmed, that at the original Mega layout pin D18 is TX1 (connectet to DI) and pin D19 is RX1 (connected to RO). Are you sure that the PCF chip's I2C address is 0x27 ? You could easily read out I2C addresses in the serial monitor by using the i2c_scanner sketch: https://playground.arduino.cc/Main/I2cScanner/ -
Modular A-10C gauge controller for DCS Bios
Vinc_Vega replied to lesthegrngo's topic in Home Cockpits
Hi Les, could you please post the actual sketch of your slave? -
Modular A-10C gauge controller for DCS Bios
Vinc_Vega replied to lesthegrngo's topic in Home Cockpits
Your wiring looks good to me. Not shure if that matters, but I use brackets <> for all includes except for "DcsBios.h". #include "DcsBios.h" #include <Wire.h> #include <SPI.h> #include <AccelStepper.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> -
Advice on using LED's for warning light panel
Vinc_Vega replied to lesthegrngo's topic in Home Cockpits
As pointed out above, the 7219 is best used wir the LedControl library. Here is the link to their Hardware documentation: http://wayoda.github.io/LedControl/pages/hardware.html -
I dont think dimming is possible via the PCF Chip. I use a PWM signal (eg. Pin 5) connected to the Background LED of the LCD. Instaed of direct connecting I use a small FET (2N7000) and the analogWrite() function to control brightness of the LED.
-
Hi Les, Do you see any effect when using a value of 10 in "lcd.setBacklight"? Is the Display's backlight more dimmed as if using the value 255 (like in the cmsc sketch)? If you only want to switch the backlight (without dimming) just use: "lcd.backlight();" in the setup loop. For dimming the backlight I think a PWM pin from the arduino has to be used.
-
Modular A-10C gauge controller for DCS Bios
Vinc_Vega replied to lesthegrngo's topic in Home Cockpits
I have the above mentioned 485 modules. They do the Job they are for. I recommend to use them until your Network ist good and than try yuor owen PCBs. -
Advice on using LED's for warning light panel
Vinc_Vega replied to lesthegrngo's topic in Home Cockpits
Instead of using four Nanos you could use just one and the Max7219 LED driver chip /LedContol library to power up a matrix with up to 64 LEDs. This should be good for the caution lights panel. library: https://github.com/wayoda/LedControl documentation: http://wayoda.github.io/LedControl/ -
Did you try the LiquidCrystal_I2C library to talk to the PCF Chip?
-
Stepper motor drivers for use with Arduino and DCS Bios
Vinc_Vega replied to lesthegrngo's topic in Home Cockpits
X27 steppers are directly connectable to an arduino by using all four Pins. So at least Hardware can be tested. Look Here for an example: -
Same for the A-10 drawings. I payed for the plans but they are not usable for cockpit building.
-
As far as I read their website, all gauges are equipped with servos. That means you still have to built your own electronics (controlers). Same is for the panels, e.g. the caution lights module hat built in LEDs but no controler.
-
For only one Mega the power supply of the USB is enough even in combination with the Max485 chip.
-
dcsbios - Can I use an Arduino Mega as an RS485 slave?
Vinc_Vega replied to Bullant's topic in Home Cockpits
Hi AndrewW, I forgot to mention that if using Megas or Unos as slaves you still have to use a Mega as the master.