Made last connections load on startup

This commit is contained in:
Kevin Santo Cappuccio 2024-11-11 10:02:25 -08:00
parent 9e0e54d3b4
commit f7b4bd7552
13 changed files with 2036 additions and 4677 deletions

View File

@ -38,7 +38,6 @@
9,
10,
11,
12,
13,
15,
16,
@ -64,7 +63,7 @@
39,
40
],
"visible_layers": "fffffff_ffffffff",
"visible_layers": "fffffcf_ffffffff",
"zone_display_mode": 1
},
"git": {

View File

@ -1,253 +1 @@
60677951824539
JumperlessFootprints
Arduino_Nano
Arduino Nano, http://www.mouser.com/pdfdocs/Gravitech_Arduino_Nano3_0.pdf
Arduino Nano
0
30
30
JumperlessFootprints
Breadboard_CustomClips_Fallback
0
320
64
JumperlessFootprints
CP_EIA-6032-20_AVX-F_Pad2.25x2.35mm_HandSolder
Tantalum Capacitor SMD AVX-F (6032-20 Metric), IPC_7351 nominal, (Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf), generated with kicad-footprint-generator
capacitor tantalum
0
2
2
JumperlessFootprints
C_0402_1005Metric
Capacitor SMD 0402 (1005 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator
capacitor
0
2
2
JumperlessFootprints
C_0603_1608Metric
Capacitor SMD 0603 (1608 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator
capacitor
0
2
2
JumperlessFootprints
C_1206_3216Metric_Pad1.33x1.80mm_HandSolder
Capacitor SMD 1206 (3216 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator
capacitor handsolder
0
2
2
JumperlessFootprints
Crystal_SMD_3225-4Pin_3.2x2.5mm
SMD Crystal SERIES SMD3225/4 http://www.txccrystal.com/images/pdf/7m-accuracy.pdf, 3.2x2.5mm^2 package
SMD SMT crystal
0
4
4
JumperlessFootprints
DIP-8_W7.62mm
8-lead though-hole mounted DIP package, row spacing 7.62 mm (300 mils)
THT DIP DIL PDIP 2.54mm 7.62mm 300mil
0
8
8
JumperlessFootprints
D_SOD-323
SOD-323
SOD-323
0
2
2
JumperlessFootprints
Fiducial_1mm_Mask2mm
Circular Fiducial, 1mm bare copper, 2mm soldermask opening (Level A)
fiducial
0
1
0
JumperlessFootprints
Fuse_1206_3216Metric_Pad1.42x1.75mm_HandSolder
Fuse SMD 1206 (3216 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: http://www.tortai-tech.com/upload/download/2011102023233369053.pdf), generated with kicad-footprint-generator
fuse handsolder
0
2
2
JumperlessFootprints
GPIO_header
0
4
4
JumperlessFootprints
LED_1206_REVERSEMOUNT_OVAL
0
2
2
JumperlessFootprints
LED_WS2812B-2020_PLCC4_2.0x2.0mm
Addressable RGB LED NeoPixel Nano, 12 mA, https://cdn-shop.adafruit.com/product-files/4684/4684_WS2812B-2020_V1.3_EN.pdf
LED RGB NeoPixel Nano 2020
0
4
4
JumperlessFootprints
LQFP44_Tight
0
44
44
JumperlessFootprints
PINHEADER-1x1_vertical
0
1
1
JumperlessFootprints
PinHeader_1x02_P2.54mm_Vertical
Through hole straight pin header, 1x02, 2.54mm pitch, single row
Through hole pin header THT 1x02 2.54mm single row
0
2
2
JumperlessFootprints
PinHeader_1x03_P2.54mm_Vertical
Through hole straight pin header, 1x03, 2.54mm pitch, single row
Through hole pin header THT 1x03 2.54mm single row
0
3
3
JumperlessFootprints
PinHeader_1x06_P2.54mm_Vertical
Through hole straight pin header, 1x06, 2.54mm pitch, single row
Through hole pin header THT 1x06 2.54mm single row
0
6
6
JumperlessFootprints
RP2040-QFN-56
QFN, 56 Pin (http://www.cypress.com/file/416486/download#page=40), generated with kicad-footprint-generator ipc_dfn_qfn_generator.py
QFN DFN_QFN
0
70
57
JumperlessFootprints
R_0402_1005Metric
Resistor SMD 0402 (1005 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator
resistor
0
2
2
JumperlessFootprints
R_0603_1608Metric
Resistor SMD 0603 (1608 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator
resistor
0
2
2
JumperlessFootprints
SOIC-8_3.9x4.9mm_P1.27mm
SOIC, 8 Pin (JEDEC MS-012AA, https://www.analog.com/media/en/package-pcb-resources/package/pkg_pdf/soic_narrow-r/r_8.pdf), generated with kicad-footprint-generator ipc_gullwing_generator.py
SOIC SO
0
8
8
JumperlessFootprints
SOIC-8_5.23x5.23mm_P1.27mm
SOIC, 8 Pin (http://www.winbond.com/resource-files/w25q32jv%20revg%2003272018%20plus.pdf#page=68), generated with kicad-footprint-generator ipc_gullwing_generator.py
SOIC SO
0
8
8
JumperlessFootprints
SOIC-14_3.9x8.7mm_P1.27mm
SOIC, 14 Pin (JEDEC MS-012AB, https://www.analog.com/media/en/package-pcb-resources/package/pkg_pdf/soic_narrow-r/r_14.pdf), generated with kicad-footprint-generator ipc_gullwing_generator.py
SOIC SO
0
14
14
JumperlessFootprints
SOIC-16_3.9x9.9mm_P1.27mm
SOIC, 16 Pin (JEDEC MS-012AC, https://www.analog.com/media/en/package-pcb-resources/package/pkg_pdf/soic_narrow-r/r_16.pdf), generated with kicad-footprint-generator ipc_gullwing_generator.py
SOIC SO
0
16
16
JumperlessFootprints
SOT-23-6
SOT, 6 Pin (https://www.jedec.org/sites/default/files/docs/Mo-178c.PDF variant AB), generated with kicad-footprint-generator ipc_gullwing_generator.py
SOT TO_SOT_SMD
0
6
6
JumperlessFootprints
SOT-223-3_TabPin2
module CMS SOT223 4 pins
CMS SOT
0
4
3
JumperlessFootprints
SW_SPST_TL3342
Low-profile SMD Tactile Switch, https://www.e-switch.com/system/asset/product_line/data_sheet/165/TL3342.pdf
SPST Tactile Switch
0
4
2
JumperlessFootprints
Slide_Switch_SSSS223600
0
8
8
JumperlessFootprints
SolderJumper_2_Bridged_Small
0
2
2
JumperlessFootprints
SolderJumper_2_Open_Small
0
2
2
JumperlessFootprints
TestPoint_D0.75mm
0
1
1
JumperlessFootprints
TestPoint_Pad_D1.0mm
SMD pad as test Point, diameter 1.0mm
test point SMD pad
0
1
1
JumperlessFootprints
USB_Mini-B_Wuerth_65100516121_Horizontal
Mini USB 2.0 Type B SMT Horizontal 5 Contacts (https://katalog.we-online.de/em/datasheet/65100516121.pdf)
Mini USB 2.0 Type B
0
9
6
JumperlessFootprints
ws2812c-2020-noSolk
0
4
4

View File

@ -0,0 +1 @@
{"hostname":"Kevins-MacBook-Pro","username":"kevinsanto"}

View File

@ -13,6 +13,11 @@
"cmath": "cpp"
},
"cortex-debug.registerUseNaturalFormat": false,
"C_Cpp.errorSquiggles": "disabled"
"C_Cpp.errorSquiggles": "disabled",
"prettier.printWidth": 200,
"python.analysis.fixAll": [
],
"platformio-ide.reopenSerialMonitorDelay": 1000
}

View File

@ -35,8 +35,8 @@
"name": "Jumperless",
"upload": {
"maximum_ram_size": 270336,
"maximum_size": 2097152,
"maximum_ram_size": 262144,
"maximum_size": 16777216,
"require_upload_port": true,
"native_usb": true,
"use_1200bps_touch": true,

View File

@ -33,5 +33,5 @@ lib_deps =
adafruit/Adafruit NeoPixel@^1.11.0
robtillaart/MCP_DAC@^0.2.0
adafruit/Adafruit SSD1306@^2.5.9
https://github.com/pschatzmann/logic-analyzer.git
;https://github.com/pschatzmann/logic-analyzer.git

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -38,11 +38,12 @@ void setDac1_8VinputCode(uint16_t value);
void refillTable (int amplitude = 2047, int offset = 2047, int adc = 2);
int waveGen(void);
void GetAdc29Status(int i);
int readAdc(int channel, int samples = 10);
int readAdc(int channel, int samples = 32);
void chooseShownReadings(void);
void showMeasurements(int samples = 50);
void showLEDmeasurements(void);
void showMeasurements(int samples = 32);
void initADC(void);
const uint16_t DACLookup_FullSine_9Bit[512] =
{

View File

@ -593,7 +593,7 @@ probeActive = 1;
showLEDsCore2 = 1;
rawOtherColors[1] = 0x550004;
showLEDsCore2 = 1;
//delay(25);
sendAllPathsCore2 = 1;
// delay(25);
// pinMode(probePin, INPUT);

View File

@ -28,23 +28,23 @@ KevinC@ppucc.io
#include "ArduinoStuff.h"
#include "JumperlessDefinesRP2040.h"
#include "NetManager.h"
#include "MatrixStateRP2040.h"
#include "NetManager.h"
#include "NetsToChipConnections.h"
#include "LEDs.h"
#include "NetsToChipConnections.h"
// #include "CH446Q.h"
#include "Peripherals.h"
#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#include "MachineCommands.h"
#include "Peripherals.h"
#include <Adafruit_NeoPixel.h>
#include <Wire.h>
// #include <EEPROM.h>
#include <EEPROM.h>
#include "CH446Q.h"
#include "RotaryEncoder.h"
#include "FileParsing.h"
#include "RotaryEncoder.h"
#include "LittleFS.h"
@ -73,7 +73,8 @@ void lastNetConfirm(int forceLastNet = 0);
unsigned long lastNetConfirmTimer = 0;
// int machineMode = 0;
volatile int sendAllPathsCore2 = 0; // this signals the core 2 to send all the paths to the CH446Q
volatile int sendAllPathsCore2 =
0; // this signals the core 2 to send all the paths to the CH446Q
int loadFileOnStart = 1;
int rotEncInit = 0;
@ -81,8 +82,9 @@ int rotEncInit = 0;
int core2setupFinished = 0;
void setup()
{
int baudRate = 115200;
void setup() {
pinMode(0, OUTPUT);
pinMode(2, INPUT);
pinMode(3, INPUT);
@ -133,14 +135,15 @@ void setup()
// rotEncInit = 1;
initRotaryEncoder();
//}
initADC();
// delay(20);
// setupAdcUsbStuff(); // I took this out because it was causing a crash on
delay(10);
setBaudRate(baudRate);
}
void setup1()
{
void setup1() {
delay(4);
initCH446Q();
@ -163,19 +166,19 @@ char input;
int serSource = 0;
int readInNodesArduino = 0;
int baudRate = 115200;
int restoredNodeFile = 0;
const char firmwareVersion[] = "1.3.15"; //// remember to update this
const char firmwareVersion[] = "1.3.18"; //// remember to update this
int firstLoop = 1;
volatile int probeActive = 1;
int showExtraMenu = 0;
int printingMeasurements = 0;
void loop()
{
void loop() {
unsigned long timer = 0;
@ -200,14 +203,14 @@ menu:
Serial.print("\to = load node files by slot\n\r");
Serial.print("\tf = load node file to current slot\n\r");
Serial.print("\tr = rotary encoder mode -");
rotaryEncoderMode == 1 ? Serial.print(" ON (z/x to cycle)\n\r") : Serial.print(" off\n\r");
rotaryEncoderMode == 1 ? Serial.print(" ON (z/x to cycle)\n\r")
: Serial.print(" off\n\r");
Serial.print("\t\b\bz/x = cycle slots - current slot ");
Serial.print(netSlot);
Serial.print("\n\r");
Serial.print("\te = show extra menu options\n\r");
if (showExtraMenu == 1)
{
if (showExtraMenu == 1) {
Serial.print("\tb = show bridge array\n\r");
Serial.print("\tp = probe connections\n\r");
Serial.print("\tw = waveGen\n\r");
@ -215,19 +218,25 @@ menu:
Serial.print("\tu = set baud rate for USB-Serial\n\r");
Serial.print("\tl = LED brightness / test\n\r");
Serial.print("\td = toggle debug flags\n\r");
}
// Serial.print("\tc = clear nodes with probe\n\r");
Serial.print("\n\n\r");
if (firstLoop == 1 && rotaryEncoderMode == 1)
{
if (firstLoop == 1 && rotaryEncoderMode == 1) {
Serial.print("Use the rotary encoder to change slots\n\r");
Serial.print("Press the button to select\n\r");
Serial.print("\n\n\r");
firstLoop = 0;
probeActive = 0;
goto loadfile;
} else if (firstLoop == 1) {
// delay(20);
// Serial.println("Press the button to load the current slot\n\r");
// delay(20);
firstLoop = 0;
probeActive = 0;
goto loadfile;
}
// if (firstLoop == 1 && rotaryEncoderMode == 0 && loadFileOnStart == 1)
@ -246,33 +255,26 @@ dontshowmenu:
connectFromArduino = '\0';
while (Serial.available() == 0 && connectFromArduino == '\0' && slotChanged == 0)
{
while (Serial.available() == 0 && connectFromArduino == '\0' &&
slotChanged == 0) {
if (showReadings >= 1)
{
if (showReadings >= 1) {
showMeasurements();
// Serial.print("\n\n\r");
// showLEDsCore2 = 1;
}
if (BOOTSEL)
{
if (BOOTSEL) {
lastNetConfirm(1);
}
if ((millis() % 200) < 5)
{
if (checkProbeButton() == 1)
{
if ((millis() % 200) < 5) {
if (checkProbeButton() == 1) {
int longShort = longShortPress(1000);
if (longShort == 1)
{
if (longShort == 1) {
input = 'c';
probingTimer = millis();
goto skipinput;
}
else if (longShort == 0)
{
} else if (longShort == 0) {
input = 'p';
probingTimer = millis();
goto skipinput;
@ -283,23 +285,18 @@ dontshowmenu:
}
}
if (slotChanged == 1)
{
if (slotChanged == 1) {
// showLEDsCore2 = 1;
goto loadfile;
}
if (connectFromArduino != '\0')
{
}
else
{
if (connectFromArduino != '\0') {
} else {
input = Serial.read();
// Serial.print("\n\r");
if (input == '}' || input == ' ' || input == '\n' || input == '\r')
{
if (input == '}' || input == ' ' || input == '\n' || input == '\r') {
goto dontshowmenu;
}
// Serial.write(input);
@ -307,16 +304,13 @@ dontshowmenu:
// Serial.print(input);
skipinput:
switch (input)
{
case '?':
{
switch (input) {
case '?': {
Serial.print("Jumperless firmware version: ");
Serial.println(firmwareVersion);
break;
}
case '$':
{
case '$': {
// return current slot number
Serial.println(netSlot);
break;
@ -335,8 +329,7 @@ skipinput:
goto dontshowmenu;
}
case '-':
{
case '-': {
clearAllConnectionsOnChip(CHIP_I, 1);
sendXYraw(CHIP_I, 11, 0, 0);
@ -349,49 +342,38 @@ goto dontshowmenu;
break;
}
case 'e':
{
if (showExtraMenu == 0)
{
case 'e': {
if (showExtraMenu == 0) {
showExtraMenu = 1;
}
else
{
} else {
showExtraMenu = 0;
}
break;
}
case 's':
{
case 's': {
int fileNo = -1;
if (Serial.available() > 0)
{
if (Serial.available() > 0) {
fileNo = Serial.read();
// break;
}
Serial.print("\n\n\r");
if (fileNo == -1)
{
if (fileNo == -1) {
Serial.print("\tSlot Files");
}
else
{
} else {
Serial.print("\tSlot File ");
Serial.print(fileNo - '0');
}
Serial.print("\n\n\r");
Serial.print("\n\ryou can paste this text reload this circuit (enter 'o' first)");
Serial.print(
"\n\ryou can paste this text reload this circuit (enter 'o' first)");
Serial.print("\n\r(or even just a single slot)\n\n\n\r");
if (fileNo == -1)
{
for (int i = 0; i < NUM_SLOTS; i++)
{
if (fileNo == -1) {
for (int i = 0; i < NUM_SLOTS; i++) {
Serial.print("\n\rSlot ");
Serial.print(i);
if (i == netSlot)
{
if (i == netSlot) {
Serial.print(" <--- current slot");
}
@ -403,9 +385,7 @@ goto dontshowmenu;
printNodeFile(i);
Serial.print("\n\n\n\r");
}
}
else
{
} else {
Serial.print("\n\rnodeFileSlot");
Serial.print(fileNo - '0');
@ -421,20 +401,17 @@ goto dontshowmenu;
}
case 'v':
if (showReadings >= 3 || (inaConnected == 0 && showReadings >= 1))
{
if (showReadings >= 3 || (inaConnected == 0 && showReadings >= 1)) {
showReadings = 0;
break;
}
else
{
} 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("\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
// Serial.write("\x1B\x5B");
// Serial.write("\033");
@ -449,8 +426,7 @@ goto dontshowmenu;
goto dontshowmenu;
// break;
}
case 'p':
{
case 'p': {
probeActive = 1;
delayMicroseconds(1500);
@ -459,8 +435,7 @@ goto dontshowmenu;
probeActive = 0;
break;
}
case 'c':
{
case 'c': {
// removeBridgeFromNodeFile(19, 1);
probeActive = 1;
delayMicroseconds(1500);
@ -500,27 +475,25 @@ goto dontshowmenu;
case 'w':
if (waveGen() == 1)
{
if (waveGen() == 1) {
break;
}
case 'o':
{
case 'o': {
probeActive = 1;
inputNodeFileList(rotaryEncoderMode);
showSavedColors(netSlot);
// input = ' ';
showLEDsCore2 = 1;
sendAllPathsCore2 = 1;
probeActive = 0;
chooseShownReadings();
goto dontshowmenu;
break;
}
case 'x':
{
case 'x': {
if (netSlot == NUM_SLOTS-1)
{
if (netSlot == NUM_SLOTS - 1) {
netSlot = 0;
} else {
netSlot++;
@ -530,13 +503,12 @@ goto dontshowmenu;
Serial.print("Slot ");
Serial.print(netSlot);
slotPreview = netSlot;
chooseShownReadings();
goto loadfile;
}
case 'z':
{
case 'z': {
if (netSlot == 0)
{
if (netSlot == 0) {
netSlot = NUM_SLOTS - 1;
} else {
netSlot--;
@ -545,10 +517,10 @@ goto dontshowmenu;
Serial.print("Slot ");
Serial.print(netSlot);
slotPreview = netSlot;
chooseShownReadings();
goto loadfile;
}
case 'y':
{
case 'y': {
loadfile:
probeActive = 1;
clearAllNTCC();
@ -564,7 +536,9 @@ goto dontshowmenu;
digitalWrite(RESETPIN, LOW);
// showNets();
// saveRawColors(netSlot);
probeActive = 0;
showSavedColors(netSlot);
chooseShownReadings();
sendAllPathsCore2 = 1;
slotChanged = 0;
input = ' ';
@ -573,7 +547,7 @@ goto dontshowmenu;
// {
// goto dontshowmenu;
// }
probeActive = 0;
break;
}
case 'f':
@ -587,12 +561,9 @@ goto dontshowmenu;
// clearNodeFile(netSlot);
if (connectFromArduino != '\0')
{
if (connectFromArduino != '\0') {
serSource = 1;
}
else
{
} else {
serSource = 0;
}
savePreformattedNodeFile(serSource, netSlot, rotaryEncoderMode);
@ -611,11 +582,11 @@ goto dontshowmenu;
digitalWrite(RESETPIN, LOW);
// showNets();
// saveRawColors(netSlot);
chooseShownReadings();
sendAllPathsCore2 = 1;
showLEDsCore2 = 1;
if (debugNMtime)
{
if (debugNMtime) {
Serial.print("\n\n\r");
Serial.print("took ");
Serial.print(millis() - timer);
@ -624,8 +595,7 @@ goto dontshowmenu;
input = ' ';
probeActive = 0;
if (connectFromArduino != '\0')
{
if (connectFromArduino != '\0') {
connectFromArduino = '\0';
// Serial.print("connectFromArduino\n\r");
// delay(2000);
@ -679,8 +649,7 @@ goto dontshowmenu;
break;
case 'l':
if (LEDbrightnessMenu() == '!')
{
if (LEDbrightnessMenu() == '!') {
clearLEDs();
delayMicroseconds(9200);
sendAllPathsCore2 = 1;
@ -689,8 +658,7 @@ goto dontshowmenu;
case 'r':
if (rotaryEncoderMode == 1)
{
if (rotaryEncoderMode == 1) {
// unInitRotaryEncoder();
rotaryEncoderMode = 0;
@ -704,9 +672,7 @@ goto dontshowmenu;
showLEDsCore2 = 1;
debugFlagSet(10); // encoderModeOff
goto menu;
}
else
{
} else {
rotaryEncoderMode = 1;
if (rotEncInit == 0) // only do this once
{
@ -750,8 +716,7 @@ goto dontshowmenu;
setBaudRate(baudRate);
break;
case 'd':
{
case 'd': {
debugFlagInit();
debugFlags:
@ -771,12 +736,9 @@ goto dontshowmenu;
Serial.print("\n\r5. LEDs = ");
Serial.print(debugLEDs);
Serial.print("\n\n\r6. swap probe pin = ");
if (probeSwap == 0)
{
if (probeSwap == 0) {
Serial.print("19");
}
else
{
} else {
Serial.print("18");
}
Serial.print("\n\n\r7. load slots on start = ");
@ -791,40 +753,33 @@ goto dontshowmenu;
Serial.write(toggleDebug);
toggleDebug -= '0';
if (toggleDebug >= 0 && toggleDebug <= 9)
{
if (toggleDebug >= 0 && toggleDebug <= 9) {
debugFlagSet(toggleDebug);
delay(10);
goto debugFlags;
}
else
{
} else {
break;
}
}
case ':':
if (Serial.read() == ':')
{
if (Serial.read() == ':') {
// Serial.print("\n\r");
// Serial.print("entering machine mode\n\r");
machineMode();
showLEDsCore2 = 1;
goto dontshowmenu;
break;
}
else
{
} else {
break;
}
default:
while (Serial.available() > 0)
{
while (Serial.available() > 0) {
int f = Serial.read();
delayMicroseconds(30);
}
@ -837,8 +792,7 @@ goto dontshowmenu;
// #include <string> // Include the necessary header file
void lastNetConfirm(int forceLastNet)
{
void lastNetConfirm(int forceLastNet) {
// while (tud_connected() == 0 && millis() < 500)
// ;
@ -850,8 +804,7 @@ void lastNetConfirm(int forceLastNet)
// return;
// }
if (forceLastNet == 1)
{
if (forceLastNet == 1) {
int bootselPressed = 0;
openNodeFile();
@ -866,13 +819,11 @@ void lastNetConfirm(int forceLastNet)
Serial.print("\n\r short press BOOTSEL to restore last netlist\n\r");
Serial.print(" long press to cancel\n\r");
delay(250);
if (BOOTSEL)
{
if (BOOTSEL) {
bootselPressed = 1;
}
while (forceLastNet == 1)
{
while (forceLastNet == 1) {
if (BOOTSEL)
bootselPressed = 1;
@ -895,12 +846,10 @@ void lastNetConfirm(int forceLastNet)
bootselPressed = 1;
// delay(250);
if (bootselPressed == 1)
{
if (bootselPressed == 1) {
unsigned long longPressTimer = millis();
int fade = 8;
while (BOOTSEL)
{
while (BOOTSEL) {
sendAllPathsCore2 = 1;
showLEDsCore2 = 2;
@ -909,8 +858,7 @@ void lastNetConfirm(int forceLastNet)
// leds.clear();
showLEDsCore2 = 2;
if (fade <= 0)
{
if (fade <= 0) {
clearAllNTCC();
clearLEDs();
startupColors();
@ -947,19 +895,18 @@ void machineMode(void) // read in commands in machine readable format
lastTimeCommandRecieved = millis();
if (millis() - lastTimeCommandRecieved > 100)
{
if (millis() - lastTimeCommandRecieved > 100) {
machineModeRespond(sequenceNumber, true);
return;
}
enum machineModeInstruction receivedInstruction = parseMachineInstructions(&sequenceNumber);
enum machineModeInstruction receivedInstruction =
parseMachineInstructions(&sequenceNumber);
// Serial.print("receivedInstruction: ");
// Serial.print(receivedInstruction);
// Serial.print("\n\r");
switch (receivedInstruction)
{
switch (receivedInstruction) {
case netlist:
lastTimeNetlistLoaded = millis();
clearAllNTCC();
@ -980,13 +927,10 @@ void machineMode(void) // read in commands in machine readable format
break;
case getnetlist:
if (millis() - lastTimeNetlistLoaded > 300)
{
if (millis() - lastTimeNetlistLoaded > 300) {
listNetsMachine();
}
else
{
} else {
machineModeRespond(0, true);
// Serial.print ("too soon bro\n\r");
return;
@ -1072,8 +1016,7 @@ void machineMode(void) // read in commands in machine readable format
machineModeRespond(sequenceNumber, true);
}
void loadFile(int slot)
{
void loadFile(int slot) {
clearAllNTCC();
openNodeFile(netSlot);
getNodesToConnect();
@ -1099,30 +1042,24 @@ volatile uint8_t pauseCore2 = 0;
void loop1() // core 2 handles the LEDs and the CH446Q8
{
// while (1) rainbowBounce(50); //I uncomment this to test the LEDs on a fresh board
while(pauseCore2 == 1)
{
// while (1) rainbowBounce(50); //I uncomment this to test the LEDs on a fresh
// board
while (pauseCore2 == 1) {
}
if (showLEDsCore2 >= 1)
{
if (showLEDsCore2 >= 1) {
int rails = showLEDsCore2;
if (rails == 1 || rails == 2)
{
if (rails == 1 || rails == 2) {
lightUpRail(-1, -1, 1, 28, supplySwitchPosition);
}
if (rails != 2)
{
if (rails != 2) {
showNets();
}
if (rails > 3)
{
if (rails > 3) {
Serial.print("\n\r");
Serial.print(rails);
}
@ -1133,8 +1070,7 @@ void loop1() // core 2 handles the LEDs and the CH446Q8
showLEDsCore2 = 0;
}
if (sendAllPathsCore2 == 1)
{
if (sendAllPathsCore2 == 1) {
delayMicroseconds(6200);
sendAllPaths();
delayMicroseconds(2200);
@ -1147,7 +1083,8 @@ void loop1() // core 2 handles the LEDs and the CH446Q8
// logicAnalyzer.processCommand();
// }
if (arduinoReset == 0 && USBSer1.peek() == 0x30) // 0x30 is the first thing AVRDUDE sends
if (arduinoReset == 0 &&
USBSer1.peek() == 0x30) // 0x30 is the first thing AVRDUDE sends
{
// Serial.print("resetting arduino\n\r");
@ -1164,77 +1101,68 @@ void loop1() // core 2 handles the LEDs and the CH446Q8
// setDac0_5Vvoltage(0.0);
// }
while (arduinoReset == 1)
{
while (arduinoReset == 1) {
if (USBSer1.available())
{
if (USBSer1.available()) {
char ch = USBSer1.read();
// Serial.write(ch);
Serial1.write(ch);
}
if (Serial1.available())
{
if (Serial1.available()) {
char ch = Serial1.read();
// Serial.write(ch);
USBSer1.write(ch);
}
if (millis() - lastTimeReset > 4000) // if the arduino hasn't been reset in a second, reset the flag
if (millis() - lastTimeReset >
4000) // if the arduino hasn't been reset in a second, reset the flag
{
arduinoReset = 0;
}
}
if (readInNodesArduino == 0)
{
if (readInNodesArduino == 0) {
if (USBSer1.available())
{
while (USBSer1.available()) {
char ch = USBSer1.read();
Serial1.write(ch);
// Serial.print(ch);
}
if (Serial1.available())
{
if (Serial1.available()) {
char ch = Serial1.read();
USBSer1.write(ch);
// Serial.print(ch);
if (ch == 'f' && connectFromArduino == '\0')
{
if (ch == 'f' && connectFromArduino == '\0') {
input = 'f';
connectFromArduino = 'f';
// Serial.print("!!!!");
Serial.print("!!!!");
while (connectFromArduino == 'f') {
//delay(10);
}
else
{
} else {
//connectFromArduino = '\0';
}
}
}
if (rotaryEncoderMode == 1)
{
if (rotaryEncoderMode == 1) {
rotaryEncoderStuff();
}
else
{
} else {
showingPreview = 0;
if (logoFlash == 2)
{
if (logoFlash == 2) {
logoFlashTimer = millis();
logoFlash = 1;
}
if (logoFlash == 1 && logoFlashTimer != 0 && millis() - logoFlashTimer > (20))
{
if (logoFlash == 1 && logoFlashTimer != 0 &&
millis() - logoFlashTimer > (20)) {
logoFlash = 0;
logoFlashTimer = 0;
lightUpRail();
@ -1247,6 +1175,9 @@ void loop1() // core 2 handles the LEDs and the CH446Q8
leds.show();
}
}
if (showReadings == 0 && probeActive == 0) {
showLEDmeasurements();
}
// logicAnalyzer.processCommand();
}

View File

@ -1,141 +0,0 @@
import PyInstaller.__main__
import pathlib
import os
import shutil
# PyInstaller.__main__.run([
# 'JumperlessWokwiBridge.py',
# '--onefile',
# '--windowed',
# '--onedir',
# '--icon=icon.icns',
# #'--add-binary=arduino-cli:.',
# '--console',
# '--target-arch=arm64',
# '--path=/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless_Wokwi_Bridge_App/JumperlessWokwiBridge/.venv/lib/python3.12/site-packages',
# '--noconfirm',
# #'--clean',
# ])
os.system(f"python -m PyInstaller --icon=\"/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless_Wokwi_Bridge_App/jumperlesswokwibridge/icon.icns\" \
-y \
--console \
--windowed \
--target-arch arm64 \
--path \"/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless_Wokwi_Bridge_App/JumperlessWokwiBridge/.venv/lib/python3.12/site-packages\" \
JumperlessWokwiBridge.py \
--name Jumperless ")
generated_app_path = pathlib.Path("dist/Jumperless.app/Contents/MacOS/Jumperless")
generated_app_path_renamed = generated_app_path.with_name("Jumperless_cli")
target_app_path = pathlib.Path("dist/Jumperless.app/Contents/MacOS/")
icon_path = pathlib.Path("icon.icns")
nonexec_launcher_path = pathlib.Path("Jumperless_cli_launcher.sh")
launcher_path = pathlib.Path("Jumperless")
app_path = pathlib.Path("Jumperless.app")
apple_silicon_folder = pathlib.Path("apple silicon/Jumperless.app")
intel_folder = pathlib.Path("intel mac/Jumperless.app")
# rename the app to JumperlessWokwiBridge_cli
print("chmodding launcher")
os.system(f"chmod 755 {nonexec_launcher_path}")
print("Changed permissions for " + str(nonexec_launcher_path)+ '\n')
print("Renaming launcher to Jumperless")
os.system(f'cp {nonexec_launcher_path} {launcher_path}')
print("Renamed " + str(nonexec_launcher_path) + " to " + str(launcher_path)+ '\n')
print("Renaming app main app to Jumperless_cli")
os.rename(generated_app_path, generated_app_path_renamed)
print("Renamed " + str(generated_app_path) + "(main app) to " + str(generated_app_path_renamed)+ '\n')
os.system(f"cp {launcher_path} {target_app_path}")
print("Copied " + str(launcher_path) + "(launcher) to " + str(target_app_path)+ '\n')
# os.system(f"cp {generated_app_path} {target_app_path}")
# print("Copied " + str(generated_app_path) + " to " + str(target_app_path))
App = "/Applications/"
print("Copying app to applications folder")
shutil.copytree("Jumperless.app", App + "Jumperless.app", dirs_exist_ok=True )
print("Copied " + str(app_path) + " to " + str(App)+ '\n')
print("Copying app to apple silicon folder")
shutil.copytree("Jumperless.app", apple_silicon_folder, dirs_exist_ok=True )
print("doing this all again for intel mac")
os.system(f"python -m PyInstaller --icon=\"/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless_Wokwi_Bridge_App/jumperlesswokwibridge/icon.icns\" \
-y \
--console \
--windowed \
--target-arch universal2 \
--path \"/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless_Wokwi_Bridge_App/JumperlessWokwiBridge/.venv/lib/python3.12/site-packages\" \
JumperlessWokwiBridge.py \
--name Jumperless ")
print("chmodding launcher")
os.system(f"chmod 755 {nonexec_launcher_path}")
print("Changed permissions for " + str(nonexec_launcher_path)+ '\n')
print("Renaming launcher to Jumperless")
os.system(f'cp {nonexec_launcher_path} {launcher_path}')
print("Renamed " + str(nonexec_launcher_path) + " to " + str(launcher_path)+ '\n')
print("Renaming app main app to Jumperless_cli")
os.rename(generated_app_path, generated_app_path_renamed)
print("Renamed " + str(generated_app_path) + "(main app) to " + str(generated_app_path_renamed)+ '\n')
os.system(f"cp {launcher_path} {target_app_path}")
print("Copied " + str(launcher_path) + "(launcher) to " + str(target_app_path)+ '\n')
# os.system(f"cp {generated_app_path} {target_app_path}")
# print("Copied " + str(generated_app_path) + " to " + str(target_app_path))
App = "/Applications/"
print("Copying app to applications folder")
shutil.copytree("Jumperless.app", App + "Jumperless.app", dirs_exist_ok=True )
print("Copied " + str(app_path) + " to " + str(App)+ '\n')
print("Copying app to intel mac folder")
shutil.copytree("Jumperless.app", intel_folder, dirs_exist_ok=True )
# os.system(f"cp {"JumperlessWokwiBridge.app"} {App}")
# os.system(f"cp {icon_path} {generated_app_path}")
print("Done")
# python -m PyInstaller \
# --icon="/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless_Wokwi_Bridge_App/jumperlesswokwibridge/icon.icns" \
# -y \
# --console \
# --windowed \
# --target-arch x86_64 \
# --path "/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless_Wokwi_Bridge_App/JumperlessWokwiBridge/.venv/lib/python3.12/site-packages" \
# --add-binary "arduino-cli:." \
# JumperlessWokwiBridge.py