Skip to content

Commit

Permalink
MSP 1.51 / Presets 0.4.0 (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdCopter authored Aug 18, 2021
1 parent 4e9a1e2 commit 8282a63
Show file tree
Hide file tree
Showing 3 changed files with 433 additions and 63 deletions.
21 changes: 21 additions & 0 deletions src/js/Features.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,27 @@ Features.prototype.findFeatureByBit = function (bit) {
}
}

Features.prototype.findFeatureByName = function (name) {
var self = this;

for (var i = 0; i < self._features.length; i++) {
if (self._features[i].name == name) {
return self._features[i];
}
}
}

Features.prototype.findBitValueByName = function (name) {
var self = this;

for (var i = 0; i < self._features.length; i++) {
if (self._features[i].name == name) {
return self._features[i].bit;
}
}
}


Features.prototype.updateData = function (featureElement) {
var self = this;

Expand Down
25 changes: 25 additions & 0 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ var helioUrlv020 = "https://raw.githubusercontent.com/emuflight/emuflight-preset
var nonHelioUrlv030 = "https://raw.githubusercontent.com/emuflight/emuflight-presets/master/presets-0.3.0/presets-nonHELIO.json";
var helioUrlv030 = "https://raw.githubusercontent.com/emuflight/emuflight-presets/master/presets-0.3.0/presets-HELIO.json";

var nonHelioUrlv040 = "https://raw.githubusercontent.com/emuflight/emuflight-presets/master/presets-0.4.0/presets-nonHELIO.json";
var helioUrlv040 = "https://raw.githubusercontent.com/emuflight/emuflight-presets/master/presets-0.4.0/presets-HELIO.json";

// TODO: migrate to a function to get rid of code duplication

client.get(nonHelioUrlv020, function(response) {
Expand Down Expand Up @@ -80,6 +83,28 @@ client.get(nonHelioUrlv030, function(response) {
})
});

client.get(nonHelioUrlv040, function(response) {
fs.writeFile(presetsFolders + "/presets-nonHELIO-v0.4.0.json", response, (err) => {
if (err) {
// FIXME: add error handling
console.error(err);
return;
}
//file written successfully
})
});

client.get(helioUrlv040, function(response) {
fs.writeFile(presetsFolders + "/presets-HELIO-v0.4.0.json", response, (err) => {
if (err) {
console.error(err);
return;
}
//file written successfully
})
});


$(document).ready(function () {
$.getJSON('version.json', function(data) {
CONFIGURATOR.version = data.version;
Expand Down
Loading

0 comments on commit 8282a63

Please sign in to comment.