Skip to content

Commit

Permalink
Fortius Antifier v3.9.e #153
Browse files Browse the repository at this point in the history
  • Loading branch information
WOUTER DUBBELDAM committed Dec 9, 2020
1 parent 3db6793 commit 1253bc5
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 27 deletions.
Binary file modified WindowsExecutable/FortiusANT.exe
Binary file not shown.
15 changes: 13 additions & 2 deletions pythoncode/FortiusAntBody.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,7 @@ def Tacx2DongleSub(self, Restart):
# Implemented for Magnetic Brake:
# - grade is NOT shifted with GradeShift (here never negative)
# - but is reduced with factor
# - and is NOT reduced with factorDH since never negative
Grade /= clv.GradeFactor

TacxTrainer.SetGrade(Grade)
Expand Down Expand Up @@ -1000,11 +1001,21 @@ def Tacx2DongleSub(self, Restart):
else:
Grade, RollingResistance = ant.msgUnpage51_TrackResistance(info)

# Implemented for Magnetic Brake:
# - grade is shifted with GradeShift (-10% --> 0)
#-----------------------------------------------
# Implemented when implementing Magnetic Brake:
# [-] grade is shifted with GradeShift (-10% --> 0) ]
# - then reduced with factor (can be re-adjusted with Virtual Gearbox)
# - and reduced with factorDH (for downhill only)
#
# GradeAdjust is valid for all configurations!
#
# GradeShift is not expected to be used anymore,
# and only left from earliest implementations
# to avoid it has to be re-introduced in future again.
#-----------------------------------------------
Grade += clv.GradeShift
Grade /= clv.GradeFactor
if Grade < 0: Grade /= clv.GradeFactorDH

TacxTrainer.SetGrade(Grade)
TacxTrainer.SetRollingResistance(RollingResistance)
Expand Down
52 changes: 37 additions & 15 deletions pythoncode/FortiusAntCommand.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#-------------------------------------------------------------------------------
# Version info
#-------------------------------------------------------------------------------
__version__ = "2020-12-08"
__version__ = "2020-12-09"
# 2020-12-09 GradeAdjust is split into GradeFactor/GradeFactorDH/GradeShift
# 2020-12-08 GradeAdjust is split into GradeShift/GradeFactor
# old code removed
# 2020-12-07 -c -G flags added
Expand Down Expand Up @@ -50,9 +51,10 @@ class CommandLineVariables(object):
calibrate = True
debug = 0
exportTCX = False # introduced 2020-11-11;
GradeAdjust = 0 # introduced 2020-12-07; The numnber of parameters specified
GradeAdjust = 0 # introduced 2020-12-07; The number of parameters specified
GradeFactor = 1 # The factor to be applied
GradeFactorDH = 1 # Extra factor to be applied downhill
GradeShift = 0 # The number of degrees to be added
GradeFactor = 1 # The factor to be applpied
gui = False
hrm = None # introduced 2020-02-09; None=not specified, numeric=HRM device, -1=no HRM
manual = False
Expand Down Expand Up @@ -100,7 +102,7 @@ def __init__(self):
parser.add_argument('-c','--CalibrateRR',help='calibrate Rolling Resistance for Magnetic Brake', required=False, default=False)
parser.add_argument('-d','--debug', help='Show debugging data', required=False, default=False)
parser.add_argument('-g','--gui', help='Run with graphical user interface', required=False, action='store_true')
parser.add_argument('-G','--GradeAdjust',help='Adjust slope%% in GradeMode (shift/factor)', required=False, default=False)
parser.add_argument('-G','--GradeAdjust',help='Adjust slope%% in GradeMode (factor/factorDownhill)',required=False, default=False)
parser.add_argument('-H','--hrm', help='Pair this ANT+ Heart Rate Monitor (0: any, -1: none); Tacx HRM is used if not specified',
required=False, default=False)
parser.add_argument('-m','--manual', help='Run manual power (ignore target from ANT+ Dongle)', required=False, action='store_true')
Expand Down Expand Up @@ -209,29 +211,43 @@ def __init__(self):
s = args.GradeAdjust.split("/")
self.GradeAdjust = len(s)
#-------------------------------------------------------------------
# parameter1: shift percentage (default = 0, allowed = 0...20)
# The target slope is incremented by this number.
# Shift = 10 means: requested slope = -10% --> 0%
# parameter1: factor (default = 1, allowed = 1...5)
# The target slope is divided by this number.
# Factor = 5 means: requested slope = 20% --> 4%
#-------------------------------------------------------------------
if len(s) >= 1:
try:
self.GradeShift = int(s[0])
self.GradeShift = max( 0, self.GradeShift)
self.GradeShift = min(20, self.GradeShift)
self.GradeFactor = int(s[0])
self.GradeFactor = max( 1, self.GradeFactor)
self.GradeFactor = min( 5, self.GradeFactor)
except:
logfile.Console('Command line error; -G incorrect Grade Adjust=%s' % args.GradeAdjust)
self.GradeAdjust = 0

