Jump to content

Recommended Posts

Posted

Hi

I am trying to setup the code for the CDU of "robinmli" to my adafruit TFT 3.5" screen and i get more compilation mistake:

 

 

CDU code:

 

#define DCSBIOS_IRQ_SERIAL

 

#include <Adafruit_GFX.h>

#include "Adafruit_HX8357.h"

#include "DcsBios.h"

 

 

// These are 'flexible' lines that can be changed

#define TFT_CS 10

#define TFT_DC 9

#define TFT_RST 8 // RST can be set to -1 if you tie it to Arduino's reset

 

Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);

 

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, 0x07E0, 0x0, 3);

}

 

/* paste code snippets from the reference documentation here */

void onCduLine0Change(char* newValue) {

for(int i = 0; i < 24; i++){

printChar(0, i, newValue);

}

}

DcsBios::StringBuffer<24> cduLine0Buffer(0x11c0, onCduLine0Change);

 

void onCduLine1Change(char* newValue) {

for(int i = 0; i < 24; i++){

printChar(1, i, newValue);

}

}

DcsBios::StringBuffer<24> cduLine1Buffer(0x11d8, onCduLine1Change);

 

void onCduLine2Change(char* newValue) {

for(int i = 0; i < 24; i++){

printChar(2, i, newValue);

}

}

DcsBios::StringBuffer<24> cduLine2Buffer(0x11f0, onCduLine2Change);

 

void onCduLine3Change(char* newValue) {

for(int i = 0; i < 24; i++){

printChar(3, i, newValue);

}

}

DcsBios::StringBuffer<24> cduLine3Buffer(0x1208, onCduLine3Change);

 

void onCduLine4Change(char* newValue) {

for(int i = 0; i < 24; i++){

printChar(4, i, newValue);

}

}

DcsBios::StringBuffer<24> cduLine4Buffer(0x1220, onCduLine4Change);

 

void onCduLine5Change(char* newValue) {

for(int i = 0; i < 24; i++){

printChar(5, i, newValue);

}

}

DcsBios::StringBuffer<24> cduLine5Buffer(0x1238, onCduLine5Change);

 

void onCduLine6Change(char* newValue) {

for(int i = 0; i < 24; i++){

printChar(6, i, newValue);

}

}

DcsBios::StringBuffer<24> cduLine6Buffer(0x1250, onCduLine6Change);

 

void onCduLine7Change(char* newValue) {

for(int i = 0; i < 24; i++){

printChar(7, i, newValue);

}

}

DcsBios::StringBuffer<24> cduLine7Buffer(0x1268, onCduLine7Change);

 

void onCduLine8Change(char* newValue) {

for(int i = 0; i < 24; i++){

printChar(8, i, newValue);

}

}

DcsBios::StringBuffer<24> cduLine8Buffer(0x1280, onCduLine8Change);

 

void onCduLine9Change(char* newValue) {

for(int i = 0; i < 24; i++){

printChar(9, i, newValue);

}

}

DcsBios::StringBuffer<24> cduLine9Buffer(0x1298, onCduLine9Change);

 

void setup() {

DcsBios::setup();

 

tft.begin(HX8357D);

tft.setRotation(1);

tft.fillScreen(HX8357_BLACK);

tft.setTextSize(3);

tft.setTextColor(HX8357_GREEN, HX8357_BLACK);

 

imprimeLinea (0, "OK RDY" ) ;

}

 

void imprimeLinea (int linea, char* newValue){

 

 

tft.setCursor(0, 30*linea);

 

tft.print(newValue);

 

}

 

void loop() {

DcsBios::loop();

}

 

 

 

 

Compilation mistake:

 

Arduino: 1.6.8 (Windows 10), Board: "Arduino/Genuino Uno"

 

C:\Users\Adrian\AppData\Local\Temp\build920689b920 17d6a575dd53eca4c7e54f.tmp/core\core.a(HardwareSerial0.cpp.o): In function `__vector_18':

 

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial0.cpp:48: multiple definition of `__vector_18'

 

sketch\DCS_CDU_DISPLAY.ino.cpp.o:C:\Users\Adrian\D ocuments\Arduino\libraries\dcs-bios-arduino-library-0.2.1/DcsBios.h:40: first defined here

 

collect2.exe: error: ld returned 1 exit status

 

exit status 1

Error compiling for board Arduino/Genuino Uno.

 

 

 

 

 

Any Idea ? Thanks so much !!!

 

 

 

 

Note: at the moment is with arduino uno and i know that is going to be too slowly,,,,,first of all i am trying get it work,,,slow but work, after this will try to work a little fast.

Posted

When you use DCSBIOS_IRQ_SERIAL, the DCS-BIOS Arduino Library supplies its own code to handle the serial port interrupts. That means that you can't use the built-in Serial object anywhere in your program, because that will bring in the default Arduino code for that, you end up with two definitions of the interrupt service routine for the receive interrupt, and get an error message like that.

 

Double-check the code of the graphics library you are using and make sure there is not a single call to Serial.print() and friends in there. Even if it will never be reached in the program flow, such a line will still cause the default Arduino serial code to be compiled in and conflict with what DCS-BIOS tries to do.

 

If you find a line like that in the library, simply commenting it out should make things work.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...