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> </action>
</animation> </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 --> <!-- WX Radar -->
<animation> <animation>

View file

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