mirror of
https://github.com/Architeuthis-Flux/Jumperless.git
synced 2025-01-19 00:34:04 +01:00
Accepts ::lightnet for +-8V and header glow and stuff
This commit is contained in:
parent
78e878cb5a
commit
2f1158393a
@ -42,15 +42,15 @@ uint32_t rawSpecialNetColors[8] =
|
||||
0x232323,
|
||||
0x232323};
|
||||
|
||||
uint32_t rawOtherColors[8] =
|
||||
{0x020008, // dim header glow
|
||||
0x550008, // logo glow
|
||||
0x0055AA, // logo flash
|
||||
uint32_t rawOtherColors[8] =
|
||||
{0x020008, // headerglow
|
||||
0x550008, // logo / status
|
||||
0x0055AA, // logoflash / statusflash
|
||||
0x301A02, // +8V
|
||||
0x120932, // -8V
|
||||
0x230913,
|
||||
0x232323,
|
||||
0x232323};
|
||||
0x230913, // unassigned
|
||||
0x232323, // unassigned
|
||||
0x232323}; // unassigned
|
||||
|
||||
rgbColor specialNetColors[8] =
|
||||
{{00, 00, 00},
|
||||
@ -1141,9 +1141,10 @@ void lightUpRail(int logo, int rail, int onOff, int brightness2, int switchPosit
|
||||
|
||||
for (int i = 80; i <= 109; i++)
|
||||
{
|
||||
if (leds.getPixelColor(i) == 0 )
|
||||
if (leds.getPixelColor(i) == 0 || leds.getPixelColor(i) != rawOtherColors[0])
|
||||
{
|
||||
leds.setPixelColor(i, rawOtherColors[0]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1166,7 +1167,7 @@ void lightUpRail(int logo, int rail, int onOff, int brightness2, int switchPosit
|
||||
// rgbColor rgbRail = railColors[j];
|
||||
// hsvColor hsvRail = RgbToHsv(rgbRail);
|
||||
// hsvRail.v = brightness2;
|
||||
// // Serial.println (brightness2);
|
||||
//Serial.println (rawOtherColors[0], HEX);
|
||||
// rgbRail = HsvToRgb(hsvRail);
|
||||
// Serial.println (hsvRail.h);
|
||||
// Serial.println (hsvRail.s);
|
||||
|
@ -516,8 +516,9 @@ int setSupplySwitch(void)
|
||||
|
||||
void lightUpNetsFromInputBuffer(void)
|
||||
{
|
||||
//char *bufferPtr = inputBuffer;
|
||||
//char inputBufferCopy[INPUTBUFFERLENGTH];
|
||||
const int numberOfNRNs = 10;//how many commands there are below
|
||||
const char *notReallyNets[] = { "headerglow", "glow", "hg", "+8v", "8v", "-8v", "logo", "status", "logoflash", "statusflash"};
|
||||
int notReallyNetsInt[] = { 0, 0, 0, 3, 3, 4, 1, 1, 2, 2};//these correspond to an index in rawOtherColors[]
|
||||
char *token[50];
|
||||
|
||||
|
||||
@ -560,6 +561,39 @@ void lightUpNetsFromInputBuffer(void)
|
||||
break;
|
||||
}
|
||||
|
||||
int wasNRN = 0;
|
||||
|
||||
for (int j = 0; j < numberOfNRNs; j++)
|
||||
{
|
||||
// Serial.print("token[i] = ");
|
||||
// Serial.println(token[i]);
|
||||
// Serial.print("notReallyNets[j] = ");
|
||||
// Serial.println(notReallyNets[j]);
|
||||
if (strcasecmp(token[i], notReallyNets[j]) == 0)
|
||||
{
|
||||
rawOtherColors[notReallyNetsInt[j]] = color;
|
||||
|
||||
switch (notReallyNetsInt[j])
|
||||
{
|
||||
case 3:
|
||||
rawRailColors[2][0] = color;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
rawRailColors[2][2] = color;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
wasNRN = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (wasNRN == 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
int netNumber = atoi(token[i]);
|
||||
|
||||
// if (netNumber == 0)
|
||||
|
@ -22,7 +22,7 @@ uint8_t intersections[8]; //if this net shares a node with another net, store th
|
||||
|
||||
int8_t doNotIntersectNodes[8]; //if the net tries to share a node with a net that contains any #defined nodes here, it won't connect and throw an error (SUPPLY to GND)
|
||||
|
||||
uint8_t priority = 0; //priority = 1 means it will move connections to take the most direct path, priority = 2 means connections will be doubled up when possible, priority = 3 means both
|
||||
uint8_t priority = 0; //this isn't implemented - priority = 1 means it will move connections to take the most direct path, priority = 2 means connections will be doubled up when possible, priority = 3 means both
|
||||
|
||||
rgbColor color; //color of the net in hex
|
||||
|
||||
@ -116,7 +116,7 @@ const int duplucateSFnodes[26][4] = { // [] [sf chip1, x pin1, sf chip2, x pin
|
||||
{CHIP_J,13,CHIP_L,3},
|
||||
{CHIP_J,14,CHIP_L,14},
|
||||
{CHIP_I,15,CHIP_J,15},
|
||||
//{CHIP_I,15,CHIP_L,15},
|
||||
//{CHIP_I,15,CHIP_L,15}, //rev2
|
||||
///{CHIP_J,15,CHIP_L,15},
|
||||
{CHIP_K,15,CHIP_L,4},
|
||||
};
|
||||
|
@ -32,6 +32,7 @@ int showReadings = 0;
|
||||
|
||||
int showADCreadings[4] = {1, 1, 1, 1};
|
||||
|
||||
int inaConnected = 0;
|
||||
int showINA0[3] = {1, 1, 1}; // 0 = current, 1 = voltage, 2 = power
|
||||
int showINA1[3] = {0, 0, 0}; // 0 = current, 1 = voltage, 2 = power
|
||||
|
||||
@ -285,6 +286,12 @@ void chooseShownReadings(void)
|
||||
showADCreadings[2] = 0;
|
||||
showADCreadings[3] = 0;
|
||||
|
||||
showINA0[0] = 0;
|
||||
showINA0[1] = 0;
|
||||
showINA0[2] = 0;
|
||||
|
||||
inaConnected = 0;
|
||||
|
||||
for (int i = 0; i <= newBridgeIndex; i++)
|
||||
{
|
||||
|
||||
@ -310,10 +317,15 @@ void chooseShownReadings(void)
|
||||
|
||||
if (path[i].node1 == CURRENT_SENSE_PLUS || path[i].node1 == CURRENT_SENSE_PLUS || path[i].node2 == CURRENT_SENSE_MINUS || path[i].node2 == CURRENT_SENSE_MINUS)
|
||||
{
|
||||
//Serial.println(showReadings);
|
||||
|
||||
inaConnected = 1;
|
||||
|
||||
switch (showReadings)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
|
||||
case 1:
|
||||
showINA0[0] = 1;
|
||||
@ -332,14 +344,29 @@ void chooseShownReadings(void)
|
||||
showINA0[2] = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
// Serial.println(showINA0[0]);
|
||||
// Serial.println(showINA0[1]);
|
||||
// Serial.println(showINA0[2]);
|
||||
// Serial.println(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inaConnected == 0)
|
||||
{
|
||||
showINA0[0] = 0;
|
||||
showINA0[1] = 0;
|
||||
showINA0[2] = 0;
|
||||
//showReadings = 3;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void showMeasurements(int samples)
|
||||
{
|
||||
|
||||
while (Serial.available() == 0 && Serial1.available() == 0)
|
||||
|
||||
{
|
||||
// CSI
|
||||
// Serial.write("\x1B\x5B 2K");
|
||||
@ -359,6 +386,13 @@ void showMeasurements(int samples)
|
||||
float adc3Reading;
|
||||
int bs = 0;
|
||||
|
||||
// Serial.print(showINA0[0]);
|
||||
// Serial.print(showINA0[1]);
|
||||
// Serial.print(showINA0[2]);
|
||||
// Serial.print("\t");
|
||||
|
||||
|
||||
|
||||
if (showADCreadings[0] == 1)
|
||||
{
|
||||
|
||||
@ -449,9 +483,21 @@ void showMeasurements(int samples)
|
||||
{
|
||||
delay(350);
|
||||
}
|
||||
// else {
|
||||
// Serial.print("Serial.available =");
|
||||
// Serial.print(Serial.available());
|
||||
// Serial.print("\nSerial1.available =");
|
||||
// Serial.print(Serial1.available());
|
||||
// Serial.print("\n\r");
|
||||
// delay(1000);
|
||||
// // break;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
// else{
|
||||
// Serial.print("\r nothing to sample \r");
|
||||
// }
|
||||
}
|
||||
|
||||
int readAdc(int channel, int samples)
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
extern int showReadings;
|
||||
|
||||
extern int inaConnected;
|
||||
extern int showINA0[3]; //0 = current, 1 = voltage, 2 = power
|
||||
extern int showINA1[3]; //0 = current, 1 = voltage, 2 = power
|
||||
|
||||
|
@ -146,8 +146,6 @@ dontshowmenu:
|
||||
connectFromArduino = '\0';
|
||||
|
||||
while (Serial.available() == 0 && connectFromArduino == '\0')
|
||||
;
|
||||
|
||||
{
|
||||
if (showReadings >= 1)
|
||||
{
|
||||
@ -172,16 +170,20 @@ skipinput:
|
||||
{
|
||||
case 'v':
|
||||
|
||||
if (showReadings >= 3)
|
||||
if (showReadings >= 3 || (inaConnected == 0 && showReadings >= 1))
|
||||
{
|
||||
showReadings = 0;
|
||||
// goto dontshowmenu;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
showReadings++;
|
||||
|
||||
chooseShownReadings();
|
||||
//Serial.println(showReadings);
|
||||
|
||||
|
||||
|
||||
// Serial.write("\033"); //these VT100/ANSI commands work on some terminals and not others so I took it out
|
||||
// Serial.write("\x1B\x5B");
|
||||
// Serial.write("1F");//scroll up one line
|
||||
@ -443,7 +445,7 @@ skipinput:
|
||||
// Serial.print("\n\r");
|
||||
// Serial.print("entering machine mode\n\r");
|
||||
machineMode();
|
||||
// showLEDsCore2 = 1;
|
||||
showLEDsCore2 = 1;
|
||||
goto dontshowmenu;
|
||||
break;
|
||||
}
|
||||
@ -516,7 +518,7 @@ void machineMode(void) // read in commands in machine readable format
|
||||
lightUpNetsFromInputBuffer();
|
||||
// lightUpNet();
|
||||
//assignNetColors();
|
||||
showLEDsCore2 = 1;
|
||||
//showLEDsCore2 = 1;
|
||||
break;
|
||||
|
||||
// case getmeasurement:
|
||||
@ -655,7 +657,7 @@ void loop1() // core 2 handles the LEDs and the CH446Q8
|
||||
logoFlash = 0;
|
||||
logoFlashTimer = 0;
|
||||
// lightUpRail();
|
||||
leds.setPixelColor(110, 0x550008);
|
||||
leds.setPixelColor(110, rawOtherColors[1]);
|
||||
leds.show();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user