- drop redundant aircraft namespace
- use getprop() instead of props.Node.getValue() here because it's faster
This commit is contained in:
parent
d6ff854aa5
commit
96a8a9657f
1 changed files with 3 additions and 5 deletions
|
@ -285,7 +285,6 @@ var light = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# lowpass
|
# lowpass
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# class that implements a variable-interval EWMA (Exponentially Weighted
|
# class that implements a variable-interval EWMA (Exponentially Weighted
|
||||||
|
@ -303,7 +302,6 @@ var light = {
|
||||||
var lowpass = {
|
var lowpass = {
|
||||||
new : func(coeff) {
|
new : func(coeff) {
|
||||||
var m = { parents : [lowpass] };
|
var m = { parents : [lowpass] };
|
||||||
m.dtN = props.globals.getNode("/sim/time/delta-realtime-sec", 1);
|
|
||||||
m.coeff = coeff >= 0 ? coeff : die("aircraft.lowpass(): coefficient must be >= 0");
|
m.coeff = coeff >= 0 ? coeff : die("aircraft.lowpass(): coefficient must be >= 0");
|
||||||
m.value = nil;
|
m.value = nil;
|
||||||
return m;
|
return m;
|
||||||
|
@ -322,7 +320,7 @@ var lowpass = {
|
||||||
me.value = v;
|
me.value = v;
|
||||||
},
|
},
|
||||||
_filter_ : func(v) {
|
_filter_ : func(v) {
|
||||||
var dt = me.dtN.getValue();
|
var dt = getprop("/sim/time/delta-realtime-sec");
|
||||||
var c = dt / (me.coeff + dt);
|
var c = dt / (me.coeff + dt);
|
||||||
me.value = v * c + me.value * (1 - c);
|
me.value = v * c + me.value * (1 - c);
|
||||||
},
|
},
|
||||||
|
@ -337,8 +335,8 @@ var lowpass = {
|
||||||
var angular_lowpass = {
|
var angular_lowpass = {
|
||||||
new : func(coeff) {
|
new : func(coeff) {
|
||||||
var m = { parents : [angular_lowpass] };
|
var m = { parents : [angular_lowpass] };
|
||||||
m.sin = aircraft.lowpass.new(coeff);
|
m.sin = lowpass.new(coeff);
|
||||||
m.cos = aircraft.lowpass.new(coeff);
|
m.cos = lowpass.new(coeff);
|
||||||
return m;
|
return m;
|
||||||
},
|
},
|
||||||
filter : func(v) {
|
filter : func(v) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue