This repository has been archived on 2021-09-26. You can view files and clone it, but cannot push or open issues or pull requests.
IDG-A32X/Nasal/PitotIcing.nas

35 lines
792 B
Text
Raw Normal View History

2017-06-21 17:21:27 +00:00
######################################################
# Fail the pitot tude due to icing of the pitot tube #
# Code by Jonathan Redpath #
######################################################
var PitotIcingReset = func {
setprop("/systems/pitot/icing", 0.0);
setprop("/systems/pitot/failed", 1);
pitot_timer.start();
}
PitotIcing = func {
var icing = getprop("/systems/pitot/icing");
var failed = getprop("/systems/pitot/failed");
if( icing > 0.03 ) {
if( !failed ) {
setprop("/systems/pitot/failed", 1);
}
2017-06-22 14:12:25 +00:00
} else if( icing < 0.03 ) {
2017-06-21 17:21:27 +00:00
if( failed ) {
setprop("/systems/pitot/failed", 0);
}
}
};
2017-06-21 17:21:27 +00:00
###################
# Update Function #
###################
2017-06-21 17:21:27 +00:00
var update_pitotIcing = func {
PitotIcing();
}
2017-06-21 17:21:27 +00:00
var pitot_timer = maketimer(0.2, update_pitotIcing);