forked from RemoteTechnologiesGroup/RemoteTech
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComputerModeMapper.cs
More file actions
43 lines (40 loc) · 1.65 KB
/
Copy pathComputerModeMapper.cs
File metadata and controls
43 lines (40 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using RemoteTech.FlightComputer.Commands;
using RemoteTech.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace RemoteTech.SimpleTypes
{
/// <summary>
/// This class converts the FlightMode from a AttitudeCommand into a ComputerMode for the AttitudeFragment
/// </summary>
public class ComputerModeMapper
{
public ComputerMode computerMode;
public FlightAttitude computerAttitude;
public void mapFlightMode(FlightMode flightMode, FlightAttitude flightAttitude, ReferenceFrame frame)
{
computerMode = ComputerMode.Off;
computerAttitude = flightAttitude;
switch (flightMode)
{
case FlightMode.Off: { computerMode = ComputerMode.Off; break; }
case FlightMode.KillRot: { computerMode = ComputerMode.Kill; break; }
case FlightMode.AttitudeHold:
{
computerMode = ComputerMode.Custom;
switch (frame)
{
case ReferenceFrame.Maneuver: { computerMode = ComputerMode.Node; break; }
case ReferenceFrame.Orbit: { computerMode = ComputerMode.Orbital; break; }
case ReferenceFrame.Surface: { computerMode = ComputerMode.Surface; break; }
case ReferenceFrame.TargetParallel: { computerMode = ComputerMode.TargetPos; break; }
case ReferenceFrame.TargetVelocity: { computerMode = ComputerMode.TargetVel; break; }
}
break;
}
}
}
}
}