thiagoralves / OpenPLC_v3

OpenPLC Runtime version 3
1.06k stars 432 forks source link

PSM recompilation #154

Open chungwong opened 2 years ago

chungwong commented 2 years ago

At this moment, saving a PSM main.py will trigger a full recompiling of current ST program on this line https://github.com/thiagoralves/OpenPLC_v3/blob/master/webserver/webserver.py#L1739

I believe the full compilation is only necessary if the following two files are changed(Changing Hardware dropdown option in the web interface)

echo linux > ../scripts/openplc_platform
echo psm_linux > ../scripts/openplc_driver

on this file https://github.com/thiagoralves/OpenPLC_v3/blob/master/webserver/scripts/change_hardware_layer.sh#L100

If I am making changes to main.py directly on the web interface, it will definitely trigger the full compilation which is quite slow especially we are making lots of changes to main.py during dev.

Does it mean I am better to modify the file via SSH to bypass the compilation? Or Am I completely wrong and the compilation process is necessary no matter what?

thiagoralves commented 2 years ago

Indeed, the recompilation process for PSM is not needed if all you're changing is the main.py file. The hardware tab is generic so that whatever changes to hardware settings will cause a full recompilation. If you edit the python file directly (either from terminal, text editor, ssh, whatever) you will skip the recompilation process and that should work just fine

thiagoralves commented 2 years ago

I'll keep this issue open so that in the future I can (or someone else) make the hardware tab a little smarter so to identify when a recompilation is truly necessary.