Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Supported modules:
* OH-58D Kiowa Warrior
* UH-60L Blackhawk
* Hercules (Requires patch available at https://github.com/Summit60/DCS-Hercules-TheWay-patch)
* CH-47F

Multiplayer is supported as long as the server has Player Exports turned on (most servers do).

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theway",
"version": "2.5.0",
"version": "2.5.3",
"private": true,
"main": "electron/electron.js",
"dependencies": {
Expand Down
Binary file added public/assets/moduleImages/CH-47Fbl1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/moduleCommands/GetModuleCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import miragef1 from "./miragef1";
import uh60l from "./uh60l";
import hercules from "./Hercules";
import oh58d from "./oh58d";
import ch47f from "./ch47f";

export default function getModuleCommands(module, waypoints, buttonExtraDelay) {
switch (module) {
Expand Down Expand Up @@ -88,6 +89,10 @@ export default function getModuleCommands(module, waypoints, buttonExtraDelay) {
oh58d.slotVariant = "OH58Dleft-seat";
return oh58d.createButtonCommands(waypoints);
}
case "CH-47Fbl1": {
ch47f.extraDelay = buttonExtraDelay;
return ch47f.createButtonCommands(waypoints);
}
default:
return [];
}
Expand Down
228 changes: 228 additions & 0 deletions src/moduleCommands/ch47f.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
class ch47f {
static extraDelay = 0; // TODO remove this (back to 0)
static #delay100 = this.extraDelay + 100;
static #delay200 = this.extraDelay + 200;
static #delay500 = this.extraDelay + 500;
static #delay800 = this.extraDelay + 800;
static #delay1000 = this.extraDelay + 1000;
static #kuKeycodes = {
1: 3030,
2: 3031,
3: 3032,
4: 3033,
5: 3034,
6: 3035,
7: 3036,
8: 3037,
9: 3038,
0: 3039,
a: 3043,
b: 3044,
c: 3045,
d: 3046,
e: 3047,
f: 3048,
g: 3049,
h: 3050,
i: 3051,
j: 3052,
k: 3053,
l: 3054,
m: 3055,
n: 3056,
o: 3057,
p: 3058,
q: 3059,
r: 3060,
s: 3061,
t: 3062,
u: 3063,
v: 3064,
w: 3065,
x: 3066,
y: 3067,
z: 3068,
".": 3040,
"/": 3042,
up: 3026,
down: 3027
};
static #codesPayload = [];

static #addKeyboardCode(character) {
const characterCode = this.#kuKeycodes[character.toLowerCase()];
if (characterCode !== undefined)
this.#codesPayload.push({
device: 3,
code: characterCode,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});
}

static createButtonCommands(waypoints) {
this.#codesPayload = [];
// Press Index Key for main menu
this.#codesPayload.push({
device: 3,
code: 3004,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});
// Select Procedures/PATT List
this.#codesPayload.push({
device: 3,
code: 3013,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});
// Select ACP
this.#codesPayload.push({
device: 3,
code: 3013,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});

// //Increment waypoint - UP ARROW (start after current selected ACP) props not needed, delete in PR
// this.#codesPayload.push({
// device: 3,
// code: 3026,
// delay: this.#delay800,
// activate: 1,
// addDepress: "true",
// });

for (const waypoint of waypoints) {
//Clear the Scatchpad
this.#codesPayload.push({
device: 3,
code: 3028,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});

//Increment waypoint - UP ARROW (start after current selected ACP)
this.#codesPayload.push({
device: 3,
code: 3026,
delay: this.#delay800,
activate: 1,
addDepress: "true",
});

//Type hem
if (waypoint.latHem === "N") {
this.#codesPayload.push({
device: 3,
code: 3056,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});
} else {
this.#codesPayload.push({
device: 3,
code: 3061,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});
}

//Type lat
for (let i = 0; i < waypoint.lat.length; i++) {
if (i !== 2) { // remove first "."
this.#addKeyboardCode(waypoint.lat.charAt(i));
}

}

//Type hem
if (waypoint.longHem === "E") {
this.#codesPayload.push({
device: 3,
code: 3047,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});
} else {
this.#codesPayload.push({
device: 3,
code: 3065,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});
}

//Type long
for (let i = 0; i < waypoint.long.length; i++) {
console.log(waypoint.long.charAt(i), i);
if (i !== 3) { // remove first "."
this.#addKeyboardCode(waypoint.long.charAt(i));
}
}

// Press LSK L1 to enter coordinates
this.#codesPayload.push({
device: 3,
code: 3008,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});

//Type elev
for (let i = 0; i < waypoint.elev.length; i++) {
this.#addKeyboardCode(waypoint.elev.charAt(i));
}

// Press LSK L3 to enter elevation
this.#codesPayload.push({
device: 3,
code: 3010,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});

// Press /
this.#codesPayload.push({
device: 3,
code: 3042,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});

//Type name
// const waypointNameLength = waypoint.name.length < 12 ? waypoint.name.length : 12;
// console.log(waypoint.name);
const match = waypoint.name.match(/^Waypoint (\d+)$/);
if (match) { waypoint.name = match[1];}
for (let i = 0; i < Math.min(waypoint.name.length, 9); i++) {
this.#addKeyboardCode(waypoint.name.charAt(i));
}

// Press LSK L2 to enter waypoint number
this.#codesPayload.push({
device: 3,
code: 3009,
delay: this.#delay100,
activate: 1,
addDepress: "true",
});
}

return this.#codesPayload;
}
}

export default ch47f;
3 changes: 2 additions & 1 deletion src/utils/ConvertModuleWaypoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const convert = (dcsWaypoints, module) => {
case "A-10C_2":
case "A-10C":
case "Hercules":
case "M-2000C": {
case "M-2000C":
case "CH-47Fbl1": {
// lat 00.00.000 DMM
//long 000.00.000
let waypoints = [];
Expand Down
1 change: 1 addition & 0 deletions src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ export const supportedModules = [
"UH-60L",
"Hercules",
"OH58D",
"CH-47Fbl1"
];