Skip to content

Commit 05426a3

Browse files
authored
Merge pull request #571 from basdelfos/3.1.x-fixes
3.1.x fixes
2 parents 9d240fb + f95b6f1 commit 05426a3

File tree

10 files changed

+451
-57
lines changed

10 files changed

+451
-57
lines changed

_locales/en/messages.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,6 +2480,42 @@
24802480
"configurationMagHardware": {
24812481
"message": "Magnetometer (if supported)"
24822482
},
2483+
"configurationBatteryVoltage": {
2484+
"message": "Battery Voltage"
2485+
},
2486+
"configurationBatteryCurrent": {
2487+
"message": "Battery Current"
2488+
},
2489+
"configurationBatteryMeterType": {
2490+
"message": "Battery Meter Type"
2491+
},
2492+
"configurationBatteryMinimum": {
2493+
"message": "Minimum Cell Voltage"
2494+
},
2495+
"configurationBatteryMaximum": {
2496+
"message": "Maximum Cell Voltage"
2497+
},
2498+
"configurationBatteryWarning": {
2499+
"message": "Warning Cell Voltage"
2500+
},
2501+
"configurationBatteryScale": {
2502+
"message": "Voltage Scale"
2503+
},
2504+
"configurationCurrentMeterType": {
2505+
"message": "Current Meter Type"
2506+
},
2507+
"configurationCurrent": {
2508+
"message": "Current Sensor"
2509+
},
2510+
"configurationCurrentScale": {
2511+
"message": "Scale the output voltage to milliamps [1/10th mV/A]"
2512+
},
2513+
"configurationCurrentOffset": {
2514+
"message": "Offset in millivolt steps"
2515+
},
2516+
"configurationBatteryMultiwiiCurrent": {
2517+
"message": "Enable support for legacy Multiwii MSP current output"
2518+
},
24832519
"pidTuningProfile": {
24842520
"message": "Profile"
24852521
},

changelog.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<span>2016.07.29 - 3.1.2 - BetaFlight</span>
1+
<span>2017.07.29 - 3.1.3 - BetaFlight</span>
22
<ul>
3-
<li>First version suitable for 3.2 features</li>
3+
<li>Fixed incompatibility issues with BF 3.1.x</li>
44
</ul>
5-
<span>2016.03.09 - 3.1.1 - BetaFlight</span>
5+
<span>2017.07.28 - 3.1.1 - BetaFlight</span>
66
<ul>
77
<li>Changed donation page to english</li>
88
</ul>

js/fc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
// define all the global variables that are uses to hold FC state
44
var CONFIG;
5+
var BF_CONFIG; // Remove when we officialy retire BF 3.1
56
var FEATURE_CONFIG;
67
var BEEPER_CONFIG;
78
var MIXER_CONFIG;
@@ -79,6 +80,13 @@ var FC = {
7980
boardType: 0,
8081
};
8182

