Skip to content

Commit

Permalink
issue #361 iPower not integer in simulation mode
Browse files Browse the repository at this point in the history
  • Loading branch information
WouterJD committed Jan 13, 2022
1 parent 4e5c0c0 commit d3a732f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pythoncode/usbTrainer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#-------------------------------------------------------------------------------
# Version info
#-------------------------------------------------------------------------------
__version__ = "2021-11-15"
__version__ = "2022-01-13"
# 2022-01-13 clsSimulatedTrainer.Refresh() must correct data type of variables
# otherwise CurrentPower = iPower is not integer.
# 2021-11-15 "Steering axis = " commented code added for investigation
# 2021-05-18 TargetResistanceFT used in logfile (instead of TargetResistance)
# 2021-04-29 Short message warning message comment added for Raspberry
Expand Down Expand Up @@ -666,7 +668,7 @@ def Refresh(self, QuarterSecond, TacxMode):
self.CurrentPower /= self.clv.PowerFactor # Was just received

# ----------------------------------------------------------------------
# Round after all these calculations
# Round after all these calculations (and correct data type!)
# ----------------------------------------------------------------------
self.TargetPower = int(self.TargetPower)
self.TargetResistance = int(self.TargetResistance)
Expand Down Expand Up @@ -1048,6 +1050,16 @@ def Refresh (self, _QuarterSecond=None, _TacxMode=None):

self.VirtualSpeedKmh= self.SpeedKmh

# ----------------------------------------------------------------------
# Round after all these calculations (and correct data type!)
# ----------------------------------------------------------------------
self.TargetPower = int(self.TargetPower)
self.TargetResistance = int(self.TargetResistance)
self.CurrentResistance = int(self.CurrentResistance)
self.CurrentPower = int(self.CurrentPower)
self.SpeedKmh = round(self.SpeedKmh,1)
self.VirtualSpeedKmh = round(self.VirtualSpeedKmh,1)

#-------------------------------------------------------------------------------
# c l s T a c x A n t V o r t e x T r a i n e r
#-------------------------------------------------------------------------------
Expand Down

0 comments on commit d3a732f

Please sign in to comment.