Clean up Nagelfar warnings in generated drivers

This commit is contained in:
Douglas Clowes
2014-07-04 16:27:44 +10:00
parent a9e4c80a87
commit 35067c3673

View File

@@ -971,7 +971,7 @@ def put_read_function(MyDriver, func):
txt += [' sct oldval ${data}']
txt += [' sct update ${data}']
txt += [' sct utime readtime']
txt += [' }']
txt += [' }']
txt += [' return ${nextState}']
txt += [' } catch_message ]']
txt += [' handle_exception ${catch_status} ${catch_message}']
@@ -1115,19 +1115,19 @@ def put_pid_function(MyDriver, func):
txt += ['proc %s::%s {tc_root sp pv} {' % (MyDriver['namespace'], func)]
txt += [' set catch_status [ catch {']
txt += [' debug_log ${tc_root} 1 "%s tc_root=${tc_root} sct=[sct] pv=${pv} sp=${sp}"' % func]
txt += [' sct pid_error [expr ${sp} - ${pv}]']
txt += [' set p_value [expr [sct pid_pvalue] * [sct pid_error]]']
txt += [' set d_value [expr [sct pid_dvalue] * (${pv} - [sct oldval])]']
txt += [' sct pid_error [expr {${sp} - ${pv}}]']
txt += [' set p_value [expr {[sct pid_pvalue] * [sct pid_error]}]']
txt += [' set d_value [expr {[sct pid_dvalue] * (${pv} - [sct oldval])}]']
txt += [' sct pid_deriv [sct pid_error]']
txt += [' sct pid_integ [expr [sct pid_integ] + [sct pid_error]]']
txt += [' sct pid_integ [expr {[sct pid_integ] + [sct pid_error]}]']
txt += [' if { [sct pid_integ] > [sct pid_imax] } {']
txt += [' sct pid_integ [sct pid_imax]']
txt += [' }']
txt += [' if { [sct pid_integ] < -[sct pid_imax] } {']
txt += [' sct pid_integ -[sct pid_imax]']
txt += [' }']
txt += [' set i_value [expr [sct pid_ivalue] * [sct pid_integ]]']
txt += [' set pid [expr ${p_value} + ${i_value} + ${d_value}]']
txt += [' set i_value [expr {[sct pid_ivalue] * [sct pid_integ]}]']
txt += [' set pid [expr {${p_value} + ${i_value} + ${d_value}}]']
if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0:
txt += ['# %s hook code starts' % func]
txt += MyDriver['Funcs'][func]['text']