83+
BF_CONFIG = {
84+
currentscale: 0,
85+
currentoffset: 0,
86+
currentmetertype: 0,
87+
batterycapacity: 0,
88+
};
89+
8290
FEATURE_CONFIG = {
8391
features: 0,
8492
};
@@ -228,6 +236,7 @@ var FC = {
228236
vbatmincellvoltage: 0,
229237
vbatmaxcellvoltage: 0,
230238
vbatwarningcellvoltage: 0,
239+
batterymetertype: 1, // 1=ADC, 2=ESC
231240
};
232241
MOTOR_CONFIG = {
233242
minthrottle: 0,

js/msp/MSPHelper.js

Lines changed: 63 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
171171
}
172172
break;
173173
case MSPCodes.MSP_CURRENT_METERS:
174+
174175
CURRENT_METERS = [];
175176
var currentMeterLength = 5;
176177
for (var i = 0; i < (data.byteLength / currentMeterLength); i++) {
@@ -192,46 +193,63 @@ MspHelper.prototype.process_data = function(dataHandler) {
192193
break;
193194

194195
case MSPCodes.MSP_VOLTAGE_METER_CONFIG:
195-
VOLTAGE_METER_CONFIGS = [];
196-
var voltage_meter_count = data.readU8();
197-
198-
for (var i = 0; i < voltage_meter_count; i++) {
199-
var subframe_length = data.readU8();
200-
if (subframe_length != 5) {
201-
for (var j = 0; j < subframe_length; j++) {
202-
data.readU8();
196+
if (semver.lt(CONFIG.apiVersion, "1.36.0")) {
197+
MISC.vbatscale = data.readU8(); // 10-200
198+
MISC.vbatmincellvoltage = data.readU8() / 10; // 10-50
199+
MISC.vbatmaxcellvoltage = data.readU8() / 10; // 10-50
200+
MISC.vbatwarningcellvoltage = data.readU8() / 10; // 10-50
201+
if (semver.gte(CONFIG.apiVersion, "1.23.0")) {
202+
MISC.batterymetertype = data.readU8();
203+
}
204+
} else {
205+
VOLTAGE_METER_CONFIGS = [];
206+
var voltage_meter_count = data.readU8();
207+
208+
for (var i = 0; i < voltage_meter_count; i++) {
209+
var subframe_length = data.readU8();
210+
if (subframe_length != 5) {
211+
for (var j = 0; j < subframe_length; j++) {
212+
data.readU8();
213+
}
214+
} else {
215+
var voltageMeterConfig = {};
216+
voltageMeterConfig.id = data.readU8();
217+
voltageMeterConfig.sensorType = data.readU8();
218+
voltageMeterConfig.vbatscale = data.readU8();
219+
voltageMeterConfig.vbatresdivval = data.readU8();
220+
voltageMeterConfig.vbatresdivmultiplier = data.readU8();
221+
222+
VOLTAGE_METER_CONFIGS.push(voltageMeterConfig);
203223
}
204-
} else {
205-
var voltageMeterConfig = {};
206-
voltageMeterConfig.id = data.readU8();
207-
voltageMeterConfig.sensorType = data.readU8();
208-
voltageMeterConfig.vbatscale = data.readU8();
209-
voltageMeterConfig.vbatresdivval = data.readU8();
210-
voltageMeterConfig.vbatresdivmultiplier = data.readU8();
211-
212-
VOLTAGE_METER_CONFIGS.push(voltageMeterConfig);
213224
}
214225
}
215226
break;
216227
case MSPCodes.MSP_CURRENT_METER_CONFIG:
217-
var offset = 0;
218-
CURRENT_METER_CONFIGS = [];
219-
var current_meter_count = data.readU8();
220-
for (var i = 0; i < current_meter_count; i++) {
221-
var currentMeterConfig = {};
222-
var subframe_length = data.readU8();
223-
224-
if (subframe_length != 6) {
225-
for (var j = 0; j < subframe_length; j++) {
226-
data.readU8();
227-
}
228-
} else {
229-
currentMeterConfig.id = data.readU8();
230-
currentMeterConfig.sensorType = data.readU8();
231-
currentMeterConfig.scale = data.readU16();
232-
currentMeterConfig.offset = data.readU16();
228+
if (semver.lt(CONFIG.apiVersion, "1.36.0")) {
229+
BF_CONFIG.currentscale = data.read16();
230+
BF_CONFIG.currentoffset = data.read16();
231+
BF_CONFIG.currentmetertype = data.readU8();
232+
BF_CONFIG.batterycapacity = data.readU16();
233+
} else {
234+
var offset = 0;
235+
CURRENT_METER_CONFIGS = [];
236+
var current_meter_count = data.readU8();
237+
for (var i = 0; i < current_meter_count; i++) {
238+
var currentMeterConfig = {};
239+
var subframe_length = data.readU8();
240+
241+
if (subframe_length != 6) {
242+
for (var j = 0; j < subframe_length; j++) {
243+
data.readU8();
244+
}
245+
} else {
246+
currentMeterConfig.id = data.readU8();
247+
currentMeterConfig.sensorType = data.readU8();
248+
currentMeterConfig.scale = data.readU16();
249+
currentMeterConfig.offset = data.readU16();
233250

234-
CURRENT_METER_CONFIGS.push(currentMeterConfig);
251+
CURRENT_METER_CONFIGS.push(currentMeterConfig);
252+
}
235253
}
236254
}
237255
break;
@@ -557,7 +575,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
557575

558576
case MSPCodes.MSP_MIXER_CONFIG:
559577
MIXER_CONFIG.mixer = data.readU8();
560-
MIXER_CONFIG.reverseMotorDir = data.readU8();
578+
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
579+
MIXER_CONFIG.reverseMotorDir = data.readU8();
580+
}
561581
break;
562582

563583
case MSPCodes.MSP_FEATURE_CONFIG:
@@ -1161,7 +1181,9 @@ MspHelper.prototype.crunch = function(code) {
11611181
break;
11621182
case MSPCodes.MSP_SET_MIXER_CONFIG:
11631183
buffer.push8(MIXER_CONFIG.mixer)
1164-
.push8(MIXER_CONFIG.reverseMotorDir);
1184+
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
1185+
buffer.push8(MIXER_CONFIG.reverseMotorDir);
1186+
}
11651187
break;
11661188
case MSPCodes.MSP_SET_BOARD_ALIGNMENT_CONFIG:
11671189
buffer.push16(BOARD_ALIGNMENT_CONFIG.roll)
@@ -1269,19 +1291,19 @@ MspHelper.prototype.crunch = function(code) {
12691291
case MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG:
12701292
if (semver.lt(CONFIG.apiVersion, "1.36.0")) {
12711293
buffer.push8(MISC.vbatscale)
1272-
.push8(Math.round(BATTERY_CONFIG.vbatmincellvoltage * 10))
1273-
.push8(Math.round(BATTERY_CONFIG.vbatmaxcellvoltage * 10))
1274-
.push8(Math.round(BATTERY_CONFIG.vbatwarningcellvoltage * 10));
1294+
.push8(Math.round(MISC.vbatmincellvoltage * 10))
1295+
.push8(Math.round(MISC.vbatmaxcellvoltage * 10))
1296+
.push8(Math.round(MISC.vbatwarningcellvoltage * 10));
12751297
if (semver.gte(CONFIG.apiVersion, "1.23.0")) {
1276-
buffer.push8(BATTERY_CONFIG.voltageMeterSource);
1298+
buffer.push8(MISC.batterymetertype);
12771299
}
12781300
}
12791301
break;
12801302
case MSPCodes.MSP_SET_CURRENT_METER_CONFIG:
12811303
if (semver.lt(CONFIG.apiVersion, "1.36.0")) {
12821304
buffer.push16(BF_CONFIG.currentscale)
12831305
.push16(BF_CONFIG.currentoffset)
1284-
.push8(BATTERY_CONFIG.currentMeterSource)
1306+
.push8(BF_CONFIG.currentmetertype)
12851307
.push16(BF_CONFIG.batterycapacity)
12861308
}
12871309
break;

main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,11 +470,18 @@ function updateTabList(features) {
470470
} else {
471471
$('#tabs ul.mode-connected li.tab_transponder').hide();
472472
}
473+
473474
if (features.isEnabled('OSD')) {
474475
$('#tabs ul.mode-connected li.tab_osd').show();
475476
} else {
476477
$('#tabs ul.mode-connected li.tab_osd').hide();
477478
}
479+
480+
if (semver.gte(CONFIG.apiVersion, "1.36.0")) {
481+
$('#tabs ul.mode-connected li.tab_power').show();
482+
} else {
483+
$('#tabs ul.mode-connected li.tab_power').hide();
484+
}
478485
}
479486

480487
function zeroPad(value, width) {

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"minimum_chrome_version": "38",
4-
"version": "3.1.2",
4+
"version": "3.1.3",
55
"author": "Betaflight Squad",
66
"name": "Betaflight - Configurator",
77
"short_name": "Betaflight",

tabs/configuration.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,21 @@
291291
width: 150px;
292292
}
293293

294-
.tab-configuration .currentMeterSource {
294+
.tab-configuration .currentmetertype {
295295
border: 1px solid silver;
296296
margin-right: 5px;
297297
float: left;
298298
width: 150px;
299299
}
300300

301+
.tab-configuration .vbatmonitoring {
302+
margin-top: 5px;
303+
}
304+
305+
.tab-configuration .currentMonitoring {
306+
margin-top: 5px;
307+
}
308+
301309
.tab-configuration .rssi td:nth-child(2) {
302310
width: 30px;
303311
}

0 commit comments

Comments
 (0)