Skip to content

Commit

Permalink
manual for #366 and problem solved for #373
Browse files Browse the repository at this point in the history
  • Loading branch information
WouterJD committed Apr 11, 2022
1 parent 66165bd commit 7bbd309
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 15 deletions.
11 changes: 7 additions & 4 deletions StartUp Json/FortiusAntSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
"device ID": ""
},
"bluetooth": {
"enable": false
"bless": true,
"nodejs": false
},
"general": {
"autostart": true,
"debug": "",
"export TCX-file": false,
"gui": false,
"hrm": ""
"gui": true,
"home trainer": false,
"hrm": "",
"imperial": false
},
"simulation": {
"manual grade": false,
Expand All @@ -21,7 +24,7 @@
"trainer": {
"auto calibrate": true,
"calibrate rolling resistance": "",
"factor": "100",
"factor": "20",
"grade factor": "100",
"grade factor downhill": "100",
"pedal stroke analysis": true,
Expand Down
10 changes: 6 additions & 4 deletions StartUp/help.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
usage: FortiusAnt.py [-h] [-a] [-A] [-b] [-B 0...65535] [-c 0...100]
[-d 0...255] [-D USB-DeviceID] [-e] [-g] [-G % / % / %]
usage: FortiusAnt.py [-h] [-a] [-A] [-b] [-bb] [-B 0...65535] [-c 0...100]
[-d 0...65535] [-D USB-DeviceID] [-e] [-g] [-G % / % / %]
[-H ANT+DeviceID] [-i] [-l] [-m] [-M] [-n] [-p %] [-P]
[-r] [-R see text] [-s] [-T see text]
[-t {Bushido,Genius,Vortex,Magneticbrake,Motorbrake,i-Vortex}]
Expand All @@ -14,11 +14,13 @@ optional arguments:
required devices were found.
-A Pedal Stroke Analysis.
-b Advertise FortiusAnt as �FortiusAnt Trainer� on a
Bluetooth Low Energy dongle.
Bluetooth Low Energy dongle, using nodejs.
-bb Advertise FortiusAnt as �FortiusAnt Trainer� on a
Bluetooth Low Energy dongle, using bless.
-B 0...65535 ANT DeviceNumber range Base, making multiple
FortiusAnt sessions unique.
-c 0...100 Calibrate the rolling resistance for magnetic brake.
-d 0...255 Create logfile with debugging data.
-d 0...65535 Create logfile with debugging data.
-D USB-DeviceID Select one specific antDongle (perhaps with a non-
standard deviceID).
-e Operate as homeTrainer (excersize bike); up/down
Expand Down
Binary file modified doc/FortiusANTUserManual.pdf
Binary file not shown.
53 changes: 46 additions & 7 deletions pythoncode/settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#-------------------------------------------------------------------------------
# Version info
#-------------------------------------------------------------------------------
__version__ = "2021-04-13"
__version__ = "2022-04-11"
# 2022-04-11 issue #373 solved; value = '' must be changed to None
# issue #366 bless flag added
# 2021-04-13 added: -i, leds renamed into StatusLeds
# 2021-03-02 added: -l Raspberry status Leds
# 2021-02-11 added: -e homeTrainer
Expand Down Expand Up @@ -58,7 +60,9 @@
json_simulate = 'simulate'

json_Bluetooth = 'bluetooth'
json_ble = 'enable'
json_ble = 'enable' # initial implementation with node.js only, for compatibility
json_nodejs = 'nodejs'
json_bless = 'bless'

json_Ant = 'ant'
json_antDeviceID = 'device ID'
Expand Down Expand Up @@ -144,22 +148,39 @@ def ReadJsonFile (args):
else:
# ------------------------------------------------------------------
# Handle content AND check for unknown/incorrectly spelled params.
#
# p = group of parameters (general, ant, ...)
# q = the parameters in the group
# r = sub-parameters, if applicable
#
# w = data[p] = all parameters and their values in the group
# w[q] = the value of parameter q in group p
# and could have been written as data[p][q]
# ------------------------------------------------------------------
ActualVersion = -1
G = 0
R = 0

for p in data:
w = data[p]
if p == json_Ant:
w = data[p] # shorthand for data[p]

if type(w) == type({}): # Issue #373
for q in w:
if w[q] == '': # If no value defined in json
w[q] = None # then None is expected by FortiusAndCommand.py

if p == json_Ant:
for q in data[json_Ant]:
if q == json_antDeviceID: args.antDeviceID = w[q]
#'CtrlCommand': args.CtrlCommand
#'scs': args.scs = p[q]
else: logfile.Console ('Json file contains unknown parameter %s %s' % (p, q))

elif p == json_Bluetooth:
for q in data[json_Bluetooth]:
if q == json_ble: args.ble = w[q]
if q == json_ble: args.ble = w[q] # For compatibility
elif q == json_nodejs: args.ble = w[q]
elif q == json_bless: args.bless = w[q]
else: logfile.Console ('Json file contains unknown parameter %s %s' % (p, q))

elif p == json_General:
Expand Down Expand Up @@ -356,7 +377,9 @@ def WriteJsonFile (DialogWindow):
}

data[json_Bluetooth] = {
json_ble: DialogWindow.cb_b .GetValue(),
#json_ble is not written anymore since #366
json_nodejs: DialogWindow.cb_b .GetValue(),
json_bless: DialogWindow.cb_bb .GetValue(),
}

data[json_Ant] = {
Expand Down Expand Up @@ -559,9 +582,15 @@ def __init__(self, parent):
self.cb_b = wx.CheckBox(panel, id=wx.ID_ANY, label=l, pos=p, size=s, style=0, validator=wx.DefaultValidator, name=wx.CheckBoxNameStr)
self.cb_b.Bind(wx.EVT_CHECKBOX, self.EVT_CHECKBOX_cb_b)

l = constants.help_g + " (-g *)"
l = constants.help_bb + " (-bb *)"
s = (-1, -1)
p = Under(self.cb_b)
self.cb_bb = wx.CheckBox(panel, id=wx.ID_ANY, label=l, pos=p, size=s, style=0, validator=wx.DefaultValidator, name=wx.CheckBoxNameStr)
self.cb_bb.Bind(wx.EVT_CHECKBOX, self.EVT_CHECKBOX_cb_bb)

l = constants.help_g + " (-g *)"
s = (-1, -1)
p = Under(self.cb_bb)
self.cb_g = wx.CheckBox(panel, id=wx.ID_ANY, label=l, pos=p, size=s, style=0, validator=wx.DefaultValidator, name=wx.CheckBoxNameStr)
self.cb_g.Bind(wx.EVT_CHECKBOX, self.EVT_CHECKBOX_cb_g)

Expand Down Expand Up @@ -901,6 +930,7 @@ def __init__(self, parent):
self.cb_a .SetValue(clv.autostart)
self.cb_A .SetValue(clv.PedalStrokeAnalysis)
self.cb_b .SetValue(clv.ble)
self.cb_bb .SetValue(clv.bless)
self.txt_d .SetValue(str(clv.debug))
self.EVT_KILL_FOCUS_txt_d()
self.cb_g .SetValue(clv.gui)
Expand Down Expand Up @@ -949,6 +979,14 @@ def EVT_CHECKBOX_cb_A (self, event):
# --------------------------------------------------------------------------
def EVT_CHECKBOX_cb_b (self, event):
self.cb_restart.SetValue(True)
if self.cb_b.GetValue(): self.cb_bb.SetValue(False)

# --------------------------------------------------------------------------
# Checkbox -bb
# --------------------------------------------------------------------------
def EVT_CHECKBOX_cb_bb (self, event):
self.cb_restart.SetValue(True)
if self.cb_bb.GetValue(): self.cb_b.SetValue(False)

# --------------------------------------------------------------------------
# Checkbox -d
Expand Down Expand Up @@ -1136,6 +1174,7 @@ def EVT_BUTTON_btnOK (self, event):
clv.autostart = self.cb_a.GetValue()
clv.PedalStrokeAnalysis = self.cb_A.GetValue()
clv.ble = self.cb_b.GetValue()
clv.bless = self.cb_bb.GetValue()
clv.gui = self.cb_g.GetValue()

if self.txt_d.GetValue() == '':
Expand Down

0 comments on commit 7bbd309

Please sign in to comment.