Skip to content

Commit

Permalink
Brought back the size argument to update_history_size function. Name …
Browse files Browse the repository at this point in the history
…the device history_size 'default_history_size' becuase this is what it is and technically, it's possible to define different history size for different points.
  • Loading branch information
ChristianTremblay committed Oct 18, 2020
1 parent a69a27a commit 9445607
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions BAC0/core/devices/Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __init__(
self.properties.multistates = {}
self.properties.auto_save = auto_save
self.properties.clear_history_on_save = clear_history_on_save
self.properties.history_size = history_size
self.properties.default_history_size = history_size

self.segmentation_supported = segmentation_supported
self.custom_object_list = object_list
Expand Down Expand Up @@ -315,9 +315,9 @@ def clear_histories(self):
for point in self.points:
point.clear_history()

def update_history_size(self):
def update_history_size(self, size=None):
for point in self.points:
point.properties.history_size = self.properties.history_size
point.properties.history_size = size

@property
def analog_units(self):
Expand Down Expand Up @@ -529,9 +529,8 @@ def _buildPointList(self):
)
if self.properties.pollDelay > 0:
self.poll(delay=self.properties.pollDelay)
if self.properties.history_size is not None:
self.update_history_size()
self.clear_histories()
self.update_history_size(size=self.properties.default_history_size)
#self.clear_histories()
except NoResponseFromController as error:
self._log.error("Cannot retrieve object list, disconnecting...")
self.segmentation_supported = False
Expand Down

0 comments on commit 9445607

Please sign in to comment.