GoFlight MFR
true
= 2) activeChannel = 0;
updateActive();
}
# map decimal digits 0..9 to standard 7-segment LCD pattern
var translateDigitToSevenSegment = [0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f];
var formatFrequency = func(freqMhz)
{
var s = sprintf("%.3f", freqMhz);
var padCount = 6 - size(s);
var r = "";
while (padCount > 0) {
r ~= chr(0);
padCount -=1;
}
for (var i=0; i < size(s); i += 1) {
if (s[i] == `.`) {
# set the high bit to correspond to the decimal
var lastIndex = size(r) - 1;
r[lastIndex] = r[lastIndex] + 0x80;
} else {
var digitCode = s[i] - `0`;
r ~= chr(translateDigitToSevenSegment[digitCode]);
}
}
return r;
}
var standbyAlphanumeric = func() {
return formatFrequency(standbyNode.getValue());
}
var selectedAlphanumeric = func() {
return formatFrequency(selectedNode.getValue());
}
var ledState = func()
{
if (activeChannel == 1) return chr(0x04);
return chr(0x2);
}
updateActive(0);
]]>
rel-dial
property-adjust
/input/goflight/mfr/standby-mhz
108.0
117.95
true
00
11
22
34
48
rel-dial-1
property-adjust
/input/goflight/mfr/standby-mhz
0.025
108.0
117.95
true
00
11
22
34
48
3
/input/goflight/mfr/active
/instrumentation/nav[0]/frequencies/selected-mhz
/instrumentation/nav[1]/frequencies/selected-mhz
selectedAlphanumeric
5
/input/goflight/mfr/active
/instrumentation/nav[0]/frequencies/standby-mhz
/instrumentation/nav[1]/frequencies/standby-mhz
standbyAlphanumeric
7
/input/goflight/mfr/active
ledState
Transfer Button
button-1
property-swap
/input/goflight/mfr/standby-mhz
/input/goflight/mfr/selected-mhz
Nav 1 Button
button-2
nasal
Nav 2 Button
button-3
nasal