Fixing backwards compatibility of prodrone's failsafe tab

10.3.x-maintenance
NightHawk32 2015-12-15 14:45:09 -05:00
parent c1a7452b27
commit a72a00a2de
1 changed files with 13 additions and 9 deletions

View File

@ -818,12 +818,14 @@ var MSP = {
offset++; offset++;
FAILSAFE_CONFIG.failsafe_throttle = data.getUint16(offset, 1); FAILSAFE_CONFIG.failsafe_throttle = data.getUint16(offset, 1);
offset += 2; offset += 2;
FAILSAFE_CONFIG.failsafe_kill_switch = data.getUint8(offset, 1); if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
offset++; FAILSAFE_CONFIG.failsafe_kill_switch = data.getUint8(offset, 1);
FAILSAFE_CONFIG.failsafe_throttle_low_delay = data.getUint16(offset, 1); offset++;
offset += 2; FAILSAFE_CONFIG.failsafe_throttle_low_delay = data.getUint16(offset, 1);
FAILSAFE_CONFIG.failsafe_procedure = data.getUint8(offset, 1); offset += 2;
offset++; FAILSAFE_CONFIG.failsafe_procedure = data.getUint8(offset, 1);
offset++;
}
break; break;
case MSP_codes.MSP_RXFAIL_CONFIG: case MSP_codes.MSP_RXFAIL_CONFIG:
@ -1206,9 +1208,11 @@ MSP.crunch = function (code) {
buffer.push(lowByte(FAILSAFE_CONFIG.failsafe_throttle)); buffer.push(lowByte(FAILSAFE_CONFIG.failsafe_throttle));
buffer.push(highByte(FAILSAFE_CONFIG.failsafe_throttle)); buffer.push(highByte(FAILSAFE_CONFIG.failsafe_throttle));
buffer.push(FAILSAFE_CONFIG.failsafe_kill_switch); buffer.push(FAILSAFE_CONFIG.failsafe_kill_switch);
buffer.push(lowByte(FAILSAFE_CONFIG.failsafe_throttle_low_delay)); if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
buffer.push(highByte(FAILSAFE_CONFIG.failsafe_throttle_low_delay)); buffer.push(lowByte(FAILSAFE_CONFIG.failsafe_throttle_low_delay));
buffer.push(FAILSAFE_CONFIG.failsafe_procedure); buffer.push(highByte(FAILSAFE_CONFIG.failsafe_throttle_low_delay));
buffer.push(FAILSAFE_CONFIG.failsafe_procedure);
}
break; break;
case MSP_codes.MSP_SET_RXFAIL_CONFIG: case MSP_codes.MSP_SET_RXFAIL_CONFIG: