Skip to content

Commit 94572ac

Browse files
New Wokwi Bridge app
1 parent 52a8308 commit 94572ac

File tree

1,152 files changed

+47963
-430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,152 files changed

+47963
-430
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"hostname":"Kevins-MBP","username":"kevinsanto"}
-28.6 KB
Binary file not shown.

JumperlessNano/src/CH446Q.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,56 @@ void sendAllPaths(void) // should we sort them by chip? for now, no
219219
}
220220
}
221221

222+
uint8_t restoreConnections[12][16][2]; // [chip][index][pairs 0=x, 1=y]
223+
224+
222225

223226

227+
int clearAllConnectionsOnChip(int chip, int clearOrRestore)
228+
{
229+
230+
int numCleared = 0;
231+
uint8_t netCleared = 0;
232+
233+
if (clearOrRestore == 0)
234+
{
235+
for (int x = 0; x < 16; x++)
236+
{
237+
if (ch[chip].xStatus[x] != -1)
238+
{
239+
netCleared = ch[chip].xStatus[x];
240+
241+
for (int y = 0; y < 8; y++)
242+
{
243+
if (ch[chip].yStatus[y] == netCleared)
244+
{
245+
246+
restoreConnections[chip][numCleared][0] = x;
247+
restoreConnections[chip][numCleared][1] = y;
248+
numCleared++;
249+
Serial.print("chip ");
250+
Serial.print(chip);
251+
Serial.print(" x:");
252+
Serial.print(x);
253+
Serial.print(" y:");
254+
Serial.print(y);
255+
Serial.print(" net:");
256+
Serial.print(netCleared);
257+
Serial.print("\n\r");
258+
sendXYraw(chip, x, y, 0);
259+
}
260+
}
261+
}
262+
}
263+
} else {
264+
for (int i = 0; i < numCleared; i++)
265+
{
266+
sendXYraw(chip, restoreConnections[chip][i][0], restoreConnections[chip][i][1], 1);
267+
}
268+
}
269+
return numCleared;
270+
271+
}
224272

225273
void sendPath(int i, int setOrClear)
226274
{

JumperlessNano/src/CH446Q.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ extern int lightUpNetCore2;
1414

1515
void initCH446Q(void);
1616
void sendXYraw(int chip, int x, int y, int setorclear);
17+
int clearAllConnectionsOnChip(int chip, int clearOrRestore);//returns number of connections cleared
1718

1819
void sendAllPaths(void); // should we sort them by chip? for now, no
1920
void resetArduino (void);

JumperlessNano/src/FileParsing.cpp

Lines changed: 62 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ File nodeFileBuffer;
3535

3636
unsigned long timeToFP = 0;
3737

38-
const char rotaryConnectionString[] = "{ AREF-GND, D11-GND, D10-UART_TX, D12-UART_RX, D13-GPIO_0, ";
38+
const char rotaryConnectionString[] = "{AREF-GND,D11-GND,D10-UART_TX,D12-UART_RX,D13-GPIO_0, ";
3939

4040
void createSlots(int slot, int addRotaryConnections)
4141
{
@@ -55,8 +55,8 @@ void createSlots(int slot, int addRotaryConnections)
5555
// {
5656
// //nodeFile.write(' ');
5757
// index++;
58-
59-
// } else
58+
59+
// } else
6060
// length++;
6161
// }
6262
// }
@@ -78,11 +78,7 @@ void createSlots(int slot, int addRotaryConnections)
7878
// Serial.write(nodeFile.read());
7979
// }
8080

81-
8281
// nodeFile.close();
83-
84-
85-
8682

8783
nodeFile = LittleFS.open("nodeFileSlot" + String(i) + ".txt", "w");
8884
if (i >= 0)
@@ -92,11 +88,11 @@ void createSlots(int slot, int addRotaryConnections)
9288
// nodeFile.print("{ AREF-D8, D8-ADC0, ADC0-GPIO_0, D11-GND, D10-ADC2, ADC2-UART_TX, D12-ADC1, ADC1-UART_RX, D13-GND, ");
9389
if (addRotaryConnections > 0)
9490
{
95-
nodeFile.print("{ AREF-GND, D11-GND, D10-UART_TX, D12-UART_RX, D13-GPIO_0, ");
91+
nodeFile.print("{AREF-GND,D11-GND,D10-UART_TX,D12-UART_RX,D13-GPIO_0,");
9692
nodeFile.print(i * 4 + 1);
9793
nodeFile.print("-");
9894
nodeFile.print(i * 4 + 2);
99-
nodeFile.print(", }");
95+
nodeFile.print(",}");
10096
}
10197
else
10298
{
@@ -113,7 +109,7 @@ void createSlots(int slot, int addRotaryConnections)
113109
// nodeFile.print("{ D12-D7, D7-ADC0, ADC0-UART_RX, D11-GND, D10-ADC2, ADC2-UART_TX, AREF-ADC1, ADC1-GPIO_0, D13-GND, ");
114110
if (addRotaryConnections > 0)
115111
{
116-
nodeFile.print("{ AREF-GND, D11-GND, D10-UART_TX, D12-UART_RX, D13-GPIO_0, } ");
112+
nodeFile.print("{AREF-GND,D11-GND,D10-UART_TX,D12-UART_RX,D13-GPIO_0,} ");
117113
// nodeFile.print(slot * 4 + 1);
118114
// nodeFile.print("-");
119115
// nodeFile.print(slot * 4 + 2);
@@ -122,22 +118,51 @@ void createSlots(int slot, int addRotaryConnections)
122118
nodeFile.close();
123119
}
124120
}
125-
void inputNodeFileList(void)
121+
void inputNodeFileList(int addRotaryConnections)
126122
{
127-
Serial.println("Paste the nodeFile list here");
123+
// addRotaryConnections = 1;
124+
// Serial.println("Paste the nodeFile list here\n\n\r");
125+
126+
unsigned long humanTime = millis();
127+
128+
int shown = 0;
128129
while (Serial.available() == 0)
129130
{
131+
if (millis() - humanTime == 400 && shown == 0)
132+
{
133+
Serial.println("Paste the nodeFile list here\n\n\r");
134+
shown = 1;
135+
}
130136
}
131137
nodeFileString.clear();
132-
138+
// if (addRotaryConnections > 0)
139+
// {
140+
// for (int i = 0; i < 59 ; i++)
141+
// {
142+
// nodeFileString.write(rotaryConnectionString[i]);
143+
// Serial.print(rotaryConnectionString[i]);
144+
// }
145+
// }
146+
int startInsertion = 0;
133147
while (Serial.available() > 0)
134148
{
135-
nodeFileString.write(Serial.read());
149+
uint8_t c = Serial.read();
150+
if (c == '{' && addRotaryConnections > 0)
151+
{
152+
// startInsertion = 1;
153+
for (int i = 0; i < 53; i++)
154+
{
155+
nodeFileString.write(rotaryConnectionString[i]);
156+
// Serial.print(rotaryConnectionString[i]);
157+
}
158+
continue;
159+
}
160+
nodeFileString.write(c);
136161
delayMicroseconds(100);
137162
}
138163
// nodeFileString.read(Serial);
139164
// Serial.println("nodeFileString");
140-
// Serial.println(nodeFileString);
165+
// Serial.println(nodeFileString);
141166
int lastTokenIndex = 0;
142167
int tokenFound = 0;
143168
uint8_t lastReads[8] = {' ', ' ', ' ', ' '};
@@ -165,10 +190,11 @@ void inputNodeFileList(void)
165190
// nodeFileBuffer.seek(nodeFileBuffer.size());
166191
// nodeFileBuffer.print("fuck \n\r");
167192
nodeFileBuffer.seek(0);
168-
// while (nodeFileBuffer.available())
169-
// {
170-
// Serial.write(nodeFileBuffer.read());
171-
// }
193+
// Serial.println(" \n\n\n\r");
194+
// while (nodeFileBuffer.available())
195+
// {
196+
// Serial.write(nodeFileBuffer.read());
197+
// }
172198

173199
for (int i = 0; i < NUM_SLOTS; i++) // this just searches for how many slots are in the pasted list
174200
{
@@ -215,15 +241,8 @@ void inputNodeFileList(void)
215241
}
216242
index++;
217243
}
218-
219-
// Serial.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
220-
// nodeFile.close();
221244
}
222245

223-
Serial.print("\n\rFirst slot found: ");
224-
Serial.println(firstSlotNumber, HEX);
225-
226-
Serial.println("Number of slots found: " + String(numberOfSlotsFound));
227246
index = 0;
228247
int lastSlotNumber = firstSlotNumber + numberOfSlotsFound - 1;
229248

@@ -232,7 +251,7 @@ void inputNodeFileList(void)
232251

233252
if (i >= firstSlotNumber && i <= lastSlotNumber)
234253
{
235-
Serial.println(i);
254+
// Serial.println(i);
236255
nodeFile = LittleFS.open("nodeFileSlot" + String(i) + ".txt", "w");
237256
}
238257

@@ -270,31 +289,38 @@ void inputNodeFileList(void)
270289
if (i >= firstSlotNumber && i <= lastSlotNumber)
271290
{
272291
nodeFile.seek(0);
273-
printNodeFile(i);
274-
275-
// Serial.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
276292
nodeFile.close();
277293
}
278294
}
295+
// uint8_t trash = Serial.read();
296+
// Serial.write(trash);
297+
// delay(10);
279298

