thiagoralves / OpenPLC_Editor

OpenPLC Editor - IDE capable of creating programs for the OpenPLC Runtime
GNU General Public License v2.0
385 stars 191 forks source link

Speeded up the reading of board installed by arduino-cli #86

Closed francesco-fioretti closed 2 months ago

francesco-fioretti commented 11 months ago

Hi thiagoralves, In the previous PR you said that the readBoardsInstalled function was taking too long, so you commented it out. I now make it run on a parallel thread when you click the icon to compile on the microprocessor, so that some time is 'masked' by the compilation. I also speeded things up by making more threads, one for each board, with a 4-thread semaphore so as not to ask arduino to serve too many parallel threads (arduino response time goes up to 4-5 seconds) In my opinion checking installed boards is crucial, because if you also have arduino installed and you install/uninstall boards from arduino and not from OpenPLC, OpenPLC can't know about it, so it would install boards that are already installed, or in any case in the drop down menu it would give wrong results (board installed when it is not and vice versa) Please tell me what you think Thank you very much for your work and availability

thiagoralves commented 11 months ago

Hi Francesco, this feature is not essential, as the board is not installed again. It will show as not installed, but once you uploads your code it will check that the board is installed and populate the hals.json appropriately. I will test your code anyway to see the improvements. One thing I don’t know if you had implemented in this improvement is to only check the boards that are marked as not installed, and to write back on hals.json all boards installed

thiagoralves commented 2 months ago

Not relevant anymore on current code. Other optimizations were made