From f803878691e58c83005a37a07e9e6b8f85bf0467 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 17 May 2021 17:54:56 +0200 Subject: [PATCH] using targetValueHigh and targetValueLow as recommended --- rowers/garmin_stuff.py | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/rowers/garmin_stuff.py b/rowers/garmin_stuff.py index ee4d1e9f..5237f927 100644 --- a/rowers/garmin_stuff.py +++ b/rowers/garmin_stuff.py @@ -267,32 +267,38 @@ def step_to_garmin(step,order=0): targetValue = None try: targetValueLow = step['dict']['targetValueLow'] - if targetValueLow == 0: # pragma: no cover + if targetValueLow == 0 and targetValue is not None and targetValue > 0: + targetValueLow = targetValue + targetValue = None + elif targetValueLow == 0: # pragma: no cover targetValueLow = None except KeyError: targetValueLow = None try: targetValueHigh = step['dict']['targetValueHigh'] - if targetValueHigh == 0: # pragma: no cover + if targetValue is not None and targetValue > 0 and targetValueHigh == 0: + targetValueHigh = targetValue + targetValue = 0 + elif targetValueHigh == 0: # pragma: no cover targetValueHigh = None except KeyError: targetValueHigh = None if targetType is not None and targetType.lower() == "power": targetType = 'POWER' - if targetValue is not None and targetValue > 1000: - targetValue -= 1000 - if targetValueHigh is not None and targetValueHigh > 1000: # pragma: no cover - targetValueHigh -= 1000 - if targetValueLow is not None and targetValueLow > 1000: # pragma: no cover - targetValueLow -= 1000 + #if targetValue is not None and targetValue > 1000: + # targetValue -= 1000 + #if targetValueHigh is not None and targetValueHigh > 1000: # pragma: no cover + # targetValueHigh -= 1000 + #if targetValueLow is not None and targetValueLow > 1000: # pragma: no cover + # targetValueLow -= 1000 # temp - throw away target other than power - if targetType is not None and targetType.lower() != 'power': - targetType = None - targetValue = None - targetValueLow = None - targetValueHigh = None + #if targetType is not None and targetType.lower() != 'power': + # targetType = None + # targetValue = None + # targetValueLow = None + # targetValueHigh = None if targetValue is None and targetValueLow is None and targetValueHigh is None: targetType = None