Skip to content

Commit 24010a2

Browse files
committed
Move FC global vars inside FC object
1 parent b9137a6 commit 24010a2

32 files changed

+2837
-2835
lines changed

src/js/CliAutoComplete.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var CliAutoComplete = {
1212
};
1313

1414
CliAutoComplete.isEnabled = function() {
15-
return this.isBuilding() || (this.configEnabled && CONFIG.flightControllerIdentifier == "BTFL" && this.builder.state != 'fail');
15+
return this.isBuilding() || (this.configEnabled && FC.CONFIG.flightControllerIdentifier == "BTFL" && this.builder.state != 'fail');
1616
};
1717

1818
CliAutoComplete.isBuilding = function() {
@@ -397,7 +397,7 @@ CliAutoComplete._initTextcomplete = function() {
397397
search: function(term, callback, match) {
398398
sendOnEnter = false;
399399
var arr = cache.resources;
400-
if (semver.gte(CONFIG.flightControllerVersion, "4.0.0")) {
400+
if (semver.gte(FC.CONFIG.flightControllerVersion, "4.0.0")) {
401401
arr = ['show'].concat(arr);
402402
} else {
403403
arr = ['list'].concat(arr);
@@ -509,7 +509,7 @@ CliAutoComplete._initTextcomplete = function() {
509509
})
510510
]);
511511

512-
if (semver.gte(CONFIG.flightControllerVersion, "4.0.0")) {
512+
if (semver.gte(FC.CONFIG.flightControllerVersion, "4.0.0")) {
513513
$textarea.textcomplete('register', [
514514
strategy({ // "resource show all", from BF 4.0.0 onwards
515515
match: /^(\s*resource\s+show\s+)(\w*)$/i,
@@ -527,12 +527,12 @@ CliAutoComplete._initTextcomplete = function() {
527527
var diffArgs1 = ["master", "profile", "rates", "all"];
528528
var diffArgs2 = [];
529529

530-
if (semver.lt(CONFIG.flightControllerVersion, "3.4.0")) {
530+
if (semver.lt(FC.CONFIG.flightControllerVersion, "3.4.0")) {
531531
diffArgs2.push("showdefaults");
532532
} else {
533533
// above 3.4.0
534534
diffArgs2.push("defaults");
535-
if (semver.gte(CONFIG.flightControllerVersion, "4.0.0")) {
535+
if (semver.gte(FC.CONFIG.flightControllerVersion, "4.0.0")) {
536536
diffArgs1.push("hardware");
537537
diffArgs2.push("bare");
538538
}

src/js/Features.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,27 @@ var Features = function (config) {
3333
);
3434
}
3535

36-
if (semver.gte(CONFIG.apiVersion, "1.15.0") && !semver.gte(CONFIG.apiVersion, "1.36.0")) {
36+
if (semver.gte(FC.CONFIG.apiVersion, "1.15.0") && !semver.gte(FC.CONFIG.apiVersion, "1.36.0")) {
3737
features.push(
3838
{bit: 8, group: 'rxFailsafe', name: 'FAILSAFE', haveTip: true}
3939
);
4040
}
4141

42-
if (semver.gte(CONFIG.apiVersion, "1.16.0")) {
42+
if (semver.gte(FC.CONFIG.apiVersion, "1.16.0")) {
4343
features.push(
4444
{bit: 21, group: 'other', name: 'TRANSPONDER', haveTip: true}
4545
);
4646
}
4747

4848
if (config.flightControllerVersion !== '') {
49-
if (semver.gte(CONFIG.apiVersion, "1.16.0")) {
49+
if (semver.gte(FC.CONFIG.apiVersion, "1.16.0")) {
5050
features.push(
5151
{bit: 22, group: 'other', name: 'AIRMODE'}
5252
);
5353
}
5454

55-
if (semver.gte(CONFIG.apiVersion, "1.16.0")) {
56-
if (semver.lt(CONFIG.apiVersion, "1.20.0")) {
55+
if (semver.gte(FC.CONFIG.apiVersion, "1.16.0")) {
56+
if (semver.lt(FC.CONFIG.apiVersion, "1.20.0")) {
5757
features.push(
5858
{bit: 23, group: 'superexpoRates', name: 'SUPEREXPO_RATES'}
5959
);
@@ -64,32 +64,32 @@ var Features = function (config) {
6464
}
6565
}
6666

67-
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
67+
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
6868
features.push(
6969
{bit: 18, group: 'other', name: 'OSD'}
7070
);
71-
if (!semver.gte(CONFIG.apiVersion, "1.35.0")) {
71+
if (!semver.gte(FC.CONFIG.apiVersion, "1.35.0")) {
7272
features.push(
7373
{bit: 24, group: 'other', name: 'VTX'}
7474
)
7575
}
7676
}
7777

78-
if (semver.gte(CONFIG.apiVersion, "1.31.0")) {
78+
if (semver.gte(FC.CONFIG.apiVersion, "1.31.0")) {
7979
features.push(
8080
{bit: 25, group: 'rxMode', mode: 'select', name: 'RX_SPI'},
8181
{bit: 27, group: 'escSensor', name: 'ESC_SENSOR'}
8282
);
8383
}
8484

85-
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
85+
if (semver.gte(FC.CONFIG.apiVersion, "1.36.0")) {
8686
features.push(
8787
{bit: 28, group: 'antiGravity', name: 'ANTI_GRAVITY', haveTip: true, hideName: true},
8888
{bit: 29, group: 'other', name: 'DYNAMIC_FILTER'}
8989
);
9090
}
9191

92-
if (!semver.gte(CONFIG.apiVersion, "1.36.0")) {
92+
if (!semver.gte(FC.CONFIG.apiVersion, "1.36.0")) {
9393
features.push(
9494
{bit: 1, group: 'batteryVoltage', name: 'VBAT'},
9595
{bit: 11, group: 'batteryCurrent', name: 'CURRENT_METER'}

src/js/RateCurve.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ var RateCurve = function (useLegacyCurve) {
8888
var expoPower;
8989
var rcRateConstant;
9090

91-
if (semver.gte(CONFIG.apiVersion, "1.20.0")) {
91+
if (semver.gte(FC.CONFIG.apiVersion, "1.20.0")) {
9292
expoPower = 3;
9393
rcRateConstant = 200;
9494
} else {
@@ -157,7 +157,7 @@ RateCurve.prototype.rcCommandRawToDegreesPerSecond = function (rcData, rate, rcR
157157

158158
if (rate !== undefined && rcRate !== undefined && rcExpo !== undefined) {
159159
let rcCommandf = this.rcCommand(rcData, 1, deadband);
160-
if (semver.gte(CONFIG.apiVersion, API_VERSION_1_43)) {
160+
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_43)) {
161161
rcCommandf = rcCommandf / (500 - deadband);
162162
} else {
163163
rcCommandf = rcCommandf / 500;

0 commit comments

Comments
 (0)