1
0
Fork 0

Improvements to DCDU: enable close button and allow display of sender and message time

This commit is contained in:
legoboyvdlp R 2020-12-28 17:19:48 +00:00
parent 82d4eec004
commit 2384f6542d
2 changed files with 69 additions and 14 deletions

View file

@ -9070,6 +9070,34 @@
</action>
</animation>
<animation>
<type>pick</type>
<object-name>dcduBtnL.R2</object-name>
<object-name>dcduBtnR.R2</object-name>
<action>
<button>0</button>
<repeatable>true</repeatable>
<binding>
<condition>
<or>
<greater-than-equals>
<property>systems/electrical/bus/ac-1</property>
<value>110</value>
</greater-than-equals>
<greater-than-equals>
<property>systems/electrical/bus/dc-1</property>
<value>110</value>
</greater-than-equals>
</or>
</condition>
<command>nasal</command>
<script>
canvas_dcdu.DCDU.btnR2();
</script>
</binding>
</action>
</animation>
<!-- WX Radar -->
<animation>

View file

@ -108,6 +108,8 @@ var canvas_DCDU = {
var m = {parents: [canvas_DCDU, canvas_DCDU_base]};
m.init(canvas_group, file);
m.updateActiveATC();
m["MessageTimeStamp"].hide();
m["Close"].hide();
return m;
},
getKeys: func() {
@ -116,32 +118,43 @@ var canvas_DCDU = {
cache: {
adsCount: 0,
},
currentMessage: nil,
update: func() {
me["RecallMode"].hide();
me["LinkLost"].hide();
me["Recall"].show();
me["Close"].hide();
me["Recall"].hide();
if (atsu.ADS.getCount() != me.cache.adsCount) {
me.cache.adsCount = atsu.ADS.getCount();
# FANS A+: status of ADS seems to be independent of connection to CPDLC: confirm in GTG document
if (atsu.ADS.state == 2) {
me["ADSConnection"].setText("ADS CONNECTED(" ~ atsu.ADS.getCount() ~ ")");
me["ADSConnection"].show();
} else {
me["ADSConnection"].hide();
if (!me.showingMessage) {
if (atsu.ADS.getCount() != me.cache.adsCount) {
me.cache.adsCount = atsu.ADS.getCount();
# FANS A+: status of ADS seems to be independent of connection to CPDLC: confirm in GTG document
if (atsu.ADS.state == 2) {
me["ADSConnection"].setText("ADS CONNECTED(" ~ atsu.ADS.getCount() ~ ")");
me["ADSConnection"].show();
} else {
me["ADSConnection"].hide();
}
}
} else {
me["ADSConnection"].hide();
}
},
currentMessage: nil,
showNextMessage: func() {
me.showingMessage = 1;
me.currentMessage = atsu.DCDUBuffer.popMessage();
me["MessageTimeStamp"].show();
me["MessageTimeStamp"].setText(me.currentMessage.receivedTime);
me["MessageTimeStamp"].setText(me.currentMessage.receivedTime ~ " FROM " ~ CPDLCauthority.getValue() ~ " CTL");
me["ActiveATC"].hide();
me["Close"].show();
},
clearMessage: func() {
me.currentMessage = nil;
me["MessageTimeStamp"].hide();
if (me.showingMessage) {
me.currentMessage = nil;
me["MessageTimeStamp"].hide();
me["Close"].hide();
me.updateActiveATC();
me.showingMessage = 0;
}
},
updateActiveATC: func() {
if (CPDLCstatusNode.getValue() == 2) {
@ -151,6 +164,20 @@ var canvas_DCDU = {
me["ActiveATC"].hide();
}
},
btnL1: func() {
},
btnL2: func() {
},
btnR1: func() {
},
btnR2: func() {
if (me.showingMessage) {
me.clearMessage();
}
},
};
setlistener("/network/cpdlc/link/status", func() {