280-
for (int i = 0; i < NUM_SLOTS; i++)
281-
{
282-
// printNodeFile(i);
283-
}
299+
// while(Serial.available() > 0)
300+
// {
301+
// trash = Serial.read();
302+
// //Serial.write(trash);
303+
// delay(1);
304+
// }
305+
306+
// for (int i = 0; i < NUM_SLOTS; i++)
307+
// {
308+
// // printNodeFile(i);
309+
// }
284310
}
285311

286312
void savePreformattedNodeFile(int source, int slot, int keepEncoder)
287313
{
288314

289315
nodeFile = LittleFS.open("nodeFileSlot" + String(slot) + ".txt", "w+");
290-
Serial.println("Slot " + String(slot));
316+
// Serial.println("Slot " + String(slot));
291317

292318
// Serial.println(nodeFile);
293319

294320
if (keepEncoder == 1)
295321
{
296322
// nodeFile.print("{ D12-D7, D7-ADC0, ADC0-UART_RX, D11-GND, D10-ADC2, ADC2-UART_TX, AREF-ADC1, ADC1-GPIO_0, D13-GND, ");
297-
nodeFile.print("{ AREF-GND, D11-GND, D10-UART_TX, D12-UART_RX, D13-GPIO_0, ");
323+
nodeFile.print("{AREF-GND,D11-GND,D10-UART_TX,D12-UART_RX,D13-GPIO_0, ");
298324
// Serial.println(" keeping encoder");
299325
}
300326

JumperlessNano/src/FileParsing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extern bool debugMM;
1919

2020
//extern File nodeFile;
2121
void createSlots(int slot = -1, int addRotaryConnections = 0);
22-
void inputNodeFileList(void);
22+
void inputNodeFileList(int addRotaryConnections = 0);
2323
//this just opens the file, takes out all the bullshit, and then populates the newBridge array
2424
void parseWokwiFileToNodeFile();
2525
void changeWokwiDefinesToJumperless ();

JumperlessNano/src/LEDs.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ void showSavedColors(int slot)
564564
// }
565565
// Serial.print("\rNo saved colors for slot ");
566566
// Serial.print(slot);
567+
///pauseCore2 = 1;
567568
clearAllNTCC();
568569
openNodeFile(slot);
569570
getNodesToConnect();
@@ -572,8 +573,9 @@ void showSavedColors(int slot)
572573
// leds.clear();
573574

574575
assignNetColors();
576+
//pauseCore2 = 0;
575577
showNets();
576-
lightUpRail();
578+
//lightUpRail();
577579
// delayMicroseconds(100);
578580
// saveRawColors(slot);
579581
}

JumperlessNano/src/LEDs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
extern volatile uint8_t LEDbrightness;
4444
extern volatile uint8_t LEDbrightnessSpecial;
4545

46+
extern volatile uint8_t pauseCore2;
47+
4648
extern Adafruit_NeoPixel leds;
4749
extern bool debugLEDs;
4850

0 commit comments

Comments
 (0)