Experimental battery voltage canvas
This commit is contained in:
parent
f4c41ca18c
commit
bc179e508f
5 changed files with 136 additions and 167 deletions
|
@ -4934,6 +4934,9 @@
|
|||
<file>Aircraft/A320-family/Models/Instruments/Lower-ECAM/Lower-ECAM-wheel.nas</file>
|
||||
<file>Aircraft/A320-family/Models/Instruments/Lower-ECAM/Lower-ECAM.nas</file>
|
||||
</canvas_ecam>
|
||||
<canvas_battery>
|
||||
<file>Aircraft/A320-family/Models/Instruments/BatteryVoltage/BatteryVoltage.nas</file>
|
||||
</canvas_battery>
|
||||
<canvas_iesi>
|
||||
<file>Aircraft/A320-family/Models/Instruments/IESI/IESI.nas</file>
|
||||
</canvas_iesi>
|
||||
|
|
|
@ -836,7 +836,8 @@
|
|||
<!-- Overhead panel battery voltmeter -->
|
||||
<animation>
|
||||
<type>material</type>
|
||||
<object-name>batt_voltage.canvas</object-name>
|
||||
<object-name>batt_voltage.canvas.L</object-name>
|
||||
<object-name>batt_voltage.canvas.R</object-name>
|
||||
<emission>
|
||||
<red>1</red>
|
||||
<green>1</green>
|
||||
|
@ -845,122 +846,6 @@
|
|||
</emission>
|
||||
</animation>
|
||||
|
||||
<effect>
|
||||
<inherits-from>Aircraft/A320-family/Models/Effects/displays/lcd</inherits-from>
|
||||
<parameters>
|
||||
<inner-angle>90</inner-angle> <!-- 0-90, use 90 for LED or plasma display-->
|
||||
<outer-angle>90</outer-angle> <!-- 0-90, but greater than inner -->
|
||||
<black-angle>90</black-angle> <!-- 0-90, but greater than outer -->
|
||||
<dirt-factor>0.09</dirt-factor>
|
||||
<contrast><use>instrumentation/battery/lcd-contrast</use></contrast>
|
||||
</parameters>
|
||||
<object-name>batt_voltage.canvas</object-name>
|
||||
</effect>
|
||||
|
||||
<text>
|
||||
<name>Battery-volt1</name>
|
||||
<offsets>
|
||||
<x-m>0.114295</x-m>
|
||||
<y-m>-0.05412</y-m>
|
||||
<z-m>1.000</z-m>
|
||||
<pitch-deg>90</pitch-deg>
|
||||
<roll-deg>90</roll-deg>
|
||||
<heading-deg>0</heading-deg>
|
||||
</offsets>
|
||||
<alignment>center-center</alignment>
|
||||
<axis-alignment>xy-plane</axis-alignment>
|
||||
<type type="string">number-value</type>
|
||||
<format type="string">%2.1fV</format>
|
||||
<property>systems/electrical/bus/dc-hot-1</property>
|
||||
<font type="string">Airbus7Seg.ttf</font>
|
||||
<draw-text type="bool">true</draw-text>
|
||||
<draw-alignment type="bool">false</draw-alignment>
|
||||
<draw-boundingbox type="bool">false</draw-boundingbox>
|
||||
<character-size>0.007</character-size>
|
||||
<font-resolution>
|
||||
<width type="int">32</width>
|
||||
<height type="int">32</height>
|
||||
</font-resolution>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<name>Battery-volt1-test</name>
|
||||
<offsets>
|
||||
<x-m>0.114295</x-m>
|
||||
<y-m>-0.05412</y-m>
|
||||
<z-m>1.000</z-m>
|
||||
<pitch-deg>90</pitch-deg>
|
||||
<roll-deg>90</roll-deg>
|
||||
<heading-deg>0</heading-deg>
|
||||
</offsets>
|
||||
<alignment>center-center</alignment>
|
||||
<axis-alignment>xy-plane</axis-alignment>
|
||||
<type type="string">text-value</type>
|
||||
<format type="string">88.8V</format>
|
||||
<property>autopilot/serviceable</property>
|
||||
<font type="string">Airbus7Seg.ttf</font>
|
||||
<draw-text type="bool">true</draw-text>
|
||||
<draw-alignment type="bool">false</draw-alignment>
|
||||
<draw-boundingbox type="bool">false</draw-boundingbox>
|
||||
<character-size>0.007</character-size>
|
||||
<font-resolution>
|
||||
<width type="int">32</width>
|
||||
<height type="int">32</height>
|
||||
</font-resolution>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<name>Battery-volt2</name>
|
||||
<offsets>
|
||||
<x-m>0.114303</x-m>
|
||||
<y-m>0.034005</y-m>
|
||||
<z-m>1.000</z-m>
|
||||
<pitch-deg>90</pitch-deg>
|
||||
<roll-deg>90</roll-deg>
|
||||
<heading-deg>0</heading-deg>
|
||||
</offsets>
|
||||
<alignment>center-center</alignment>
|
||||
<axis-alignment>xy-plane</axis-alignment>
|
||||
<type type="string">number-value</type>
|
||||
<format type="string">%2.1fV</format>
|
||||
<property>systems/electrical/bus/dc-hot-2</property>
|
||||
<font type="string">Airbus7Seg.ttf</font>
|
||||
<draw-text type="bool">true</draw-text>
|
||||
<draw-alignment type="bool">false</draw-alignment>
|
||||
<draw-boundingbox type="bool">false</draw-boundingbox>
|
||||
<character-size>0.007</character-size>
|
||||
<font-resolution>
|
||||
<width type="int">32</width>
|
||||
<height type="int">32</height>
|
||||
</font-resolution>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<name>Battery-volt2-test</name>
|
||||
<offsets>
|
||||
<x-m>0.114303</x-m>
|
||||
<y-m>0.034005</y-m>
|
||||
<z-m>1.000</z-m>
|
||||
<pitch-deg>90</pitch-deg>
|
||||
<roll-deg>90</roll-deg>
|
||||
<heading-deg>0</heading-deg>
|
||||
</offsets>
|
||||
<alignment>center-center</alignment>
|
||||
<axis-alignment>xy-plane</axis-alignment>
|
||||
<type type="string">text-value</type>
|
||||
<format type="string">88.8V</format>
|
||||
<property>autopilot/serviceable</property>
|
||||
<font type="string">Airbus7Seg.ttf</font>
|
||||
<draw-text type="bool">true</draw-text>
|
||||
<draw-alignment type="bool">false</draw-alignment>
|
||||
<draw-boundingbox type="bool">false</draw-boundingbox>
|
||||
<character-size>0.007</character-size>
|
||||
<font-resolution>
|
||||
<width type="int">32</width>
|
||||
<height type="int">32</height>
|
||||
</font-resolution>
|
||||
</text>
|
||||
|
||||
<!-- DME -->
|
||||
<text>
|
||||
<name>dme_0</name>
|
||||
|
@ -2202,37 +2087,6 @@
|
|||
<blue>1.0</blue>
|
||||
</emission>
|
||||
</animation>
|
||||
|
||||
<!-- Overhead digit lighting -->
|
||||
<animation>
|
||||
<type>material</type>
|
||||
<object-name>Battery-volt1</object-name>
|
||||
<object-name>Battery-volt2</object-name>
|
||||
<object-name>Battery-volt1-test</object-name>
|
||||
<object-name>Battery-volt2-test</object-name>
|
||||
<diffuse>
|
||||
<red>1</red>
|
||||
<green>1</green>
|
||||
<blue>1</blue>
|
||||
<factor-prop>controls/lighting/overhead-panel-norm-digital</factor-prop>
|
||||
</diffuse>
|
||||
<ambient>
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</ambient>
|
||||
<specular>
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</specular>
|
||||
<emission>
|
||||
<red>1</red>
|
||||
<green>1</green>
|
||||
<blue>1</blue>
|
||||
<factor-prop>controls/lighting/overhead-panel-norm-digital</factor-prop>
|
||||
</emission>
|
||||
</animation>
|
||||
|
||||
<!-- osgText show / hide -->
|
||||
|
||||
|
@ -2245,25 +2099,6 @@
|
|||
</condition>
|
||||
</animation>
|
||||
|
||||
<!-- Battery voltage show / hide -->
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>Battery-volt1</object-name>
|
||||
<object-name>Battery-volt2</object-name>
|
||||
<condition>
|
||||
<not><property>controls/switches/annun-test</property></not>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>select</type>
|
||||
<object-name>Battery-volt1-test</object-name>
|
||||
<object-name>Battery-volt2-test</object-name>
|
||||
<condition>
|
||||
<property>controls/switches/annun-test</property>
|
||||
</condition>
|
||||
</animation>
|
||||
|
||||
<!-- Chrono show / hide -->
|
||||
<animation>
|
||||
<type>select</type>
|
||||
|
|
85
Models/Instruments/BatteryVoltage/BatteryVoltage.nas
Normal file
85
Models/Instruments/BatteryVoltage/BatteryVoltage.nas
Normal file
|
@ -0,0 +1,85 @@
|
|||
# A3XX IESI
|
||||
|
||||
# Copyright (c) 2022 Josh Davidson (Octal450)
|
||||
|
||||
var canvas_battery = {
|
||||
new: func(name, num) {
|
||||
var obj = {parents: [canvas_battery] };
|
||||
obj.canvas = canvas.new({
|
||||
"name": "Battery",
|
||||
"size": [600, 256],
|
||||
"view": [600, 256],
|
||||
"mipmapping": 1,
|
||||
});
|
||||
|
||||
obj.canvas.addPlacement({"node": "batt_voltage.canvas." ~ (num == 0 ? "L" : "R")});
|
||||
obj.group = obj.canvas.createGroup();
|
||||
|
||||
obj.text = obj.group.createChild("text", "optional-id-for element");
|
||||
obj.text.setText("28.8V");
|
||||
obj.text.setTranslation(150, 128);
|
||||
obj.text.setAlignment("left-center");
|
||||
obj.text.setFont("Airbus7Seg.ttf");
|
||||
obj.text.setFontSize(100);
|
||||
|
||||
obj.update_items = [
|
||||
props.UpdateManager.FromHashValue("annunTest", 1, func(val) {
|
||||
obj.test = val;
|
||||
}),
|
||||
];
|
||||
|
||||
if (num == 0) {
|
||||
append(obj.update_items, props.UpdateManager.FromHashValue("dcHot1", 0.05, func(val) {
|
||||
obj.voltage = sprintf("%4.1fV", val);
|
||||
}));
|
||||
} else {
|
||||
append(obj.update_items, props.UpdateManager.FromHashValue("dcHot2", 0.05, func(val) {
|
||||
obj.voltage = sprintf("%4.1fV", val);
|
||||
}));
|
||||
}
|
||||
|
||||
return obj;
|
||||
},
|
||||
update: func(notification) {
|
||||
foreach(var update_item; me.update_items)
|
||||
{
|
||||
update_item.update(notification);
|
||||
}
|
||||
|
||||
if (me.test) {
|
||||
me.text.setText("88.8V");
|
||||
} else {
|
||||
me.text.setText(me.voltage);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var BatteryRecipient =
|
||||
{
|
||||
new: func(_ident, num)
|
||||
{
|
||||
var NewIESIRecipient = emesary.Recipient.new(_ident);
|
||||
NewIESIRecipient.MainScreen = nil;
|
||||
NewIESIRecipient.Receive = func(notification)
|
||||
{
|
||||
if (notification.NotificationType == "FrameNotification")
|
||||
{
|
||||
if (NewIESIRecipient.MainScreen == nil) {
|
||||
NewIESIRecipient.MainScreen = canvas_battery.new("A320 Battery", num);
|
||||
}
|
||||
|
||||
if (math.mod(notifications.frameNotification.FrameCount,2) == 0) {
|
||||
NewIESIRecipient.MainScreen.update(notification);
|
||||
}
|
||||
return emesary.Transmitter.ReceiptStatus_OK;
|
||||
}
|
||||
return emesary.Transmitter.ReceiptStatus_NotProcessed;
|
||||
};
|
||||
return NewIESIRecipient;
|
||||
},
|
||||
};
|
||||
|
||||
var A320BatteryL = BatteryRecipient.new("A320 Battery", 0);
|
||||
var A320BatteryR = BatteryRecipient.new("A320 Battery", 1);
|
||||
emesary.GlobalTransmitter.Register(A320BatteryL);
|
||||
emesary.GlobalTransmitter.Register(A320BatteryR);
|
45
Models/Instruments/BatteryVoltage/BatteryVoltage.xml
Normal file
45
Models/Instruments/BatteryVoltage/BatteryVoltage.xml
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- Copyright (c) 2022 Josh Davidson (Octal450) -->
|
||||
|
||||
<PropertyList>
|
||||
|
||||
<path>res/IESI.ac</path>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>iesi.screen</object-name>
|
||||
<action>
|
||||
<button>0</button>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>canvas_iesi.showIESI();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>material</type>
|
||||
<object-name>iesi.screen</object-name>
|
||||
<emission>
|
||||
<red>1</red>
|
||||
<green>1</green>
|
||||
<blue>1</blue>
|
||||
<factor-prop>controls/lighting/DU/iesi</factor-prop>
|
||||
</emission>
|
||||
</animation>
|
||||
|
||||
<effect>
|
||||
<inherits-from>Aircraft/A320-family/Models/Effects/displays/lcd</inherits-from>
|
||||
<parameters>
|
||||
<inner-angle>90</inner-angle> <!-- 0-90, use 90 for LED or plasma display-->
|
||||
<outer-angle>90</outer-angle> <!-- 0-90, but greater than inner -->
|
||||
<black-angle>90</black-angle> <!-- 0-90, but greater than outer -->
|
||||
<dirt-factor>0.09</dirt-factor>
|
||||
<contrast><use>instrumentation/iesi/lcd-contrast</use></contrast>
|
||||
</parameters>
|
||||
<object-name>iesi.screen</object-name>
|
||||
</effect>
|
||||
|
||||
</PropertyList>
|
|
@ -375,6 +375,7 @@ var input = {
|
|||
"gearPosNorm2": "/gear/gear[2]/position-norm",
|
||||
"engine1Running": "/engines/engine[0]/running",
|
||||
"engine2Running": "/engines/engine[1]/running",
|
||||
"annunTest": "/controls/switches/annun-test",
|
||||
};
|
||||
|
||||
foreach (var name; keys(input)) {
|
||||
|
|
Loading…
Reference in a new issue