mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-08 22:03:53 +01:00
Doppelte Fehlerzählung bei imgwriter und modio in modio zusammengeführt
This commit is contained in:
@@ -429,7 +429,7 @@ Thread
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>__slots__</td></tr><tr><td>ioerrors</td></tr><tr><td>maxioerrors</td></tr><tr><td>refresh</td></tr>
|
<tr><td>__slots__</td></tr><tr><td>refresh</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -452,24 +452,12 @@ Methods</h3>
|
|||||||
<td><a style="color:#0000FF" href="#ProcimgWriter._collect_events">_collect_events</a></td>
|
<td><a style="color:#0000FF" href="#ProcimgWriter._collect_events">_collect_events</a></td>
|
||||||
<td>Aktiviert oder Deaktiviert die Eventueberwachung.</td>
|
<td>Aktiviert oder Deaktiviert die Eventueberwachung.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#ProcimgWriter._get_ioerrors">_get_ioerrors</a></td>
|
|
||||||
<td>Ruft aktuelle Anzahl der Fehler ab.</td>
|
|
||||||
</tr><tr>
|
|
||||||
<td><a style="color:#0000FF" href="#ProcimgWriter._gotioerror">_gotioerror</a></td>
|
|
||||||
<td>IOError Verwaltung fuer autorefresh.</td>
|
|
||||||
</tr><tr>
|
|
||||||
<td><a style="color:#0000FF" href="#ProcimgWriter.get_maxioerrors">get_maxioerrors</a></td>
|
|
||||||
<td>Gibt die Anzahl der maximal erlaubten Fehler zurueck.</td>
|
|
||||||
</tr><tr>
|
|
||||||
<td><a style="color:#0000FF" href="#ProcimgWriter.get_refresh">get_refresh</a></td>
|
<td><a style="color:#0000FF" href="#ProcimgWriter.get_refresh">get_refresh</a></td>
|
||||||
<td>Gibt Zykluszeit zurueck.</td>
|
<td>Gibt Zykluszeit zurueck.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#ProcimgWriter.run">run</a></td>
|
<td><a style="color:#0000FF" href="#ProcimgWriter.run">run</a></td>
|
||||||
<td>Startet die automatische Prozessabbildsynchronisierung.</td>
|
<td>Startet die automatische Prozessabbildsynchronisierung.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#ProcimgWriter.set_maxioerrors">set_maxioerrors</a></td>
|
|
||||||
<td>Setzt die Anzahl der maximal erlaubten Fehler.</td>
|
|
||||||
</tr><tr>
|
|
||||||
<td><a style="color:#0000FF" href="#ProcimgWriter.set_refresh">set_refresh</a></td>
|
<td><a style="color:#0000FF" href="#ProcimgWriter.set_refresh">set_refresh</a></td>
|
||||||
<td>Setzt die Zykluszeit in Millisekunden.</td>
|
<td>Setzt die Zykluszeit in Millisekunden.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
@@ -521,39 +509,6 @@ True aktiviert / False deaktiviert
|
|||||||
<dd>
|
<dd>
|
||||||
True, wenn Anforderung erfolgreich war
|
True, wenn Anforderung erfolgreich war
|
||||||
</dd>
|
</dd>
|
||||||
</dl><a NAME="ProcimgWriter._get_ioerrors" ID="ProcimgWriter._get_ioerrors"></a>
|
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
|
||||||
ProcimgWriter._get_ioerrors</h3>
|
|
||||||
<b>_get_ioerrors</b>(<i></i>)
|
|
||||||
<p>
|
|
||||||
Ruft aktuelle Anzahl der Fehler ab.
|
|
||||||
</p><dl>
|
|
||||||
<dt>Returns:</dt>
|
|
||||||
<dd>
|
|
||||||
Aktuelle Fehleranzahl
|
|
||||||
</dd>
|
|
||||||
</dl><a NAME="ProcimgWriter._gotioerror" ID="ProcimgWriter._gotioerror"></a>
|
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
|
||||||
ProcimgWriter._gotioerror</h3>
|
|
||||||
<b>_gotioerror</b>(<i>e=None</i>)
|
|
||||||
<p>
|
|
||||||
IOError Verwaltung fuer autorefresh.
|
|
||||||
</p><dl>
|
|
||||||
<dt><i>e</i></dt>
|
|
||||||
<dd>
|
|
||||||
Exception to log if debug is enabled
|
|
||||||
</dd>
|
|
||||||
</dl><a NAME="ProcimgWriter.get_maxioerrors" ID="ProcimgWriter.get_maxioerrors"></a>
|
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
|
||||||
ProcimgWriter.get_maxioerrors</h3>
|
|
||||||
<b>get_maxioerrors</b>(<i></i>)
|
|
||||||
<p>
|
|
||||||
Gibt die Anzahl der maximal erlaubten Fehler zurueck.
|
|
||||||
</p><dl>
|
|
||||||
<dt>Returns:</dt>
|
|
||||||
<dd>
|
|
||||||
Anzahl erlaubte Fehler
|
|
||||||
</dd>
|
|
||||||
</dl><a NAME="ProcimgWriter.get_refresh" ID="ProcimgWriter.get_refresh"></a>
|
</dl><a NAME="ProcimgWriter.get_refresh" ID="ProcimgWriter.get_refresh"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
ProcimgWriter.get_refresh</h3>
|
ProcimgWriter.get_refresh</h3>
|
||||||
@@ -571,18 +526,7 @@ ProcimgWriter.run</h3>
|
|||||||
<b>run</b>(<i></i>)
|
<b>run</b>(<i></i>)
|
||||||
<p>
|
<p>
|
||||||
Startet die automatische Prozessabbildsynchronisierung.
|
Startet die automatische Prozessabbildsynchronisierung.
|
||||||
</p><a NAME="ProcimgWriter.set_maxioerrors" ID="ProcimgWriter.set_maxioerrors"></a>
|
</p><a NAME="ProcimgWriter.set_refresh" ID="ProcimgWriter.set_refresh"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
|
||||||
ProcimgWriter.set_maxioerrors</h3>
|
|
||||||
<b>set_maxioerrors</b>(<i>value</i>)
|
|
||||||
<p>
|
|
||||||
Setzt die Anzahl der maximal erlaubten Fehler.
|
|
||||||
</p><dl>
|
|
||||||
<dt><i>value</i></dt>
|
|
||||||
<dd>
|
|
||||||
Anzahl erlaubte Fehler
|
|
||||||
</dd>
|
|
||||||
</dl><a NAME="ProcimgWriter.set_refresh" ID="ProcimgWriter.set_refresh"></a>
|
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
ProcimgWriter.set_refresh</h3>
|
ProcimgWriter.set_refresh</h3>
|
||||||
<b>set_refresh</b>(<i>value</i>)
|
<b>set_refresh</b>(<i>value</i>)
|
||||||
|
|||||||
@@ -82,15 +82,9 @@ revpimodio2.helper.EventCallback.run?4()
|
|||||||
revpimodio2.helper.EventCallback.stop?4()
|
revpimodio2.helper.EventCallback.stop?4()
|
||||||
revpimodio2.helper.EventCallback?1(func, name, value)
|
revpimodio2.helper.EventCallback?1(func, name, value)
|
||||||
revpimodio2.helper.ProcimgWriter._collect_events?5(value)
|
revpimodio2.helper.ProcimgWriter._collect_events?5(value)
|
||||||
revpimodio2.helper.ProcimgWriter._get_ioerrors?5()
|
|
||||||
revpimodio2.helper.ProcimgWriter._gotioerror?5(e=None)
|
|
||||||
revpimodio2.helper.ProcimgWriter.get_maxioerrors?4()
|
|
||||||
revpimodio2.helper.ProcimgWriter.get_refresh?4()
|
revpimodio2.helper.ProcimgWriter.get_refresh?4()
|
||||||
revpimodio2.helper.ProcimgWriter.ioerrors?7
|
|
||||||
revpimodio2.helper.ProcimgWriter.maxioerrors?7
|
|
||||||
revpimodio2.helper.ProcimgWriter.refresh?7
|
revpimodio2.helper.ProcimgWriter.refresh?7
|
||||||
revpimodio2.helper.ProcimgWriter.run?4()
|
revpimodio2.helper.ProcimgWriter.run?4()
|
||||||
revpimodio2.helper.ProcimgWriter.set_maxioerrors?4(value)
|
|
||||||
revpimodio2.helper.ProcimgWriter.set_refresh?4(value)
|
revpimodio2.helper.ProcimgWriter.set_refresh?4(value)
|
||||||
revpimodio2.helper.ProcimgWriter.stop?4()
|
revpimodio2.helper.ProcimgWriter.stop?4()
|
||||||
revpimodio2.helper.ProcimgWriter?1(parentmodio)
|
revpimodio2.helper.ProcimgWriter?1(parentmodio)
|
||||||
|
|||||||
@@ -348,12 +348,10 @@ class Device(object):
|
|||||||
if not self._modio._imgwriter.is_alive():
|
if not self._modio._imgwriter.is_alive():
|
||||||
|
|
||||||
# Alte Einstellungen speichern
|
# Alte Einstellungen speichern
|
||||||
imgmaxioerrors = self._modio._imgwriter.maxioerrors
|
|
||||||
imgrefresh = self._modio._imgwriter.refresh
|
imgrefresh = self._modio._imgwriter.refresh
|
||||||
|
|
||||||
# ImgWriter mit alten Einstellungen erstellen
|
# ImgWriter mit alten Einstellungen erstellen
|
||||||
self._modio._imgwriter = ProcimgWriter(self._modio)
|
self._modio._imgwriter = ProcimgWriter(self._modio)
|
||||||
self._modio._imgwriter.maxioerrors = imgmaxioerrors
|
|
||||||
self._modio._imgwriter.refresh = imgrefresh
|
self._modio._imgwriter.refresh = imgrefresh
|
||||||
self._modio._imgwriter.start()
|
self._modio._imgwriter.start()
|
||||||
|
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ class ProcimgWriter(Thread):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__ = "__dict_delay", "__eventth", "_eventqth", "__eventwork", \
|
__slots__ = "__dict_delay", "__eventth", "_eventqth", "__eventwork", \
|
||||||
"_adjwait", "_eventq", "_ioerror", "_maxioerrors", "_modio", \
|
"_adjwait", "_eventq", "_modio", \
|
||||||
"_refresh", "_work", "daemon", "lck_refresh", "newdata"
|
"_refresh", "_work", "daemon", "lck_refresh", "newdata"
|
||||||
|
|
||||||
def __init__(self, parentmodio):
|
def __init__(self, parentmodio):
|
||||||
@@ -303,8 +303,6 @@ class ProcimgWriter(Thread):
|
|||||||
self.__eventwork = False
|
self.__eventwork = False
|
||||||
self._adjwait = 0
|
self._adjwait = 0
|
||||||
self._eventq = queue.Queue()
|
self._eventq = queue.Queue()
|
||||||
self._ioerror = 0
|
|
||||||
self._maxioerrors = 0
|
|
||||||
self._modio = parentmodio
|
self._modio = parentmodio
|
||||||
self._refresh = 0.05
|
self._refresh = 0.05
|
||||||
self._work = Event()
|
self._work = Event()
|
||||||
@@ -427,39 +425,6 @@ class ProcimgWriter(Thread):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _get_ioerrors(self):
|
|
||||||
"""Ruft aktuelle Anzahl der Fehler ab.
|
|
||||||
@return Aktuelle Fehleranzahl"""
|
|
||||||
return self._ioerror
|
|
||||||
|
|
||||||
def _gotioerror(self, e=None):
|
|
||||||
"""IOError Verwaltung fuer autorefresh.
|
|
||||||
@param e Exception to log if debug is enabled
|
|
||||||
"""
|
|
||||||
self._ioerror += 1
|
|
||||||
if self._maxioerrors != 0 and self._ioerror >= self._maxioerrors:
|
|
||||||
raise RuntimeError(
|
|
||||||
"reach max io error count {0} on process image".format(
|
|
||||||
self._maxioerrors
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if self._modio._debug:
|
|
||||||
warnings.warn(
|
|
||||||
"count {0} io errors on process image | {1}"
|
|
||||||
"".format(self._ioerror, str(e)),
|
|
||||||
RuntimeWarning
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
warnings.warn(
|
|
||||||
"got io error on process image",
|
|
||||||
RuntimeWarning
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_maxioerrors(self):
|
|
||||||
"""Gibt die Anzahl der maximal erlaubten Fehler zurueck.
|
|
||||||
@return Anzahl erlaubte Fehler"""
|
|
||||||
return self._maxioerrors
|
|
||||||
|
|
||||||
def get_refresh(self):
|
def get_refresh(self):
|
||||||
"""Gibt Zykluszeit zurueck.
|
"""Gibt Zykluszeit zurueck.
|
||||||
@return <class 'int'> Zykluszeit in Millisekunden"""
|
@return <class 'int'> Zykluszeit in Millisekunden"""
|
||||||
@@ -515,7 +480,7 @@ class ProcimgWriter(Thread):
|
|||||||
fh.flush()
|
fh.flush()
|
||||||
|
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
self._gotioerror(e)
|
self._modio._gotioerror("autorefresh", e)
|
||||||
self.lck_refresh.release()
|
self.lck_refresh.release()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -567,17 +532,6 @@ class ProcimgWriter(Thread):
|
|||||||
"""Beendet die automatische Prozessabbildsynchronisierung."""
|
"""Beendet die automatische Prozessabbildsynchronisierung."""
|
||||||
self._work.set()
|
self._work.set()
|
||||||
|
|
||||||
def set_maxioerrors(self, value):
|
|
||||||
"""Setzt die Anzahl der maximal erlaubten Fehler.
|
|
||||||
@param value Anzahl erlaubte Fehler"""
|
|
||||||
if type(value) == int:
|
|
||||||
if value >= 0:
|
|
||||||
self._maxioerrors = value
|
|
||||||
else:
|
|
||||||
raise ValueError("value must be 0 or a positive integer")
|
|
||||||
else:
|
|
||||||
raise TypeError("value must be <class 'int'>")
|
|
||||||
|
|
||||||
def set_refresh(self, value):
|
def set_refresh(self, value):
|
||||||
"""Setzt die Zykluszeit in Millisekunden.
|
"""Setzt die Zykluszeit in Millisekunden.
|
||||||
@param value <class 'int'> Millisekunden"""
|
@param value <class 'int'> Millisekunden"""
|
||||||
@@ -590,6 +544,4 @@ class ProcimgWriter(Thread):
|
|||||||
"refresh time must be 5 to 2000 milliseconds"
|
"refresh time must be 5 to 2000 milliseconds"
|
||||||
)
|
)
|
||||||
|
|
||||||
ioerrors = property(_get_ioerrors)
|
|
||||||
maxioerrors = property(get_maxioerrors, set_maxioerrors)
|
|
||||||
refresh = property(get_refresh, set_refresh)
|
refresh = property(get_refresh, set_refresh)
|
||||||
|
|||||||
@@ -413,10 +413,7 @@ class RevPiModIO(object):
|
|||||||
def _get_ioerrors(self):
|
def _get_ioerrors(self):
|
||||||
"""Getter function.
|
"""Getter function.
|
||||||
@return Aktuelle Anzahl gezaehlter Fehler"""
|
@return Aktuelle Anzahl gezaehlter Fehler"""
|
||||||
if self._looprunning:
|
return self._ioerror
|
||||||
return self._imgwriter._ioerror
|
|
||||||
else:
|
|
||||||
return self._ioerror
|
|
||||||
|
|
||||||
def _get_length(self):
|
def _get_length(self):
|
||||||
"""Getter function.
|
"""Getter function.
|
||||||
@@ -499,7 +496,6 @@ class RevPiModIO(object):
|
|||||||
@param value Anzahl erlaubte Fehler"""
|
@param value Anzahl erlaubte Fehler"""
|
||||||
if type(value) == int and value >= 0:
|
if type(value) == int and value >= 0:
|
||||||
self._maxioerrors = value
|
self._maxioerrors = value
|
||||||
self._imgwriter.maxioerrors = value
|
|
||||||
else:
|
else:
|
||||||
raise ValueError("value must be 0 or a positive integer")
|
raise ValueError("value must be 0 or a positive integer")
|
||||||
|
|
||||||
@@ -981,7 +977,6 @@ class RevPiModIO(object):
|
|||||||
def resetioerrors(self):
|
def resetioerrors(self):
|
||||||
"""Setzt aktuellen IOError-Zaehler auf 0 zurueck."""
|
"""Setzt aktuellen IOError-Zaehler auf 0 zurueck."""
|
||||||
self._ioerror = 0
|
self._ioerror = 0
|
||||||
self._imgwriter._ioerror = 0
|
|
||||||
|
|
||||||
def setdefaultvalues(self, device=None):
|
def setdefaultvalues(self, device=None):
|
||||||
"""Alle Outputbuffer werden auf die piCtory default Werte gesetzt.
|
"""Alle Outputbuffer werden auf die piCtory default Werte gesetzt.
|
||||||
|
|||||||
Reference in New Issue
Block a user