var knobsClass = { new : func (device) { var m = { parents: [ knobsClass ] }; m.device = device; return m; }, XPDRCodeSetDigits : func (d) { # disable SoftKey entering method setprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method', 1); if (!contains(me.device.softkeys.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) { me.device.softkeys.bindings.PFD.XPDR.CODE.inactivity.stop(); me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity = maketimer(10, func { setprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit', 3); call(me.device.softkeys.bindings.PFD.XPDR.CODE.restore, [], me); }); me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.singleShot = 1; me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.start(); } else me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10); var digit = getprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit'); var code = getprop('/instrumentation/transponder/id-code'); if (digit == 3) var val = int(code/100) + d; else var val = math.mod(code, 100) + d; if (math.mod(val, 10) == 8) { if (val > 77) val = 0; else val += 2; } elsif (val < 0) val = 77; elsif (math.mod(val, 10) == 9) val -= 2; if (digit == 3) setprop('/instrumentation/transponder/id-code', sprintf('%i', val * 100 + math.mod(code, 100))); else setprop('/instrumentation/transponder/id-code', sprintf('%i', int(code/100) * 100 + val)); me.device.display.updateXPDR(); }, XPDRCodeNextDigits : func { setprop('/instrumentation/zkv1000/radios/xpdr-tuning-fms-method', 1); if (!contains(me.device.softkeys.bindings.PFD.XPDR.CODE, 'on_change_inactivity')) { me.device.softkeys.bindings.PFD.XPDR.CODE.inactivity.stop(); me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity = maketimer(10, func { setprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit', 3); call(me.device.softkeys.bindings.PFD.XPDR.CODE.restore, [], me); }); me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.singleShot = 1; me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.start(); } else me.device.softkeys.bindings.PFD.XPDR.CODE.on_change_inactivity.restart(10); setprop('/instrumentation/zkv1000/radios/xpdr-tuning-digit', 1); me.device.display.updateXPDR(); }, MenuSettings : func (d) { var (id, selected) = split('-', me.device.windows.selected); var state = me.device.windows.state[id]; if (find('choices', state.lines[selected].type) > -1) { var val = me.device.windows.window[me.device.windows.selected] .get('text'); forindex (var i; state.lines[selected].choices) if (state.lines[selected].choices[i] == val) { if (i == size(state.lines[selected].choices) - 1) me.device.windows.window[me.device.windows.selected] .setText(state.lines[selected].choices[0]); else me.device.windows.window[me.device.windows.selected] .setText(state.lines[selected].choices[i + 1]); break; } } elsif (find('time', state.lines[selected].type) > -1) { var val = me.device.windows.window[me.device.windows.selected] .get('text'); var (hh, mm, ss) = split(':', val); var time = hh * 3600 + mm * 60 + ss; if (time >= 600) # 10 min d *= 60; elsif (time >= 300) # 5 minutes d *= 30; elsif (time >= 180) # 3 minutes d *= 10; ss += d; if (ss > 59) { ss -= 60; mm += 1; if (mm > 59) { mm = 0; hh += 1; } } elsif (ss < 0) { if (mm > 0) { ss += 60; mm -= 1; } elsif (mm == 0 and hh > 0) { ss += 60; mm = 59; hh -= 1; } elsif (mm == 0 and hh == 0) ss = 0; } me.device.windows.window[me.device.windows.selected] .setText(sprintf('%02i:%02i:%02i', hh, mm, ss)); } }, NavigateMenu : func (d) { var (id, selected) = split('-', me.device.windows.selected); var state = me.device.windows.state[id]; for (var i = selected + d; i >= 0 and i < size(state.lines); i += d) { if (find('editable', state.lines[i].type) > -1) { state.lines[i].type = string.replace(state.lines[i].type, 'editable', 'selected'); state.lines[selected].type = string.replace(state.lines[selected].type, 'selected', 'editable'); me.device.windows.window[me.device.windows.selected] .setDrawMode(0x01) .setColor(0,1,1); me.device.windows.window[id ~ '-' ~ i] .setDrawMode(0x05) .setColorFill(0,1,1) .setColor(0,0,0); me.device.windows.selected = id ~ '-' ~ i; break; } } }, FmsInner : void, FmsOuter : void };