Skip to content

Commit

Permalink
Try to detect BLHeli_M based on version number and display warning. R…
Browse files Browse the repository at this point in the history
…esolves #17
  • Loading branch information
stylesuxx committed Jan 5, 2022
1 parent 8113903 commit f6dd179
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Components/Flash/CommonSettings/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function CommonSettings({
}

if (!settingsDescriptions) {
const unsupportedNames = ['JESC'];
const unsupportedNames = ['JESC', 'BLHeli_M'];
const version = `${availableSettings.MAIN_REVISION}.${availableSettings.SUB_REVISION}`;

let unsupportedText = (
Expand Down
6 changes: 6 additions & 0 deletions src/changelog.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
[
{
"title": "Unreleased",
"items": [
"Enhancement: Detect BLHeli_M and recommend to use dedicated configurator"
]
},
{
"title": "0.21.0",
"items": [
Expand Down
26 changes: 22 additions & 4 deletions src/utils/FourWay.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class FourWay {
flash.settings = Convert.arrayToSettingsObject(settingsArray, layout);

/**
* Baased on the name we can decide if the initially guessed layout
* Based on the name we can decide if the initially guessed layout
* was correct, if not, we need to build a new settings object.
*/
let name = flash.settings.NAME;
Expand Down Expand Up @@ -328,6 +328,21 @@ class FourWay {
break;
}
}

/*
* If still no name, it might be BLHeli_M - this can unfortunately
* only be guessed based on the version - if it is 16.9, then it
* _might_ be BLHeli_M.
*/
if(flash.settings.NAME === '') {
if(
flash.settings.MAIN_REVISION === 16 &&
flash.settings.SUB_REVISION === 9
) {
flash.settings.NAME = 'BLHeli_M';
layout = null;
}
}
}

if(newLayout) {
Expand Down Expand Up @@ -376,16 +391,19 @@ class FourWay {
const blheliSLayouts = blheliSSource.getEscLayouts();
const bluejayLayouts = bluejaySource.getEscLayouts();

if (flash.settings.NAME === 'JESC') {
if (
flash.settings.NAME === 'JESC' ||
flash.settings.NAME === 'BLHeli_M'
) {
make = blheliSLayouts[layoutName].name;
const settings = flash.settings;
let revision = 'Unsupported/Unrecognized';
if(settings.MAIN_REVISION !== undefined && settings.SUB_REVISION !== undefined) {
revision = `${settings.MAIN_REVISION}.${settings.SUB_REVISION}`;
}

displayName = `${make} - JESC, ${revision}`;
firmwareName = 'JESC';
displayName = `${make} - ${flash.settings.NAME}, ${revision}`;
firmwareName = flash.settings.NAME;
} else if (bluejayEeprom.NAMES.includes(name) && layoutName in bluejayLayouts) {
make = bluejayLayouts[layoutName].name;
displayName = bluejaySource.buildDisplayName(flash, make);
Expand Down

0 comments on commit f6dd179

Please sign in to comment.