oss-slu / Mouser

GNU General Public License v3.0
1 stars 7 forks source link

Threading no longer hardcoded - takes in serial port settings RELATED TO PR 241 #242

Closed NNewbauer closed 2 weeks ago

NNewbauer commented 3 weeks ago

Fixes #240

What was changed?

Method of collecting data from serial port was changed from listening to two separate inputs to threading.

Here, describe what part of the application you changed (e.g. login page, database, etc.). If possible, mention what specific components were added, removed, or modified.

Changed data_collection.py, added serial_listener.py and listenTest.py. Data collection calls for serial listener components that handle threading.

UPDATE

Moved serial_listener.py and serial_handler.py (previously listenerTest.py) to shared. Serial handler calls to serial listener for serial data and send it to data collection ui.

Why was it changed?

Listening for two different inputs proved to be incredibly buggy and inefficient, so doing threading appeared to be the only fix.

Here, describe the issue that you are fixing with this code, and why your code fixes it.

Data inputs popped up an input box prematurely that immediately shut down, this bug created extra unneeded button clicks and general bugs that we do not want. Fixing this is essential to a smooth user experience.

UPDATE

Some of it was sheerly due to organizational reasons. However, a lot of it had to do with the being able to pull serial device settings into our newly implemented threading functions to obtain serial inputs.

How was it changed?

Added a new class, SerialReader and SerialDataHandler to control threading from serial inputs, these classes are in charge of reading the data and pulling what is specifically needed for the input, the old method couldn't handle that.

UPDATE

Serial handler calls for serial listener which uses serial port controllers retrieve setting function from the preferred config setting to get the device config settings from a list that is easily readable to other objects (old code didn't make sense, considering the program will ALWAYS look for the preferred setting, I just hard coded that file to be the file it always looks for). Using these settings, the serial listener will open a thread that listens for data, while serial handler pulls that data and spits it into the UI. Currently it's a bit disorganized, things such as serial_port_controller.py have gotten more and more antiquated as we've modified this program, the use of this file at this point is simply to find serial port settings, split the .csv, and plug them into the device, but this COULD be done from a file that has newly become relevant to our program; however, I'm not deleting that file until I'm confident that it is useless.

All in all... We have a very efficient data collection system now!

jackbelyeu commented 2 weeks ago

Sorry this keep happening, are you able to push the deletion of the exports folder. If you want to go above and beyond you can add exports to .gitignore with the push to avoid this issue in the future.