Skip to content

Commit a3526f6

Browse files
authored
Add support for WingFlex RMP Cube (#3069)
* Add RMP Cube json file * Add RmpCube classes * Added first unit tests - all working * Dot position is calculated automatically * Corect enabling of digits (based on docs) * Correct button count (26-25) Fixed wrong big knob label * Added debug log messages for better troubleshooting * Add improved Serial fallback and better logging * Use same serial fallback * Flip Transponder AUTO & ON for correct sequence * Updated logic for active digits * Removed outputs that are internally used only.
1 parent e8cb786 commit a3526f6

11 files changed

Lines changed: 1236 additions & 35 deletions

File tree

Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
{
2+
"$schema": "./mfjoystick.schema.json",
3+
"InstanceName": "RMP Cube",
4+
"VendorId": "0xA616",
5+
"ProductId": "0x5750",
6+
"Inputs": [
7+
{
8+
"Id": 1,
9+
"Type": "Button",
10+
"Label": "Transfer Key"
11+
},
12+
{
13+
"Id": 2,
14+
"Type": "Button",
15+
"Label": "VHF1 Key"
16+
},
17+
{
18+
"Id": 3,
19+
"Type": "Button",
20+
"Label": "VHF2 Key"
21+
},
22+
{
23+
"Id": 4,
24+
"Type": "Button",
25+
"Label": "VHF3 Key"
26+
},
27+
{
28+
"Id": 5,
29+
"Type": "Button",
30+
"Label": "LOAD Key"
31+
},
32+
{
33+
"Id": 6,
34+
"Type": "Button",
35+
"Label": "HF1 Key"
36+
},
37+
{
38+
"Id": 7,
39+
"Type": "Button",
40+
"Label": "HF2 Key"
41+
},
42+
{
43+
"Id": 8,
44+
"Type": "Button",
45+
"Label": "ATC Key"
46+
},
47+
{
48+
"Id": 9,
49+
"Type": "Button",
50+
"Label": "NAV Key"
51+
},
52+
{
53+
"Id": 10,
54+
"Type": "Button",
55+
"Label": "VOR Key"
56+
},
57+
{
58+
"Id": 11,
59+
"Type": "Button",
60+
"Label": "ILS Key"
61+
},
62+
{
63+
"Id": 12,
64+
"Type": "Button",
65+
"Label": "GLS Key"
66+
},
67+
{
68+
"Id": 13,
69+
"Type": "Button",
70+
"Label": "MLS Key"
71+
},
72+
{
73+
"Id": 14,
74+
"Type": "Button",
75+
"Label": "ADF Key"
76+
},
77+
{
78+
"Id": 15,
79+
"Type": "Button",
80+
"Label": "IDENT Key"
81+
},
82+
{
83+
"Id": 16,
84+
"Type": "Button",
85+
"Label": "Power On"
86+
},
87+
{
88+
"Id": 17,
89+
"Type": "Button",
90+
"Label": "Power Off"
91+
},
92+
{
93+
"Id": 18,
94+
"Type": "Button",
95+
"Label": "ATC MSG Key"
96+
},
97+
{
98+
"Id": 19,
99+
"Type": "Button",
100+
"Label": "AUTO LAND Key"
101+
},
102+
{
103+
"Id": 20,
104+
"Type": "Button",
105+
"Label": "Transponder - STBY"
106+
},
107+
{
108+
"Id": 21,
109+
"Type": "Button",
110+
"Label": "Transponder - AUTO"
111+
},
112+
{
113+
"Id": 22,
114+
"Type": "Button",
115+
"Label": "Transponder - ON"
116+
},
117+
{
118+
"Id": 23,
119+
"Type": "Button",
120+
"Label": "TCAS - STBY"
121+
},
122+
{
123+
"Id": 24,
124+
"Type": "Button",
125+
"Label": "TCAS - TA"
126+
},
127+
{
128+
"Id": 25,
129+
"Type": "Button",
130+
"Label": "TCAS - TA/RA"
131+
},
132+
{
133+
"Id": 26,
134+
"Type": "Button",
135+
"Label": "Small Knob - Turn Left"
136+
},
137+
{
138+
"Id": 27,
139+
"Type": "Button",
140+
"Label": "Small Knob - Turn Right"
141+
},
142+
{
143+
"Id": 28,
144+
"Type": "Button",
145+
"Label": "Big Knob - Turn Left"
146+
},
147+
{
148+
"Id": 29,
149+
"Type": "Button",
150+
"Label": "Big Knob - Turn Right"
151+
}
152+
],
153+
"Outputs": [
154+
{
155+
"Label": "Transfer Light",
156+
"Id": "transfer.led",
157+
"Byte": 6,
158+
"Bit": 0
159+
},
160+
{
161+
"Label": "VHF1",
162+
"Id": "VHF1.led",
163+
"Byte": 6,
164+
"Bit": 1
165+
},
166+
{
167+
"Label": "VHF2",
168+
"Id": "VHF2.led",
169+
"Byte": 6,
170+
"Bit": 2
171+
},
172+
{
173+
"Label": "VHF3",
174+
"Id": "VHF3.led",
175+
"Byte": 6,
176+
"Bit": 3
177+
},
178+
{
179+
"Label": "LOAD",
180+
"Id": "LOAD.led",
181+
"Byte": 6,
182+
"Bit": 4
183+
},
184+
{
185+
"Label": "HF1",
186+
"Id": "HF1.led",
187+
"Byte": 6,
188+
"Bit": 5
189+
},
190+
{
191+
"Label": "SEL",
192+
"Id": "SEL.led",
193+
"Byte": 6,
194+
"Bit": 6
195+
},
196+
{
197+
"Label": "HF2",
198+
"Id": "HF2.led",
199+
"Byte": 6,
200+
"Bit": 7
201+
},
202+
{
203+
"Label": "ATC",
204+
"Id": "ATC.led",
205+
"Byte": 7,
206+
"Bit": 0
207+
},
208+
{
209+
"Label": "NAV",
210+
"Id": "NAV.led",
211+
"Byte": 7,
212+
"Bit": 1
213+
},
214+
{
215+
"Label": "VOR",
216+
"Id": "VOR.led",
217+
"Byte": 7,
218+
"Bit": 2
219+
},
220+
{
221+
"Label": "ILS",
222+
"Id": "ILS.led",
223+
"Byte": 7,
224+
"Bit": 3
225+
},
226+
{
227+
"Label": "GLS",
228+
"Id": "GLS.led",
229+
"Byte": 7,
230+
"Bit": 4
231+
},
232+
{
233+
"Label": "MLS",
234+
"Id": "MLS.led",
235+
"Byte": 7,
236+
"Bit": 5
237+
},
238+
{
239+
"Label": "ADF",
240+
"Id": "ADF.led",
241+
"Byte": 7,
242+
"Bit": 6
243+
},
244+
{
245+
"Label": "ATC MSG (upper)",
246+
"Id": "ATC.upper.led",
247+
"Byte": 7,
248+
"Bit": 7
249+
},
250+
{
251+
"Label": "AUTO LAND",
252+
"Id": "autoland.led",
253+
"Byte": 8,
254+
"Bit": 0
255+
},
256+
{
257+
"Label": "Left LCD Switch",
258+
"Id": "llcd.switch",
259+
"Byte": 8,
260+
"Bit": 1
261+
},
262+
{
263+
"Label": "Right LCD Switch",
264+
"Id": "rlcd.switch",
265+
"Byte": 8,
266+
"Bit": 2
267+
},
268+
{
269+
"Label": "Left Display - \"C\" Mode",
270+
"Id": "lcmode.switch",
271+
"Byte": 8,
272+
"Bit": 3
273+
},
274+
{
275+
"Label": "Right Display - \"C\" Mode",
276+
"Id": "rcmode.switch",
277+
"Byte": 8,
278+
"Bit": 4
279+
},
280+
{
281+
"Label": "Left Display - \"DATA\" Mode",
282+
"Id": "ldatamode.switch",
283+
"Byte": 8,
284+
"Bit": 5
285+
},
286+
{
287+
"Label": "Right Display - \"DATA\" Mode",
288+
"Id": "rdatamode.switch",
289+
"Byte": 8,
290+
"Bit": 6
291+
},
292+
{
293+
"Label": "ATC MSG (lower)",
294+
"Id": "ATC.lower.led",
295+
"Byte": 8,
296+
"Bit": 7
297+
},
298+
{
299+
"Label": "Display Brightness",
300+
"Id": "brightness.panel",
301+
"Byte": 11,
302+
"Bit": 0
303+
},
304+
{
305+
"Label": "Background Brightness",
306+
"Id": "brightness.display",
307+
"Byte": 12,
308+
"Bit": 0
309+
},
310+
{
311+
"Label": "Active Lcd",
312+
"Id": "active.lcd",
313+
"Type": "LcdDisplay",
314+
"Byte": 19,
315+
"Cols": 6,
316+
"Lines": 1
317+
},
318+
{
319+
"Label": "Standby Lcd",
320+
"Id": "standby.lcd",
321+
"Type": "LcdDisplay",
322+
"Byte": 23,
323+
"Cols": 6,
324+
"Lines": 1
325+
}
326+
]
327+
}

src/MobiFlightConnector/MobiFlight/Joysticks/HidControllerFactory.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public static bool CanCreate(string InstanceName)
1313

1414
switch (InstanceName.Trim())
1515
{
16+
case "RMP Cube":
1617
case "EFIS Cube":
1718
case "FCU Cube":
1819
return true;
@@ -25,6 +26,9 @@ internal static Joystick Create(JoystickDefinition definition)
2526
Joystick result = null;
2627
switch (definition.InstanceName)
2728
{
29+
case "RMP Cube":
30+
result = new WingFlex.RmpCube(definition);
31+
break;
2832
case "EFIS Cube":
2933
result = new WingFlex.EfisCube(definition);
3034
break;

src/MobiFlightConnector/MobiFlight/Joysticks/JoystickManager.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,12 @@ private void ConnectHidController()
297297
joystick.Connect(new IntPtr());
298298
joystick.OnButtonPressed += Js_OnButtonPressed;
299299
joystick.OnDisconnected += Js_OnDisconnected;
300-
Joysticks.TryAdd(joystick.Serial, joystick);
301-
Log.Instance.log($"Connected HID device: {definition.InstanceName}", LogSeverity.Info);
300+
if (!Joysticks.TryAdd(joystick.Serial, joystick))
301+
{
302+
Log.Instance.log($"Error adding HID device: {definition.InstanceName} / {joystick.Serial}. Likely Joystick Serial conflict.", LogSeverity.Error);
303+
return;
304+
}
305+
Log.Instance.log($"Connected HID device: {definition.InstanceName} / {joystick.Serial}", LogSeverity.Info);
302306
}
303307
catch (Exception ex)
304308
{
@@ -358,4 +362,4 @@ public Dictionary<String, int> GetStatistics()
358362
return result;
359363
}
360364
}
361-
}
365+
}

0 commit comments

Comments
 (0)