add rgbw ws2812 ring

This commit is contained in:
interfisch 2023-05-19 16:45:56 +02:00
parent 30d4aad60f
commit 63f96de5fb
5 changed files with 103 additions and 38 deletions

View File

@ -3966,11 +3966,11 @@
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 1c3169e1-78dc-4f3a-b1a2-bf02578265f6)
)
(text "red" (at 59.69 99.06 0)
(text "red/blue" (at 59.69 99.06 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 26c57574-e303-4cc8-896b-e7ea7adae64d)
)
(text "yellow" (at 59.69 96.52 0)
(text "red/yellow" (at 59.69 96.52 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 2819c1c9-34b5-4b2f-b35c-51ec20ecfa7c)
)
@ -4034,7 +4034,7 @@
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 96de0051-7945-413a-9219-1ab367546962)
)
(text "blue" (at 59.69 91.44 0)
(text "black/blue" (at 59.69 91.44 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid a117b197-5c7e-41c8-8217-8c95a87f5a78)
)
@ -4054,7 +4054,7 @@
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid bc91a8a4-732a-4c96-8534-67afbc0f2670)
)
(text "orange" (at 59.69 93.98 0)
(text "red/red" (at 59.69 93.98 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid c06122cb-56aa-47a8-b046-d9da1ae267b2)
)
@ -4074,11 +4074,11 @@
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid ded3aa6c-bb84-41f6-b2cf-6526daddab10)
)
(text "NC" (at 49.53 96.52 0)
(text "NC" (at 48.26 96.52 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid e17e6c0e-7e5b-43f0-ad48-0a2760b45b04)
)
(text "NO" (at 49.53 101.6 0)
(text "NO" (at 48.26 101.6 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid e4e20505-1208-4100-a4aa-676f50844c06)
)
@ -4283,10 +4283,10 @@
(property "Datasheet" "" (id 3) (at 76.835 134.62 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "~" (uuid 289d2381-c24d-462b-86ba-5805292aae71))
(pin "~" (uuid 289d2381-c24d-462b-86ba-5805292aae71))
(pin "~" (uuid 289d2381-c24d-462b-86ba-5805292aae71))
(pin "~" (uuid 289d2381-c24d-462b-86ba-5805292aae71))
(pin "~" (uuid 289d2381-c24d-462b-86ba-5805292aae74))
(pin "~" (uuid 289d2381-c24d-462b-86ba-5805292aae74))
(pin "~" (uuid 289d2381-c24d-462b-86ba-5805292aae74))
(pin "~" (uuid 289d2381-c24d-462b-86ba-5805292aae74))
)
(symbol (lib_id "Bobbycar_components:powerlatch") (at 50.165 133.35 0) (unit 1)
@ -4300,13 +4300,13 @@
(property "Datasheet" "" (id 3) (at 50.165 133.35 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f6b))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f6b))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f6b))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f6b))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f6b))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f6b))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f6b))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f71))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f71))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f71))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f71))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f71))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f71))
(pin "~" (uuid 7672a6d3-c089-44dd-b44a-004517620f71))
)
(symbol (lib_id "Switch:SW_Push_SPDT") (at 44.45 99.06 0) (unit 1)
@ -4435,8 +4435,8 @@
(property "Datasheet" "" (id 3) (at 58.42 33.02 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "~" (uuid 5e737bb7-9ff1-43d7-bb29-d92d56c2e835))
(pin "~" (uuid 5e737bb7-9ff1-43d7-bb29-d92d56c2e835))
(pin "~" (uuid 5e737bb7-9ff1-43d7-bb29-d92d56c2e836))
(pin "~" (uuid 5e737bb7-9ff1-43d7-bb29-d92d56c2e836))
)
(symbol (lib_id "Bobbycar_components:xt60_male") (at 55.88 50.8 90) (unit 1)
@ -4454,8 +4454,8 @@
(property "Datasheet" "" (id 3) (at 58.42 52.07 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "~" (uuid 283e418a-9a69-45b9-b0eb-506e5b012a1f))
(pin "~" (uuid 283e418a-9a69-45b9-b0eb-506e5b012a1f))
(pin "~" (uuid 283e418a-9a69-45b9-b0eb-506e5b012a20))
(pin "~" (uuid 283e418a-9a69-45b9-b0eb-506e5b012a20))
)
(symbol (lib_id "Bobbycar_components:xt60_female") (at 92.71 31.75 270) (mirror x) (unit 1)
@ -4469,8 +4469,8 @@
(property "Datasheet" "" (id 3) (at 92.71 31.75 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "~" (uuid abfe2d16-5c1c-42e5-a5b8-7ee7611663a7))
(pin "~" (uuid abfe2d16-5c1c-42e5-a5b8-7ee7611663a7))
(pin "~" (uuid abfe2d16-5c1c-42e5-a5b8-7ee7611663a8))
(pin "~" (uuid abfe2d16-5c1c-42e5-a5b8-7ee7611663a8))
)
(symbol (lib_id "Bobbycar_components:xt60_female") (at 92.71 50.8 270) (mirror x) (unit 1)
@ -4484,8 +4484,8 @@
(property "Datasheet" "" (id 3) (at 92.71 50.8 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "~" (uuid 87069b1b-beb7-4ccb-b34c-3dbae8f09b84))
(pin "~" (uuid 87069b1b-beb7-4ccb-b34c-3dbae8f09b84))
(pin "~" (uuid 87069b1b-beb7-4ccb-b34c-3dbae8f09b85))
(pin "~" (uuid 87069b1b-beb7-4ccb-b34c-3dbae8f09b85))
)
(symbol (lib_id "Bobbycar_components:xt90antispark_female") (at 116.84 40.64 270) (unit 1)
@ -4503,8 +4503,8 @@
(property "Datasheet" "" (id 3) (at 116.84 40.64 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "~" (uuid 47077c27-146a-406e-a83a-e467ee31c5ec))
(pin "~" (uuid 47077c27-146a-406e-a83a-e467ee31c5ec))
(pin "~" (uuid 47077c27-146a-406e-a83a-e467ee31c5ed))
(pin "~" (uuid 47077c27-146a-406e-a83a-e467ee31c5ed))
)
(symbol (lib_id "Bobbycar_components:xt90_male") (at 148.59 40.64 90) (mirror x) (unit 1)
@ -4518,8 +4518,8 @@
(property "Datasheet" "" (id 3) (at 148.59 40.64 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "~" (uuid aa0df799-0b67-406d-90cf-6dbd82290544))
(pin "~" (uuid aa0df799-0b67-406d-90cf-6dbd82290544))
(pin "~" (uuid aa0df799-0b67-406d-90cf-6dbd82290545))
(pin "~" (uuid aa0df799-0b67-406d-90cf-6dbd82290545))
)
(symbol (lib_id "Connector_Generic:Conn_01x04") (at 90.17 180.975 90) (mirror x) (unit 1)
@ -4558,8 +4558,8 @@
(property "Datasheet" "" (id 3) (at 22.86 105.41 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "~" (uuid a5adf9fc-330f-4cad-bdb2-e0f8fb1b77b4))
(pin "~" (uuid a5adf9fc-330f-4cad-bdb2-e0f8fb1b77b4))
(pin "~" (uuid a5adf9fc-330f-4cad-bdb2-e0f8fb1b77b5))
(pin "~" (uuid a5adf9fc-330f-4cad-bdb2-e0f8fb1b77b5))
)
(symbol (lib_id "Bobbycar_components:xt30_female") (at 22.86 81.28 0) (mirror x) (unit 1)
@ -4577,8 +4577,8 @@
(property "Datasheet" "" (id 3) (at 22.86 81.28 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "~" (uuid 92c8a67d-ecef-4663-99f5-c2b6e82bc065))
(pin "~" (uuid 92c8a67d-ecef-4663-99f5-c2b6e82bc065))
(pin "~" (uuid 92c8a67d-ecef-4663-99f5-c2b6e82bc066))
(pin "~" (uuid 92c8a67d-ecef-4663-99f5-c2b6e82bc066))
)
(symbol (lib_id "Bobbycar_wiring-rescue:SW_DPST_x2-Switch") (at 173.99 43.18 0) (unit 1)
@ -4708,8 +4708,8 @@
(property "Datasheet" "" (id 3) (at 26.67 31.75 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "~" (uuid c8baad8e-84f6-4984-837a-38ef6d0b77bf))
(pin "~" (uuid c8baad8e-84f6-4984-837a-38ef6d0b77bf))
(pin "~" (uuid c8baad8e-84f6-4984-837a-38ef6d0b77c0))
(pin "~" (uuid c8baad8e-84f6-4984-837a-38ef6d0b77c0))
)
(symbol (lib_id "Bobbycar_components:xt60_female") (at 26.67 50.8 270) (mirror x) (unit 1)
@ -4723,8 +4723,8 @@
(property "Datasheet" "" (id 3) (at 26.67 50.8 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "~" (uuid a4649d4d-6aa3-4f07-b7a6-0d73d155ec90))
(pin "~" (uuid a4649d4d-6aa3-4f07-b7a6-0d73d155ec90))
(pin "~" (uuid a4649d4d-6aa3-4f07-b7a6-0d73d155ec91))
(pin "~" (uuid a4649d4d-6aa3-4f07-b7a6-0d73d155ec91))
)
(symbol (lib_id "Device:R") (at 240.665 156.845 0) (unit 1)

1
controller_teensy/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.pio

View File

@ -0,0 +1,43 @@
#ifndef _LED_H_
#define _LED_H_
#include <Adafruit_NeoPixel.h>
#define LED_PIN 3
#define LED_COUNT 16
// NeoPixel brightness, 0 (min) to 255 (max)
#define BRIGHTNESS 50 // Set BRIGHTNESS to about 1/5 (max = 255)
// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRBW + NEO_KHZ800);
unsigned long last_ledupdate=0;
#define LEDUPDATEINTERVAL 100
void init_led() {
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
strip.setBrightness(BRIGHTNESS);
}
void led_update(unsigned long loopmillis) {
if (loopmillis>last_ledupdate+LEDUPDATEINTERVAL) {
last_ledupdate=loopmillis;
uint32_t color=strip.Color(0, 0, 0, 255);
uint32_t colorOff=strip.Color(30, 0, 0, 0);
uint8_t position=(loopmillis/100)%strip.numPixels();
for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
if (i==position) {
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
}else{
strip.setPixelColor(i, colorOff); // Set pixel's color (in RAM)
}
}
strip.show(); // Update strip to match
}
}
#endif

View File

@ -23,4 +23,5 @@ build_flags =
lib_deps =
robtillaart/ADS1X15@^0.3.9
adafruit/Adafruit SSD1306@^2.5.7
arduino-libraries/SD@^1.2.4
arduino-libraries/SD@^1.2.4
https://github.com/adafruit/Adafruit_NeoPixel

View File

@ -1,5 +1,7 @@
#include <Arduino.h>
#include "led.h"
#include "definitions.h"
//#include "structs.h"
#include "helpfunctions.h"
@ -11,6 +13,9 @@
#include "ADS1X15.h"
ESCSerialComm escFront(Serial2);
ESCSerialComm escRear(Serial3);
//Serial1 = TX1=1, RX1=0
@ -73,19 +78,30 @@ void setup()
pinMode(PIN_LATCH_ENABLE, OUTPUT);
digitalWrite(PIN_LATCH_ENABLE,HIGH); //latch on
init_led();
led_update(millis());
delay(2000);
Serial.println("Init Functions");
led_update(millis());
display_init();
led_update(millis());
initLogging();
led_update(millis());
escFront.init();
led_update(millis());
escRear.init();
led_update(millis());
delay(2000);
Serial.println("Wait finished. Booting..");
led_update(millis());
//init ADS1115
if (!ADS.begin()) {
@ -97,6 +113,7 @@ void setup()
// also set ADSREADPERIOD to at least the read interval
ADS.requestADC(0); //Start requesting a channel
delay(10);
led_update(millis());
setSyncProvider(getTeensy3Time); //See https://www.pjrc.com/teensy/td_libs_Time.html#teensy3
if (timeStatus()!= timeSet) {
@ -104,9 +121,11 @@ void setup()
} else {
Serial.println("RTC has set the system time");
}
led_update(millis());
writeLogComment(millis(), "Setup Finished");
led_update(millis());
}
@ -215,6 +234,7 @@ void loop() {
loggingLoop(loopmillis,escFront,escRear);
leds();
led_update(loopmillis);
static unsigned long last_display_update=0;
if (loopmillis - last_display_update > DISPLAYUPDATEPERIOD) {