diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas index 0666cf96..40231d6a 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-hyd.nas @@ -165,63 +165,63 @@ var canvas_lowerECAMPageHyd = obj["Pump-Yellow-label"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashValue("hydBlueResvLoPrs", nil, func(val) { + props.UpdateManager.FromHashValue("hydBlueResvLoPrs", 1, func(val) { if (val) { obj["LO-AIR-PRESS-Blue"].show(); } else { obj["LO-AIR-PRESS-Blue"].hide(); } }), - props.UpdateManager.FromHashValue("hydGreenResvLoPrs", nil, func(val) { + props.UpdateManager.FromHashValue("hydGreenResvLoPrs", 1, func(val) { if (val) { obj["LO-AIR-PRESS-Green"].show(); } else { obj["LO-AIR-PRESS-Green"].hide(); } }), - props.UpdateManager.FromHashValue("hydYellowResvLoPrs", nil, func(val) { + props.UpdateManager.FromHashValue("hydYellowResvLoPrs", 1, func(val) { if (val) { obj["LO-AIR-PRESS-Yellow"].show(); } else { obj["LO-AIR-PRESS-Yellow"].hide(); } }), - props.UpdateManager.FromHashValue("hydYellowElecPumpOvht", nil, func(val) { + props.UpdateManager.FromHashValue("hydYellowElecPumpOvht", 1, func(val) { if (val) { obj["ELEC-OVHT-Yellow"].show(); } else { obj["ELEC-OVHT-Yellow"].hide(); } }), - props.UpdateManager.FromHashValue("hydBlueElecPumpOvht", nil, func(val) { + props.UpdateManager.FromHashValue("hydBlueElecPumpOvht", 1, func(val) { if (val) { obj["ELEC-OVHT-Blue"].show(); } else { obj["ELEC-OVHT-Blue"].hide(); } }), - props.UpdateManager.FromHashValue("hydBlueResvOvht", nil, func(val) { + props.UpdateManager.FromHashValue("hydBlueResvOvht", 1, func(val) { if (val) { obj["OVHT-Blue"].show(); } else { obj["OVHT-Blue"].hide(); } }), - props.UpdateManager.FromHashValue("hydGreenResvOvht", nil, func(val) { + props.UpdateManager.FromHashValue("hydGreenResvOvht", 1, func(val) { if (val) { obj["OVHT-Green"].show(); } else { obj["OVHT-Green"].hide(); } }), - props.UpdateManager.FromHashValue("hydYellowResvOvht", nil, func(val) { + props.UpdateManager.FromHashValue("hydYellowResvOvht", 1, func(val) { if (val) { obj["OVHT-Yellow"].show(); } else { obj["OVHT-Yellow"].hide(); } }), - props.UpdateManager.FromHashValue("hydRATPosition", nil, func(val) { + props.UpdateManager.FromHashValue("hydRATPosition", 1, func(val) { if (val) { obj["RAT-stowed"].hide(); obj["RAT-not-stowed"].show(); @@ -230,8 +230,8 @@ var canvas_lowerECAMPageHyd = obj["RAT-not-stowed"].hide(); } }), - props.UpdateManager.FromHashValue("hydGreenFireValve", nil, func(val) { - if (val != 0) { + props.UpdateManager.FromHashValue("hydGreenFireValve", 0.1, func(val) { + if (val >= 0.1) { obj["Fire-Valve-Green"].setColor(0.7333,0.3803,0); obj["Fire-Valve-Green-Cross"].setColorFill(0.7333,0.3803,0); obj["Fire-Valve-Green"].setRotation(90 * D2R); @@ -241,8 +241,8 @@ var canvas_lowerECAMPageHyd = obj["Fire-Valve-Green"].setRotation(0); } }), - props.UpdateManager.FromHashValue("hydYellowFireValve", nil, func(val) { - if (val != 0) { + props.UpdateManager.FromHashValue("hydYellowFireValve", 0.1, func(val) { + if (val >= 0.1) { obj["Fire-Valve-Yellow"].setColor(0.7333,0.3803,0); obj["Fire-Valve-Yellow-Cross"].setColorFill(0.7333,0.3803,0); obj["Fire-Valve-Yellow"].setRotation(90 * D2R); @@ -266,7 +266,7 @@ var canvas_lowerECAMPageHyd = obj["ELEC-Yellow-label"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["yellow","hydYellowElecPumpSwitch"], nil, func(val) { + props.UpdateManager.FromHashList(["yellow","hydYellowElecPumpSwitch"], 1, func(val) { if (!val.hydYellowElecPumpSwitch) { obj["ELEC-Yellow-on"].hide(); obj["ELEC-Yellow-off"].show(); @@ -280,7 +280,7 @@ var canvas_lowerECAMPageHyd = } } }), - props.UpdateManager.FromHashList(["blue","hydBlueElecPumpSwitch"], nil, func(val) { + props.UpdateManager.FromHashList(["blue","hydBlueElecPumpSwitch"], 1, func(val) { if (val.hydBlueElecPumpSwitch) { obj["Pump-Blue-off"].hide(); if (val.blue > 1450) { @@ -302,7 +302,7 @@ var canvas_lowerECAMPageHyd = obj["Pump-Blue"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["yellow","hydYellowEDPPumpSwitch"], nil, func(val) { + props.UpdateManager.FromHashList(["yellow","hydYellowEDPPumpSwitch"], 1, func(val) { if (val.hydYellowEDPPumpSwitch) { obj["Pump-Yellow-off"].hide(); if (val.yellow > 1450) { @@ -324,7 +324,7 @@ var canvas_lowerECAMPageHyd = obj["Pump-Yellow"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["green","hydGreenEDPPumpSwitch"], nil, func(val) { + props.UpdateManager.FromHashList(["green","hydGreenEDPPumpSwitch"], 1, func(val) { if (val.hydGreenEDPPumpSwitch) { obj["Pump-Green-off"].hide(); if (val.green > 1450) { @@ -345,7 +345,7 @@ var canvas_lowerECAMPageHyd = obj["Pump-Green"].setColor(0.7333,0.3803,0); } }), - props.UpdateManager.FromHashList(["hydPTUSwitch","hydPTUDiff","hydPTUActive","hydPTUFault"], nil, func(val) { + props.UpdateManager.FromHashList(["hydPTUSwitch","hydPTUDiff","hydPTUActive","hydPTUFault"], 1, func(val) { if (val.hydPTUSwitch and !val.hydPTUFault) { obj["PTU-connection"].setColor(0.0509,0.7529,0.2941); diff --git a/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas b/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas index de038111..61000629 100644 --- a/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas +++ b/Models/Instruments/Lower-ECAM/Lower-ECAM-press.nas @@ -27,13 +27,7 @@ var canvas_lowerECAMPagePress = obj.update_items = [ props.UpdateManager.FromHashValue("pressDelta", 0.05, func(val) { - if (val > 31.9) { - obj["PRESS-deltaP"].setText(sprintf("%2.1f", 31.9)); - } else if (val < -9.9) { - obj["PRESS-deltaP"].setText(sprintf("%2.1f", -9.9)); - } else { - obj["PRESS-deltaP"].setText(sprintf("%2.1f", val)); - } + obj["PRESS-deltaP"].setText(sprintf("%2.1f", math.clamp(val, -9.9, 31.9))); if (val < -0.4 or val > 8.5) { obj["PRESS-deltaP"].setColor(0.7333,0.3803,0); @@ -42,13 +36,7 @@ var canvas_lowerECAMPagePress = } }), props.UpdateManager.FromHashValue("pressVS", 25, func(val) { - if (val > 9950) { - obj["PRESS-Cab-VS"].setText(sprintf("%4.0f", 9950)); - } else if (val < -9950) { - obj["PRESS-Cab-VS"].setText(sprintf("%4.0f", -9950)); - } else { - obj["PRESS-Cab-VS"].setText(sprintf("%-4.0f", math.round(val,50))); - } + obj["PRESS-Cab-VS"].setText(sprintf("%-4.0f", math.clamp(math.round(val,50), -9950, 9950))); if (abs(val) > 2000) { obj["PRESS-Cab-VS"].setColor(0.7333,0.3803,0); @@ -57,13 +45,7 @@ var canvas_lowerECAMPagePress = } }), props.UpdateManager.FromHashValue("pressAlt", 25, func(val) { - if (val > 32750) { - obj["PRESS-Cab-Alt"].setText(sprintf("%5.0f", 32750)); - } else if (val < -9950) { - obj["PRESS-Cab-Alt"].setText(sprintf("%5.0f", -9950)); - } else { - obj["PRESS-Cab-Alt"].setText(sprintf("%5.0f", math.round(val,50))); - } + obj["PRESS-Cab-Alt"].setText(sprintf("%5.0f", math.clamp(math.round(val,50), -9950, 32750))); if (val > 9550) { obj["PRESS-Cab-Alt"].setColor(1,0,0); @@ -80,8 +62,8 @@ var canvas_lowerECAMPagePress = obj["PRESS-Sys-1"].hide(); } }), - props.UpdateManager.FromHashList(["flowCtlValve1","engine1State"], nil, func(val) { - if (val.flowCtlValve1 == 0 and val.engine1State == 3) { + props.UpdateManager.FromHashList(["flowCtlValve1","engine1State"], 0.1, func(val) { + if (val.flowCtlValve1 <= 0.1 and val.engine1State == 3) { obj["PRESS-Pack-1-Triangle"].setColor(0.7333,0.3803,0); obj["PRESS-Pack-1"].setColor(0.7333,0.3803,0); } else { @@ -89,8 +71,8 @@ var canvas_lowerECAMPagePress = obj["PRESS-Pack-1"].setColor(0.8078,0.8039,0.8078); } }), - props.UpdateManager.FromHashList(["flowCtlValve2","engine2State"], nil, func(val) { - if (val.flowCtlValve2 == 0 and val.engine2State == 3) { + props.UpdateManager.FromHashList(["flowCtlValve2","engine2State"], 0.1, func(val) { + if (val.flowCtlValve2 <= 0.1 and val.engine2State == 3) { obj["PRESS-Pack-2-Triangle"].setColor(0.7333,0.3803,0); obj["PRESS-Pack-2"].setColor(0.7333,0.3803,0); } else {