From 6e50fb9a65efbf4a748e6d63a2b332d81de8c33f Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Sun, 20 Oct 2024 02:08:10 +0200 Subject: [PATCH] Add softserial as build option (#4202) --- src/js/Features.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/js/Features.js b/src/js/Features.js index 13e48959f1..f181e7220f 100644 --- a/src/js/Features.js +++ b/src/js/Features.js @@ -1,5 +1,5 @@ import { bit_check, bit_set, bit_clear } from "./bit"; -import { API_VERSION_1_45, API_VERSION_1_46 } from './data_storage'; +import { API_VERSION_1_45, API_VERSION_1_46, API_VERSION_1_47 } from './data_storage'; import semver from "semver"; import { tracking } from "./Analytics"; import $ from 'jquery'; @@ -34,6 +34,18 @@ const Features = function (config) { self._features = features; + function addFeatureDependsOn(obj, featureName, dependsOn) { + obj.forEach(f => { + if (f.name === featureName) { + f.dependsOn = dependsOn; + } + }); + } + + if (semver.gte(config.apiVersion, API_VERSION_1_47)) { + addFeatureDependsOn(self._features, 'SOFTSERIAL', 'SOFTSERIAL'); + } + if (config.buildOptions?.length) { // Filter features based on build options if (semver.gte(config.apiVersion, API_VERSION_1_45)) { @@ -46,7 +58,7 @@ const Features = function (config) { } } - // Add TELEMETRY feature if any of the following protocols are used: CRSF, GHST, FPORT + // Add TELEMETRY feature if any of the following protocols are used: CRSF, GHST, FPORT, JETI if (semver.gte(config.apiVersion, API_VERSION_1_46)) { let enableTelemetry = false; if (config.buildOptions.some(opt => opt.includes('CRSF') || opt.includes('GHST') || opt.includes('FPORT') || opt.includes('JETI'))) {