mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-14 20:10:11 +03:00
Intermediate commit.
Not currently working
This commit is contained in:
parent
553bde1b37
commit
372dcae919
4 changed files with 87 additions and 14 deletions
|
@ -183,6 +183,8 @@ var MSPCodes = {
|
||||||
MSP2_INAV_MC_BRAKING: 0x200B,
|
MSP2_INAV_MC_BRAKING: 0x200B,
|
||||||
MSP2_INAV_SET_MC_BRAKING: 0x200C,
|
MSP2_INAV_SET_MC_BRAKING: 0x200C,
|
||||||
MSPV2_INAV_OUTPUT_MAPPING_EXT: 0x200D,
|
MSPV2_INAV_OUTPUT_MAPPING_EXT: 0x200D,
|
||||||
|
MSP2_INAV_TIMER_OUTPUT_MODE: 0x200E,
|
||||||
|
MSP2_INAV_SET_TIMER_OUTPUT_MODE: 0x200F,
|
||||||
|
|
||||||
MSP2_INAV_MIXER: 0x2010,
|
MSP2_INAV_MIXER: 0x2010,
|
||||||
MSP2_INAV_SET_MIXER: 0x2011,
|
MSP2_INAV_SET_MIXER: 0x2011,
|
||||||
|
|
|
@ -1499,8 +1499,17 @@ var mspHelper = (function (gui) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MSPCodes.MSPV2_INAV_TIMER_OUTPUT_MODE:
|
||||||
|
if(data.byteLength > 2) {
|
||||||
|
OUTPUT_MAPPING.flushTimerOverrides();
|
||||||
|
}
|
||||||
|
for (i = 0; i < data.byteLength; i += 2) {
|
||||||
|
timerId = data.getUint8(i);
|
||||||
|
outputMode = data.getUint8(i + 1);
|
||||||
|
OUTPUT_MAPPING.setTimerOverride(timerId, outputMode);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case MSPCodes.MSP2_INAV_MC_BRAKING:
|
case MSPCodes.MSP2_INAV_MC_BRAKING:
|
||||||
try {
|
try {
|
||||||
|
@ -2841,6 +2850,44 @@ var mspHelper = (function (gui) {
|
||||||
MSP.send_message(MSPCodes.MSPV2_INAV_OUTPUT_MAPPING_EXT, false, false, callback);
|
MSP.send_message(MSPCodes.MSPV2_INAV_OUTPUT_MAPPING_EXT, false, false, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.loadTimerOutputModes = function(callback) {
|
||||||
|
MSP.send_message(MSPCodes.MSPV2_INAV_TIMER_OUTPUT_MODE, false, false, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
self.sendTimerOutputModes = function(callback) {
|
||||||
|
var nextFunction = send_next_output_mode;
|
||||||
|
|
||||||
|
var idIndex = 0;
|
||||||
|
|
||||||
|
var overrideIds = OUTPUT_MAPPING.getTimerOverrideIds();
|
||||||
|
|
||||||
|
if (MODE_RANGES.length == 0) {
|
||||||
|
onCompleteCallback();
|
||||||
|
} else {
|
||||||
|
send_next_output_mode();
|
||||||
|
}
|
||||||
|
|
||||||
|
function send_next_output_mode() {
|
||||||
|
|
||||||
|
var timerId = overrideIds[idIndex];
|
||||||
|
|
||||||
|
var ouputMode = OUTPUT_MAPPING.getTimerOverride(timerId);
|
||||||
|
|
||||||
|
var buffer = [];
|
||||||
|
buffer.push(timerId);
|
||||||
|
buffer.push(outputMode);
|
||||||
|
|
||||||
|
// prepare for next iteration
|
||||||
|
idIndex++;
|
||||||
|
if (idIndex == overrideIds.length) {
|
||||||
|
nextFunction = onCompleteCallback;
|
||||||
|
|
||||||
|
}
|
||||||
|
MSP.send_message(MSPCodes.MSP2_INAV_SET_TIMER_OUTPUT_MODE, buffer, false, nextFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
self.loadBatteryConfig = function (callback) {
|
self.loadBatteryConfig = function (callback) {
|
||||||
MSP.send_message(MSPCodes.MSPV2_BATTERY_CONFIG, false, false, callback);
|
MSP.send_message(MSPCodes.MSPV2_BATTERY_CONFIG, false, false, callback);
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
let OutputMappingCollection = function () {
|
let OutputMappingCollection = function () {
|
||||||
let self = {},
|
let self = {},
|
||||||
data = [];
|
data = [],
|
||||||
|
timerOverrides = {};
|
||||||
|
|
||||||
const TIM_USE_ANY = 0;
|
const TIM_USE_ANY = 0;
|
||||||
const TIM_USE_PPM = 0;
|
const TIM_USE_PPM = 0;
|
||||||
|
@ -19,6 +20,26 @@ let OutputMappingCollection = function () {
|
||||||
const OUTPUT_TYPE_MOTOR = 0;
|
const OUTPUT_TYPE_MOTOR = 0;
|
||||||
const OUTPUT_TYPE_SERVO = 1;
|
const OUTPUT_TYPE_SERVO = 1;
|
||||||
|
|
||||||
|
const TIMER_OUTPUT_MODE_AUTO = 0;
|
||||||
|
const TIMER_OUTPUT_MODE_MOTORS = 1;
|
||||||
|
const TIMER_OUTPUT_MODE_SERVOS = 2;
|
||||||
|
|
||||||
|
self.flushTimerOverrides = function() {
|
||||||
|
timerOverrides = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
self.setTimerOverride = function (timer, outputMode) {
|
||||||
|
timerOverrides[timer] = outputMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.getTimerOverride = function (timer) {
|
||||||
|
timerOverrides[timer] = outputMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.getTimerOverrideIds = function (timer) {
|
||||||
|
return Object.keys(timerOverrides).sort((a, b) => a - b);
|
||||||
|
}
|
||||||
|
|
||||||
function getTimerMap(isMR, motors, servos) {
|
function getTimerMap(isMR, motors, servos) {
|
||||||
let timerMap = [],
|
let timerMap = [],
|
||||||
motorsToGo = motors,
|
motorsToGo = motors,
|
||||||
|
|
|
@ -28,6 +28,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
||||||
mspHelper.loadServoMixRules,
|
mspHelper.loadServoMixRules,
|
||||||
mspHelper.loadMotorMixRules,
|
mspHelper.loadMotorMixRules,
|
||||||
mspHelper.loadOutputMappingExt,
|
mspHelper.loadOutputMappingExt,
|
||||||
|
mspHelper.loadTimerOutputModes,
|
||||||
mspHelper.loadLogicConditions
|
mspHelper.loadLogicConditions
|
||||||
]);
|
]);
|
||||||
loadChainer.setExitPoint(loadHtml);
|
loadChainer.setExitPoint(loadHtml);
|
||||||
|
@ -37,6 +38,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
||||||
mspHelper.saveMixerConfig,
|
mspHelper.saveMixerConfig,
|
||||||
mspHelper.sendServoMixer,
|
mspHelper.sendServoMixer,
|
||||||
mspHelper.sendMotorMixer,
|
mspHelper.sendMotorMixer,
|
||||||
|
mspHelper.sendTimerOutputModes,
|
||||||
saveSettings,
|
saveSettings,
|
||||||
mspHelper.saveToEeprom
|
mspHelper.saveToEeprom
|
||||||
]);
|
]);
|
||||||
|
@ -87,29 +89,25 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
||||||
$container = $('#timerOutputsList'), timers = {};
|
$container = $('#timerOutputsList'), timers = {};
|
||||||
|
|
||||||
|
|
||||||
for(let i = 0; i < outputCount; ++i) {
|
let usedTimers = OUTPUT_MAPPING.getTimerOverrideIds();
|
||||||
let timer = OUTPUT_MAPPING.getTimerId(i);
|
|
||||||
|
|
||||||
timers[timer] = true;
|
|
||||||
console.log("timer: " + i + " " + timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
let usedTimers = Object.keys(timers).sort((a,b) => a-b);
|
|
||||||
|
|
||||||
for (t of usedTimers) {
|
for (t of usedTimers) {
|
||||||
|
var usageMode = OUTPUT_MAPPING.getTimerOverride(t);
|
||||||
console.log("timer settings: " + t);
|
console.log("timer settings: " + t);
|
||||||
|
/*
|
||||||
$container.append(
|
$container.append(
|
||||||
'<div class="select">' +
|
'<div class="select">' +
|
||||||
'<select id="timer-output-' + t + '">' +
|
'<select id="timer-output-' + t + '">' +
|
||||||
'<option>AUTO</option>'+
|
'<option value=' + TIMER_OUTPUT_MODE_AUTO + '' + (usageMode == TIMER_OUTPUT_MODE_AUTO ? ' selected' : '')+ '>AUTO</option>'+
|
||||||
'<option>MOTORS</option>'+
|
'<option value=' + TIMER_OUTPUT_MODE_MOTORS + '' + (usageMode == TIMER_OUTPUT_MODE_MOTORS ? ' selected' : '')+ '>MOTORS</option>'+
|
||||||
'<option>SERVOS</option>'+
|
'<option value=' + TIMER_OUTPUT_MODE_SERVOS + '' + (usageMode == TIMER_OUTPUT_MODE_SERVOS ? ' selected' : '')+ '>SERVOS</option>'+
|
||||||
'</select>' +
|
'</select>' +
|
||||||
'<label for="timer-output-' + t + '">' +
|
'<label for="timer-output-' + t + '">' +
|
||||||
'<span> T' + t + '</span>' +
|
'<span> T' + t + '</span>' +
|
||||||
'</label>' +
|
'</label>' +
|
||||||
'</div>'
|
'</div>'
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -469,6 +467,11 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
||||||
SERVO_RULES.inflate();
|
SERVO_RULES.inflate();
|
||||||
MOTOR_RULES.cleanup();
|
MOTOR_RULES.cleanup();
|
||||||
MOTOR_RULES.inflate();
|
MOTOR_RULES.inflate();
|
||||||
|
|
||||||
|
for (timerId OUTPUT_MAPPING.getTimerOverrideIds()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
saveChainer.execute();
|
saveChainer.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue