Page 1 of 2

Counter Reset With RevPiModIO

Posted: 06 Dec 2018, 22:00
by kodyaz
Hi, How to reset counter values with RevPiModIO.

Re: Counter Reset With RevPiModIO

Posted: 08 Dec 2018, 20:39
by RevPiModIO
It is not implemented yet :(

! BUT !

I did it NOW 8-) I just have to run some tests an will publish a link to the "beta" tomorrow. It would be nice if you can test the new Version (2.3.0) an report your experience!

Sven

Re: Counter Reset With RevPiModIO

Posted: 10 Dec 2018, 16:34
by RevPiModIO
And here it is: http://revpimodio.org/dnl/python3-revpi ... -1_all.deb

Beta with reset of counter inputs.

You have to download and install it on you pi via:

Code: Select all

wget http://revpimodio.org/dnl/python3-revpimodio2_2.3.0-1_all.deb
sudo dpkg -i python3-revpimodio2_2.3.0-1_all.deb
You use it like the old version. So let the counters count some values and call the .reset() function of the counter inputs.

Code: Select all

import revpimodio2
rpi = revpimodio2.RevPiModIO(autorefresh=True)

# Read the counter input values
rpi.io.Counter_1.value
11
rpi.io.Counter_2.value
11

# Reset counter inputs
rpi.io.Counter_1.reset()
rpi.io.Counter_2.reset()

# Read the counter input values again
rpi.io.Counter_1.value
0
rpi.io.Counter_2.value
0

Please post your experiences!

Sven

Re: Counter Reset With RevPiModIO

Posted: 15 Dec 2018, 12:00
by kodyaz
miprotek wrote: 10 Dec 2018, 16:34 And here it is: http://revpimodio.org/dnl/python3-revpi ... -1_all.deb

Beta with reset of counter inputs.

You have to download and install it on you pi via:

Code: Select all

wget http://revpimodio.org/dnl/python3-revpimodio2_2.3.0-1_all.deb
sudo dpkg -i python3-revpimodio2_2.3.0-1_all.deb
You use it like the old version. So let the counters count some values and call the .reset() function of the counter inputs.

Code: Select all

import revpimodio2
rpi = revpimodio2.RevPiModIO(autorefresh=True)

# Read the counter input values
rpi.io.Counter_1.value
11
rpi.io.Counter_2.value
11

# Reset counter inputs
rpi.io.Counter_1.reset()
rpi.io.Counter_2.reset()

# Read the counter input values again
rpi.io.Counter_1.value
0
rpi.io.Counter_2.value
0

Please post your experiences!

Sven
Thanks Sven. This code was executed.
Thank you for your interest.

But I have one more question. Can I shut down Revolution Pi 3 with python software?

Re: Counter Reset With RevPiModIO

Posted: 17 Dec 2018, 08:27
by RevPiModIO
Nice to read that the counter reset works, thank you!

You can execute all system commands via python with os.system("command"). So if you like so shutdown your RevPi with Python, you can do it like this:

Code: Select all

import os
os.system("/usr/bin/sudo /sbin/poweroff")

This code will shut down your RevPi immediately.

Sven

Re: Counter Reset With RevPiModIO

Posted: 17 Dec 2018, 20:42
by kodyaz
Thank you Sven for your benevolence.

Re: Counter Reset With RevPiModIO

Posted: 18 Apr 2019, 19:55
by Bonze
das reseten der Counter funktioniert aber nicht bei allen Inputs!, das ist mir heute aufgefallen, dachte erst an einen Fehler meinerseits,
aber nach wechsel auf einen anderen Input hat es sofort funktioniert... vl liegt hier ein Software Bug vor. D Bei Counter6/7 funktioniert es auf jedenfall, aber bei 8/9 hat es nicht funktioniert..

Re: Counter Reset With RevPiModIO

Posted: 19 Apr 2019, 07:23
by RevPiModIO
Hi Bonze!

Danke für die Meldung, ich werde das umgehen prüfen und korrigieren - Ergebnisse poste ich dann an dieser Stelle.

Re: Counter Reset With RevPiModIO

Posted: 01 May 2019, 15:06
by RevPiModIO
Alle liebe Community!

Dank Bonze konnte ich einen Fehler verbessern und der .reset() Befehl der Counter IOs läuft nun auch auf Countern 8-16.

Zu dem Fehler kam es durch den ioctl Aufruf, dessen Daten durch padding etwas anders interpretiert werden müssen :D

Version 2.3.2 Behebt dieses Problem und führt noch ein paar Debuggingwerkzeuge ein:

DE [https://revpimodio.org/version-2-3-2/]
EN [https://revpimodio.org/en/blogs/version ... imodio-en/]

Gruß, Sven

Re: Counter Reset With RevPiModIO

Posted: 21 Feb 2020, 13:44
by Bonze
ich hab heute festgestellt, das wohl in der neusten Version wieder ein Bug ist, bei dem sich der Counter nicht zurücksetzen lässt. Counter7/8 funktioniert bei gleicher Konfiguration.
Counter9/10 , konfiguriert als Encoder, wirft beim zurücksetzen folgenden Fehler:

Code: Select all

plc: __init__.py started: Fri Feb 21 13:18:05 2020
/home/pi/.local/lib/python3.5/site-packages/revpimodio2/modio.py:330: RuntimeWarning: got io error during ioctl and count 1 errors now
  RuntimeWarning