diff --git a/Universal_Serial_Adapter/Config.cpp b/Universal_Serial_Adapter/Config.cpp index 9f9ebf9..ef6a693 100644 --- a/Universal_Serial_Adapter/Config.cpp +++ b/Universal_Serial_Adapter/Config.cpp @@ -238,13 +238,13 @@ void Config::processSerialData() { int inByte = serialPort3.read(); serialPort0.write(inByte); ui->blinkCancelButton(); - dataFile.print(inByte); + //dataFile.print(inByte); } if (serialPort0.available()) { int inByte = serialPort0.read(); serialPort3.write(inByte); ui->blinkOKButton(); - dataFile.print(inByte); + //dataFile.print(inByte); } break; case 1: // db9_null @@ -252,13 +252,13 @@ void Config::processSerialData() { int inByte = serialPort2.read(); serialPort0.write(inByte); ui->blinkCancelButton(); - dataFile.print(inByte); + //dataFile.print(inByte); } if (serialPort0.available()) { int inByte = serialPort0.read(); serialPort2.write(inByte); ui->blinkOKButton(); - dataFile.print(inByte); + //dataFile.print(inByte); } break; case 2: // cisco @@ -266,17 +266,17 @@ void Config::processSerialData() { int inByte = serialPort1.read(); serialPort0.write(inByte); ui->blinkCancelButton(); - dataFile.print(inByte); + //dataFile.print(inByte); } if (serialPort0.available()) { int inByte = serialPort0.read(); serialPort1.write(inByte); ui->blinkOKButton(); - dataFile.print(inByte); - } + //dataFile.print(inByte); + } break; } // Flush data written to log file - dataFile.sync(); + //dataFile.sync(); } diff --git a/Universal_Serial_Adapter/Project.h b/Universal_Serial_Adapter/Project.h index 4f0706f..f748248 100644 --- a/Universal_Serial_Adapter/Project.h +++ b/Universal_Serial_Adapter/Project.h @@ -15,6 +15,9 @@ #define DEBUG 1 // NONE = 0; MINIMAL = 1; FULL = 2; +// Whether or not the Arduino Mega 2560 is used as the base board +#define ARD_MEGA_2560 true + // Buttons / Joystick / Input Hardware Pinouts #define okButtonPin 22 #define okButtonLed 23 @@ -54,10 +57,17 @@ #define FONT_HEIGHT 8 // Serial ports -extern SerialPort<0, 4096, 0> serialPort0; -extern SerialPort<0, 4096, 0> serialPort1; -extern SerialPort<0, 4096, 0> serialPort2; -extern SerialPort<0, 4096, 0> serialPort3; +#if ARD_MEGA_2560 +extern SerialPort<0, 512, 512> serialPort0; +extern SerialPort<1, 512, 512> serialPort1; +extern SerialPort<2, 512, 512> serialPort2; +extern SerialPort<3, 512, 512> serialPort3; +#else +extern SerialPort<0, 4096, 4096> serialPort0; +extern SerialPort<1, 4096, 4096> serialPort1; +extern SerialPort<2, 4096, 4096> serialPort2; +extern SerialPort<3, 4096, 4096> serialPort3; +#endif // Serial modes supported // Abused in for loops / lookup tables -- DO NOT CHANGE none or set values diff --git a/Universal_Serial_Adapter/UILCD.cpp b/Universal_Serial_Adapter/UILCD.cpp index 9b83654..93291cc 100644 --- a/Universal_Serial_Adapter/UILCD.cpp +++ b/Universal_Serial_Adapter/UILCD.cpp @@ -18,9 +18,10 @@ #include "UIJoystickPSP.h" UILCD::UILCD() { -#if DEBUG == 2 + #if DEBUG == 2 serialPort0.println("UILCD::UILCD()"); -#endif + #endif + pinMode(LCD_LITE, OUTPUT); tft = new Adafruit_ST7735(LCD_CS, LCD_DC, LCD_RST); @@ -496,7 +497,7 @@ void UILCD::bmpDraw(char *filename, uint8_t x, uint8_t y) { return; } - #if DEBUG == 2 + #if DEBUG == 1 serialPort0.println(); serialPort0.print("Loading image '"); serialPort0.print(filename); @@ -505,7 +506,8 @@ void UILCD::bmpDraw(char *filename, uint8_t x, uint8_t y) { // Open requested file on SD card if (!bmpFile.open(filename)) { - serialPort0.print("File not found"); + serialPort0.print(filename); + serialPort0.println(" not found"); return; } diff --git a/Universal_Serial_Adapter/Universal_Serial_Adapter.ino b/Universal_Serial_Adapter/Universal_Serial_Adapter.ino index 5305679..b495f30 100644 --- a/Universal_Serial_Adapter/Universal_Serial_Adapter.ino +++ b/Universal_Serial_Adapter/Universal_Serial_Adapter.ino @@ -33,10 +33,17 @@ Config* config; RTC_DS1307 rtc; SdFat sd; SdFile dataFile; -SerialPort<0, 4096, 0> serialPort0; -SerialPort<0, 4096, 0> serialPort1; -SerialPort<0, 4096, 0> serialPort2; -SerialPort<0, 4096, 0> serialPort3; +#if ARD_MEGA_2560 +SerialPort<0, 512, 512> serialPort0; +SerialPort<1, 512, 512> serialPort1; +SerialPort<2, 512, 512> serialPort2; +SerialPort<3, 512, 512> serialPort3; +#else +SerialPort<0, 4096, 4096> serialPort0; +SerialPort<1, 4096, 4096> serialPort1; +SerialPort<2, 4096, 4096> serialPort2; +SerialPort<3, 4096, 4096> serialPort3; +#endif // helper for interrupt method call void processSerial() {