Raspberry pi (boot option on download)

Post here to discuss any new features, components, chips, etc, that you would like to see in Flowcode.
Post Reply
RGV250
Posts: 264
http://meble-kuchenne.info.pl
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 23 times
Been thanked: 30 times

Raspberry pi (boot option on download)

Post by RGV250 »

Hi,
I am not sure if this is possible but i think it would be very useful. I have been playing with the Pi and the annoying thing is that to make it run independent you need to edit the rc.localfile. If you are testing and turn the PC off the project stops.
I have a PLC (Programmable Logic Controller) running my lighting and there is an option to "Create boot project" so it starts automatically.

Would it be possible to have a check box so on download Flowcode edits this file for you, the only issue I can see is deleting the last entry unless you keep the filename the same which is not good in case you make a mistake. Could the rc.local entry read the latest project file and use that name for the boot project.

Regards,
Bob

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: Raspberry pi (boot option on download)

Post by Steve-Matrix »

It's a bit of a niche case, but it could be possible. Can you please provide some details of what edits needs to be made and I will look into how this can be done.

RGV250
Posts: 264
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 23 times
Been thanked: 30 times

Re: Raspberry pi (boot option on download)

Post by RGV250 »

Hi Steve,
From the second to last page of the document here
https://www.flowcode.co.uk/resources/da ... de%209.pdf
Running your programs independently of Flowcode
Once you have used Flowcode to create, compile and transfer your program to the
Raspberry PI, it will exist in the home directory of the selected user e.g. /home/pi
From there the application can be run via a serial console such as Putty or virtual desktop
such as VNC or RDP. VNC and SSH for Putty are enabled via the Raspberry Pi “Interface
Configuration” dialog.
Your application can also be configured to run from start-up of the Raspberry Pi by adding a
line to the /etc/rc.local file, but before the exit 0.
Editing this file must be done with root privileges, e.g. sudo nano /etc/rc.local
/home/pi/MyFlowcodeProject &
exit 0
Notes: It is vital that you do not use any spaces within the project name.
If you do, the code will not autorun on start up.
Underscores are allowed.
It is always best to add a space then & after the project name.
If you don’t then the Pi will not complete the
boot process
Regards,
Bob

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: Raspberry pi (boot option on download)

Post by Steve-Matrix »

Thanks for the info.

I think this is probably something you are better applying manually when you want to set a specific program to run on boot. For example, what happens when you want to change your device so the program in no longer automatically executed at boot time. Or you want multiple programs to run at boot. Also, if you choose to move the compiled program to a different PI, you would need to manually edit that file.

RGV250
Posts: 264
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 23 times
Been thanked: 30 times

Re: Raspberry pi (boot option on download)

Post by RGV250 »

Hi Steve,
Been busy with visitors. I thought it would be nice to have the option especially for newbies to the Pi like me. If you wanted to run multiple programs you are probably a lot more experienced so would know what to edit. Not sure why you would want to change it so the program is no longer executed at boot time apart from if you downloaded a different program which is where i think it could get difficult for flowcode to do automaticall unless it can remover the previous entry.

Bob

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: Raspberry pi (boot option on download)

Post by Steve-Matrix »

Thanks for taking the time to respond, Bob. I see your point, but I'm concerned that having Flowcode automatically edit that rc.local file has potential for things to go wrong. It could cause more problems than it fixes, and the alternative (manually editing the file) should be relatively trivial.

The Pi is very different from most Flowcode targets in that Flowcode creates a program that runs within the Pi operating system alongside many other running applications. Whereas on most targets, Flowcode rewrites the whole chip with a dedicated program. So for the Pi, Flowcode is not designed to take full control over the Pi.

Plus, for those wanting automatic run-on-boot capabilities, that facility is well documented and simple to administer.

Post Reply