-
-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable or disable features according to port configuration #2840
Enable or disable features according to port configuration #2840
Conversation
b8dfb74
to
6dbfcf3
Compare
This comment has been minimized.
This comment has been minimized.
6dbfcf3
to
aee70af
Compare
This comment has been minimized.
This comment has been minimized.
6071317
to
7d234f2
Compare
This comment has been minimized.
This comment has been minimized.
The idea is great, but has some sense to define the port and disable the feature? If not, to me, the correct way is to remove completely the "feature" in the firmware, and make it enable it simply when defined the port. |
AUTOMERGE: (FAIL)
|
src/js/tabs/ports.js
Outdated
serialPortConfig.functions.forEach(e => { | ||
if (e === 'RX_SERIAL') { | ||
enableRxSerial = true; | ||
} | ||
|
||
if (e.startsWith("TELEMETRY")) { | ||
enableTelemetry = true; | ||
} | ||
}); | ||
|
||
if (serialPortConfig.functions.indexOf('BLACKBOX') >= 0) { | ||
enableBlackbox = true; | ||
} | ||
|
||
if (serialPortConfig.functions.indexOf('ESC_SENSOR') >= 0) { | ||
enableEsc = true; | ||
} | ||
|
||
if (serialPortConfig.functions.indexOf('GPS') >= 0) { | ||
enableGps = true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like that woudl work as well
serialPortConfig.functions.forEach(e => { | |
if (e === 'RX_SERIAL') { | |
enableRxSerial = true; | |
} | |
if (e.startsWith("TELEMETRY")) { | |
enableTelemetry = true; | |
} | |
}); | |
if (serialPortConfig.functions.indexOf('BLACKBOX') >= 0) { | |
enableBlackbox = true; | |
} | |
if (serialPortConfig.functions.indexOf('ESC_SENSOR') >= 0) { | |
enableEsc = true; | |
} | |
if (serialPortConfig.functions.indexOf('GPS') >= 0) { | |
enableGps = true; | |
} | |
let functions = serialPortConfig.functions | |
enableRxSerial = functions.includes('RX_SERIAL'); | |
enableTelemetry = functions.some(e => e.startsWith("TELEMETRY")); | |
enableBlackbox = functions.includes('BLACKBOX'); | |
enableEsc = functions.includes('ESC_SENSOR'); | |
enableGps = functions.includes('GPS'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Much easier to read.
7d234f2
to
bdffebd
Compare
This comment has been minimized.
This comment has been minimized.
bdffebd
to
bfc9daf
Compare
This comment has been minimized.
This comment has been minimized.
dff7a04
to
84670ef
Compare
This comment has been minimized.
This comment has been minimized.
84670ef
to
c9de010
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As requested, I can approve it if you want, but as I said, I think this is not the correct approach.
This is a workaround more that we need to maintain in the Configurator.
I think that if we want that something is enabled or disabled automatically, is better to remove the feature in the firmware and simply make it enabled by default. Or if we want to maintain the feature, enable it in the firmware not in the Configurator when it receives the MSP command.
The problem with the Configurator is that we need to maintain backward compatibility, if the things change between versions, we need to maintain old and new code. If we do this in the firmware part and it changes in a future, the old code is simply removed and new code replaces it.
i would agree, sounds reasonable |
Could VTX tab be hided with the same logic in this PR? Discussed it with @limonspb a week ago and was going to open own PR. P.S. I like @McGiverGim proposion |
c9de010
to
ee3b53c
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Do you want to test this code? Here you have an automated build: |
Fixes: #329