Skip to content
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

vtx: fetch powerlevel count from fc #2202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ var FC = {
power: 0,
pitmode: 0,
low_power_disarm: 0,
band_count: 0,
channel_count: 0,
power_count: 0,
};

this.ADVANCED_CONFIG = {
Expand Down
5 changes: 5 additions & 0 deletions js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,11 @@ var mspHelper = (function () {
// Ignore wether the VTX is ready for now
offset++;
FC.VTX_CONFIG.low_power_disarm = data.getUint8(offset++);
// Assume we got a vtx table
offset++;
FC.VTX_CONFIG.band_count = data.getUint8(offset++);
FC.VTX_CONFIG.channel_count = data.getUint8(offset++);
FC.VTX_CONFIG.power_count = data.getUint8(offset++);
}
break;
case MSPCodes.MSP_ADVANCED_CONFIG:
Expand Down
12 changes: 1 addition & 11 deletions js/vtx.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@ var VTX = (function() {

self.CHANNEL_MIN = 1;
self.CHANNEL_MAX = 8;

self.getMinPower = function(vtxDev) {
return 1;
}

self.getMaxPower = function(vtxDev) {
if ((vtxDev == self.DEV_SMARTAUDIO) || (vtxDev == self.DEV_TRAMP)) {
return 5;
}
return 3;
}
self.POWER_MIN = 1;

self.LOW_POWER_DISARM_MIN = 0;
self.LOW_POWER_DISARM_MAX = 2;
Expand Down
4 changes: 1 addition & 3 deletions tabs/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {

var vtx_power = $('#vtx_power');
vtx_power.empty();
var minPower = VTX.getMinPower(FC.VTX_CONFIG.device_type);
var maxPower = VTX.getMaxPower(FC.VTX_CONFIG.device_type);
for (var ii = minPower; ii <= maxPower; ii++) {
for (var ii = VTX.POWER_MIN; ii <= FC.VTX_CONFIG.power_count; ii++) {
var option = $('<option value="' + ii + '">' + ii + '</option>');
if (ii == FC.VTX_CONFIG.power) {
option.prop('selected', true);
Expand Down
Loading