Hi Sailoog,
I´m not sure if this is the right thread for questions to the Template?
I started a little bit to write a app for Openplotter and the MCS Modul. This Python work with wx is already new for me.
Here you find my first tests... :
https://github.com/Thomas-GeDaD/openplotter-MCS
Some questions:
When started the postinstall.py ? Also the work with setuptools is new for me... ;-) So i do not know How this start? Or did this start later through OP-settings?
I want to do the configurations ( set the sc16is752 and mcp2515 to config.txt, config the 1-wire driver) on installing the app.
Then I want to add a tab for "Settings" and for "1-wire" configuration.
On Settings i only want to display if all config is correct and the serial/can ports availible.
On 1-wire tab i want to make the config for the 1-wire sensors like in your I2C App....
The inputs can define in your part?
The startup.py starts at every systemstart or at programmstart?
[
attachment=554]
What kind of using mcp2515 should I do?
At the moment I make the entries in config.txt in PostInstall script.
Schould I also start the interface?:
Code:
sudo ip link set can0 up type can bitrate 250000
or do you do this in the mcp2515 can-app?
Should I do anithing else witch can?
(2019-09-20, 05:26 PM)glowntiger Wrote: [ -> ]Hi Sailoog,
I´m not sure if this is the right thread for questions to the Template?
I started a little bit to write a app for Openplotter and the MCS Modul. This Python work with wx is already new for me.
Here you find my first tests... :
https://github.com/Thomas-GeDaD/openplotter-MCS
Some questions:
When started the postinstall.py ? Also the work with setuptools is new for me... ;-) So i do not know How this start? Or did this start later through OP-settings?
I want to do the configurations ( set the sc16is752 and mcp2515 to config.txt, config the 1-wire driver) on installing the app.
Then I want to add a tab for "Settings" and for "1-wire" configuration.
On Settings i only want to display if all config is correct and the serial/can ports availible.
On 1-wire tab i want to make the config for the 1-wire sensors like in your I2C App....
The inputs can define in your part?
The startup.py starts at every systemstart or at programmstart?
- when you install any app from openplotter-settings, postinstall.py file is executed after the app package installation. If you are developing, you have to install your app for testing using "sudo python3 setup.py install" and then you have to run manually the postinstall script just typing "myappPostInstall"
- startup.py files have 2 functions: "start" and "check". On
system start all startup.py files of all apps are called and "start" functions are executed, then "check" functions are executed. When you click on "check system" in openplotter-settings all startups.py files of all apps are called too but only "check" functions are executed.
- I do not understand this question: "The inputs can define in your part?"
(2019-09-23, 03:54 PM)glowntiger Wrote: [ -> ]What kind of using mcp2515 should I do?
At the moment I make the entries in config.txt in PostInstall script.
Schould I also start the interface?:
Code:
sudo ip link set can0 up type can bitrate 250000
or do you do this in the mcp2515 can-app?
Should I do anithing else witch can?
Forget about mcp2515, we will do this in openplotter-can app (config.tx and interfaces). You will be able to choose SPI1 or SPI0, oscillator and interrupt GPIO too.
You have to do nothing
![Smile Smile](https://forum.openmarine.net/images/smilies/smile.png)
(2019-09-23, 04:34 PM)Sailoog Wrote: [ -> ]- when you install any app from openplotter-settings, postinstall.py file is executed after the app package installation. If you are developing, you have to install your app for testing using "sudo python3 setup.py install" and then you have to run manually the postinstall script just typing "myappPostInstall"
- startup.py files have 2 functions: "start" and "check". On system start all startup.py files of all apps are called and "start" functions are executed, then "check" functions are executed. When you click on "check system" in openplotter-settings all startups.py files of all apps are called too but only "check" functions are executed.
Is there a possibility to start the script in development? There is no entry point for the Script in Setup.py. I think I cannot start this via "sudo python Startup.py"?
- I do not understand this question: "The inputs can define in your part?" The GPIO Inputs. If I understand it right with your app you can handle the state of any gpio Input?
O.K. I delete all I have done for mcp2515 in my scripts…
![Rolleyes Rolleyes](https://forum.openmarine.net/images/smilies/rolleyes.png)
(2019-09-23, 05:26 PM)glowntiger Wrote: [ -> ] (2019-09-23, 04:34 PM)Sailoog Wrote: [ -> ]- when you install any app from openplotter-settings, postinstall.py file is executed after the app package installation. If you are developing, you have to install your app for testing using "sudo python3 setup.py install" and then you have to run manually the postinstall script just typing "myappPostInstall"
- startup.py files have 2 functions: "start" and "check". On system start all startup.py files of all apps are called and "start" functions are executed, then "check" functions are executed. When you click on "check system" in openplotter-settings all startups.py files of all apps are called too but only "check" functions are executed.
Is there a possibility to start the script in development? There is no entry point for the Script in Setup.py. I think I cannot start this via "sudo python Startup.py"?
- I do not understand this question: "The inputs can define in your part?" The GPIO Inputs. If I understand it right with your app you can handle the state of any gpio Input?
O.K. I delete all I have done for mcp2515 in my scripts… ![Rolleyes Rolleyes](https://forum.openmarine.net/images/smilies/rolleyes.png)
Yes, download openplotter-settings from github and add:
Code:
startup = False
try:
from openplotterMyapp import startup
except:pass
if startup: self.processApp(startup)
in "starting" function in openplotterSettings/startup.py and install it with "sudo python3 setup.py install"
After installing you have to run "openplotter-startup start" or "openplotter-startup check" and your startup.py script in openplotter-myapp will be called and executed.
Handling GPIO states will be done by openplotter-actions app and you will be able to use states as trigger or actions. I guess you are thinking about your auto-shutdown feature, aren't you?
thanks i will try this…. ;-)
Yes, I think about the auto-shutdown and further i have 4 more opto-Inputs on the board wich can use for switches or so on.
If you have some time, you can take a quick look at my Postinstall.py script? If it is o.k. for you I make the preuninstall to delete all changes?
https://github.com/Thomas-GeDaD/openplot...plotterMCS
For the I2C devices I must call "
echo ds2482 0x18 > /sys/bus/i2c/devices/i2c-1/new_device". Is the startup.py the right place for it?
(2019-09-23, 06:09 PM)glowntiger Wrote: [ -> ]thanks i will try this…. ;-)
Yes, I think about the auto-shutdown and further i have 4 more opto-Inputs on the board wich can use for switches or so on.
If you have some time, you can take a quick look at my Postinstall.py script? If it is o.k. for you I make the preuninstall to delete all changes?
https://github.com/Thomas-GeDaD/openplot...plotterMCS
For the I2C devices I must call "echo ds2482 0x18 > /sys/bus/i2c/devices/i2c-1/new_device". Is the startup.py the right place for it?
I will take a look to your app as soon as possible, really busy now
In preUninstall script you should revert all changes you did in postInstall script.
If you need to do "
echo ds2482 0x18 > /sys/bus/i2c/devices/i2c-1/new_device" just once, the postInstall script is the right place, otherwise startup.py should be fine.
If I make all config edits for the 1-wire ds2482 in the MCS-App, is it possible that your 1-wire app Handle the Sensor too?
Or should I make an own 1-wire handle in the MCS app?
The code after config
Code:
import os
x= os.listdir("/sys/bus/w1/devices")
x.remove ("w1_bus_master1")
sensor_data=""
for i in x:
foo = open("/sys/bus/w1/devices/"+ i +"/w1_slave","r")
data = foo.read ()
foo.close()
spos=data.find("t=")
tempx=(data[spos+2:-1])
temp = int(tempx)/1000
sensor_data +=i + ";" + str(temp) +","
sensor_data=sensor_data.split(",")
for i in sensor_data:
print (i)
[
attachment=555]