mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 00:05:22 +03:00
Added dropdown for current and battery meter selection to configuration tab
This commit is contained in:
parent
7350ff9cba
commit
591d907016
7 changed files with 345 additions and 202 deletions
|
@ -665,6 +665,9 @@
|
||||||
"configurationBatteryCurrent": {
|
"configurationBatteryCurrent": {
|
||||||
"message": "Battery Current"
|
"message": "Battery Current"
|
||||||
},
|
},
|
||||||
|
"configurationBatteryMeterType": {
|
||||||
|
"message": "Battery Meter Type"
|
||||||
|
},
|
||||||
"configurationBatteryMinimum": {
|
"configurationBatteryMinimum": {
|
||||||
"message": "Minimum Cell Voltage"
|
"message": "Minimum Cell Voltage"
|
||||||
},
|
},
|
||||||
|
@ -677,6 +680,9 @@
|
||||||
"configurationBatteryScale": {
|
"configurationBatteryScale": {
|
||||||
"message": "Voltage Scale"
|
"message": "Voltage Scale"
|
||||||
},
|
},
|
||||||
|
"configurationCurrentMeterType": {
|
||||||
|
"message": "Current Meter Type"
|
||||||
|
},
|
||||||
"configurationCurrent": {
|
"configurationCurrent": {
|
||||||
"message": "Current Sensor"
|
"message": "Current Sensor"
|
||||||
},
|
},
|
||||||
|
|
7
js/fc.js
7
js/fc.js
|
@ -74,7 +74,9 @@ var FC = {
|
||||||
board_align_pitch: 0,
|
board_align_pitch: 0,
|
||||||
board_align_yaw: 0,
|
board_align_yaw: 0,
|
||||||
currentscale: 0,
|
currentscale: 0,
|
||||||
currentoffset: 0
|
currentoffset: 0,
|
||||||
|
currentmetertype: 0,
|
||||||
|
batterycapacity: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
LED_STRIP = [];
|
LED_STRIP = [];
|
||||||
|
@ -199,7 +201,8 @@ var FC = {
|
||||||
vbatscale: 0,
|
vbatscale: 0,
|
||||||
vbatmincellvoltage: 0,
|
vbatmincellvoltage: 0,
|
||||||
vbatmaxcellvoltage: 0,
|
vbatmaxcellvoltage: 0,
|
||||||
vbatwarningcellvoltage: 0
|
vbatwarningcellvoltage: 0,
|
||||||
|
batterymetertype: 1, // 1=ADC, 2=ESC
|
||||||
};
|
};
|
||||||
|
|
||||||
_3D = {
|
_3D = {
|
||||||
|
|
|
@ -2,129 +2,134 @@
|
||||||
|
|
||||||
//MSPCodes needs to be re-integrated inside MSP object
|
//MSPCodes needs to be re-integrated inside MSP object
|
||||||
var MSPCodes = {
|
var MSPCodes = {
|
||||||
MSP_API_VERSION: 1,
|
MSP_API_VERSION: 1,
|
||||||
MSP_FC_VARIANT: 2,
|
MSP_FC_VARIANT: 2,
|
||||||
MSP_FC_VERSION: 3,
|
MSP_FC_VERSION: 3,
|
||||||
MSP_BOARD_INFO: 4,
|
MSP_BOARD_INFO: 4,
|
||||||
MSP_BUILD_INFO: 5,
|
MSP_BUILD_INFO: 5,
|
||||||
|
|
||||||
MSP_NAME: 10,
|
MSP_NAME: 10,
|
||||||
MSP_SET_NAME: 11,
|
MSP_SET_NAME: 11,
|
||||||
|
|
||||||
MSP_CHANNEL_FORWARDING: 32,
|
MSP_CHANNEL_FORWARDING: 32,
|
||||||
MSP_SET_CHANNEL_FORWARDING: 33,
|
MSP_SET_CHANNEL_FORWARDING: 33,
|
||||||
MSP_MODE_RANGES: 34,
|
MSP_MODE_RANGES: 34,
|
||||||
MSP_SET_MODE_RANGE: 35,
|
MSP_SET_MODE_RANGE: 35,
|
||||||
|
|
||||||
MSP_RX_CONFIG: 44,
|
MSP_CURRENT_METER_CONFIG: 40,
|
||||||
MSP_SET_RX_CONFIG: 45,
|
MSP_SET_CURRENT_METER_CONFIG: 41,
|
||||||
MSP_LED_COLORS: 46,
|
|
||||||
MSP_SET_LED_COLORS: 47,
|
|
||||||
MSP_LED_STRIP_CONFIG: 48,
|
|
||||||
MSP_SET_LED_STRIP_CONFIG: 49,
|
|
||||||
|
|
||||||
MSP_ADJUSTMENT_RANGES: 52,
|
MSP_RX_CONFIG: 44,
|
||||||
MSP_SET_ADJUSTMENT_RANGE: 53,
|
MSP_SET_RX_CONFIG: 45,
|
||||||
MSP_CF_SERIAL_CONFIG: 54,
|
MSP_LED_COLORS: 46,
|
||||||
MSP_SET_CF_SERIAL_CONFIG: 55,
|
MSP_SET_LED_COLORS: 47,
|
||||||
MSP_SONAR: 58,
|
MSP_LED_STRIP_CONFIG: 48,
|
||||||
MSP_PID_CONTROLLER: 59,
|
MSP_SET_LED_STRIP_CONFIG: 49,
|
||||||
MSP_SET_PID_CONTROLLER: 60,
|
|
||||||
MSP_ARMING_CONFIG: 61,
|
|
||||||
MSP_SET_ARMING_CONFIG: 62,
|
|
||||||
MSP_RX_MAP: 64,
|
|
||||||
MSP_SET_RX_MAP: 65,
|
|
||||||
MSP_BF_CONFIG: 66,
|
|
||||||
MSP_SET_BF_CONFIG: 67,
|
|
||||||
MSP_SET_REBOOT: 68,
|
|
||||||
MSP_BF_BUILD_INFO: 69, // Not used
|
|
||||||
MSP_DATAFLASH_SUMMARY: 70,
|
|
||||||
MSP_DATAFLASH_READ: 71,
|
|
||||||
MSP_DATAFLASH_ERASE: 72,
|
|
||||||
MSP_LOOP_TIME: 73,
|
|
||||||
MSP_SET_LOOP_TIME: 74,
|
|
||||||
MSP_FAILSAFE_CONFIG: 75,
|
|
||||||
MSP_SET_FAILSAFE_CONFIG: 76,
|
|
||||||
MSP_RXFAIL_CONFIG: 77,
|
|
||||||
MSP_SET_RXFAIL_CONFIG: 78,
|
|
||||||
MSP_SDCARD_SUMMARY: 79,
|
|
||||||
MSP_BLACKBOX_CONFIG: 80,
|
|
||||||
MSP_SET_BLACKBOX_CONFIG: 81,
|
|
||||||
MSP_TRANSPONDER_CONFIG: 82,
|
|
||||||
MSP_SET_TRANSPONDER_CONFIG: 83,
|
|
||||||
MSP_OSD_CONFIG: 84,
|
|
||||||
MSP_SET_OSD_CONFIG: 85,
|
|
||||||
MSP_OSD_CHAR_READ: 86,
|
|
||||||
MSP_OSD_CHAR_WRITE: 87,
|
|
||||||
MSP_VTX_CONFIG: 88,
|
|
||||||
MSP_SET_VTX_CONFIG: 89,
|
|
||||||
MSP_ADVANCED_CONFIG: 90,
|
|
||||||
MSP_SET_ADVANCED_CONFIG: 91,
|
|
||||||
MSP_FILTER_CONFIG: 92,
|
|
||||||
MSP_SET_FILTER_CONFIG: 93,
|
|
||||||
MSP_PID_ADVANCED: 94,
|
|
||||||
MSP_SET_PID_ADVANCED: 95,
|
|
||||||
MSP_SENSOR_CONFIG: 96,
|
|
||||||
MSP_SET_SENSOR_CONFIG: 97,
|
|
||||||
MSP_SPECIAL_PARAMETERS: 98,
|
|
||||||
MSP_SET_SPECIAL_PARAMETERS: 99,
|
|
||||||
MSP_IDENT: 100, // Not used
|
|
||||||
MSP_STATUS: 101,
|
|
||||||
MSP_RAW_IMU: 102,
|
|
||||||
MSP_SERVO: 103,
|
|
||||||
MSP_MOTOR: 104,
|
|
||||||
MSP_RC: 105,
|
|
||||||
MSP_RAW_GPS: 106,
|
|
||||||
MSP_COMP_GPS: 107,
|
|
||||||
MSP_ATTITUDE: 108,
|
|
||||||
MSP_ALTITUDE: 109,
|
|
||||||
MSP_ANALOG: 110,
|
|
||||||
MSP_RC_TUNING: 111,
|
|
||||||
MSP_PID: 112,
|
|
||||||
MSP_BOX: 113, // Not used
|
|
||||||
MSP_MISC: 114,
|
|
||||||
MSP_MOTOR_PINS: 115, // Not used
|
|
||||||
MSP_BOXNAMES: 116,
|
|
||||||
MSP_PIDNAMES: 117,
|
|
||||||
MSP_WP: 118, // Not used
|
|
||||||
MSP_BOXIDS: 119,
|
|
||||||
MSP_SERVO_CONFIGURATIONS: 120,
|
|
||||||
MSP_3D: 124,
|
|
||||||
MSP_RC_DEADBAND: 125,
|
|
||||||
MSP_SENSOR_ALIGNMENT: 126,
|
|
||||||
MSP_LED_STRIP_MODECOLOR: 127,
|
|
||||||
|
|
||||||
MSP_STATUS_EX: 150,
|
MSP_ADJUSTMENT_RANGES: 52,
|
||||||
|
MSP_SET_ADJUSTMENT_RANGE: 53,
|
||||||
|
MSP_CF_SERIAL_CONFIG: 54,
|
||||||
|
MSP_SET_CF_SERIAL_CONFIG: 55,
|
||||||
|
MSP_VOLTAGE_METER_CONFIG: 56,
|
||||||
|
MSP_SET_VOLTAGE_METER_CONFIG: 57,
|
||||||
|
MSP_SONAR: 58,
|
||||||
|
MSP_PID_CONTROLLER: 59,
|
||||||
|
MSP_SET_PID_CONTROLLER: 60,
|
||||||
|
MSP_ARMING_CONFIG: 61,
|
||||||
|
MSP_SET_ARMING_CONFIG: 62,
|
||||||
|
MSP_RX_MAP: 64,
|
||||||
|
MSP_SET_RX_MAP: 65,
|
||||||
|
MSP_BF_CONFIG: 66,
|
||||||
|
MSP_SET_BF_CONFIG: 67,
|
||||||
|
MSP_SET_REBOOT: 68,
|
||||||
|
MSP_BF_BUILD_INFO: 69, // Not used
|
||||||
|
MSP_DATAFLASH_SUMMARY: 70,
|
||||||
|
MSP_DATAFLASH_READ: 71,
|
||||||
|
MSP_DATAFLASH_ERASE: 72,
|
||||||
|
MSP_LOOP_TIME: 73,
|
||||||
|
MSP_SET_LOOP_TIME: 74,
|
||||||
|
MSP_FAILSAFE_CONFIG: 75,
|
||||||
|
MSP_SET_FAILSAFE_CONFIG: 76,
|
||||||
|
MSP_RXFAIL_CONFIG: 77,
|
||||||
|
MSP_SET_RXFAIL_CONFIG: 78,
|
||||||
|
MSP_SDCARD_SUMMARY: 79,
|
||||||
|
MSP_BLACKBOX_CONFIG: 80,
|
||||||
|
MSP_SET_BLACKBOX_CONFIG: 81,
|
||||||
|
MSP_TRANSPONDER_CONFIG: 82,
|
||||||
|
MSP_SET_TRANSPONDER_CONFIG: 83,
|
||||||
|
MSP_OSD_CONFIG: 84,
|
||||||
|
MSP_SET_OSD_CONFIG: 85,
|
||||||
|
MSP_OSD_CHAR_READ: 86,
|
||||||
|
MSP_OSD_CHAR_WRITE: 87,
|
||||||
|
MSP_VTX_CONFIG: 88,
|
||||||
|
MSP_SET_VTX_CONFIG: 89,
|
||||||
|
MSP_ADVANCED_CONFIG: 90,
|
||||||
|
MSP_SET_ADVANCED_CONFIG: 91,
|
||||||
|
MSP_FILTER_CONFIG: 92,
|
||||||
|
MSP_SET_FILTER_CONFIG: 93,
|
||||||
|
MSP_PID_ADVANCED: 94,
|
||||||
|
MSP_SET_PID_ADVANCED: 95,
|
||||||
|
MSP_SENSOR_CONFIG: 96,
|
||||||
|
MSP_SET_SENSOR_CONFIG: 97,
|
||||||
|
MSP_SPECIAL_PARAMETERS: 98,
|
||||||
|
MSP_SET_SPECIAL_PARAMETERS: 99,
|
||||||
|
MSP_IDENT: 100, // Not used
|
||||||
|
MSP_STATUS: 101,
|
||||||
|
MSP_RAW_IMU: 102,
|
||||||
|
MSP_SERVO: 103,
|
||||||
|
MSP_MOTOR: 104,
|
||||||
|
MSP_RC: 105,
|
||||||
|
MSP_RAW_GPS: 106,
|
||||||
|
MSP_COMP_GPS: 107,
|
||||||
|
MSP_ATTITUDE: 108,
|
||||||
|
MSP_ALTITUDE: 109,
|
||||||
|
MSP_ANALOG: 110,
|
||||||
|
MSP_RC_TUNING: 111,
|
||||||
|
MSP_PID: 112,
|
||||||
|
MSP_BOX: 113, // Not used
|
||||||
|
MSP_MISC: 114,
|
||||||
|
MSP_MOTOR_PINS: 115, // Not used
|
||||||
|
MSP_BOXNAMES: 116,
|
||||||
|
MSP_PIDNAMES: 117,
|
||||||
|
MSP_WP: 118, // Not used
|
||||||
|
MSP_BOXIDS: 119,
|
||||||
|
MSP_SERVO_CONFIGURATIONS: 120,
|
||||||
|
MSP_3D: 124,
|
||||||
|
MSP_RC_DEADBAND: 125,
|
||||||
|
MSP_SENSOR_ALIGNMENT: 126,
|
||||||
|
MSP_LED_STRIP_MODECOLOR: 127,
|
||||||
|
|
||||||
MSP_UID: 160,
|
MSP_STATUS_EX: 150,
|
||||||
MSP_GPS_SV_INFO: 164,
|
|
||||||
|
|
||||||
MSP_SET_RAW_RC: 200,
|
MSP_UID: 160,
|
||||||
MSP_SET_RAW_GPS: 201, // Not used
|
MSP_GPS_SV_INFO: 164,
|
||||||
MSP_SET_PID: 202,
|
|
||||||
MSP_SET_BOX: 203,
|
|
||||||
MSP_SET_RC_TUNING: 204,
|
|
||||||
MSP_ACC_CALIBRATION: 205,
|
|
||||||
MSP_MAG_CALIBRATION: 206,
|
|
||||||
MSP_SET_MISC: 207,
|
|
||||||
MSP_RESET_CONF: 208,
|
|
||||||
MSP_SET_WP: 209, // Not used
|
|
||||||
MSP_SELECT_SETTING: 210,
|
|
||||||
MSP_SET_HEAD: 211, // Not used
|
|
||||||
MSP_SET_SERVO_CONFIGURATION:212,
|
|
||||||
MSP_SET_MOTOR: 214,
|
|
||||||
MSP_SET_3D: 217,
|
|
||||||
MSP_SET_RC_DEADBAND: 218,
|
|
||||||
MSP_SET_RESET_CURR_PID: 219,
|
|
||||||
MSP_SET_SENSOR_ALIGNMENT: 220,
|
|
||||||
MSP_SET_LED_STRIP_MODECOLOR:221,
|
|
||||||
|
|
||||||
MSP_SET_ACC_TRIM: 239,
|
MSP_SET_RAW_RC: 200,
|
||||||
MSP_ACC_TRIM: 240,
|
MSP_SET_RAW_GPS: 201, // Not used
|
||||||
MSP_SERVO_MIX_RULES: 241,
|
MSP_SET_PID: 202,
|
||||||
MSP_SET_SERVO_MIX_RULE: 242, // Not used
|
MSP_SET_BOX: 203,
|
||||||
|
MSP_SET_RC_TUNING: 204,
|
||||||
|
MSP_ACC_CALIBRATION: 205,
|
||||||
|
MSP_MAG_CALIBRATION: 206,
|
||||||
|
MSP_SET_MISC: 207,
|
||||||
|
MSP_RESET_CONF: 208,
|
||||||
|
MSP_SET_WP: 209, // Not used
|
||||||
|
MSP_SELECT_SETTING: 210,
|
||||||
|
MSP_SET_HEAD: 211, // Not used
|
||||||
|
MSP_SET_SERVO_CONFIGURATION: 212,
|
||||||
|
MSP_SET_MOTOR: 214,
|
||||||
|
MSP_SET_3D: 217,
|
||||||
|
MSP_SET_RC_DEADBAND: 218,
|
||||||
|
MSP_SET_RESET_CURR_PID: 219,
|
||||||
|
MSP_SET_SENSOR_ALIGNMENT: 220,
|
||||||
|
MSP_SET_LED_STRIP_MODECOLOR: 221,
|
||||||
|
|
||||||
MSP_EEPROM_WRITE: 250,
|
MSP_SET_ACC_TRIM: 239,
|
||||||
MSP_DEBUGMSG: 253, // Not used
|
MSP_ACC_TRIM: 240,
|
||||||
MSP_DEBUG: 254
|
MSP_SERVO_MIX_RULES: 241,
|
||||||
|
MSP_SET_SERVO_MIX_RULE: 242, // Not used
|
||||||
|
|
||||||
|
MSP_EEPROM_WRITE: 250,
|
||||||
|
MSP_DEBUGMSG: 253, // Not used
|
||||||
|
MSP_DEBUG: 254
|
||||||
};
|
};
|
|
@ -203,6 +203,21 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
MISC.vbatmaxcellvoltage = data.readU8() / 10; // 10-50
|
MISC.vbatmaxcellvoltage = data.readU8() / 10; // 10-50
|
||||||
MISC.vbatwarningcellvoltage = data.readU8() / 10; // 10-50
|
MISC.vbatwarningcellvoltage = data.readU8() / 10; // 10-50
|
||||||
break;
|
break;
|
||||||
|
case MSPCodes.MSP_VOLTAGE_METER_CONFIG:
|
||||||
|
MISC.vbatscale = data.readU8(); // 10-200
|
||||||
|
MISC.vbatmincellvoltage = data.readU8() / 10; // 10-50
|
||||||
|
MISC.vbatmaxcellvoltage = data.readU8() / 10; // 10-50
|
||||||
|
MISC.vbatwarningcellvoltage = data.readU8() / 10; // 10-50
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.23.0")) {
|
||||||
|
MISC.batteryMeterType = data.readU8();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MSPCodes.MSP_CURRENT_METER_CONFIG:
|
||||||
|
BF_CONFIG.currentscale = data.readU16();
|
||||||
|
BF_CONFIG.currentoffset = data.readU16();
|
||||||
|
BF_CONFIG.currentmetertype = data.readU8();
|
||||||
|
BF_CONFIG.batterycapacity = data.readU16();
|
||||||
|
break;
|
||||||
case MSPCodes.MSP_3D:
|
case MSPCodes.MSP_3D:
|
||||||
_3D.deadband3d_low = data.readU16();
|
_3D.deadband3d_low = data.readU16();
|
||||||
_3D.deadband3d_high = data.readU16();
|
_3D.deadband3d_high = data.readU16();
|
||||||
|
@ -342,6 +357,11 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
case MSPCodes.MSP_EEPROM_WRITE:
|
case MSPCodes.MSP_EEPROM_WRITE:
|
||||||
console.log('Settings Saved in EEPROM');
|
console.log('Settings Saved in EEPROM');
|
||||||
break;
|
break;
|
||||||
|
case MSPCodes.MSP_SET_CURRENT_METER_CONFIG:
|
||||||
|
console.log('Current Settings saved');
|
||||||
|
break;
|
||||||
|
case MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG:
|
||||||
|
console.log('Voltage config saved');
|
||||||
case MSPCodes.MSP_DEBUG:
|
case MSPCodes.MSP_DEBUG:
|
||||||
for (var i = 0; i < 4; i++)
|
for (var i = 0; i < 4; i++)
|
||||||
SENSOR_DATA.debug[i] = data.read16();
|
SENSOR_DATA.debug[i] = data.read16();
|
||||||
|
@ -1006,7 +1026,21 @@ MspHelper.prototype.crunch = function(code) {
|
||||||
.push8(Math.round(MISC.vbatmaxcellvoltage * 10))
|
.push8(Math.round(MISC.vbatmaxcellvoltage * 10))
|
||||||
.push8(Math.round(MISC.vbatwarningcellvoltage * 10));
|
.push8(Math.round(MISC.vbatwarningcellvoltage * 10));
|
||||||
break;
|
break;
|
||||||
|
case MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG:
|
||||||
|
buffer.push8(MISC.vbatscale)
|
||||||
|
.push8(Math.round(MISC.vbatmincellvoltage * 10))
|
||||||
|
.push8(Math.round(MISC.vbatmaxcellvoltage * 10))
|
||||||
|
.push8(Math.round(MISC.vbatwarningcellvoltage * 10));
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.23.0")) {
|
||||||
|
buffer.push8(MISC.batteryMeterType);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MSPCodes.MSP_SET_CURRENT_METER_CONFIG:
|
||||||
|
buffer.push16(BF_CONFIG.currentscale)
|
||||||
|
.push16(BF_CONFIG.currentoffset)
|
||||||
|
.push8(BF_CONFIG.currentmetertype)
|
||||||
|
.push16(BF_CONFIG.batterycapacity)
|
||||||
|
break;
|
||||||
case MSPCodes.MSP_SET_RX_CONFIG:
|
case MSPCodes.MSP_SET_RX_CONFIG:
|
||||||
buffer.push8(RX_CONFIG.serialrx_provider)
|
buffer.push8(RX_CONFIG.serialrx_provider)
|
||||||
.push16(RX_CONFIG.maxcheck)
|
.push16(RX_CONFIG.maxcheck)
|
||||||
|
|
|
@ -295,6 +295,20 @@
|
||||||
width: 30px;
|
width: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab-configuration .batterymetertype {
|
||||||
|
border: 1px solid silver;
|
||||||
|
margin-right: 5px;
|
||||||
|
float: left;
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-configuration .currentmetertype {
|
||||||
|
border: 1px solid silver;
|
||||||
|
margin-right: 5px;
|
||||||
|
float: left;
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
.tab-configuration .rssi td:nth-child(2) {
|
.tab-configuration .rssi td:nth-child(2) {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,6 +339,12 @@
|
||||||
<!-- table generated here -->
|
<!-- table generated here -->
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div class="select">
|
||||||
|
<label>
|
||||||
|
<select class="batterymetertype"><!-- list generated here --></select>
|
||||||
|
<span i18n="configurationBatteryMeterType"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="number">
|
<div class="number">
|
||||||
<label> <input type="number" name="mincellvoltage" step="0.1" min="1" max="5" /> <span
|
<label> <input type="number" name="mincellvoltage" step="0.1" min="1" max="5" /> <span
|
||||||
i18n="configurationBatteryMinimum"></span>
|
i18n="configurationBatteryMinimum"></span>
|
||||||
|
@ -383,6 +389,12 @@
|
||||||
<!-- table generated here -->
|
<!-- table generated here -->
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div class="select">
|
||||||
|
<label>
|
||||||
|
<select class="currentmetertype"><!-- list generated here --></select>
|
||||||
|
<span i18n="configurationCurrentMeterType"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="number">
|
<div class="number">
|
||||||
<label> <input type="number" name="currentscale" step="1" min="-16000" max="16000" /> <span
|
<label> <input type="number" name="currentscale" step="1" min="-16000" max="16000" /> <span
|
||||||
i18n="configurationCurrentScale"></span>
|
i18n="configurationCurrentScale"></span>
|
||||||
|
|
|
@ -98,7 +98,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_name() {
|
function load_name() {
|
||||||
var next_callback = load_html;
|
var next_callback = load_battery;
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||||
MSP.send_message(MSPCodes.MSP_NAME, false, false, next_callback);
|
MSP.send_message(MSPCodes.MSP_NAME, false, false, next_callback);
|
||||||
} else {
|
} else {
|
||||||
|
@ -106,6 +106,24 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function load_battery() {
|
||||||
|
var next_callback = load_current;
|
||||||
|
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||||
|
MSP.send_message(MSPCodes.MSP_VOLTAGE_METER_CONFIG, false, false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function load_current() {
|
||||||
|
var next_callback = load_html;
|
||||||
|
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||||
|
MSP.send_message(MSPCodes.MSP_CURRENT_METER_CONFIG, false, false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Update Analog/Battery Data
|
//Update Analog/Battery Data
|
||||||
function load_analog() {
|
function load_analog() {
|
||||||
|
@ -426,12 +444,45 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
$('input[name="mincommand"]').val(MISC.mincommand);
|
$('input[name="mincommand"]').val(MISC.mincommand);
|
||||||
|
|
||||||
// fill battery
|
// fill battery
|
||||||
|
var batteryMeterTypes = [
|
||||||
|
'None', //Do not show in GUI
|
||||||
|
'Onboard ADC',
|
||||||
|
'ESC Sensor',
|
||||||
|
];
|
||||||
|
|
||||||
|
var batteryMeterType_e = $('select.batterymetertype');
|
||||||
|
for (i = 1; i < batteryMeterTypes.length; i++) {
|
||||||
|
batteryMeterType_e.append('<option value="' + i + '">' + batteryMeterTypes[i] + '</option>');
|
||||||
|
}
|
||||||
|
|
||||||
|
batteryMeterType_e.change(function () {
|
||||||
|
MISC.batterymetertype = parseInt($(this).val());
|
||||||
|
});
|
||||||
|
batteryMeterType_e.val(MISC.batterymetertype);
|
||||||
|
|
||||||
$('input[name="mincellvoltage"]').val(MISC.vbatmincellvoltage);
|
$('input[name="mincellvoltage"]').val(MISC.vbatmincellvoltage);
|
||||||
$('input[name="maxcellvoltage"]').val(MISC.vbatmaxcellvoltage);
|
$('input[name="maxcellvoltage"]').val(MISC.vbatmaxcellvoltage);
|
||||||
$('input[name="warningcellvoltage"]').val(MISC.vbatwarningcellvoltage);
|
$('input[name="warningcellvoltage"]').val(MISC.vbatwarningcellvoltage);
|
||||||
$('input[name="voltagescale"]').val(MISC.vbatscale);
|
$('input[name="voltagescale"]').val(MISC.vbatscale);
|
||||||
|
|
||||||
// fill current
|
// fill current
|
||||||
|
var currentMeterTypes = [
|
||||||
|
'None', //Do not show in GUI
|
||||||
|
'Onboard ADC',
|
||||||
|
'Virtual',
|
||||||
|
'ESC Sensor',
|
||||||
|
];
|
||||||
|
|
||||||
|
var currentMeterType_e = $('select.currentmetertype');
|
||||||
|
for (i = 1; i < currentMeterTypes.length; i++) {
|
||||||
|
currentMeterType_e.append('<option value="' + i + '">' + currentMeterTypes[i] + '</option>');
|
||||||
|
}
|
||||||
|
|
||||||
|
currentMeterType_e.change(function () {
|
||||||
|
BF_CONFIG.currentmetertype = parseInt($(this).val());
|
||||||
|
});
|
||||||
|
currentMeterType_e.val(BF_CONFIG.currentmetertype);
|
||||||
|
|
||||||
$('input[name="currentscale"]').val(BF_CONFIG.currentscale);
|
$('input[name="currentscale"]').val(BF_CONFIG.currentscale);
|
||||||
$('input[name="currentoffset"]').val(BF_CONFIG.currentoffset);
|
$('input[name="currentoffset"]').val(BF_CONFIG.currentoffset);
|
||||||
$('input[name="multiwiicurrentoutput"]').prop('checked', MISC.multiwiicurrentoutput !== 0);
|
$('input[name="multiwiicurrentoutput"]').prop('checked', MISC.multiwiicurrentoutput !== 0);
|
||||||
|
@ -621,7 +672,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_name() {
|
function save_name() {
|
||||||
var next_callback = save_to_eeprom;
|
var next_callback = save_battery;
|
||||||
|
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||||
CONFIG.name = $.trim($('input[name="vesselName"]').val());
|
CONFIG.name = $.trim($('input[name="vesselName"]').val());
|
||||||
|
@ -631,6 +682,24 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function save_battery() {
|
||||||
|
var next_callback = save_current;
|
||||||
|
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||||
|
MSP.send_message(MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG), false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function save_current() {
|
||||||
|
var next_callback = save_to_eeprom;
|
||||||
|
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "3.1.0")) {
|
||||||
|
MSP.send_message(MSPCodes.MSP_SET_CURRENT_METER_CONFIG, mspHelper.crunch(MSPCodes.MSP_SET_CURRENT_METER_CONFIG), false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function save_to_eeprom() {
|
function save_to_eeprom() {
|
||||||
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
|
MSP.send_message(MSPCodes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue