Allow driving when simulated and add generated comments

This commit is contained in:
Douglas Clowes
2014-09-29 15:44:53 +10:00
parent 713e88d236
commit f86dc33081

View File

@ -1229,7 +1229,12 @@ def put_checkstatus_function(MyDriver, func):
txt += ['# %s hook code goes here' % func]
txt += [' if {[sct driving]} {']
txt += [' set sp "[sct target]"']
txt += [' set pv "[hval ${tc_root}/[sct driveable]]"']
txt += [' if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {']
txt += [' set pv "${sp}"']
txt += [' hset ${tc_root}/[sct driveable] ${sp}']
txt += [' }']
txt += [' set pv "[hval ${tc_root}/[sct driveable]]"']
txt += [' }']
txt += [' if { abs(${pv} - ${sp}) <= [sct tolerance] } {']
txt += [' if { [hpropexists [sct] settle_time] } {']
txt += [' if { [hpropexists [sct] settle_time_start] } {']
@ -1312,7 +1317,7 @@ def put_pid_function(MyDriver, func):
def put_var(MyDriver, MyGroup, MyVar):
readable_or_writeable = False
txt = ['']
txt = [' # Start of var: ' + MyVar['name']]
postfix = []
if MyGroup['name']:
nodename = MyGroup['path'] + '/' + MyVar['name']
@ -1443,8 +1448,10 @@ def put_var(MyDriver, MyGroup, MyVar):
# Generate <dev>_<group...>_<name> at runtime for driveable
driveable = '${name}_' + make_path(MyVar)
postfix += [' ansto_makesctdrive %s ${scobj_hpath}/%s ${scobj_hpath}/%s ${sct_controller}' % (driveable, nodename, MyVar['driveable'])]
txt += [' hsetprop ${scobj_hpath}/%s simulated false']
txt += [' } else {']
txt += [' %s::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for %s"' % (MyDriver['namespace'], MyDriver['name'])]
txt += [' hsetprop ${scobj_hpath}/%s simulated true']
txt += [' }']
if 'conditional' in MyVar:
@ -1467,9 +1474,10 @@ def put_group(MyDriver, MyGroup):
dfr = []
if MyGroup['name']:
txt += ['']
txt += [' # Start of named group: ' + MyGroup['path']]
txt += [' hfactory ${scobj_hpath}/%s plain spy none' % MyGroup['path']]
else:
pass
txt += [' # Start of unnamed group']
for var in sorted(MyGroup['Vars']):
txt += ['']
@ -1482,11 +1490,13 @@ def put_group(MyDriver, MyGroup):
if 'GroupProperty' in MyGroup:
for key in sorted(MyGroup['GroupProperty']):
txt += [' hsetprop ${scobj_hpath}/%s %s "%s"' % (MyGroup['path'], key, MyGroup['GroupProperty'][key])]
txt += [' # End of named group: ' + MyGroup['path']]
else:
if 'GroupProperty' in MyGroup:
txt += ['']
for key in sorted(MyGroup['GroupProperty']):
txt += [' hsetprop ${scobj_hpath} %s "%s"' % (key, MyGroup['GroupProperty'][key])]
txt += [' # End of unnamed group']
for grp in sorted(MyGroup['Groups']):
txt += put_group(MyDriver, MyGroup['Groups'][grp])