mirror of
https://github.com/Architeuthis-Flux/Jumperless.git
synced 2025-02-17 11:08:35 +01:00
fixed a few little things
This commit is contained in:
parent
fa24391751
commit
b85d89da62
File diff suppressed because it is too large
Load Diff
4
Jumperless Wokwi Bridge App/savedWokwiProjects copy.txt
Normal file
4
Jumperless Wokwi Bridge App/savedWokwiProjects copy.txt
Normal file
@ -0,0 +1,4 @@
|
||||
fuck https://wokwi.com/projects/369614891595393025
|
||||
fuck2 https://wokwi.com/projects/367384677537829889
|
||||
fuck3 https://wokwi.com/projects/369024970682423297
|
||||
|
5
Jumperless Wokwi Bridge App/savedWokwiProjects.txt
Normal file
5
Jumperless Wokwi Bridge App/savedWokwiProjects.txt
Normal file
@ -0,0 +1,5 @@
|
||||
fuck https://wokwi.com/projects/369614891595393025
|
||||
fuck2 https://wokwi.com/projects/367384677537829889
|
||||
fuck3 https://wokwi.com/projects/369024970682423297
|
||||
LEDarray https://wokwi.com/projects/370450364106546177
|
||||
|
3
JumperlessNano/.vscode/settings.json
vendored
3
JumperlessNano/.vscode/settings.json
vendored
@ -9,7 +9,8 @@
|
||||
"string_view": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"ranges": "cpp",
|
||||
"cstring": "cpp"
|
||||
"cstring": "cpp",
|
||||
"cmath": "cpp"
|
||||
},
|
||||
"cortex-debug.registerUseNaturalFormat": false,
|
||||
"C_Cpp.errorSquiggles": "disabled"
|
||||
|
@ -13,17 +13,15 @@ platform = https://github.com/maxgerhardt/platform-raspberrypi.git
|
||||
framework = arduino
|
||||
board_build.core = earlephilhower
|
||||
board_build.filesystem_size = 0.5m
|
||||
;upload_port = /dev/cu.usbmodem11701 ;leave these out, the script will find the port
|
||||
;monitor_port = /dev/cu.usbmodem11701
|
||||
extra_scripts = pre:scripts/find_Jumperless_upload.py, post:scripts/extra_script.py
|
||||
extra_scripts = pre:scripts/find_Jumperless_upload.py, post:scripts/extra_script.py
|
||||
monitor_speed = 256000
|
||||
|
||||
[env:pico]
|
||||
board = pico
|
||||
lib_deps =
|
||||
powerbroker2/SafeString@^4.1.27
|
||||
adafruit/Adafruit NeoPixel@^1.11.0
|
||||
adafruit/Adafruit INA219@^1.2.1
|
||||
robtillaart/INA219@^0.1.3
|
||||
bblanchon/ArduinoJson@^6.21.2
|
||||
arduino-libraries/Arduino_JSON@^0.2.0
|
||||
adafruit/Adafruit NeoPixel@^1.11.0
|
||||
|
@ -8,6 +8,7 @@ def find_jumperless_port_monitor(source, target, env):
|
||||
|
||||
import serial.tools.list_ports
|
||||
#print(env.dump())
|
||||
counter = 0
|
||||
while True:
|
||||
autodetected = -1
|
||||
ports = serial.tools.list_ports.comports()
|
||||
@ -31,6 +32,10 @@ def find_jumperless_port_monitor(source, target, env):
|
||||
print("Autodetected jumperless port: " + ports[selection][0])
|
||||
|
||||
return ports[selection][0]
|
||||
counter = counter + 1
|
||||
if counter > 30000:
|
||||
#print("timeout")
|
||||
return 'timeout'
|
||||
|
||||
|
||||
|
||||
@ -41,6 +46,7 @@ def after_upload(source, target, env):
|
||||
|
||||
print("waiting for " + port + " ...")
|
||||
import serial
|
||||
counter = 0
|
||||
while True:
|
||||
try:
|
||||
s = serial.Serial(port)
|
||||
@ -48,6 +54,11 @@ def after_upload(source, target, env):
|
||||
break
|
||||
except:
|
||||
pass
|
||||
counter = counter + 1
|
||||
if counter > 30000:
|
||||
print("timeout")
|
||||
break
|
||||
|
||||
|
||||
env.AddPostAction("upload", after_upload)
|
||||
|
||||
|
@ -6,20 +6,26 @@
|
||||
#include "JumperlessDefinesRP2040.h"
|
||||
#include "ArduinoStuff.h"
|
||||
#include <Arduino.h>
|
||||
//#include <SoftwareSerial.h>
|
||||
|
||||
|
||||
//SerialPIO ardUart(0, 1, 64);
|
||||
//SoftwareSerial ardSerial(1, 0);
|
||||
|
||||
|
||||
//SerialPIO ardSerial(1, 0);
|
||||
|
||||
void initArduino (void)
|
||||
{
|
||||
|
||||
//Serial1.setRX(0);
|
||||
//Serial1.setTX(1);
|
||||
//Serial1.setRX(1);
|
||||
|
||||
//Serial1.setTX(0);
|
||||
|
||||
|
||||
//pinMode (1, OUTPUT);
|
||||
//pinMode (0, INPUT);
|
||||
//ardUart.begin(115200);
|
||||
//ardUart.println("hello from arduino");
|
||||
Serial1.begin(115200);
|
||||
Serial1.println("hello from arduino");
|
||||
|
||||
|
||||
|
||||
@ -30,6 +36,32 @@ void initArduino (void)
|
||||
|
||||
void arduinoPrint (void)
|
||||
{
|
||||
if (Serial1.available())
|
||||
{
|
||||
Serial1.read();
|
||||
Serial.write( Serial1.read());
|
||||
}
|
||||
|
||||
//Serial1.println("fuck");
|
||||
}
|
||||
|
||||
void uploadArduino (void)
|
||||
{
|
||||
while (!Serial.available());
|
||||
|
||||
while (Serial.available())
|
||||
{
|
||||
Serial1.write(Serial.read());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//ardUart.println("fuck");
|
||||
}
|
@ -10,7 +10,7 @@ void initArduino(void);
|
||||
void arduinoPrint(void);
|
||||
|
||||
|
||||
|
||||
void uploadArduino(void);
|
||||
|
||||
|
||||
|
||||
|
@ -180,6 +180,24 @@ if (MYNAMEISERIC)
|
||||
digitalWrite(RESETPIN, LOW);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void resetArduino (void)
|
||||
{
|
||||
int lastPath = MAX_BRIDGES - 1;
|
||||
path[lastPath].chip[0] = CHIP_I;
|
||||
path[lastPath].chip[1] = CHIP_I;
|
||||
path[lastPath].x[0] = 11;
|
||||
path[lastPath].y[0] = 0;
|
||||
path[lastPath].x[1] = 15;
|
||||
path[lastPath].y[1] = 0;
|
||||
|
||||
sendPath(lastPath, 1);
|
||||
delay(100);
|
||||
sendPath(lastPath, 0);
|
||||
|
||||
|
||||
}
|
||||
void sendAllPaths(void) // should we sort them by chip? for now, no
|
||||
{
|
||||
|
||||
@ -188,19 +206,10 @@ void sendAllPaths(void) // should we sort them by chip? for now, no
|
||||
|
||||
|
||||
sendPath(i, 1);
|
||||
|
||||
|
||||
|
||||
//delay(120);
|
||||
//showLEDsCore2 = 1;
|
||||
}
|
||||
/*for (int i = numberOfPaths; i >= 0; i--)
|
||||
{
|
||||
sendPath(i, 0);
|
||||
|
||||
delay(800);
|
||||
}*/
|
||||
}
|
||||
|
||||
void sendPath(int i, int setOrClear)
|
||||
{
|
||||
|
||||
@ -259,11 +268,11 @@ void sendPath(int i, int setOrClear)
|
||||
|
||||
// delayMicroseconds(50);
|
||||
|
||||
delayMicroseconds(20);
|
||||
delayMicroseconds(30);
|
||||
|
||||
pio_sm_put(pio, sm, chAddress);
|
||||
|
||||
delayMicroseconds(30);
|
||||
delayMicroseconds(40);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ extern int lightUpNetCore2;
|
||||
void initCH446Q(void);
|
||||
|
||||
void sendAllPaths(void); // should we sort them by chip? for now, no
|
||||
|
||||
void resetArduino (void);
|
||||
void sendPath(int path, int setOrClear = 1);
|
||||
|
||||
void createXYarray(void);
|
||||
|
@ -55,9 +55,9 @@ void initLEDs(void)
|
||||
EEPROM.write(DEBUG_LEDSADDRESS, debugLEDs);
|
||||
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
delay(20);
|
||||
delay(30);
|
||||
leds.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
|
||||
delay(20);
|
||||
delay(30);
|
||||
showLEDsCore2 = 1; // Turn OFF all pixels ASAP
|
||||
delay(40);
|
||||
leds.setBrightness(BRIGHTNESS);
|
||||
@ -358,7 +358,6 @@ struct rgbColor pcbColorCorrect(rgbColor colorToShift)
|
||||
testNeg = colorToShiftRgb.r;
|
||||
testNeg -= abs(PCBREDSHIFTBLUE);
|
||||
|
||||
|
||||
if (testNeg < 0)
|
||||
{
|
||||
colorToShiftRgb.r = 0;
|
||||
@ -386,8 +385,6 @@ struct rgbColor pcbColorCorrect(rgbColor colorToShift)
|
||||
testNeg = colorToShiftRgb.g;
|
||||
testNeg -= abs(PCBGREENSHIFTBLUE);
|
||||
|
||||
|
||||
|
||||
if (testNeg < 0)
|
||||
{
|
||||
colorToShiftRgb.g = 0;
|
||||
@ -397,42 +394,39 @@ struct rgbColor pcbColorCorrect(rgbColor colorToShift)
|
||||
colorToShiftRgb.g = colorToShiftRgb.g - abs(PCBGREENSHIFTBLUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
colorToShiftRgb.g = colorToShiftRgb.g + abs(PCBGREENSHIFTBLUE);
|
||||
if (colorToShiftRgb.g > 254)
|
||||
{
|
||||
colorToShiftRgb.g = 254;
|
||||
}
|
||||
}
|
||||
|
||||
if (PCBBLUESHIFTBLUE < 0)
|
||||
{
|
||||
|
||||
testNeg = colorToShiftRgb.b;
|
||||
|
||||
testNeg -= abs(PCBBLUESHIFTBLUE);
|
||||
|
||||
if (testNeg < 0)
|
||||
{
|
||||
colorToShiftRgb.b = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
colorToShiftRgb.g = colorToShiftRgb.g + abs(PCBGREENSHIFTBLUE);
|
||||
if (colorToShiftRgb.g > 254)
|
||||
{
|
||||
colorToShiftRgb.g = 254;
|
||||
}
|
||||
}
|
||||
|
||||
if (PCBBLUESHIFTBLUE < 0)
|
||||
{
|
||||
|
||||
testNeg = colorToShiftRgb.b;
|
||||
|
||||
testNeg -= abs(PCBBLUESHIFTBLUE);
|
||||
|
||||
|
||||
if (testNeg < 0)
|
||||
{
|
||||
colorToShiftRgb.b = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
colorToShiftRgb.b = colorToShiftRgb.b - abs(PCBBLUESHIFTBLUE);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
colorToShiftRgb.b = colorToShiftRgb.b + abs(PCBBLUESHIFTBLUE);
|
||||
if (colorToShiftRgb.b > 254)
|
||||
{
|
||||
colorToShiftRgb.b = colorToShiftRgb.b + abs(PCBBLUESHIFTBLUE);
|
||||
if (colorToShiftRgb.b > 254)
|
||||
{
|
||||
colorToShiftRgb.b = 254;
|
||||
}
|
||||
colorToShiftRgb.b = 254;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Serial.print("\t\tShifted.r: ");
|
||||
|
||||
@ -442,8 +436,8 @@ struct rgbColor pcbColorCorrect(rgbColor colorToShift)
|
||||
// Serial.print("\tShifted.b: ");
|
||||
// Serial.println(colorToShiftRgb.b);
|
||||
// Serial.print("\n\n\r");
|
||||
}
|
||||
else if (colorToShiftHsv.h >= 150 && colorToShiftHsv.h < 255)
|
||||
}
|
||||
else if (colorToShiftHsv.h >= 150 && colorToShiftHsv.h < 255)
|
||||
{
|
||||
|
||||
// Serial.print("hue: ");
|
||||
@ -460,7 +454,6 @@ struct rgbColor pcbColorCorrect(rgbColor colorToShift)
|
||||
testNeg = colorToShiftRgb.r;
|
||||
testNeg -= abs(PCBREDSHIFTPINK);
|
||||
|
||||
|
||||
if (testNeg < 0)
|
||||
{
|
||||
colorToShiftRgb.r = 0;
|
||||
@ -488,8 +481,6 @@ struct rgbColor pcbColorCorrect(rgbColor colorToShift)
|
||||
testNeg = colorToShiftRgb.g;
|
||||
testNeg -= abs(PCBGREENSHIFTPINK);
|
||||
|
||||
|
||||
|
||||
if (testNeg < 0)
|
||||
{
|
||||
colorToShiftRgb.g = 0;
|
||||
@ -499,44 +490,39 @@ struct rgbColor pcbColorCorrect(rgbColor colorToShift)
|
||||
colorToShiftRgb.g = colorToShiftRgb.g - abs(PCBGREENSHIFTPINK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
colorToShiftRgb.g = colorToShiftRgb.g + abs(PCBGREENSHIFTPINK);
|
||||
if (colorToShiftRgb.g > 254)
|
||||
{
|
||||
colorToShiftRgb.g = 254;
|
||||
}
|
||||
}
|
||||
|
||||
if (PCBBLUESHIFTPINK < 0)
|
||||
{
|
||||
|
||||
testNeg = colorToShiftRgb.b;
|
||||
|
||||
testNeg -= abs(PCBBLUESHIFTPINK);
|
||||
|
||||
if (testNeg < 0)
|
||||
{
|
||||
colorToShiftRgb.b = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
colorToShiftRgb.g = colorToShiftRgb.g + abs(PCBGREENSHIFTPINK);
|
||||
if (colorToShiftRgb.g > 254)
|
||||
{
|
||||
colorToShiftRgb.g = 254;
|
||||
}
|
||||
}
|
||||
|
||||
if (PCBBLUESHIFTPINK < 0)
|
||||
{
|
||||
|
||||
testNeg = colorToShiftRgb.b;
|
||||
|
||||
testNeg -= abs(PCBBLUESHIFTPINK);
|
||||
|
||||
|
||||
if (testNeg < 0)
|
||||
{
|
||||
colorToShiftRgb.b = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
colorToShiftRgb.b = colorToShiftRgb.b - abs(PCBBLUESHIFTPINK);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
colorToShiftRgb.b = colorToShiftRgb.b + abs(PCBBLUESHIFTPINK);
|
||||
if (colorToShiftRgb.b > 254)
|
||||
{
|
||||
colorToShiftRgb.b = colorToShiftRgb.b + abs(PCBBLUESHIFTPINK);
|
||||
if (colorToShiftRgb.b > 254)
|
||||
{
|
||||
colorToShiftRgb.b = 254;
|
||||
}
|
||||
colorToShiftRgb.b = 254;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return colorToShiftRgb;
|
||||
}
|
||||
@ -580,9 +566,12 @@ void lightUpNode(int node)
|
||||
leds.setPixelColor(node, 0);
|
||||
}
|
||||
|
||||
void lightUpRail(int rail, int onOff, int brightness2)
|
||||
void lightUpRail( int logo, int rail, int onOff, int brightness2)
|
||||
{
|
||||
if (logo == -1)
|
||||
{
|
||||
leds.setPixelColor(110, 0xaa0011);
|
||||
}
|
||||
|
||||
leds.setPixelColor(83, packRgb((railColors[1].r * brightness2) >> 8, (railColors[1].g * brightness2) >> 8, (railColors[1].b * brightness2) >> 8));
|
||||
leds.setPixelColor(108, packRgb((railColors[1].r * brightness2) >> 8, (railColors[1].g * brightness2) >> 8, (railColors[1].b * brightness2) >> 8));
|
||||
@ -619,11 +608,7 @@ void showNets(void)
|
||||
|
||||
for (int i = 0; i < numberOfNets; i++)
|
||||
{
|
||||
for (int j = 0; j < numberOfPaths; j++)
|
||||
{
|
||||
uint32_t color = packRgb(net[i].color.r, net[i].color.g, net[i].color.b);
|
||||
leds.setPixelColor(bbPixelToNodesMap[net[i].nodes[j]], color);
|
||||
}
|
||||
lightUpNet();
|
||||
}
|
||||
showLEDsCore2 = 1;
|
||||
}
|
||||
@ -739,21 +724,170 @@ void colorWipe(uint32_t color, int wait)
|
||||
void rainbowy(int saturation, int brightness, int wait)
|
||||
{
|
||||
|
||||
for (long firstPixelHue = 0; firstPixelHue < 5 * 65536; firstPixelHue += 256)
|
||||
hsvColor hsv;
|
||||
int bounce = 0;
|
||||
int offset = 1;
|
||||
|
||||
for (long j = 0; j < 60; j += 1)
|
||||
{
|
||||
// strip.rainbow() can take a single argument (first pixel hue) or
|
||||
// optionally a few extras: number of rainbow repetitions (default 1),
|
||||
// saturation and value (brightness) (both 0-255, similar to the
|
||||
// ColorHSV() function, default 255), and a true/false flag for whether
|
||||
// to apply gamma correction to provide 'truer' colors (default true).
|
||||
leds.rainbow(firstPixelHue, 1, saturation, brightness, true);
|
||||
// Above line is equivalent to:
|
||||
// strip.rainbow(firstPixelHue, 1, 255, 255, true);
|
||||
showLEDsCore2 = 1; // Update strip with new contents
|
||||
delay(wait); // Pause for a moment
|
||||
|
||||
for (int i = 0; i < LED_COUNT; i++)
|
||||
{
|
||||
float huef;
|
||||
float i2 = i;
|
||||
float j2 = j;
|
||||
|
||||
//huef = ((i * j)) * 0.1f; //*254.1;
|
||||
// hsv.h = (j*(i*j))%255;
|
||||
//hsv.h = (j*(int((sin(j+i)*4))))%254;
|
||||
//
|
||||
huef = sinf((i2 * (j2)) * 3.0f);//*(sinf((j2*i2))*19.0);
|
||||
hsv.h = ((int)(huef)) % 254;
|
||||
|
||||
hsv.s = 254;
|
||||
hsv.v = 80;
|
||||
rgbColor rgb = HsvToRgb(hsv);
|
||||
uint32_t rgbPacked = packRgb(rgb.r, rgb.g, rgb.b);
|
||||
// rgbPacked = rgbPacked * i
|
||||
leds.setPixelColor((i + offset) % LED_COUNT, rgbPacked);
|
||||
}
|
||||
|
||||
offset += 1;
|
||||
// offset = offset % 80;
|
||||
showLEDsCore2 = 1;
|
||||
delayMicroseconds((wait * 1000)); //*((j/20.0)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void startupColors(void)
|
||||
{
|
||||
hsvColor hsv;
|
||||
int bounce = 0;
|
||||
int offset = 1;
|
||||
int fade = 0;
|
||||
int done = 0;
|
||||
|
||||
for (long j = 4; j < 162; j += 2)
|
||||
{
|
||||
if (j < BRIGHTNESS/3)
|
||||
{
|
||||
fade = j*3;
|
||||
}
|
||||
else
|
||||
{
|
||||
int fadeout = j - BRIGHTNESS;
|
||||
if (fadeout < 0)
|
||||
{
|
||||
fadeout = 0;
|
||||
}
|
||||
if (fadeout > BRIGHTNESS)
|
||||
{
|
||||
fadeout = BRIGHTNESS;
|
||||
done = 1;
|
||||
Serial.println (j);
|
||||
//break;
|
||||
}
|
||||
fade = BRIGHTNESS - fadeout;
|
||||
}
|
||||
|
||||
for (int i = 0; i < LED_COUNT; i++)
|
||||
{
|
||||
float huef;
|
||||
float i2 = i;
|
||||
float j2 = j+50;
|
||||
|
||||
huef = ((i2 * j2)) * 0.1f; //*254.1;
|
||||
// hsv.h = (j*(i*j))%255;
|
||||
// hsv.h = (j*(int((sin(j+i)*4))))%254;
|
||||
hsv.h = ((int)(huef)) % 254;
|
||||
hsv.s = 254;
|
||||
if (((i + offset)% LED_COUNT) == 110)
|
||||
{
|
||||
hsv.v = 160;
|
||||
hsv.h = (88 + j);
|
||||
} else {
|
||||
|
||||
hsv.v = fade;
|
||||
}
|
||||
rgbColor rgb = HsvToRgb(hsv);
|
||||
uint32_t rgbPacked = packRgb(rgb.r, rgb.g, rgb.b);
|
||||
// rgbPacked = rgbPacked * i
|
||||
|
||||
leds.setPixelColor((i + offset) % LED_COUNT, rgbPacked);
|
||||
}
|
||||
|
||||
offset += 1;
|
||||
// offset = offset % 80;
|
||||
lightUpRail(1);
|
||||
//showLEDsCore2 = 1;
|
||||
leds.show();
|
||||
if (done == 0)
|
||||
{
|
||||
delayMicroseconds((8000)); //*((j/20.0)));
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
//Serial.println(j);
|
||||
|
||||
}
|
||||
clearLEDs();
|
||||
lightUpRail();
|
||||
//showLEDsCore2 = 1;
|
||||
}
|
||||
void rainbowBounce(int wait)
|
||||
{
|
||||
hsvColor hsv;
|
||||
int bounce = 0;
|
||||
for (long j = 0; j < 40; j += 1)
|
||||
{
|
||||
|
||||
for (int i = 0; i < LED_COUNT; i++)
|
||||
{
|
||||
float huef;
|
||||
float i2 = i;
|
||||
float j2 = j;
|
||||
|
||||
huef = sinf((i2 / (j2)) * 1.0f); //*(sinf((j2/i2))*19.0);
|
||||
// hsv.h = (j*(i*j))%255;
|
||||
// hsv.h = (j*(int((sin(j+i)*4))))%254;
|
||||
hsv.h = ((int)(huef * 255)) % 254;
|
||||
hsv.s = 254;
|
||||
hsv.v = 70;
|
||||
rgbColor rgb = HsvToRgb(hsv);
|
||||
uint32_t rgbPacked = packRgb(rgb.r, rgb.g, rgb.b);
|
||||
// rgbPacked = rgbPacked * i
|
||||
leds.setPixelColor(i, rgbPacked);
|
||||
}
|
||||
|
||||
showLEDsCore2 = 1;
|
||||
delayMicroseconds((wait * 1000) * ((j / 20.0)));
|
||||
}
|
||||
for (long j = 40; j >= 0; j -= 1)
|
||||
{
|
||||
|
||||
for (int i = 0; i < LED_COUNT; i++)
|
||||
{
|
||||
float huef;
|
||||
float i2 = i;
|
||||
float j2 = j;
|
||||
|
||||
huef = sinf((i2 / (j2)) * 1.0f); //*(sinf((j2/i2))*19.0);
|
||||
// hsv.h = (j*(i*j))%255;
|
||||
// hsv.h = (j*(int((sin(j+i)*4))))%254;
|
||||
hsv.h = ((int)(huef * 255)) % 254;
|
||||
hsv.s = 254;
|
||||
hsv.v = 70;
|
||||
rgbColor rgb = HsvToRgb(hsv);
|
||||
uint32_t rgbPacked = packRgb(rgb.r, rgb.g, rgb.b);
|
||||
// rgbPacked = rgbPacked * i
|
||||
leds.setPixelColor(i, rgbPacked);
|
||||
}
|
||||
|
||||
showLEDsCore2 = 1;
|
||||
delayMicroseconds((wait * 1000) * ((j / 20.0)));
|
||||
}
|
||||
}
|
||||
void clearLEDs(void)
|
||||
{
|
||||
for (int i = 0; i <= LED_COUNT; i++)
|
||||
@ -762,7 +896,7 @@ void clearLEDs(void)
|
||||
leds.setPixelColor(i, 0); // Set pixel's color (in RAM)
|
||||
// Update strip to match
|
||||
}
|
||||
lightUpRail(-1,1);
|
||||
lightUpRail();
|
||||
// for (int i = 80; i <= 109; i++)
|
||||
// { // For each pixel in strip...
|
||||
// if (nodesToPixelMap[i] > NANO_D0 && nodesToPixelMap[i] < NANO_A7)
|
||||
|
@ -8,9 +8,9 @@
|
||||
|
||||
#define LED_PIN 25
|
||||
#define LED_COUNT 111
|
||||
#define BRIGHTNESS 50
|
||||
#define RAILBRIGHTNESS 55
|
||||
#define SPECIALNETBRIGHTNESS 60
|
||||
#define BRIGHTNESS 80
|
||||
#define RAILBRIGHTNESS 75
|
||||
#define SPECIALNETBRIGHTNESS 90
|
||||
|
||||
// #define PCBEXTINCTION 0 //extra brightness for to offset the extinction through pcb
|
||||
#define PCBREDSHIFTBLUE -25 //extra hue shift to offset the hue shift through pcb
|
||||
@ -18,7 +18,7 @@
|
||||
#define PCBBLUESHIFTBLUE 42
|
||||
|
||||
|
||||
#define PCBEXTINCTION 0 //extra brightness for to offset the extinction through pcb
|
||||
#define PCBEXTINCTION 30 //extra brightness for to offset the extinction through pcb
|
||||
#define PCBREDSHIFTPINK -18 //extra hue shift to offset the hue shift through pcb
|
||||
#define PCBGREENSHIFTPINK -25
|
||||
#define PCBBLUESHIFTPINK 35
|
||||
@ -106,14 +106,15 @@ void colorWipe(uint32_t color, int wait);
|
||||
void rainbowy(int ,int, int wait);
|
||||
void showNets(void);
|
||||
void assignNetColors (void);
|
||||
void lightUpRail (int railNumber, int onOff = 1, int brightness = RAILBRIGHTNESS);
|
||||
void lightUpRail (int logo = -1, int railNumber = -1, int onOff = 1, int brightness = RAILBRIGHTNESS);
|
||||
|
||||
void lightUpNet (int netNumber = -1 , int node = -1, int onOff = 1, int brightness = BRIGHTNESS, int hueShift = 0);//-1 means all nodes (default)
|
||||
void lightUpNet (int netNumber = 0 , int node = -1, int onOff = 1, int brightness = BRIGHTNESS, int hueShift = 0);//-1 means all nodes (default)
|
||||
void lightUpNode (int node);
|
||||
rgbColor pcbColorCorrect (rgbColor colorToCorrect);
|
||||
hsvColor RgbToHsv(rgbColor rgb);
|
||||
rgbColor HsvToRgb(hsvColor hsv);
|
||||
|
||||
uint32_t packRgb(uint8_t r, uint8_t g, uint8_t b);
|
||||
|
||||
void startupColors(void);
|
||||
void rainbowBounce(int wait);
|
||||
#endif
|
@ -32,12 +32,12 @@ uint32_t halvePeriod[3] = {0, 0, 0};
|
||||
char mode[3] = {'z', 'z', 'z'};
|
||||
|
||||
int dacOn[3] = {0, 0, 0};
|
||||
int amplitude[3] = {4095, 4040, 0};
|
||||
int amplitude[3] = {4095, 3500, 0};
|
||||
int offset[3] = {2047, 1932, 2047};
|
||||
int calib[3] = {-10, 100, 0};
|
||||
int calib[3] = {-10, 150, 0};
|
||||
|
||||
MCP4725_PICO dac0_5V(5.0);
|
||||
MCP4725_PICO dac1_8V(15.0);
|
||||
MCP4725_PICO dac1_8V(18.0);
|
||||
|
||||
INA219 INA0(0x40);
|
||||
INA219 INA1(0x41);
|
||||
@ -72,7 +72,8 @@ void initDAC(void)
|
||||
{
|
||||
// Wire.begin();
|
||||
dac1_8V.begin(MCP4725A1_Addr_A01, i2c0, 3000, 4, 5);
|
||||
dac0_5V.begin(MCP4725A0_Addr_A00, i2c0, 3000, 4, 5);
|
||||
|
||||
dac0_5V.begin(MCP4725A1_Addr_A00, i2c0, 3000, 4, 5);
|
||||
|
||||
//
|
||||
delay(1);
|
||||
@ -238,7 +239,7 @@ float readAdc(int channel, int samples)
|
||||
return adc3Voltage;
|
||||
}
|
||||
|
||||
void waveGen(void)
|
||||
int waveGen(void)
|
||||
{
|
||||
|
||||
listSpecialNets();
|
||||
@ -283,7 +284,7 @@ void waveGen(void)
|
||||
// float adc3Voltage = (adc3Reading - 2528) / 220.0; //painstakingly measured
|
||||
// float adc0Voltage = ((adc0Reading) / 400.0) - 0.69; //- 0.93; //painstakingly measured
|
||||
|
||||
int adc0Reading = 0;
|
||||
int adc0Reading = 0;
|
||||
int brightness0 = 0;
|
||||
int hueShift0 = 0;
|
||||
|
||||
@ -291,6 +292,7 @@ void waveGen(void)
|
||||
if (dacOn[0] == 1)
|
||||
{
|
||||
adc0Reading = INA1.getBusVoltage_mV();
|
||||
//adc0Reading = dac0_5V.getInputCode();
|
||||
adc0Reading = abs(adc0Reading );
|
||||
hueShift0 = map(adc0Reading, 0, 5000, -90, 0);
|
||||
|
||||
@ -330,9 +332,26 @@ void waveGen(void)
|
||||
{
|
||||
|
||||
//int adc0Reading = analogRead(26);
|
||||
// if (activeDac == 0)
|
||||
// {
|
||||
// for (int i = 0; i < (analogRead(27)/100); i++)
|
||||
// {
|
||||
// Serial.print('.');
|
||||
|
||||
// }
|
||||
// Serial.println(' ');
|
||||
// }
|
||||
// else if (activeDac == 1)
|
||||
// {
|
||||
|
||||
//Serial.println(adc1Reading);
|
||||
|
||||
// for (int i = 0; i < (analogRead(29)/100); i++)
|
||||
// {
|
||||
// Serial.print('.');
|
||||
|
||||
// }
|
||||
// Serial.println(' ');
|
||||
// }
|
||||
|
||||
lastTime = now;
|
||||
// Serial.println(count); // show # updates per 0.1 second
|
||||
count = 0;
|
||||
@ -452,10 +471,21 @@ void waveGen(void)
|
||||
|
||||
mode[activeDac] = c;
|
||||
break;
|
||||
case '{':
|
||||
case 'f':
|
||||
{
|
||||
if (mode[0] != 'v')
|
||||
{
|
||||
dac0_5V.setVoltage(0.0);
|
||||
}
|
||||
if (mode[1] != 'v')
|
||||
{
|
||||
dac1_8V.setInputCode(offset[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
case 'x':
|
||||
case 'f':
|
||||
case '{':
|
||||
{
|
||||
if (mode[0] != 'v')
|
||||
{
|
||||
@ -469,7 +499,7 @@ void waveGen(void)
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ void setDac0_5V(float value);
|
||||
void setDac1_8V(float value);
|
||||
|
||||
void refillTable (int amplitude = 2047, int offset = 2047, int adc = 2);
|
||||
void waveGen(void);
|
||||
int waveGen(void);
|
||||
void GetAdc29Status(int i);
|
||||
float readAdc(int channel, int samples = 10);
|
||||
|
||||
|
@ -10,9 +10,9 @@
|
||||
// #include "CH446Q.h"
|
||||
#include "Peripherals.h"
|
||||
#include <Wire.h>
|
||||
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
// #include <EEPROM.h>
|
||||
// #include "ArduinoStuff.h"
|
||||
#include "ArduinoStuff.h"
|
||||
|
||||
|
||||
#ifdef EEPROMSTUFF
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
int sendAllPathsCore2 = 0;
|
||||
volatile int sendAllPathsCore2 = 0;
|
||||
|
||||
|
||||
// https://wokwi.com/projects/367384677537829889
|
||||
@ -43,7 +43,9 @@ void setup()
|
||||
//
|
||||
|
||||
//
|
||||
// initArduino();
|
||||
pinMode(2,INPUT);
|
||||
pinMode(3,INPUT);
|
||||
//initArduino();
|
||||
//debugFlagInit();
|
||||
|
||||
#ifdef EEPROMSTUFF
|
||||
@ -78,7 +80,14 @@ void setup1()
|
||||
#endif
|
||||
|
||||
initLEDs();
|
||||
lightUpRail(-1, 1);
|
||||
//delay(100);
|
||||
|
||||
|
||||
|
||||
lightUpRail();
|
||||
//delay(100);
|
||||
startupColors();
|
||||
|
||||
|
||||
}
|
||||
void loop()
|
||||
@ -87,10 +96,18 @@ void loop()
|
||||
|
||||
char input;
|
||||
unsigned long timer = 0;
|
||||
// while (1)
|
||||
// {
|
||||
|
||||
|
||||
|
||||
// delay(5000);
|
||||
|
||||
|
||||
// }
|
||||
// initArduino();
|
||||
//
|
||||
//rainbowy(255,125,30);
|
||||
//while (1) rainbowBounce(30);
|
||||
// while(1)
|
||||
// {
|
||||
// for (int i = 0; i < 30; i++)
|
||||
@ -102,9 +119,12 @@ void loop()
|
||||
// }
|
||||
// }
|
||||
menu:
|
||||
|
||||
// arduinoPrint();
|
||||
delay(10);
|
||||
// while (1)
|
||||
// {
|
||||
// arduinoPrint();
|
||||
// delay(10);
|
||||
// }
|
||||
showLEDsCore2 = 1;
|
||||
Serial.print("\n\n\r\t\t\tMenu\n\n\r");
|
||||
Serial.print("\tn = show netlist\n\r");
|
||||
Serial.print("\tb = show bridge array\n\r");
|
||||
@ -153,13 +173,28 @@ menu:
|
||||
// lastCommandWrite(input);
|
||||
printBridgeArray();
|
||||
break;
|
||||
case 'w':
|
||||
// lastCommandWrite(input);
|
||||
waveGen();
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
// measureCurrent();
|
||||
break;
|
||||
case 'w':
|
||||
// lastCommandWrite(input);
|
||||
if (waveGen() == 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
//break;
|
||||
case 'a':
|
||||
{
|
||||
resetArduino();
|
||||
uploadArduino();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
case 'f':
|
||||
digitalWrite(RESETPIN, HIGH);
|
||||
@ -179,6 +214,7 @@ menu:
|
||||
|
||||
bridgesToPaths();
|
||||
assignNetColors();
|
||||
showNets();
|
||||
|
||||
#ifdef PIOSTUFF
|
||||
sendAllPathsCore2 = 1;
|
||||
@ -195,6 +231,9 @@ sendAllPathsCore2 = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
case 'p':
|
||||
|
||||
// case '{':
|
||||
@ -279,18 +318,19 @@ sendAllPathsCore2 = 1;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
resetArduino();
|
||||
// EEPROM.commit();
|
||||
digitalWrite(RESETPIN, HIGH);
|
||||
delay(1);
|
||||
#ifdef FSSSTUFF
|
||||
clearNodeFile();
|
||||
#endif
|
||||
digitalWrite(RESETPIN, LOW);
|
||||
clearAllNTCC();
|
||||
leds.clear();
|
||||
//leds.show();
|
||||
showLEDsCore2 = 1;
|
||||
// AIRCR_Register = 0x5FA0004; // this just hardware resets the rp2040, it would be too much of a pain in the ass to reinitialize everything
|
||||
// digitalWrite(RESETPIN, HIGH);
|
||||
// delay(1);
|
||||
// #ifdef FSSSTUFF
|
||||
// clearNodeFile();
|
||||
// #endif
|
||||
// digitalWrite(RESETPIN, LOW);
|
||||
// clearAllNTCC();
|
||||
// leds.clear();
|
||||
// //leds.show();
|
||||
// showLEDsCore2 = 1;
|
||||
// // AIRCR_Register = 0x5FA0004; // this just hardware resets the rp2040, it would be too much of a pain in the ass to reinitialize everything
|
||||
|
||||
break;
|
||||
|
||||
@ -358,7 +398,7 @@ sendAllPathsCore2 = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//leds.show();
|
||||
goto menu;
|
||||
|
||||
|
||||
@ -372,6 +412,7 @@ void loop1()
|
||||
|
||||
if (showLEDsCore2 == 1)
|
||||
{
|
||||
showNets();
|
||||
delayMicroseconds(9200);
|
||||
leds.show();
|
||||
delayMicroseconds(9200);
|
||||
|
Loading…
x
Reference in New Issue
Block a user