Add library const PROCESS_IMAGE_SIZE should it change some day in future.

This commit is contained in:
2020-07-14 19:35:50 +02:00
parent 110a366e14
commit 85c4babc2a
3 changed files with 6 additions and 4 deletions

View File

@@ -33,6 +33,7 @@ BOTH = 33
INP = 300 INP = 300
OUT = 301 OUT = 301
MEM = 302 MEM = 302
PROCESS_IMAGE_SIZE = 4096
class DeviceNotFoundError(Exception): class DeviceNotFoundError(Exception):

View File

@@ -298,7 +298,7 @@ class Device(object):
if len(dict_io) <= 0: if len(dict_io) <= 0:
return slice(0, 0) return slice(0, 0)
int_min, int_max = 4096, 0 int_min, int_max = PROCESS_IMAGE_SIZE, 0
for key in sorted(dict_io, key=lambda x: int(x)): for key in sorted(dict_io, key=lambda x: int(x)):
# Neuen IO anlegen # Neuen IO anlegen
@@ -1273,4 +1273,4 @@ class Virtual(Gateway):
# Nachträglicher Import # Nachträglicher Import
from .io import IOBase, IntIO, IntIOCounter, IntIOReplaceable, MemIO from .io import IOBase, IntIO, IntIOCounter, IntIOReplaceable, MemIO
from revpimodio2 import INP, OUT, MEM from revpimodio2 import INP, OUT, MEM, PROCESS_IMAGE_SIZE

View File

@@ -4,7 +4,8 @@ import struct
from re import match as rematch from re import match as rematch
from threading import Event from threading import Event
from revpimodio2 import BOTH, FALLING, INP, MEM, OUT, RISING, consttostr from revpimodio2 import BOTH, FALLING, INP, MEM, OUT, RISING, consttostr, \
PROCESS_IMAGE_SIZE
__author__ = "Sven Sager" __author__ = "Sven Sager"
__copyright__ = "Copyright (C) 2018 Sven Sager" __copyright__ = "Copyright (C) 2018 Sven Sager"
@@ -37,7 +38,7 @@ class IOList(object):
def __init__(self): def __init__(self):
"""Init IOList class.""" """Init IOList class."""
self.__dict_iobyte = {k: [] for k in range(4096)} self.__dict_iobyte = {k: [] for k in range(PROCESS_IMAGE_SIZE)}
self.__dict_iorefname = {} self.__dict_iorefname = {}
def __contains__(self, key): def __contains__(self, key):