Skip to content

Commit 9d8f57a

Browse files
author
mattnischan
committed
SDK 0.7.1 and SR22T plugin release.
1 parent 8a8240f commit 9d8f57a

File tree

180 files changed

+19466
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+19466
-52
lines changed

src/garminsdk/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/msfs-garminsdk",
3-
"version": "0.3.0",
3+
"version": "0.5.0",
44
"description": "Common files for the Garmin series of avionics systems",
55
"main": "garminsdk.js",
66
"scripts": {
@@ -11,7 +11,7 @@
1111
"author": "Working Title Simulations",
1212
"license": "MIT",
1313
"devDependencies": {
14-
"@microsoft/msfs-sdk": "0.5.0",
14+
"@microsoft/msfs-sdk": "0.7.0",
1515
"@microsoft/msfs-types": "1.14.6",
1616
"@rollup/plugin-node-resolve": "^15.0.1",
1717
"@types/node": "^18.11.18",
@@ -23,4 +23,4 @@
2323
"type": "git",
2424
"url": "https://github.com/microsoft/msfs-avionics-mirror/"
2525
}
26-
}
26+
}

src/garminsdk/settings/VSpeedUserSettings.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export class VSpeedUserSettingUtils {
3434
* @param name The name of the reference V-speed.
3535
* @param settingManager A manager for reference V-speed user settings.
3636
* @param useFmsValue Whether to support the V-speed's FMS-defined value.
37+
* @param allowZeroValue Whether to allow the active value to be equal to zero. If `false`, a value of zero is
38+
* treated as an undefined value (similar to negative values). Defaults to `false`.
3739
* @returns A mapped subscribable which provides the active value of the specified reference V-speed, in knots.
3840
*/
3941
public static activeValue(
@@ -51,6 +53,8 @@ export class VSpeedUserSettingUtils {
5153
* @param name The name of the reference V-speed.
5254
* @param settingManager A manager for reference V-speed user settings.
5355
* @param useFmsValue Whether to support the V-speed's FMS-defined value.
56+
* @param allowZeroValue Whether to allow the active value to be equal to zero. If `false`, a value of zero is
57+
* treated as an undefined value (similar to negative values). Defaults to `false`.
5458
* @returns A mapped subscribable which provides the active value of the specified reference V-speed, in knots.
5559
*/
5660
public static activeValue(

src/sdk/instruments/ADC.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export interface BaseAdcEvents {
6363
/** The ambient air density, in slugs per cubic foot */
6464
ambient_density: number;
6565

66-
/** The ambient temperature, in degrees Celsius. Same as OAT (Outside Air Temperature). */
66+
/** The ambient static air temperature, in degrees Celsius. */
6767
ambient_temp_c: number;
6868

6969
/** The ambient pressure, in inches of mercury. */
@@ -72,7 +72,7 @@ export interface BaseAdcEvents {
7272
/** The current ISA temperature, in degrees Celsius. */
7373
isa_temp_c: number;
7474

75-
/** The current ram air temperature, in degrees Celsius. Same as TAT (Total Air Temperature). */
75+
/** The current ram air temperature (total air temperature), in degrees Celsius. */
7676
ram_air_temp_c: number;
7777

7878
/** The ambient wind velocity, in knots. */

src/sdk/instruments/AircraftInertialPublisher.ts

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,41 @@ import { SimVarPublisher, SimVarPublisherEntry } from './BasePublishers';
99
* An interface that describes the possible aircraft inertial motion events.
1010
*/
1111
export interface AircraftInertialEvents {
12-
/** Lateral acceleration relative to aircraft X axis, in east/west direction in metres/sec^2, +ve to the right. */
13-
acceleration_body_x: number,
14-
/** Vertical acceleration relative to aircraft Y axis, in vertical direction in metres/sec^2, +ve upwards. */
15-
acceleration_body_y: number,
16-
/** Longitudinal acceleration relative to aircraft Z axis, in fore/aft direction in metres/sec^2, +ve forwards. */
17-
acceleration_body_z: number,
18-
/** Pitch rotation velocity relative to aircraft X axis in °/sec, +ve downwards. */
19-
rotation_velocity_body_x: number,
20-
/** Yaw rotation velocity relative to aircraft Y axis in °/sec, +ve right. */
21-
rotation_velocity_body_y: number,
22-
/** Roll rotation velocity relative to aircraft Z axis in °/sec +ve to the left. */
23-
rotation_velocity_body_z: number,
12+
/**
13+
* The airplane's linear acceleration, in meters per second per second, along the airplane's lateral (left-right)
14+
* axis. Positive values indicate acceleration toward the right of the airplane.
15+
*/
16+
acceleration_body_x: number;
17+
18+
/**
19+
* The airplane's linear acceleration, in meters per second per second, along the airplane's vertical (bottom-top)
20+
* axis. Positive values indicate acceleration toward the top of the airplane.
21+
*/
22+
acceleration_body_y: number;
23+
24+
/**
25+
* The airplane's linear acceleration, in meters per second per second, along the airplane's longitudinal
26+
* (rear-front) axis. Positive values indicate acceleration toward the front of the airplane.
27+
*/
28+
acceleration_body_z: number;
29+
30+
/**
31+
* The airplane's rotational velocity, in degrees per second, about its lateral (left-right) axis (i.e. the rate of
32+
* change of its pitch angle). Positive values indicate the airplane is pitching down.
33+
*/
34+
rotation_velocity_body_x: number;
35+
36+
/**
37+
* The airplane's rotational velocity, in degrees per second, about its vertical (bottom-top) axis (i.e. the rate of
38+
* change of its yaw angle). Positive values indicate the airplane is yawing to the right.
39+
*/
40+
rotation_velocity_body_y: number;
41+
42+
/**
43+
* The airplane's rotational velocity, in degrees per second, about its longitudinal (rear-front) axis (i.e. the rate
44+
* of change of its roll/bank angle). Positive values indicate the airplane is rolling to the left.
45+
*/
46+
rotation_velocity_body_z: number;
2447
}
2548

2649
/**

src/sdk/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/msfs-sdk",
3-
"version": "0.5.0",
3+
"version": "0.7.0",
44
"description": "HTML and Typescript SDK for MSFS Coherent based instruments and aircraft development.",
55
"main": "msfssdk.js",
66
"typings": "msfssdk.d.ts",
@@ -23,4 +23,4 @@
2323
"rollup-plugin-dts": "^4.2.3",
2424
"typescript": "4.5.5"
2525
}
26-
}
26+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Working Title SR22T
2+
3+
This is the source code for the Working Title SR22T for MSFS. To compile simply run:
4+
5+
npm i && npm run build
6+
7+
Once compiled the final output will be in the `dist` directory. However, this is not a full package that can be deployed in the sim, it only represents the plugin code for the stock SR22T.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "workingtitle-aircraft-sr22t",
3+
"version": "1.1.9",
4+
"description": "Working Title MSFS SR22T",
5+
"scripts": {
6+
"build": "npm run build:compile && npm run build:rollup",
7+
"build:compile": "npx tsc",
8+
"build:rollup": "robocopy src/Plugins *.css build/Plugins /s & npx rollup -c rollup.config.js"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/microsoft/msfs-avionics-mirror/"
13+
},
14+
"author": "Working Title Simulations, LLC",
15+
"license": "Modified MIT",
16+
"devDependencies": {
17+
"@rollup/plugin-image": "^3.0.2",
18+
"@rollup/plugin-node-resolve": "^15.0.1",
19+
"@microsoft/msfs-garminsdk": "0.5.0",
20+
"@microsoft/msfs-sdk": "0.7.0",
21+
"@microsoft/msfs-types": "1.14.6",
22+
"@microsoft/msfs-wtg1000": "1.3.3",
23+
"rollup": "^2.79.1",
24+
"rollup-plugin-import-css": "^3.1.0",
25+
"typescript": "4.5.5"
26+
}
27+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import css from 'rollup-plugin-import-css';
2+
import image from '@rollup/plugin-image';
3+
import resolve from '@rollup/plugin-node-resolve';
4+
5+
export default [
6+
{
7+
input: 'build/Plugins/PFD/index.js',
8+
output: {
9+
file: 'dist/workingtitle-aircraft-sr22t/SimObjects/Airplanes/Asobo_SR22/panel/Instruments/G1000/Plugins/SR22TPfdPlugins.js',
10+
format: 'iife',
11+
name: 'sr22tPfd',
12+
globals: {
13+
'@microsoft/msfs-sdk': 'msfssdk',
14+
'@microsoft/msfs-garminsdk': 'garminsdk',
15+
'@microsoft/msfs-wtg1000': 'wtg1000'
16+
}
17+
},
18+
external: ['@microsoft/msfs-sdk', '@microsoft/msfs-garminsdk', '@microsoft/msfs-wtg1000'],
19+
plugins: [image(), css({ output: 'SR22TPfdPlugins.css' }), resolve()]
20+
},
21+
{
22+
input: 'build/Plugins/PFD/index.js',
23+
output: {
24+
file: 'dist/workingtitle-aircraft-sr22t/SimObjects/Airplanes/Asobo_SR22/panel/Instruments/G1000/Plugins/SR22TMfdPlugins.js',
25+
format: 'iife',
26+
name: 'sr22tMfd',
27+
globals: {
28+
'@microsoft/msfs-sdk': 'msfssdk',
29+
'@microsoft/msfs-garminsdk': 'garminsdk',
30+
'@microsoft/msfs-wtg1000': 'wtg1000'
31+
}
32+
},
33+
external: ['@microsoft/msfs-sdk', '@microsoft/msfs-garminsdk', '@microsoft/msfs-wtg1000'],
34+
plugins: [image(), css({ output: 'SR22TMfdPlugins.css' }), resolve()]
35+
},
36+
];
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.sr22t-dest-airport-info-display {
2+
display: grid;
3+
position: absolute;
4+
left: 0;
5+
width: 100%;
6+
height: 50%;
7+
font-size: 20px;
8+
padding: 0 2px;
9+
grid-template-rows: 100%;
10+
grid-template-columns: 21% 38% 41%;
11+
align-items: center;
12+
13+
}
14+
15+
.sr22t-dest-airport-info-display>div:first-child {
16+
grid-row: 1 / 3;
17+
}
18+
19+
.sr22t-dest-airport-info-data-field {
20+
color: magenta;
21+
}
22+
23+
.sr22t-dest-airport-info-data-field>div.nav-data-field-title {
24+
font-size: 0.75em;
25+
margin-right: 0.5em;
26+
color: var(--title-gray);
27+
}
28+
29+
.sr22t-dest-airport-info-data-field.sr22t-dest-airport {
30+
display: flex;
31+
flex-direction: column;
32+
}
33+
34+
.sr22t-dest-airport-info-data-field.sr22t-dest-airport>div.nav-data-field-title {
35+
font-size: 20px;
36+
padding-top: 4px;
37+
margin-left: -8px;
38+
padding-left: 8px;
39+
border-right: 1px solid #4A4A4A;
40+
border-bottom: 1px solid #4A4A4A;
41+
border-radius: 7px;
42+
width: 58px;
43+
}
44+
45+
.sr22t-dest-airport-info-data-field.sr22t-destination-ete>div.nav-data-field-title {
46+
width: 26px;
47+
}
48+
49+
.sr22t-dest-airport-info-data-field.sr22t-waypoint-distance>div.nav-data-field-title {
50+
width: 30px;
51+
}
52+
53+
.sr22t-dest-airport-info-data-field.sr22t-fod>div.nav-data-field-title {
54+
width: 38px;
55+
}
56+
57+
.sr22t-dest-airport-info-data-field.sr22t-waypoint-brg>div.nav-data-field-title {
58+
width: 34px;
59+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import { ComponentProps, EventBus, DisplayComponent, VNode, FSComponent, Subject, ClockEvents, Subscription } from '@microsoft/msfs-sdk';
2+
import { DefaultNavDataBarFieldModelFactory, Fms, NavDataBarFieldModel, NavDataFieldGpsValidity, NavDataFieldType, UnitsUserSettings } from '@microsoft/msfs-garminsdk';
3+
import { Sr22tDestAirportInfoFieldRenderer } from './Sr22tDestAirportInfoFieldRenderer';
4+
5+
import './Sr22tDestAirportInfoDisplay.css';
6+
7+
/** The properties for the {@link Sr22tDestAirportInfoDisplay} component. */
8+
interface Sr22tDestAirportInfoDisplayProps extends ComponentProps {
9+
/** An instance of the event bus. */
10+
bus: EventBus;
11+
12+
/** The FMS. */
13+
fms: Fms;
14+
15+
/** The update frequency of the data fields, in hertz. */
16+
updateFreq: number;
17+
}
18+
19+
/**
20+
* The Sr22tDestAirportInfoComponent.
21+
* Displays Destination Airport Information, including:
22+
* - Destination airport ident
23+
* - Enroute distance
24+
* - Estimated time enroute
25+
* - Bearing to airport
26+
* - Fuel remaining at airport
27+
*/
28+
export class Sr22tDestAirportInfoDisplay extends DisplayComponent<Sr22tDestAirportInfoDisplayProps> {
29+
private readonly fieldTypes = [
30+
NavDataFieldType.Destination,
31+
NavDataFieldType.TimeToDestination,
32+
NavDataFieldType.FuelOverDestination,
33+
NavDataFieldType.DistanceToDestination,
34+
NavDataFieldType.BearingToWaypoint,
35+
];
36+
37+
private readonly unitsSettingManager = UnitsUserSettings.getManager(this.props.bus);
38+
39+
private readonly modelFactory = new DefaultNavDataBarFieldModelFactory(
40+
this.props.bus,
41+
this.props.fms,
42+
Subject.create(NavDataFieldGpsValidity.Valid),
43+
);
44+
45+
private readonly fieldRenderer = new Sr22tDestAirportInfoFieldRenderer(this.unitsSettingManager);
46+
47+
private readonly fieldSlots: VNode[] = Array.from(
48+
{ length: this.fieldTypes.length },
49+
() => <div class='nav-data-bar-field-slot' />
50+
);
51+
private readonly models: NavDataBarFieldModel<any>[] = [];
52+
53+
private clockSub?: Subscription;
54+
55+
/** @inheritdoc */
56+
public onAfterRender(): void {
57+
for (const [index, type] of this.fieldTypes.entries()) {
58+
const model = this.modelFactory.create(type);
59+
model.update();
60+
const field = this.fieldRenderer.render(type, model);
61+
62+
FSComponent.render(field, this.fieldSlots[index].instance as HTMLDivElement);
63+
this.models[index] = model;
64+
}
65+
66+
this.clockSub = this.props.bus.getSubscriber<ClockEvents>().on('realTime').whenChangedBy(1000 / this.props.updateFreq).handle(this.onUpdated.bind(this));
67+
}
68+
69+
/** Responds to update events. */
70+
private onUpdated(): void {
71+
for (let i = 0; i < this.fieldTypes.length; i++) {
72+
this.models[i].update();
73+
}
74+
}
75+
76+
/** @inheritdoc */
77+
public render(): VNode {
78+
return (
79+
<div class="sr22t-dest-airport-info-display">
80+
{this.fieldSlots}
81+
</div>
82+
);
83+
}
84+
85+
/** @inheritdoc */
86+
public destroy(): void {
87+
this.clockSub?.destroy();
88+
89+
for (let i = 0; i < this.fieldTypes.length; i++) {
90+
this.models[i]?.destroy();
91+
}
92+
}
93+
}

0 commit comments

Comments
 (0)