From 51715e4221f9dbabc891850c38daf56982fa0745 Mon Sep 17 00:00:00 2001 From: Jesse Kleemann Date: Thu, 24 Oct 2024 19:23:28 +0200 Subject: [PATCH] start current with 0 --- .github/workflows/docker-publish.yml | 8 ++++---- battery_system.py | 2 +- measurement.py | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 0a41601..f427350 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -6,12 +6,12 @@ name: Docker # documentation. on: - schedule: - - cron: '35 20 * * *' +# schedule: +# - cron: '35 20 * * *' push: branches: [ "master" ] # Publish semver tags as releases. - tags: [ 'v*.*.*' ] + tags: [ '*.*.*' ] pull_request: branches: [ "master" ] @@ -76,7 +76,7 @@ jobs: uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 with: context: . - platforms: linux/amd64,linux/arm64,linux/arm/v7 + platforms: linux/amd64,linux/arm64/v8,linux/arm/v7 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/battery_system.py b/battery_system.py index e202f36..e1def24 100644 --- a/battery_system.py +++ b/battery_system.py @@ -42,7 +42,7 @@ def __init__(self, number_of_modules: int, number_of_serial_cells: int) -> None: self.voltage_limits.warning_upper = cells_total * BatteryCell.UPPER_VOLTAGE_LIMIT_WARNING self.voltage: Measurement = Measurement(self, self.voltage_limits) - self.current: Measurement = Measurement(self, self.current_limits) + self.current: Measurement = Measurement(self, self.current_limits, 0) self.battery_modules: List[BatteryModule] = [] for module_id in range(0, number_of_modules): diff --git a/measurement.py b/measurement.py index 936e272..bc2f110 100644 --- a/measurement.py +++ b/measurement.py @@ -9,17 +9,18 @@ class MeasurementEvent(Events): class MeasurementLimits: def __init__(self): - self.warning_upper: float or None = None - self.warning_lower: float or None = None - self.critical_upper: float or None = None - self.critical_lower: float or None = None - self.implausible_upper: float or None = None - self.implausible_lower: float or None = None + self.warning_upper: float | None = None + self.warning_lower: float | None = None + self.critical_upper: float | None = None + self.critical_lower: float | None = None + self.implausible_upper: float | None = None + self.implausible_lower: float | None = None + class Measurement: - def __init__(self, owner, limits: MeasurementLimits): - self.value: float or None = None - self.timestamp: float or None = None + def __init__(self, owner, limits: MeasurementLimits, start_value: float | None = None): + self.value: float | None = start_value + self.timestamp: float | None = None self.init = False self.owner = owner self.limits = limits @@ -66,4 +67,3 @@ def initialized(self) -> bool: def age_seconds(self) -> float: return time.time() - self.timestamp -