#include "Arduino.h" #include #include "config.h" #include "CommandHandler.h" #include "DisplayProxyMAX7456.h" #include "max7456.h" Max7456 osd; DisplayProxyMAX7456 proxy(&osd); CommandHandler cmd_handler(&proxy); void processSerial() { static byte ndx = 0; char endMarker = '\n'; char rc; const byte numChars = 128; char receivedChars[numChars]; // an array to store the received data while (Serial.available() > 0) { rc = Serial.read(); if (rc != endMarker) { receivedChars[ndx] = rc; ndx++; if (ndx >= numChars) { ndx = numChars - 1; } } else { receivedChars[ndx] = '\0'; // terminate the string ndx = 0; cmd_handler.parse(receivedChars); } } } void setup() { Serial.begin(BAUDRATE); Serial.println("================================================================================"); Serial.println("Firmware: " PROJECT_NAME); Serial.println("Version: " VERSION_STRING); Serial.println("Built: " __DATE__ ", " __TIME__); Serial.println("================================================================================"); Serial.println("Initialize..."); SPI.begin(); osd.init(6); osd.clearScreen(); osd.setDisplayOffsets(DISP_OFFSET_X, DISP_OFFSET_Y); osd.setBlinkParams(_8fields, _BT_3BT); osd.activateOSD(); osd.activateExternalVideo(false); osd.print("==========================", 0, 0); osd.print("Firmware: " PROJECT_NAME, 0, 1); osd.print("Version: " VERSION_STRING, 0, 2); osd.print("Built: " __DATE__ ", " __TIME__, 0, 3); osd.print("==========================", 0, 4); delay(3000); osd.clearScreen(); Serial.println("Ready!"); } void loop() { processSerial(); }