#-------------------------------------------------------------------
# parameter2: factor (default = 1, allowed = 1...10)
# parameter2: factor (default = 1, allowed = 1...5)
# The target slope is divided by this number.
# Factor = 5 means: requested slope = 20% --> 4%
#-------------------------------------------------------------------
if len(s) >= 2:
try:
self.GradeFactor = int(s[1])
self.GradeFactor = max( 1, self.GradeFactor)
self.GradeFactor = min(10, self.GradeFactor)
self.GradeFactorDH = int(s[1])
self.GradeFactorDH = max( 1, self.GradeFactorDH)
self.GradeFactorDH = min( 5, self.GradeFactorDH)
except:
logfile.Console('Command line error; -G incorrect Grade Adjust=%s' % args.GradeAdjust)
self.GradeAdjust = 0

#-------------------------------------------------------------------
# parameter3: shift percentage (default = 0, allowed = 0...20)
# The target slope is incremented by this number.
# Shift = 10 means: requested slope = -10% --> 0%
#-------------------------------------------------------------------
if len(s) >= 3:
try:
self.GradeShift = int(s[2])
self.GradeShift = max( 0, self.GradeShift)
self.GradeShift = min(20, self.GradeShift)
except:
logfile.Console('Command line error; -G incorrect Grade Adjust=%s' % args.GradeAdjust)
self.GradeAdjust = 0
Expand Down Expand Up @@ -295,7 +311,13 @@ def print(self):
if self.PedalStrokeAnalysis:logfile.Console("-A")
if v or self.args.CalibrateRR: logfile.Console("-c %s" % self.CalibrateRR )
if v or self.args.debug: logfile.Console("-d %s (%s)" % (self.debug, bin(self.debug) ) )
if v or self.args.GradeAdjust: logfile.Console("-G %s/%s" % (self.GradeShift, self.GradeFactor ) )
if v or self.args.GradeAdjust:
if self.GradeAdjust == 1: logfile.Console("-G defines Grade = antGrade / %s" \
% (self.GradeFactor ) )
if self.GradeAdjust == 2: logfile.Console("-G defines Grade = antGrade / %s [/ %s (downhill)]" \
% (self.GradeFactor, self.GradeFactorDH) )
if self.GradeAdjust == 3: logfile.Console("-G defines Grade = (antGrade - %s) / %s [/ %s (downhill)]" \
% (self.GradeShift, self.GradeFactor, self.GradeFactorDH) )
if self.gui: logfile.Console("-g")
if v or self.args.hrm: logfile.Console("-H %s" % self.hrm )
if self.manual: logfile.Console("-m")
Expand Down
2 changes: 1 addition & 1 deletion pythoncode/FortiusAntTitle.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#-------------------------------------------------------------------------------
# Version info
#-------------------------------------------------------------------------------
WindowTitle = "Fortius Antifier v3.9.d #153" # Double quotes, see below!
WindowTitle = "Fortius Antifier v3.9.e #153" # Double quotes, see below!
# 2020-11-19 Version 3.8
# 2020-11-18 Version 3.7
# 2020-11-12 Version 3.6
Expand Down
9 changes: 0 additions & 9 deletions pythoncode/usbTrainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1727,15 +1727,6 @@ def __init__(self, clv, Message, Headunit, UsbDevice):
self.SendToTrainer(True, modeStop)
time.sleep(0.1) # Allow head unit time to process
self.Refresh(True, modeStop)
#---------------------------------------------------------------------------
# For MotorBrake, use standard PowerCurve
#
# For Magnetic Brake, adjust operation in GradeMode (by default)
# See FortiusAntCommand for more explanation to avoid duplication.
#---------------------------------------------------------------------------
if not self.MotorBrake:
if self.clv.GradeAdjust < 1: self.clv.GradeShift = 10
if self.clv.GradeAdjust < 2: self.clv.GradeFactor = 5

#---------------------------------------------------------------------------
if debug.on(debug.Function):logfile.Write ("clsTacxNewUsbTrainer.__init__() done")
Expand Down
Binary file modified supportfiles/FortiusANT - Powercurve.xlsm
Binary file not shown.
Binary file modified supportfiles/FortiusANTUserManual.pdf
Binary file not shown.

0 comments on commit 1253bc5

Please sign in to comment.