mirror of
https://github.com/Architeuthis-Flux/Jumperless.git
synced 2024-11-12 01:30:50 +01:00
Fixed a bug where bounces wouldn't check for overlaps
phew
This commit is contained in:
parent
20ec8043fe
commit
3a66d7fb12
22
JumperlessNano/JumperlessNano.code-workspace
Normal file
22
JumperlessNano/JumperlessNano.code-workspace
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"files.associations": {
|
||||||
|
"array": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"list": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"string_view": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"ranges": "cpp",
|
||||||
|
"cstring": "cpp",
|
||||||
|
"cmath": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -89,7 +89,7 @@ void isrFromPio(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delayMicroseconds(1);
|
delayMicroseconds(2);
|
||||||
digitalWriteFast(CS_A, LOW);
|
digitalWriteFast(CS_A, LOW);
|
||||||
digitalWriteFast(CS_B, LOW);
|
digitalWriteFast(CS_B, LOW);
|
||||||
digitalWriteFast(CS_C, LOW);
|
digitalWriteFast(CS_C, LOW);
|
||||||
@ -103,7 +103,7 @@ void isrFromPio(void)
|
|||||||
digitalWriteFast(CS_J, LOW);
|
digitalWriteFast(CS_J, LOW);
|
||||||
digitalWriteFast(CS_K, LOW);
|
digitalWriteFast(CS_K, LOW);
|
||||||
digitalWriteFast(CS_L, LOW);
|
digitalWriteFast(CS_L, LOW);
|
||||||
|
delayMicroseconds(2);
|
||||||
irq_flags = pio0_hw->irq;
|
irq_flags = pio0_hw->irq;
|
||||||
pio_interrupt_clear(pio, PIO0_IRQ_0);
|
pio_interrupt_clear(pio, PIO0_IRQ_0);
|
||||||
hw_clear_bits(&pio0_hw->irq, irq_flags);
|
hw_clear_bits(&pio0_hw->irq, irq_flags);
|
||||||
@ -219,6 +219,11 @@ void sendPath(int i, int setOrClear)
|
|||||||
|
|
||||||
chipToConnect = path[i].chip[chip];
|
chipToConnect = path[i].chip[chip];
|
||||||
|
|
||||||
|
if (path[i].y[chip] == -1 || path[i].x[chip] == -1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
chYdata = path[i].y[chip];
|
chYdata = path[i].y[chip];
|
||||||
chXdata = path[i].x[chip];
|
chXdata = path[i].x[chip];
|
||||||
|
|
||||||
@ -243,7 +248,7 @@ void sendPath(int i, int setOrClear)
|
|||||||
|
|
||||||
pio_sm_put(pio, sm, chAddress);
|
pio_sm_put(pio, sm, chAddress);
|
||||||
|
|
||||||
delayMicroseconds(40);
|
delayMicroseconds(60);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,10 @@ CHIP_H,CHIP_H,CHIP_H,CHIP_H,CHIP_H,CHIP_H,CHIP_H, //53,54,55,56,57,58,59
|
|||||||
CHIP_L}; //60
|
CHIP_L}; //60
|
||||||
|
|
||||||
|
|
||||||
|
// const int xHopMap[12][12][16] = //[chip] [other chip][x]
|
||||||
|
// {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct chipStatus ch[12] = {
|
struct chipStatus ch[12] = {
|
||||||
|
@ -718,7 +718,8 @@ void resolveAltPaths(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int bb = 0; bb < 8; bb++) // check if any other chips have free paths to both the sf chip and target chip
|
for (int bb = 0; bb < 8; bb++) // check if any other chips have free paths to both the sf chip and target chip
|
||||||
{tryAfterSwap:
|
{
|
||||||
|
tryAfterSwap:
|
||||||
|
|
||||||
if (foundPath == 1)
|
if (foundPath == 1)
|
||||||
{
|
{
|
||||||
@ -829,25 +830,25 @@ void resolveAltPaths(void)
|
|||||||
|
|
||||||
int xMapBB = xMapForChipLane0(path[i].chip[0], bb);
|
int xMapBB = xMapForChipLane0(path[i].chip[0], bb);
|
||||||
|
|
||||||
int yMapSF = bb;//always
|
int yMapSF = bb; // always
|
||||||
|
|
||||||
int sfChip = path[i].chip[1];
|
int sfChip = path[i].chip[1];
|
||||||
|
|
||||||
// not chip L
|
// not chip L
|
||||||
if (debugNTCC2)
|
if (debugNTCC2)
|
||||||
{
|
{
|
||||||
Serial.print(" bb: ");
|
Serial.print(" bb: ");
|
||||||
printChipNumToChar(bb);
|
printChipNumToChar(bb);
|
||||||
Serial.print(" \t sfChip: ");
|
Serial.print(" \t sfChip: ");
|
||||||
printChipNumToChar(sfChip);
|
printChipNumToChar(sfChip);
|
||||||
Serial.print(" \t xMapBB: ");
|
Serial.print(" \t xMapBB: ");
|
||||||
Serial.print(xMapBB);
|
Serial.print(xMapBB);
|
||||||
Serial.print(" \t yMapSF: ");
|
Serial.print(" \t yMapSF: ");
|
||||||
Serial.print(yMapSF);
|
Serial.print(yMapSF);
|
||||||
Serial.print(" \t xStatus: ");
|
Serial.print(" \t xStatus: ");
|
||||||
Serial.print(ch[0].xStatus[xMapBB]);
|
Serial.print(ch[0].xStatus[xMapBB]);
|
||||||
Serial.print(" \n\r");
|
Serial.print(" \n\r");
|
||||||
}
|
}
|
||||||
if ((ch[0].xStatus[xMapBB] == path[i].net || ch[0].xStatus[xMapBB] == -1)) // were going through each bb chip to see if it has a connection to both chips free
|
if ((ch[0].xStatus[xMapBB] == path[i].net || ch[0].xStatus[xMapBB] == -1)) // were going through each bb chip to see if it has a connection to both chips free
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -857,32 +858,32 @@ void resolveAltPaths(void)
|
|||||||
|
|
||||||
int xMapL0c1 = xMapForChipLane0(bb, path[i].chip[0]);
|
int xMapL0c1 = xMapForChipLane0(bb, path[i].chip[0]);
|
||||||
int xMapL1c1 = xMapForChipLane1(bb, path[i].chip[0]);
|
int xMapL1c1 = xMapForChipLane1(bb, path[i].chip[0]);
|
||||||
if (debugNTCC2)
|
if (debugNTCC2)
|
||||||
{
|
{
|
||||||
Serial.print(" bb: ");
|
Serial.print(" bb: ");
|
||||||
printChipNumToChar(bb);
|
printChipNumToChar(bb);
|
||||||
Serial.print(" \t sfChip: ");
|
Serial.print(" \t sfChip: ");
|
||||||
printChipNumToChar(sfChip);
|
printChipNumToChar(sfChip);
|
||||||
Serial.print(" \t xMapBB: ");
|
Serial.print(" \t xMapBB: ");
|
||||||
Serial.print(xMapBB);
|
Serial.print(xMapBB);
|
||||||
Serial.print(" \t yMapSF: ");
|
Serial.print(" \t yMapSF: ");
|
||||||
Serial.print(yMapSF);
|
Serial.print(yMapSF);
|
||||||
Serial.print(" \t xStatus: ");
|
Serial.print(" \t xStatus: ");
|
||||||
Serial.print(ch[bb].xStatus[xMapBB]);
|
Serial.print(ch[bb].xStatus[xMapBB]);
|
||||||
Serial.print(" \n\r");
|
Serial.print(" \n\r");
|
||||||
|
|
||||||
Serial.print("xMapL0c0: ");
|
Serial.print("xMapL0c0: ");
|
||||||
Serial.print(xMapL0c0);
|
Serial.print(xMapL0c0);
|
||||||
Serial.print(" \txMapL1c0: ");
|
Serial.print(" \txMapL1c0: ");
|
||||||
|
|
||||||
Serial.print(xMapL0c1);
|
Serial.print(xMapL0c1);
|
||||||
Serial.print(" \txMapL1c1: ");
|
Serial.print(" \txMapL1c1: ");
|
||||||
|
|
||||||
Serial.print(xMapL1c0);
|
Serial.print(xMapL1c0);
|
||||||
Serial.print(" \txMapL0c1: ");
|
Serial.print(" \txMapL0c1: ");
|
||||||
Serial.print(xMapL1c1);
|
Serial.print(xMapL1c1);
|
||||||
Serial.print("\n\n\r");
|
Serial.print("\n\n\r");
|
||||||
}
|
}
|
||||||
int freeLane = -1;
|
int freeLane = -1;
|
||||||
// Serial.print("\t");
|
// Serial.print("\t");
|
||||||
// Serial.print(bb);
|
// Serial.print(bb);
|
||||||
@ -890,17 +891,14 @@ void resolveAltPaths(void)
|
|||||||
if ((xMapL1c0 != -1) && ch[path[i].chip[0]].xStatus[xMapL1c0] == path[i].net) // check if lane 1 shares a net first so it should prefer sharing lanes
|
if ((xMapL1c0 != -1) && ch[path[i].chip[0]].xStatus[xMapL1c0] == path[i].net) // check if lane 1 shares a net first so it should prefer sharing lanes
|
||||||
{
|
{
|
||||||
freeLane = 1;
|
freeLane = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ((ch[path[i].chip[0]].xStatus[xMapL0c0] == -1) || ch[path[i].chip[0]].xStatus[xMapL0c0] == path[i].net) // lanes will alway be taken together, so only check chip 1
|
else if ((ch[path[i].chip[0]].xStatus[xMapL0c0] == -1) || ch[path[i].chip[0]].xStatus[xMapL0c0] == path[i].net) // lanes will alway be taken together, so only check chip 1
|
||||||
{
|
{
|
||||||
freeLane = 0;
|
freeLane = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ((xMapL1c0 != -1) && ((ch[path[i].chip[0]].xStatus[xMapL1c0] == -1) || ch[path[i].chip[0]].xStatus[xMapL1c0] == path[i].net))
|
else if ((xMapL1c0 != -1) && ((ch[path[i].chip[0]].xStatus[xMapL1c0] == -1) || ch[path[i].chip[0]].xStatus[xMapL1c0] == path[i].net))
|
||||||
{
|
{
|
||||||
freeLane = 1;
|
freeLane = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -909,6 +907,12 @@ void resolveAltPaths(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ( ch[sfChip].yStatus[yMapSF] != -1 && ch[sfChip].yStatus[yMapSF] != path[i].net)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
path[i].chip[2] = bb;
|
path[i].chip[2] = bb;
|
||||||
path[i].altPathNeeded = false;
|
path[i].altPathNeeded = false;
|
||||||
|
|
||||||
@ -918,7 +922,6 @@ void resolveAltPaths(void)
|
|||||||
// Serial.print("\n\r\t\t\t\tFree Lane: ");
|
// Serial.print("\n\r\t\t\t\tFree Lane: ");
|
||||||
// Serial.println(freeLane);
|
// Serial.println(freeLane);
|
||||||
|
|
||||||
|
|
||||||
if (freeLane == 0)
|
if (freeLane == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -932,11 +935,11 @@ void resolveAltPaths(void)
|
|||||||
path[i].x[1] = SFnode;
|
path[i].x[1] = SFnode;
|
||||||
|
|
||||||
path[i].x[2] = xMapL0c1;
|
path[i].x[2] = xMapL0c1;
|
||||||
// Serial.print("\n\r\t\t\t\txBB: ");
|
//Serial.print("\n\r\t\t\t\txBB: ");
|
||||||
// Serial.println(bb);
|
//Serial.println(bb);
|
||||||
|
|
||||||
xMapBB = xMapForChipLane0(path[i].chip[2], path[i].chip[1]);
|
xMapBB = xMapForChipLane0(path[i].chip[2], path[i].chip[1]);
|
||||||
// Serial.println(xMapBB);
|
//Serial.println(xMapBB);
|
||||||
path[i].chip[3] = path[i].chip[2];
|
path[i].chip[3] = path[i].chip[2];
|
||||||
|
|
||||||
path[i].x[3] = xMapBB;
|
path[i].x[3] = xMapBB;
|
||||||
@ -950,12 +953,6 @@ void resolveAltPaths(void)
|
|||||||
ch[path[i].chip[1]].yStatus[path[i].y[1]] = path[i].net;
|
ch[path[i].chip[1]].yStatus[path[i].y[1]] = path[i].net;
|
||||||
|
|
||||||
path[i].sameChip = true;
|
path[i].sameChip = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (freeLane == 1)
|
else if (freeLane == 1)
|
||||||
{
|
{
|
||||||
@ -1020,9 +1017,9 @@ void resolveAltPaths(void)
|
|||||||
{
|
{
|
||||||
swapped = 1;
|
swapped = 1;
|
||||||
if (debugNTCC2 == true)
|
if (debugNTCC2 == true)
|
||||||
Serial.print("\n\rtrying again with swapped nodes\n\r");
|
Serial.print("\n\rtrying again with swapped nodes\n\r");
|
||||||
|
|
||||||
//path[i].x[0] = xMapForNode(path[i].node2, path[i].chip[0]);
|
// path[i].x[0] = xMapForNode(path[i].node2, path[i].chip[0]);
|
||||||
swapDuplicateNode(i);
|
swapDuplicateNode(i);
|
||||||
bb = 0;
|
bb = 0;
|
||||||
goto tryAfterSwap;
|
goto tryAfterSwap;
|
||||||
@ -1425,7 +1422,7 @@ void resolveAltPaths(void)
|
|||||||
|
|
||||||
for (int bb = 0; bb < 8; bb++) // this is a long winded way to do this but it's at least slightly readable
|
for (int bb = 0; bb < 8; bb++) // this is a long winded way to do this but it's at least slightly readable
|
||||||
{
|
{
|
||||||
//Serial.print("! ");
|
// Serial.print("! ");
|
||||||
int sfChip1 = path[i].chip[0];
|
int sfChip1 = path[i].chip[0];
|
||||||
int sfChip2 = path[i].chip[1];
|
int sfChip2 = path[i].chip[1];
|
||||||
|
|
||||||
@ -1655,7 +1652,7 @@ void resolveUncommittedHops(void)
|
|||||||
|
|
||||||
for (int chip2 = 0; chip2 < 4; chip2++)
|
for (int chip2 = 0; chip2 < 4; chip2++)
|
||||||
{
|
{
|
||||||
if ((path[i].chip[chip] == path[i].chip[chip2] && chip != chip2) || (chip == 2 && path[i].chip[2] != -1))//(path[i].x[3] != -1 || path[i].y[3] != -1)) )
|
if ((path[i].chip[chip] == path[i].chip[chip2] && chip != chip2) || (chip == 2 && path[i].chip[2] != -1)) //(path[i].x[3] != -1 || path[i].y[3] != -1)) )
|
||||||
{
|
{
|
||||||
for (int xy = 0; xy < 6; xy++)
|
for (int xy = 0; xy < 6; xy++)
|
||||||
{
|
{
|
||||||
@ -1726,32 +1723,136 @@ void resolveUncommittedHops(void)
|
|||||||
|
|
||||||
int freeXSearchOrder[12][16] = {
|
int freeXSearchOrder[12][16] = {
|
||||||
// this disallows bounces from sf x pins that would cause problems (5V, GND, etc.)
|
// this disallows bounces from sf x pins that would cause problems (5V, GND, etc.)
|
||||||
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
|
{-1, -1, 2, 3, 4, 5, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15},
|
||||||
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
|
{0, 1, -1, -1, 4, 5, 6, 7, 8, 9, 10, -1, 12, 13, 14, 15},
|
||||||
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
|
{0, 1, 2, 3, -1, -1, 6, 7, 8, 9, 10, 11, 12, -1, 14, 15},
|
||||||
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
|
{0, 1, 2, 3, 4, 5, -1, -1, 8, 9, 10, 11, 12, 13, 14, -1},
|
||||||
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
|
{0, -1, 2, 3, 4, 5, 6, 7, -1, -1, 10, 11, 12, 13, 14, 15},
|
||||||
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
|
{0, 1, 2, -1, 4, 5, 6, 7, 8, 9, -1, -1, 12, 13, 14, 15},
|
||||||
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
|
{0, 1, 2, 3, 4, -1, 6, 7, 8, 9, 10, 11, -1, -1, 14, 15},
|
||||||
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
|
{0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 10, 11, 12, 13, -1, -1},
|
||||||
{13, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -1, -1, -1},
|
{13, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -1, -1, -1},
|
||||||
{13, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -1, -1, -1},
|
{13, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -1, -1, -1},
|
||||||
{15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
|
{15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
|
||||||
{5, 4, 3, 2, 13, 12, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1},
|
{5, 4, 3, 2, 13, 12, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// int freeXSearchOrder[12][16] = {
|
||||||
|
// // this disallows bounces from sf x pins that would cause problems (5V, GND, etc.)
|
||||||
|
// {2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, -1, -1, -1},
|
||||||
|
// {0, 1, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, -1, -1, -1},
|
||||||
|
// {0, 1, 2, 3, 6, 7, 8, 9, 10, 11, 12, 14, 15, -1, -1, -1},
|
||||||
|
// {0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14, -1, -1, -1 },
|
||||||
|
// {0, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, -1, -1, -1},
|
||||||
|
// {0, 1, 2, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, -1, -1, -1},
|
||||||
|
// {0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 14, 15, -1, -1, -1},
|
||||||
|
// {0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, -1, -1, -1},
|
||||||
|
// {13, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -1, -1},
|
||||||
|
// {13, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -1, -1},
|
||||||
|
// {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
|
||||||
|
// {5, 4, 3, 2, 13, 12, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1},
|
||||||
|
// };
|
||||||
|
|
||||||
for (int chip = 0; chip < 4; chip++)
|
for (int chip = 0; chip < 4; chip++)
|
||||||
{
|
{
|
||||||
if (sameChips[0][chip] != -1)
|
if (sameChips[0][chip] != -1)
|
||||||
{
|
{
|
||||||
|
int otherChip = -1;
|
||||||
|
int otherChipX = -1;
|
||||||
|
int checkOtherEnd = -1;
|
||||||
|
int otherChipXStatus = 99;
|
||||||
|
int thisChip = sameChips[0][chip];
|
||||||
|
|
||||||
for (int freeXidx = 0; freeXidx < 16; freeXidx++)
|
for (int freeXidx = 0; freeXidx < 16; freeXidx++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ch[sameChips[0][chip]].xStatus[freeXSearchOrder[sameChips[0][chip]][freeXidx]] == -1 && freeXSearchOrder[sameChips[0][chip]][freeXidx] != -1)
|
if (freeXSearchOrder[thisChip][freeXidx] == -1)
|
||||||
{
|
{
|
||||||
freeX = freeXSearchOrder[sameChips[0][chip]][freeXidx];
|
continue;
|
||||||
break;
|
}
|
||||||
|
if (debugNTCC2)
|
||||||
|
{
|
||||||
|
Serial.print("freeXidx: ");
|
||||||
|
Serial.print(freeXidx);
|
||||||
|
|
||||||
|
Serial.print(" actual freeX: ");
|
||||||
|
Serial.print(freeXSearchOrder[thisChip][freeXidx]);
|
||||||
|
Serial.print(" status: ");
|
||||||
|
Serial.print(ch[thisChip].xStatus[freeXSearchOrder[thisChip][freeXidx]]);
|
||||||
|
Serial.println("\n\r ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ch[thisChip].xStatus[freeXSearchOrder[thisChip][freeXidx]] == -1 && freeXSearchOrder[thisChip][freeXidx] != -1)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
otherChip = ch[thisChip].xMap[freeXSearchOrder[thisChip][freeXidx]];
|
||||||
|
|
||||||
|
// otherChipX = ch[otherChip].xMap[checkOtherEnd];
|
||||||
|
|
||||||
|
int lane = -1;
|
||||||
|
|
||||||
|
if (freeXidx % 2 == 0)
|
||||||
|
{
|
||||||
|
lane = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lane = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (lane == 1)
|
||||||
|
{
|
||||||
|
otherChipX = xMapForChipLane1( otherChip, thisChip);
|
||||||
|
|
||||||
|
} else if (lane == 0)
|
||||||
|
{
|
||||||
|
otherChipX = xMapForChipLane0(otherChip, thisChip);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// for (int otherChipXidx = 0; otherChipXidx < 16; otherChipXidx++)
|
||||||
|
// {
|
||||||
|
// if (ch[otherChip].xMap[otherChipXidx] == thisChip)
|
||||||
|
// {
|
||||||
|
// otherChipX = otherChipXidx;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
otherChipXStatus = ch[otherChip].xStatus[otherChipX];
|
||||||
|
|
||||||
|
if (debugNTCC2)
|
||||||
|
{
|
||||||
|
Serial.print("Checking free X connections on the bounce chip for freeness\n\r");
|
||||||
|
|
||||||
|
Serial.print("thisChip: ");
|
||||||
|
Serial.println(chipNumToChar(thisChip));
|
||||||
|
Serial.print("thisChipX: ");
|
||||||
|
Serial.println(freeXSearchOrder[thisChip][freeXidx]);
|
||||||
|
|
||||||
|
|
||||||
|
Serial.print("\nlane: ");
|
||||||
|
Serial.println(lane);
|
||||||
|
Serial.print("otherChip: ");
|
||||||
|
Serial.println(chipNumToChar(otherChip));
|
||||||
|
//Serial.print("checkOtherEnd X: ");
|
||||||
|
//Serial.println(checkOtherEnd);
|
||||||
|
Serial.print("otherChipX: ");
|
||||||
|
Serial.println(otherChipX);
|
||||||
|
Serial.print("otherChipXStatus: ");
|
||||||
|
Serial.println(ch[otherChip].xStatus[otherChipX]);
|
||||||
|
Serial.println(" ");
|
||||||
|
Serial.println(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (otherChipXStatus == -1 || otherChipXStatus == path[i].net)
|
||||||
|
{
|
||||||
|
freeX = freeXSearchOrder[thisChip][freeXidx];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1760,9 +1861,14 @@ void resolveUncommittedHops(void)
|
|||||||
if (path[i].x[x] == -2)
|
if (path[i].x[x] == -2)
|
||||||
{
|
{
|
||||||
path[i].x[x] = freeX;
|
path[i].x[x] = freeX;
|
||||||
ch[sameChips[0][chip]].xStatus[freeX] = path[i].net;
|
ch[otherChip].xStatus[otherChipX] = path[i].net;
|
||||||
|
ch[thisChip].xStatus[freeX] = path[i].net;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (debugNTCC2)
|
||||||
|
{
|
||||||
|
printChipStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1779,6 +1885,7 @@ void resolveUncommittedHops(void)
|
|||||||
|
|
||||||
if (ch[sameChips[1][chip]].yStatus[freeYsearch] == -1)
|
if (ch[sameChips[1][chip]].yStatus[freeYsearch] == -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
freeY = freeYsearch;
|
freeY = freeYsearch;
|
||||||
// Serial.print("freeY: ");
|
// Serial.print("freeY: ");
|
||||||
// Serial.println(freeY);
|
// Serial.println(freeY);
|
||||||
@ -1831,7 +1938,7 @@ void swapDuplicateNode(int pathIndex)
|
|||||||
|
|
||||||
path[pathIndex].chip[1] = duplucateSFnodes[i][2];
|
path[pathIndex].chip[1] = duplucateSFnodes[i][2];
|
||||||
break;
|
break;
|
||||||
//path[pathIndex].x[1] = duplucateSFnodes[i][3];
|
// path[pathIndex].x[1] = duplucateSFnodes[i][3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2201,7 +2308,7 @@ void assignPathType(int pathIndex)
|
|||||||
|
|
||||||
if ((path[pathIndex].node1 == 1 || path[pathIndex].node1 == 30 || path[pathIndex].node1 == 31 || path[pathIndex].node1 == 60) || path[pathIndex].chip[0] == CHIP_L)
|
if ((path[pathIndex].node1 == 1 || path[pathIndex].node1 == 30 || path[pathIndex].node1 == 31 || path[pathIndex].node1 == 60) || path[pathIndex].chip[0] == CHIP_L)
|
||||||
{
|
{
|
||||||
// Serial.print("\n\n\rthis should be a bb to sf connection\n\n\n\r ");
|
// Serial.print("\n\n\rthis should be a bb to sf connection\n\n\n\r ");
|
||||||
swapNodes(pathIndex);
|
swapNodes(pathIndex);
|
||||||
path[pathIndex].Lchip = true;
|
path[pathIndex].Lchip = true;
|
||||||
|
|
||||||
@ -2223,7 +2330,7 @@ void assignPathType(int pathIndex)
|
|||||||
|
|
||||||
if ((path[pathIndex].node2 == 1 || path[pathIndex].node2 == 30 || path[pathIndex].node2 == 31 || path[pathIndex].node2 == 60) || path[pathIndex].chip[1] == CHIP_L)
|
if ((path[pathIndex].node2 == 1 || path[pathIndex].node2 == 30 || path[pathIndex].node2 == 31 || path[pathIndex].node2 == 60) || path[pathIndex].chip[1] == CHIP_L)
|
||||||
{
|
{
|
||||||
//Serial.print("\n\n\rthis should be a bb to sf connection 2\n\n\n\r ");
|
// Serial.print("\n\n\rthis should be a bb to sf connection 2\n\n\n\r ");
|
||||||
path[pathIndex].Lchip = true;
|
path[pathIndex].Lchip = true;
|
||||||
path[pathIndex].nodeType[1] = SF;
|
path[pathIndex].nodeType[1] = SF;
|
||||||
}
|
}
|
||||||
|
@ -115,12 +115,16 @@ void initDAC(void)
|
|||||||
SPI.setTX(3);
|
SPI.setTX(3);
|
||||||
|
|
||||||
SPI.begin();
|
SPI.begin();
|
||||||
// dac_rev3.maxValue = 4095;
|
//dac_rev3.maxValue = 4095;
|
||||||
|
delay(5);
|
||||||
dac_rev3.setGain(2);
|
dac_rev3.setGain(2);
|
||||||
|
delay(5);
|
||||||
dac_rev3.begin(1);
|
dac_rev3.begin(1);
|
||||||
|
|
||||||
delay(5);
|
delay(5);
|
||||||
setDac0_5Vvoltage(0.00);
|
setDac0_5Vvoltage(0.00);
|
||||||
|
// setDac0_5VinputCode(4095);
|
||||||
|
|
||||||
setDac1_8VinputCode(4095);
|
setDac1_8VinputCode(4095);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,10 +205,12 @@ void setDac0_5Vvoltage(float voltage)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int voltageCode = voltage * 4095 / 5;
|
int voltageCode = voltage * 4095 / 5;
|
||||||
|
|
||||||
|
|
||||||
// dac_rev3.analogWrite((uint16_t)voltageCode, 0);
|
// dac_rev3.analogWrite((uint16_t)voltageCode, 0);
|
||||||
dac_rev3.fastWriteA((uint16_t)voltageCode);
|
dac_rev3.fastWriteA((uint16_t)voltageCode);
|
||||||
lastInputCode0 = voltageCode;
|
lastInputCode0 = voltageCode;
|
||||||
dac_rev3.fastWriteB(lastInputCode1);
|
//dac_rev3.fastWriteB(lastInputCode1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +225,7 @@ void setDac0_5VinputCode(uint16_t inputCode)
|
|||||||
dac_rev3.analogWrite(inputCode, 0);
|
dac_rev3.analogWrite(inputCode, 0);
|
||||||
dac_rev3.fastWriteA(inputCode);
|
dac_rev3.fastWriteA(inputCode);
|
||||||
lastInputCode0 = inputCode;
|
lastInputCode0 = inputCode;
|
||||||
dac_rev3.fastWriteB(lastInputCode1);
|
//dac_rev3.fastWriteB(lastInputCode1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +284,7 @@ int readAdc(int channel, int samples)
|
|||||||
int waveGen(void)
|
int waveGen(void)
|
||||||
{
|
{
|
||||||
int loopCounter = 0;
|
int loopCounter = 0;
|
||||||
|
int c = 0;
|
||||||
listSpecialNets();
|
listSpecialNets();
|
||||||
listNets();
|
listNets();
|
||||||
|
|
||||||
@ -336,6 +342,11 @@ int waveGen(void)
|
|||||||
{
|
{
|
||||||
//adc0Reading = INA1.getBusVoltage_mV();
|
//adc0Reading = INA1.getBusVoltage_mV();
|
||||||
// adc0Reading = dac0_5V.getInputCode();
|
// adc0Reading = dac0_5V.getInputCode();
|
||||||
|
|
||||||
|
if (c == 'q')
|
||||||
|
{
|
||||||
|
} else {
|
||||||
|
|
||||||
adc0Reading = readAdc(26, 1);
|
adc0Reading = readAdc(26, 1);
|
||||||
adc0Reading = abs(adc0Reading);
|
adc0Reading = abs(adc0Reading);
|
||||||
hueShift0 = map(adc0Reading, 0, 5000, -90, 0);
|
hueShift0 = map(adc0Reading, 0, 5000, -90, 0);
|
||||||
@ -344,6 +355,8 @@ int waveGen(void)
|
|||||||
lightUpNet(4, -1, 1, brightness0, hueShift0);
|
lightUpNet(4, -1, 1, brightness0, hueShift0);
|
||||||
showLEDsCore2 = 1;
|
showLEDsCore2 = 1;
|
||||||
firstCrossFreq0 = 1;
|
firstCrossFreq0 = 1;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -422,7 +435,7 @@ int waveGen(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int c = Serial.read();
|
c = Serial.read();
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case '+':
|
case '+':
|
||||||
@ -617,16 +630,31 @@ int waveGen(void)
|
|||||||
if (t < halvePeriod[activeDac])
|
if (t < halvePeriod[activeDac])
|
||||||
{
|
{
|
||||||
if (activeDac == 0 && dacOn[activeDac] == 1)
|
if (activeDac == 0 && dacOn[activeDac] == 1)
|
||||||
|
{
|
||||||
setDac0_5VinputCode(amplitude[activeDac]);
|
setDac0_5VinputCode(amplitude[activeDac]);
|
||||||
|
lightUpNet(4, -1, 1, DEFAULTSPECIALNETBRIGHTNESS, 12);
|
||||||
|
showLEDsCore2 = 1;
|
||||||
|
}
|
||||||
else if (activeDac == 1 && dacOn[activeDac] == 1)
|
else if (activeDac == 1 && dacOn[activeDac] == 1)
|
||||||
|
{
|
||||||
setDac1_8VinputCode(amplitude[activeDac]);
|
setDac1_8VinputCode(amplitude[activeDac]);
|
||||||
|
|
||||||
|
showLEDsCore2 = 1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (activeDac == 0 && dacOn[activeDac] == 1)
|
if (activeDac == 0 && dacOn[activeDac] == 1)
|
||||||
|
{
|
||||||
setDac0_5VinputCode(0);
|
setDac0_5VinputCode(0);
|
||||||
|
lightUpNet(4, -1, 1, 2, 12);
|
||||||
|
}
|
||||||
|
|
||||||
else if (activeDac == 1 && dacOn[activeDac] == 1)
|
else if (activeDac == 1 && dacOn[activeDac] == 1)
|
||||||
|
{
|
||||||
setDac1_8VinputCode(offset[activeDac]);
|
setDac1_8VinputCode(offset[activeDac]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
|
@ -50,15 +50,21 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
initADC();
|
initADC();
|
||||||
|
delay (1);
|
||||||
initDAC();
|
initDAC();
|
||||||
|
delay (1);
|
||||||
initINA219();
|
initINA219();
|
||||||
|
delay (1);
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
delay (4);
|
||||||
#ifdef FSSTUFF
|
#ifdef FSSTUFF
|
||||||
LittleFS.begin();
|
LittleFS.begin();
|
||||||
#endif
|
#endif
|
||||||
setDac0_5Vvoltage(0.0);
|
setDac0_5Vvoltage(0.0);
|
||||||
setDac1_8Vvoltage(1.9);
|
setDac1_8Vvoltage(1.9);
|
||||||
|
|
||||||
|
clearAllNTCC();
|
||||||
|
delay (4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup1()
|
void setup1()
|
||||||
@ -68,6 +74,7 @@ void setup1()
|
|||||||
initCH446Q();
|
initCH446Q();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//delay (4);
|
||||||
initLEDs();
|
initLEDs();
|
||||||
|
|
||||||
|
|
||||||
@ -368,9 +375,9 @@ void loop1() // core 2 handles the LEDs and the CH446Q8
|
|||||||
|
|
||||||
if (sendAllPathsCore2 == 1)
|
if (sendAllPathsCore2 == 1)
|
||||||
{
|
{
|
||||||
delayMicroseconds(9200);
|
delayMicroseconds(12200);
|
||||||
sendAllPaths();
|
sendAllPaths();
|
||||||
delayMicroseconds(2200);
|
delayMicroseconds(4200);
|
||||||
showNets();
|
showNets();
|
||||||
delayMicroseconds(9200);
|
delayMicroseconds(9200);
|
||||||
sendAllPathsCore2 = 0;
|
sendAllPathsCore2 = 0;
|
||||||
@ -396,3 +403,5 @@ void loop1() // core 2 handles the LEDs and the CH446Q8
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user