Replacing “blink on landing” overlay code for new VTX code
parent
e9febfa6e0
commit
cce9cfa9f9
|
@ -64,9 +64,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
CONFIG.activeSensors = data.readU16();
|
||||
CONFIG.mode = data.readU32();
|
||||
CONFIG.profile = data.readU8();
|
||||
|
||||
|
||||
TABS.pid_tuning.checkUpdateProfile(false);
|
||||
|
||||
|
||||
sensor_status(CONFIG.activeSensors);
|
||||
$('span.i2c-error').text(CONFIG.i2cError);
|
||||
$('span.cycle-time').text(CONFIG.cycleTime);
|
||||
|
@ -81,28 +81,28 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
if (semver.gte(CONFIG.apiVersion, "1.16.0")) {
|
||||
CONFIG.numProfiles = data.readU8();
|
||||
CONFIG.rateProfile = data.readU8();
|
||||
|
||||
|
||||
TABS.pid_tuning.checkUpdateProfile(true);
|
||||
}
|
||||
|
||||
|
||||
sensor_status(CONFIG.activeSensors);
|
||||
$('span.i2c-error').text(CONFIG.i2cError);
|
||||
$('span.cycle-time').text(CONFIG.cycleTime);
|
||||
$('span.cpu-load').text(chrome.i18n.getMessage('statusbar_cpu_load', [CONFIG.cpuload]));
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_RAW_IMU:
|
||||
// 512 for mpu6050, 256 for mma
|
||||
// currently we are unable to differentiate between the sensor types, so we are goign with 512
|
||||
SENSOR_DATA.accelerometer[0] = data.read16() / 512;
|
||||
SENSOR_DATA.accelerometer[1] = data.read16() / 512;
|
||||
SENSOR_DATA.accelerometer[2] = data.read16() / 512;
|
||||
|
||||
|
||||
// properly scaled
|
||||
SENSOR_DATA.gyroscope[0] = data.read16() * (4 / 16.4);
|
||||
SENSOR_DATA.gyroscope[1] = data.read16() * (4 / 16.4);
|
||||
SENSOR_DATA.gyroscope[2] = data.read16() * (4 / 16.4);
|
||||
|
||||
|
||||
// no clue about scaling factor
|
||||
SENSOR_DATA.magnetometer[0] = data.read16() / 1090;
|
||||
SENSOR_DATA.magnetometer[1] = data.read16() / 1090;
|
||||
|
@ -165,7 +165,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
var voltageMeter = {};
|
||||
voltageMeter.id = data.readU8();
|
||||
voltageMeter.voltage = data.readU8() / 10.0;
|
||||
|
||||
|
||||
VOLTAGE_METERS.push(voltageMeter)
|
||||
}
|
||||
break;
|
||||
|
@ -177,23 +177,23 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
currentMeter.id = data.readU8();
|
||||
currentMeter.mAhDrawn = data.readU16(); // mAh
|
||||
currentMeter.amperage = data.readU16() / 1000; // A
|
||||
|
||||
|
||||
CURRENT_METERS.push(currentMeter);
|
||||
}
|
||||
break;
|
||||
case MSPCodes.MSP_BATTERY_STATE:
|
||||
BATTERY_STATE.cellCount = data.readU8();
|
||||
BATTERY_STATE.capacity = data.readU16(); // mAh
|
||||
|
||||
|
||||
BATTERY_STATE.voltage = data.readU8() / 10.0; // V
|
||||
BATTERY_STATE.mAhDrawn = data.readU16(); // mAh
|
||||
BATTERY_STATE.amperage = data.readU16() / 100; // A
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_VOLTAGE_METER_CONFIG:
|
||||
VOLTAGE_METER_CONFIGS = [];
|
||||
var voltage_meter_count = data.readU8();
|
||||
|
||||
|
||||
for (var i = 0; i < voltage_meter_count; i++) {
|
||||
var subframe_length = data.readU8();
|
||||
if (subframe_length != 5) {
|
||||
|
@ -207,7 +207,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
voltageMeterConfig.vbatscale = data.readU8();
|
||||
voltageMeterConfig.vbatresdivval = data.readU8();
|
||||
voltageMeterConfig.vbatresdivmultiplier = data.readU8();
|
||||
|
||||
|
||||
VOLTAGE_METER_CONFIGS.push(voltageMeterConfig);
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
for (var i = 0; i < current_meter_count; i++) {
|
||||
var currentMeterConfig = {};
|
||||
var subframe_length = data.readU8();
|
||||
|
||||
|
||||
if (subframe_length != 6) {
|
||||
for (var j = 0; j < subframe_length; j++) {
|
||||
data.readU8();
|
||||
|
@ -229,12 +229,12 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
currentMeterConfig.sensorType = data.readU8();
|
||||
currentMeterConfig.scale = data.readU16();
|
||||
currentMeterConfig.offset = data.readU16();
|
||||
|
||||
|
||||
CURRENT_METER_CONFIGS.push(currentMeterConfig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_BATTERY_CONFIG:
|
||||
BATTERY_CONFIG.vbatmincellvoltage = data.readU8() / 10; // 10-50
|
||||
BATTERY_CONFIG.vbatmaxcellvoltage = data.readU8() / 10; // 10-50
|
||||
|
@ -242,7 +242,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
BATTERY_CONFIG.capacity = data.readU16();
|
||||
BATTERY_CONFIG.voltageMeterSource = data.readU8();
|
||||
BATTERY_CONFIG.currentMeterSource = data.readU8();
|
||||
|
||||
|
||||
break;
|
||||
case MSPCodes.MSP_RC_TUNING:
|
||||
RC_tuning.RC_RATE = parseFloat((data.readU8() / 100).toFixed(2));
|
||||
|
@ -285,7 +285,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_ARMING_CONFIG:
|
||||
if (semver.gte(CONFIG.apiVersion, "1.8.0")) {
|
||||
ARMING_CONFIG.auto_disarm_delay = data.readU8();
|
||||
|
@ -317,7 +317,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
MISC.vbatmincellvoltage = data.readU8() / 10; // 10-50
|
||||
MISC.vbatmaxcellvoltage = data.readU8() / 10; // 10-50
|
||||
MISC.vbatwarningcellvoltage = data.readU8() / 10; // 10-50
|
||||
break;
|
||||
break;
|
||||
case MSPCodes.MSP_MOTOR_CONFIG:
|
||||
MOTOR_CONFIG.minthrottle = data.readU16(); // 0-2000
|
||||
MOTOR_CONFIG.maxthrottle = data.readU16(); // 0-2000
|
||||
|
@ -347,13 +347,13 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
break;
|
||||
case MSPCodes.MSP_BOXNAMES:
|
||||
AUX_CONFIG = []; // empty the array as new data is coming in
|
||||
|
||||
|
||||
var buff = [];
|
||||
for (var i = 0; i < data.byteLength; i++) {
|
||||
var char = data.readU8();
|
||||
if (char == 0x3B) { // ; (delimeter char)
|
||||
AUX_CONFIG.push(String.fromCharCode.apply(null, buff)); // convert bytes into ASCII and save as strings
|
||||
|
||||
|
||||
// empty buffer
|
||||
buff = [];
|
||||
} else {
|
||||
|
@ -363,13 +363,13 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
break;
|
||||
case MSPCodes.MSP_PIDNAMES:
|
||||
PID_names = []; // empty the array as new data is coming in
|
||||
|
||||
|
||||
var buff = [];
|
||||
for (var i = 0; i < data.byteLength; i++) {
|
||||
var char = data.readU8();
|
||||
if (char == 0x3B) { // ; (delimeter char)
|
||||
PID_names.push(String.fromCharCode.apply(null, buff)); // convert bytes into ASCII and save as strings
|
||||
|
||||
|
||||
// empty buffer
|
||||
buff = [];
|
||||
} else {
|
||||
|
@ -379,14 +379,14 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
break;
|
||||
case MSPCodes.MSP_BOXIDS:
|
||||
AUX_CONFIG_IDS = []; // empty the array as new data is coming in
|
||||
|
||||
|
||||
for (var i = 0; i < data.byteLength; i++) {
|
||||
AUX_CONFIG_IDS.push(data.readU8());
|
||||
}
|
||||
break;
|
||||
case MSPCodes.MSP_SERVO_MIX_RULES:
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_SERVO_CONFIGURATIONS:
|
||||
SERVO_CONFIG = []; // empty the array as new data is coming in
|
||||
if (semver.gte(CONFIG.apiVersion, "1.33.0")) {
|
||||
|
@ -402,7 +402,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
'indexOfChannelToForward': data.readU8(),
|
||||
'reversedInputSources': data.readU32()
|
||||
};
|
||||
|
||||
|
||||
SERVO_CONFIG.push(arr);
|
||||
}
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
'indexOfChannelToForward': data.readU8(),
|
||||
'reversedInputSources': data.readU32()
|
||||
};
|
||||
|
||||
|
||||
SERVO_CONFIG.push(arr);
|
||||
}
|
||||
}
|
||||
|
@ -436,11 +436,11 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
'indexOfChannelToForward': undefined,
|
||||
'reversedInputSources': 0
|
||||
};
|
||||
|
||||
|
||||
SERVO_CONFIG.push(arr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (semver.eq(CONFIG.apiVersion, '1.10.0')) {
|
||||
// drop two unused servo configurations due to MSP rx buffer to small)
|
||||
while (SERVO_CONFIG.length > 8) {
|
||||
|
@ -453,7 +453,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
RC_DEADBAND_CONFIG.deadband = data.readU8();
|
||||
RC_DEADBAND_CONFIG.yaw_deadband = data.readU8();
|
||||
RC_DEADBAND_CONFIG.alt_hold_deadband = data.readU8();
|
||||
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.17.0")) {
|
||||
RC_DEADBAND_CONFIG.deadband3d_throttle = data.readU16();
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
case MSPCodes.MSP_GPS_SV_INFO:
|
||||
if (data.byteLength > 0) {
|
||||
var numCh = data.readU8();
|
||||
|
||||
|
||||
for (var i = 0; i < numCh; i++) {
|
||||
GPS_DATA.chn[i] = data.readU8();
|
||||
GPS_DATA.svid[i] = data.readU8();
|
||||
|
@ -539,10 +539,10 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_RX_MAP:
|
||||
RC_MAP = []; // empty the array as new data is coming in
|
||||
|
||||
|
||||
for (var i = 0; i < data.byteLength; i++) {
|
||||
RC_MAP.push(data.readU8());
|
||||
}
|
||||
|
@ -550,32 +550,32 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
case MSPCodes.MSP_SET_RX_MAP:
|
||||
console.log('RCMAP saved');
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_MIXER_CONFIG:
|
||||
MIXER_CONFIG.mixer = data.readU8();
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_FEATURE_CONFIG:
|
||||
FEATURE_CONFIG.features.setMask(data.readU32());
|
||||
|
||||
|
||||
updateTabList(FEATURE_CONFIG.features);
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_BOARD_ALIGNMENT_CONFIG:
|
||||
BOARD_ALIGNMENT_CONFIG.roll = data.read16(); // -180 - 360
|
||||
BOARD_ALIGNMENT_CONFIG.pitch = data.read16(); // -180 - 360
|
||||
BOARD_ALIGNMENT_CONFIG.yaw = data.read16(); // -180 - 360
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_SET_REBOOT:
|
||||
console.log('Reboot request accepted');
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_API_VERSION:
|
||||
CONFIG.mspProtocolVersion = data.readU8();
|
||||
CONFIG.apiVersion = data.readU8() + '.' + data.readU8() + '.0';
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_FC_VARIANT:
|
||||
var identifier = '';
|
||||
for (var i = 0; i < 4; i++) {
|
||||
|
@ -583,11 +583,11 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
}
|
||||
CONFIG.flightControllerIdentifier = identifier;
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_FC_VERSION:
|
||||
CONFIG.flightControllerVersion = data.readU8() + '.' + data.readU8() + '.' + data.readU8();
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_BUILD_INFO:
|
||||
var dateLength = 11;
|
||||
var buff = [];
|
||||
|
@ -595,14 +595,14 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
buff.push(data.readU8());
|
||||
}
|
||||
buff.push(32); // ascii space
|
||||
|
||||
|
||||
var timeLength = 8;
|
||||
for (var i = 0; i < timeLength; i++) {
|
||||
buff.push(data.readU8());
|
||||
}
|
||||
CONFIG.buildInfo = String.fromCharCode.apply(null, buff);
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_BOARD_INFO:
|
||||
var identifier = '';
|
||||
for (var i = 0; i < 4; i++) {
|
||||
|
@ -617,7 +617,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_NAME:
|
||||
CONFIG.name = '';
|
||||
var char;
|
||||
|
@ -625,11 +625,11 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
CONFIG.name += String.fromCharCode(char);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_SET_CHANNEL_FORWARDING:
|
||||
console.log('Channel forwarding saved');
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_CF_SERIAL_CONFIG:
|
||||
if (semver.lt(CONFIG.apiVersion, "1.6.0")) {
|
||||
SERIAL_CONFIG.ports = [];
|
||||
|
@ -649,7 +649,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
SERIAL_CONFIG.ports = [];
|
||||
var bytesPerPort = 1 + 2 + (1 * 4);
|
||||
var serialPortCount = data.byteLength / bytesPerPort;
|
||||
|
||||
|
||||
for (var i = 0; i < serialPortCount; i++) {
|
||||
var serialPort = {
|
||||
identifier: data.readU8(),
|
||||
|
@ -659,21 +659,21 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
telemetry_baudrate: self.BAUD_RATES[data.readU8()],
|
||||
blackbox_baudrate: self.BAUD_RATES[data.readU8()]
|
||||
}
|
||||
|
||||
|
||||
SERIAL_CONFIG.ports.push(serialPort);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_SET_CF_SERIAL_CONFIG:
|
||||
console.log('Serial config saved');
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_MODE_RANGES:
|
||||
MODE_RANGES = []; // empty the array as new data is coming in
|
||||
|
||||
|
||||
var modeRangeCount = data.byteLength / 4; // 4 bytes per item.
|
||||
|
||||
|
||||
for (var i = 0; i < modeRangeCount; i++) {
|
||||
var modeRange = {
|
||||
id: data.readU8(),
|
||||
|
@ -686,12 +686,12 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
MODE_RANGES.push(modeRange);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_ADJUSTMENT_RANGES:
|
||||
ADJUSTMENT_RANGES = []; // empty the array as new data is coming in
|
||||
|
||||
|
||||
var adjustmentRangeCount = data.byteLength / 6; // 6 bytes per item.
|
||||
|
||||
|
||||
for (var i = 0; i < adjustmentRangeCount; i++) {
|
||||
var adjustmentRange = {
|
||||
slotIndex: data.readU8(),
|
||||
|
@ -706,7 +706,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
ADJUSTMENT_RANGES.push(adjustmentRange);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_RX_CONFIG:
|
||||
RX_CONFIG.serialrx_provider = data.readU8();
|
||||
RX_CONFIG.stick_max = data.readU16();
|
||||
|
@ -736,7 +736,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
RX_CONFIG.airModeActivateThreshold = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_FAILSAFE_CONFIG:
|
||||
FAILSAFE_CONFIG.failsafe_delay = data.readU8();
|
||||
FAILSAFE_CONFIG.failsafe_off_delay = data.readU8();
|
||||
|
@ -747,10 +747,10 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
FAILSAFE_CONFIG.failsafe_procedure = data.readU8();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_RXFAIL_CONFIG:
|
||||
RXFAIL_CONFIG = []; // empty the array as new data is coming in
|
||||
|
||||
|
||||
var channelCount = data.byteLength / 3;
|
||||
for (var i = 0; i < channelCount; i++) {
|
||||
var rxfailChannel = {
|
||||
|
@ -760,7 +760,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
RXFAIL_CONFIG.push(rxfailChannel);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_ADVANCED_CONFIG:
|
||||
PID_ADVANCED_CONFIG.gyro_sync_denom = data.readU8();
|
||||
PID_ADVANCED_CONFIG.pid_process_denom = data.readU8();
|
||||
|
@ -769,7 +769,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
PID_ADVANCED_CONFIG.motor_pwm_rate = data.readU16();
|
||||
if (semver.gte(CONFIG.apiVersion, "1.24.0")) {
|
||||
PID_ADVANCED_CONFIG.digitalIdlePercent = data.readU16() / 100;
|
||||
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.25.0")) {
|
||||
PID_ADVANCED_CONFIG.gyroUse32kHz = data.readU8();
|
||||
}
|
||||
|
@ -818,41 +818,41 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
SENSOR_CONFIG.baro_hardware = data.readU8();
|
||||
SENSOR_CONFIG.mag_hardware = data.readU8();
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_LED_STRIP_CONFIG:
|
||||
LED_STRIP = [];
|
||||
|
||||
|
||||
var ledDirectionLetters = ['n', 'e', 's', 'w', 'u', 'd']; // in LSB bit order
|
||||
var ledFunctionLetters = ['i', 'w', 'f', 'a', 't', 'r', 'c', 'g', 's', 'b', 'l']; // in LSB bit order
|
||||
var ledBaseFunctionLetters = ['c', 'f', 'a', 'l', 's', 'g', 'r']; // in LSB bit
|
||||
var ledOverlayLetters = ['t', 'o', 'b', 'n', 'i', 'w']; // in LSB bit
|
||||
|
||||
|
||||
var ledOverlayLetters = ['t', 'o', 'b', 'v', 'i', 'w']; // in LSB bit
|
||||
|
||||
|
||||
var ledCount = data.byteLength / 7; // v1.4.0 and below incorrectly reported 4 bytes per led.
|
||||
if (semver.gte(CONFIG.apiVersion, "1.20.0"))
|
||||
ledCount = data.byteLength / 4;
|
||||
|
||||
|
||||
for (var i = 0; i < ledCount; i++) {
|
||||
|
||||
|
||||
if (semver.lt(CONFIG.apiVersion, "1.20.0")) {
|
||||
var directionMask = data.readU16();
|
||||
|
||||
|
||||
var directions = [];
|
||||
for (var directionLetterIndex = 0; directionLetterIndex < ledDirectionLetters.length; directionLetterIndex++) {
|
||||
if (bit_check(directionMask, directionLetterIndex)) {
|
||||
directions.push(ledDirectionLetters[directionLetterIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var functionMask = data.readU16();
|
||||
|
||||
|
||||
var functions = [];
|
||||
for (var functionLetterIndex = 0; functionLetterIndex < ledFunctionLetters.length; functionLetterIndex++) {
|
||||
if (bit_check(functionMask, functionLetterIndex)) {
|
||||
functions.push(ledFunctionLetters[functionLetterIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var led = {
|
||||
directions: directions,
|
||||
functions: functions,
|
||||
|
@ -860,11 +860,11 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
y: data.readU8(),
|
||||
color: data.readU8()
|
||||
};
|
||||
|
||||
|
||||
LED_STRIP.push(led);
|
||||
} else {
|
||||
var mask = data.readU32();
|
||||
|
||||
|
||||
var functionId = (mask >> 8) & 0xF;
|
||||
var functions = [];
|
||||
for (var baseFunctionLetterIndex = 0; baseFunctionLetterIndex < ledBaseFunctionLetters.length; baseFunctionLetterIndex++) {
|
||||
|
@ -873,14 +873,14 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var overlayMask = (mask >> 12) & 0x3F;
|
||||
for (var overlayLetterIndex = 0; overlayLetterIndex < ledOverlayLetters.length; overlayLetterIndex++) {
|
||||
if (bit_check(overlayMask, overlayLetterIndex)) {
|
||||
functions.push(ledOverlayLetters[overlayLetterIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var directionMask = (mask >> 22) & 0x3F;
|
||||
var directions = [];
|
||||
for (var directionLetterIndex = 0; directionLetterIndex < ledDirectionLetters.length; directionLetterIndex++) {
|
||||
|
@ -896,7 +896,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
directions: directions,
|
||||
parameters: (mask >> 28) & 0xF
|
||||
};
|
||||
|
||||
|
||||
LED_STRIP.push(led);
|
||||
}
|
||||
}
|
||||
|
@ -905,13 +905,13 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
console.log('Led strip config saved');
|
||||
break;
|
||||
case MSPCodes.MSP_LED_COLORS:
|
||||
|
||||
|
||||
LED_COLORS = [];
|
||||
|
||||
|
||||
var colorCount = data.byteLength / 4;
|
||||
|
||||
|
||||
for (var i = 0; i < colorCount; i++) {
|
||||
|
||||
|
||||
var color = {
|
||||
h: data.readU16(),
|
||||
s: data.readU8(),
|
||||
|
@ -919,20 +919,20 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
};
|
||||
LED_COLORS.push(color);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case MSPCodes.MSP_SET_LED_COLORS:
|
||||
console.log('Led strip colors saved');
|
||||
break;
|
||||
case MSPCodes.MSP_LED_STRIP_MODECOLOR:
|
||||
if (semver.gte(CONFIG.apiVersion, "1.19.0")) {
|
||||
|
||||
|
||||
LED_MODE_COLORS = [];
|
||||
|
||||
|
||||
var colorCount = data.byteLength / 3;
|
||||
|
||||
|
||||
for (var i = 0; i < colorCount; i++) {
|
||||
|
||||
|
||||
var mode_color = {
|
||||
mode: data.readU8(),
|
||||
direction: data.readU8(),
|
||||
|
@ -945,7 +945,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
case MSPCodes.MSP_SET_LED_STRIP_MODECOLOR:
|
||||
console.log('Led strip mode colors saved');
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_DATAFLASH_SUMMARY:
|
||||
if (data.byteLength >= 13) {
|
||||
var flags = data.readU8();
|
||||
|
@ -972,7 +972,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
break;
|
||||
case MSPCodes.MSP_SDCARD_SUMMARY:
|
||||
var flags = data.readU8();
|
||||
|
||||
|
||||
SDCARD.supported = (flags & 0x01) != 0;
|
||||
SDCARD.state = data.readU8();
|
||||
SDCARD.filesystemLastError = data.readU8();
|
||||
|
@ -993,30 +993,30 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
if (semver.gte(CONFIG.apiVersion, "1.33.0")) {
|
||||
var providerCount = data.readU8();
|
||||
bytesRemaining--;
|
||||
|
||||
|
||||
TRANSPONDER.supported = providerCount > 0;
|
||||
TRANSPONDER.providers = [];
|
||||
|
||||
|
||||
for (var i = 0; i < providerCount; i++) {
|
||||
var provider = {
|
||||
id: data.readU8(),
|
||||
dataLength: data.readU8()
|
||||
};
|
||||
bytesRemaining -= 2;
|
||||
|
||||
|
||||
TRANSPONDER.providers.push(provider);
|
||||
}
|
||||
TRANSPONDER.provider = data.readU8();
|
||||
bytesRemaining--;
|
||||
|
||||
|
||||
} else {
|
||||
TRANSPONDER.supported = (data.readU8() & 1) != 0;
|
||||
bytesRemaining--;
|
||||
|
||||
|
||||
// only ILAP was supported prior to 1.33.0
|
||||
TRANSPONDER.providers = [{
|
||||
id: 1, // ILAP
|
||||
dataLength: 6
|
||||
id: 1, // ILAP
|
||||
dataLength: 6
|
||||
}];
|
||||
TRANSPONDER.provider = TRANSPONDER.providers[0].id;
|
||||
}
|
||||
|
@ -1034,7 +1034,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
|||
case MSPCodes.MSP_SET_ADJUSTMENT_RANGE:
|
||||
console.log('Adjustment range saved');
|
||||
break;
|
||||
|
||||
|
||||
case MSPCodes.MSP_PID_CONTROLLER:
|
||||
PID.controller = data.readU8();
|
||||
break;
|
||||
|
@ -1241,7 +1241,7 @@ MspHelper.prototype.crunch = function(code) {
|
|||
.push8(BATTERY_CONFIG.voltageMeterSource)
|
||||
.push8(BATTERY_CONFIG.currentMeterSource);
|
||||
break;
|
||||
// FIXME - Needs updating before it can be used.
|
||||
// FIXME - Needs updating before it can be used.
|
||||
// case MSPCodes.MSP_SET_VOLTAGE_METER_CONFIG:
|
||||
// buffer.push8(MISC.vbatscale)
|
||||
// .push8(Math.round(BATTERY_CONFIG.vbatmincellvoltage * 10))
|
||||
|
@ -1292,7 +1292,7 @@ MspHelper.prototype.crunch = function(code) {
|
|||
|
||||
case MSPCodes.MSP_SET_TRANSPONDER_CONFIG:
|
||||
if (semver.gte(CONFIG.apiVersion, "1.33.0")) {
|
||||
buffer.push8(TRANSPONDER.provider); //
|
||||
buffer.push8(TRANSPONDER.provider); //
|
||||
}
|
||||
for (var i = 0; i < TRANSPONDER.data.length; i++) {
|
||||
buffer.push8(TRANSPONDER.data[i]);
|
||||
|
@ -1534,7 +1534,7 @@ MspHelper.prototype.sendServoConfigurations = function(onCompleteCallback) {
|
|||
.push16(servoConfiguration.max)
|
||||
.push16(servoConfiguration.middle)
|
||||
.push8(servoConfiguration.rate);
|
||||
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.33.0")) {
|
||||
buffer.push8(servoConfiguration.angleAtMin)
|
||||
.push8(servoConfiguration.angleAtMax);
|
||||
|
@ -1658,7 +1658,7 @@ MspHelper.prototype.sendLedStripConfig = function(onCompleteCallback) {
|
|||
var ledDirectionLetters = ['n', 'e', 's', 'w', 'u', 'd']; // in LSB bit order
|
||||
var ledFunctionLetters = ['i', 'w', 'f', 'a', 't', 'r', 'c', 'g', 's', 'b', 'l']; // in LSB bit order
|
||||
var ledBaseFunctionLetters = ['c', 'f', 'a', 'l', 's', 'g', 'r']; // in LSB bit
|
||||
var ledOverlayLetters = ['t', 'o', 'b', 'n', 'i', 'w']; // in LSB bit
|
||||
var ledOverlayLetters = ['t', 'o', 'b', 'v', 'i', 'w']; // in LSB bit
|
||||
|
||||
var buffer = [];
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@
|
|||
<button class="funcClearAll">Clear ALL</button>
|
||||
|
||||
<div class="section">LED Functions</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="select">
|
||||
<span class="color_section">Function</span>
|
||||
<select class="functionSelect">
|
||||
|
@ -70,7 +70,7 @@
|
|||
<option value="function-r" class="">Ring</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="modifiers">
|
||||
<span class="color_section">Color modifier</span>
|
||||
|
@ -94,25 +94,17 @@
|
|||
<span class="labelSelect">Throttle</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="checkbox extra_functions20">
|
||||
<input type="checkbox" name="LarsonScanner" class="toggle function-o" />
|
||||
<label> <span>Larson scanner</span></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="blinkers extra_functions20">
|
||||
<span class="color_section">Blink</span>
|
||||
<div class="checkbox blinkOverlay">
|
||||
<input type="checkbox" name="blink" class="toggle function-b" />
|
||||
<label> <span>Blink always</span></label>
|
||||
</div>
|
||||
<div class="checkbox landingBlinkOverlay">
|
||||
<input type="checkbox" name="landingBlink" class="toggle function-n" />
|
||||
<label> <span>Blink on landing</span></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="overlays">
|
||||
<span class="color_section">Overlay</span>
|
||||
<div class="checkbox warningOverlay">
|
||||
|
@ -123,11 +115,15 @@
|
|||
<input type="checkbox" name="Indicator" class="toggle function-i" />
|
||||
<label> <span>Indicator (uses position on matrix)</span></label>
|
||||
</div>
|
||||
<div class="checkbox vtxOverlay">
|
||||
<input type="checkbox" name="Vtx" class="toggle function-v" />
|
||||
<label> <span>VTX (uses vtx frequency to assign color)</span></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mode_colors">
|
||||
<div class="section">Mode colors</div>
|
||||
|
||||
|
||||
<select class="modeSelect">
|
||||
<option value="0">Orientation</option>
|
||||
<option value="1">Headfree</option>
|
||||
|
@ -144,7 +140,7 @@
|
|||
<button class="mode_color-0-4 dir-u">U</button>
|
||||
<button class="mode_color-0-5 dir-d">D</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="section">LED Orientation ('Modes & Orientation') and Color</div>
|
||||
<div class="directions">
|
||||
<button class="dir-n">N</button>
|
||||
|
@ -154,7 +150,7 @@
|
|||
<button class="dir-u">U</button>
|
||||
<button class="dir-d">D</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="colors">
|
||||
<button class="color-0" title="black">0</button>
|
||||
<button class="color-1" title="white">1</button>
|
||||
|
@ -185,7 +181,7 @@
|
|||
<button class="mode_color-6-6" title="orange">GPS: no lock</button>
|
||||
<button class="mode_color-6-7" title="green">GPS: locked</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="section">LED Strip Wiring</div>
|
||||
<div class="wiringMode">
|
||||
<button class="funcWire w100">Wire Ordering Mode</button>
|
||||
|
@ -196,11 +192,11 @@
|
|||
</div>
|
||||
<p>LEDs without wire ordering number will not be saved.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="colorControls">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
<div class="content_toolbar">
|
||||
|
|
|
@ -18,7 +18,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
|||
} else {
|
||||
TABS.led_strip.functions = ['i', 'w', 'f', 'a', 't', 'r', 'c', 'g', 's', 'b', 'l', 'o', 'n'];
|
||||
TABS.led_strip.baseFuncs = ['c', 'f', 'a', 'l', 's', 'g', 'r'];
|
||||
TABS.led_strip.overlays = ['t', 'o', 'b', 'n', 'i', 'w'];
|
||||
TABS.led_strip.overlays = ['t', 'o', 'b', 'v', 'i', 'w'];
|
||||
}
|
||||
|
||||
TABS.led_strip.wireMode = false;
|
||||
|
|
Loading…
Reference in New Issue