diff --git a/.gitignore b/.gitignore index 3cf8c6d339acb48eab2de2f7cd1fe5482c2a6d96..0a764a4de3a890dbe2a3336c648f7f6d1892c132 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ env -__pycache__ \ No newline at end of file diff --git a/app/autopressure/app/__main__.py b/app/__main__.py similarity index 100% rename from app/autopressure/app/__main__.py rename to app/__main__.py diff --git a/app/autopressure/.gitignore b/app/autopressure/.gitignore deleted file mode 100644 index 0a764a4de3a890dbe2a3336c648f7f6d1892c132..0000000000000000000000000000000000000000 --- a/app/autopressure/.gitignore +++ /dev/null @@ -1 +0,0 @@ -env diff --git a/app/autopressure/arduino/arduino_valve_controller/arduino_valve_controller.ino b/app/autopressure/arduino/arduino_valve_controller/arduino_valve_controller.ino deleted file mode 100644 index 098ac0cb8579de4158cde1c275c8c8774844d746..0000000000000000000000000000000000000000 --- a/app/autopressure/arduino/arduino_valve_controller/arduino_valve_controller.ino +++ /dev/null @@ -1,45 +0,0 @@ -float valve_percent; -float scale_factor = (4096-1)/100.0; -int avg_depth = 32; - -void setup() { - // put your setup code here, to run once: - pinMode(A0, OUTPUT); // sets the pin as output - pinMode(A1, INPUT); - Serial.begin(1000000); -} - -void loop() { - // put your main code here, to run repeatedly: - if (Serial.available() > 0) { - char command = Serial.read(); - if (command == 'u') { // write command - //--- actuate solenoid valve --- - float valve_percent = 0.0; - String data = Serial.readStringUntil('\n'); // Read the incoming data until newline - char *ptr = strtok(const_cast<char*>(data.c_str()), ","); - valve_percent = atof(ptr); - set_signal(valve_percent); - //--- read pressure - analogReadResolution(14); - int x = analogRead(A1); - for (int i = 0; i < avg_depth-1; i++) { - analogReadResolution(14); - x += analogRead(A1); - } - Serial.println(x/avg_depth); - } - else if (command == 'r') { - set_signal(0.0); - } - } -} - -void set_signal(float valve_percent) { - // IMPORTANT NOTE: it has been observed that the reset signal - // doesn't function properly with a 5 V logic high signal (arduino's default). - // A resistive voltage divider is required to set the logic high to 3.3 V. - analogWriteResolution(12); - analogWrite(A0, int(scale_factor*valve_percent)); -} - diff --git a/app/autopressure/requirements.txt b/app/autopressure/requirements.txt deleted file mode 100644 index d4f89ed0ce52f54236c44465fff74abe9337c0e0..0000000000000000000000000000000000000000 --- a/app/autopressure/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -numpy==2.1.3 -pyqtgraph==0.13.7 -pyserial==3.5 -PySide6==6.8.0.2 -PySide6_Addons==6.8.0.2 -PySide6_Essentials==6.8.0.2 -shiboken6==6.8.0.2 -simple-pid==2.0.1 diff --git a/app/autopressure/app/code/mainwindow.py b/app/code/mainwindow.py similarity index 100% rename from app/autopressure/app/code/mainwindow.py rename to app/code/mainwindow.py diff --git a/app/autopressure/app/code/module.py b/app/code/module.py similarity index 100% rename from app/autopressure/app/code/module.py rename to app/code/module.py diff --git a/app/autopressure/app/main.py b/app/main.py similarity index 100% rename from app/autopressure/app/main.py rename to app/main.py diff --git a/app/autopressure/app/ui/dist/__pycache__/ui_mainwindow.cpython-311.pyc b/app/ui/dist/__pycache__/ui_mainwindow.cpython-311.pyc similarity index 100% rename from app/autopressure/app/ui/dist/__pycache__/ui_mainwindow.cpython-311.pyc rename to app/ui/dist/__pycache__/ui_mainwindow.cpython-311.pyc diff --git a/app/autopressure/app/ui/dist/__pycache__/ui_mainwindow.cpython-312.pyc b/app/ui/dist/__pycache__/ui_mainwindow.cpython-312.pyc similarity index 100% rename from app/autopressure/app/ui/dist/__pycache__/ui_mainwindow.cpython-312.pyc rename to app/ui/dist/__pycache__/ui_mainwindow.cpython-312.pyc diff --git a/app/autopressure/app/ui/dist/__pycache__/ui_module.cpython-311.pyc b/app/ui/dist/__pycache__/ui_module.cpython-311.pyc similarity index 100% rename from app/autopressure/app/ui/dist/__pycache__/ui_module.cpython-311.pyc rename to app/ui/dist/__pycache__/ui_module.cpython-311.pyc diff --git a/app/autopressure/app/ui/dist/__pycache__/ui_module.cpython-312.pyc b/app/ui/dist/__pycache__/ui_module.cpython-312.pyc similarity index 100% rename from app/autopressure/app/ui/dist/__pycache__/ui_module.cpython-312.pyc rename to app/ui/dist/__pycache__/ui_module.cpython-312.pyc diff --git a/app/autopressure/app/ui/dist/ui_mainwindow.py b/app/ui/dist/ui_mainwindow.py similarity index 100% rename from app/autopressure/app/ui/dist/ui_mainwindow.py rename to app/ui/dist/ui_mainwindow.py diff --git a/app/autopressure/app/ui/dist/ui_module.py b/app/ui/dist/ui_module.py similarity index 100% rename from app/autopressure/app/ui/dist/ui_module.py rename to app/ui/dist/ui_module.py diff --git a/app/autopressure/app/ui/src/mainwindow.ui b/app/ui/src/mainwindow.ui similarity index 100% rename from app/autopressure/app/ui/src/mainwindow.ui rename to app/ui/src/mainwindow.ui diff --git a/app/autopressure/app/ui/src/module.ui b/app/ui/src/module.ui similarity index 100% rename from app/autopressure/app/ui/src/module.ui rename to app/ui/src/module.ui diff --git a/app/autopressure/compile.sh b/compile.sh similarity index 100% rename from app/autopressure/compile.sh rename to compile.sh diff --git a/main.py b/main.py deleted file mode 100644 index 17820682a198747023439672e7b7eea46750e6aa..0000000000000000000000000000000000000000 --- a/main.py +++ /dev/null @@ -1,73 +0,0 @@ -import serial -import serial.tools.list_ports -import time - - -SERIAL_NUMBER : str = "3307142A37323835191D33324B572D44" -# ser = serial.Serial("/dev/tty.usbmodem1101", 9600) - -def find_device(serial_number:str) -> str: - """Check the `hwid` through the list ports for a `SER` key - that matches `serial_number` - """ - - for port, desc, hwid in serial.tools.list_ports.comports(): - infos = hwid.split(" ") - - for info in infos: - if not info.startswith("SER"): - continue - - serial_num = info.split("=")[-1] - - if not serial_num == serial_number: - break - - return port - - return "" - - -MY_PORT : str = find_device(SERIAL_NUMBER) - -print(MY_PORT) -device = serial.Serial() -device.port = MY_PORT -device.timeout = 1 -device.baudrate = 9600 -device.open() - - -def write_value(valve_percent:float): - - device.write(b'w') - data = str(valve_percent) - device.write(data.encode() + b'\n') - - -def read_value(): - device.write(b'r') - time.sleep(0.1) - response = float(device.readline().decode().strip()) - return response - - -def read_pressure(): - device.write(b'p') - time.sleep(0.1) - response = float(device.readline().decode().strip()) - return response - - -if __name__ == "__main__": - while True: - print("Enter valve opening percentage:") - valve_percent = input() - if float(valve_percent) < 0: - break - write_value(valve_percent) - print(read_value()) - # print(read_pressure()) - device.close() - - diff --git a/requirements.txt b/requirements.txt index 8991f8fd49f7393bd2acb8aee9e2babaad7c745c..d4f89ed0ce52f54236c44465fff74abe9337c0e0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,66 +1,8 @@ -asttokens==2.4.1 -colorama==0.4.6 -comm==0.2.1 -contourpy==1.2.0 -cycler==0.12.1 -debugpy==1.8.0 -decorator==5.1.1 -distlib==0.3.7 -executing==2.0.1 -filelock==3.13.1 -fonttools==4.44.0 -future==1.0.0 -greenlet==3.0.3 -ipykernel==6.28.0 -ipympl==0.9.3 -ipython==8.20.0 -ipython-genutils==0.2.0 -ipywidgets==8.1.2 -iso8601==2.1.0 -jedi==0.19.1 -jupyter_client==8.6.0 -jupyter_core==5.7.1 -jupyterlab_widgets==3.0.10 -kiwisolver==1.4.5 -llvmlite==0.43.0 -matplotlib==3.8.1 -matplotlib-inline==0.1.6 -mendeleev==0.15.0 -mpmath==1.3.0 -nest-asyncio==1.5.8 -numba==0.60.0 -numpy==1.26.1 -packaging==23.2 -pandas==2.2.0 -parso==0.8.3 -Pillow==10.1.0 -platformdirs==3.11.0 -prompt-toolkit==3.0.43 -psutil==5.9.7 -pure-eval==0.2.2 -pyfiglet==0.8.post1 -Pygments==2.17.2 -pyparsing==3.1.1 -PyQt5==5.15.10 -PyQt5-Qt5==5.15.2 -PyQt5-sip==12.13.0 +numpy==2.1.3 +pyqtgraph==0.13.7 pyserial==3.5 -python-dateutil==2.8.2 -pytz==2024.1 -pywin32==306 -PyYAML==6.0.2 -pyzmq==25.1.2 -qutip==5.0.3.post1 -rdkit==2024.3.3 -scipy==1.11.3 -six==1.16.0 -SQLAlchemy==2.0.25 -stack-data==0.6.3 -sympy==1.12.1 -tornado==6.4 -traitlets==5.14.1 -typing_extensions==4.9.0 -tzdata==2023.4 -virtualenv==20.25.1 -wcwidth==0.2.13 -widgetsnbextension==4.0.10 +PySide6==6.8.0.2 +PySide6_Addons==6.8.0.2 +PySide6_Essentials==6.8.0.2 +shiboken6==6.8.0.2 +simple-pid==2.0.1