diff --git a/platformio.ini b/platformio.ini index eef0c6c..b78bd48 100644 --- a/platformio.ini +++ b/platformio.ini @@ -24,6 +24,11 @@ lib_deps = platform = teensy board = teensy31 framework = arduino + + +monitor_speed = 256000 + + build_flags = -D USB_SERIAL_HID -D PIN_DATA=0 diff --git a/src/main.cpp b/src/main.cpp index 256e5ce..339d1dc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -177,15 +177,18 @@ void setup(){ FastLED.show(); #endif + Serial.begin(SerialSpeed); Serial.print("Ada\n"); // Send ACK string to host lastByteTime = lastAckTime = millis(); // Set initial counters + } void loop(){ t = millis(); // Save current time + // If there is new serial data if((c = Serial.read()) >= 0){ lastByteTime = lastAckTime = t; // Reset timeout counters @@ -274,6 +277,7 @@ void dataMode(){ uint8_t g=leds[i].g; uint8_t b=leds[i].b; + /* Simple 255,255,255 = White approach uint8_t w=min(r,min(g,b)); //get white content and use for white r-=w; //subtract white content @@ -281,6 +285,7 @@ void dataMode(){ b-=w; */ + // Calibration 20201207. These RGB values match the Neutral White color with calibW brightness. uint8_t calibR=255; uint8_t calibG=175; @@ -299,6 +304,7 @@ void dataMode(){ b-=calibB*whitecontent; uint8_t w=calibW*whitecontent; + int inew = i; #ifdef LED_OFFSET