Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

programs can be loaded from external py files #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dr3y
Copy link

@dr3y dr3y commented May 6, 2021

I wanted to allow custom programs to be integrated a bit better into the workflow.

Now you can have programs in external .py files!

This is still ultraWIP(TM) so many things might be bad or unfinished.

Consequences:

  1. programs in the CustomProgram if statement no longer work
  2. "input parameters" is no longer loaded automatically (if you want to do this you can do it in the program .py file)
  3. using importlib to import a programname.py file every time you run CustomProgram(M), so any variables in the program which aren't stored in sysData are not saved
  4. your program file must have ##CHI_BIO_PROGRAM on the first line
  5. your program file must have a def main(M,sysData,api): function
  6. funcapi is a class which exposes many functions to the programs (but not all of them because I am lazy)
  7. the html now displays the names of programs in the Custom Programs dropdown, which get updated every time you reload the page
  8. at reset index() now checks the current folder for any valid programs and stores them in sysData["CustomPrograms"]={"programname":"\\path\\to\\programname.py","programname2" etc}
  9. a few 'example' programs are included, including a copy of the "C1" program

WARNING: UNTESTED ON REAL CHI.BIOs!! use at own risk tested and it works :)

dr3y added 2 commits May 6, 2021 12:53
more multiplexer messages because we are getting multiplexer issues
@HarrisonSteel
Copy link
Owner

Look like very interesting and useful changes. It's a much more rigorous/modular approach to custom programs than what is there currently.

What was your motivation for the usecomms flag? Do you have use-cases where you want the UI to run but without any interaction with the devices? I can't see that this will break it, but may add extra complexity for 98% of users if they are not going to be trying to operate without the appropriate communication toolboxes installed. The most recent software install version I have on the Chi.Bio site actually flashes the whole linux distro (including all required packages), so it would ensure that the I2C/GPIO packages are always installed...

@dr3y
Copy link
Author

dr3y commented May 9, 2021

Thanks!
I made the usecomms flag because I wanted to test the GUI on my desktop computer.

@viktorht
Copy link

viktorht commented Jul 3, 2022

Hi!

Are there any plans to merge this PR?

Best
Viktor

@HarrisonSteel
Copy link
Owner

To be honest, I had not had time to go through it line by line to see whether it might cause any issues with the broader OS. Is it something that would be useful to you? If there are multiple users who would benefit from it then (at first glance) I don't see why not merge it.

@viktorht
Copy link

Hi Harrison, thank you for the reply! I just wanted to get back to you to let you know that after some scoping of the Chi.bio system, we decided to use another system for our fermentations. So, in the end, I will not have any immediate use for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants