mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-25 01:05:12 +03:00
reboot procedure improvements
This commit is contained in:
parent
e711e5ba53
commit
8e9bded7a7
4 changed files with 50 additions and 3 deletions
|
@ -72,6 +72,10 @@ var BOARD_DEFINITIONS = [
|
||||||
name: "Omnibus F4",
|
name: "Omnibus F4",
|
||||||
identifier: "OBF4",
|
identifier: "OBF4",
|
||||||
vcp: true
|
vcp: true
|
||||||
|
}, {
|
||||||
|
name: "Omnibus F4 Pro",
|
||||||
|
identifier: "OBSD",
|
||||||
|
vcp: true
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,13 @@ var MSP = {
|
||||||
message.onFinish = callback_msp;
|
message.onFinish = callback_msp;
|
||||||
message.onSend = callback_sent;
|
message.onSend = callback_sent;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In case of MSP_REBOOT special procedure is required
|
||||||
|
*/
|
||||||
|
if (code == MSPCodes.MSP_SET_REBOOT || code == MSPCodes.MSP_EEPROM_WRITE) {
|
||||||
|
message.retryCounter = 10;
|
||||||
|
}
|
||||||
|
|
||||||
helper.mspQueue.put(message);
|
helper.mspQueue.put(message);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -300,9 +300,9 @@ var serial = {
|
||||||
*/
|
*/
|
||||||
getTimeout: function () {
|
getTimeout: function () {
|
||||||
if (serial.bitrate >= 57600) {
|
if (serial.bitrate >= 57600) {
|
||||||
return 1000;
|
|
||||||
} else {
|
|
||||||
return 1500;
|
return 1500;
|
||||||
|
} else {
|
||||||
|
return 2500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,23 @@ helper.mspQueue = (function (serial, MSP) {
|
||||||
|
|
||||||
privateScope.lockMethod = 'soft';
|
privateScope.lockMethod = 'soft';
|
||||||
|
|
||||||
|
privateScope.queueLocked = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method locks queue
|
||||||
|
* All future put requests will be rejected
|
||||||
|
*/
|
||||||
|
publicScope.lock = function () {
|
||||||
|
privateScope.queueLocked = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method unlocks queue making it possible to put new requests in it
|
||||||
|
*/
|
||||||
|
publicScope.unlock = function () {
|
||||||
|
privateScope.queueLocked = false;
|
||||||
|
};
|
||||||
|
|
||||||
publicScope.setLockMethod = function (method) {
|
publicScope.setLockMethod = function (method) {
|
||||||
privateScope.lockMethod = method;
|
privateScope.lockMethod = method;
|
||||||
};
|
};
|
||||||
|
@ -80,6 +97,14 @@ helper.mspQueue = (function (serial, MSP) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
privateScope.getTimeout = function (code) {
|
||||||
|
if (code == MSPCodes.MSP_SET_REBOOT || code == MSPCodes.MSP_EEPROM_WRITE) {
|
||||||
|
return 5000;
|
||||||
|
} else {
|
||||||
|
return serial.getTimeout();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is periodically executed and moves MSP request
|
* This method is periodically executed and moves MSP request
|
||||||
* from a queue to serial port. This allows to throttle requests,
|
* from a queue to serial port. This allows to throttle requests,
|
||||||
|
@ -137,7 +162,7 @@ helper.mspQueue = (function (serial, MSP) {
|
||||||
publicScope.put(request);
|
publicScope.put(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, serial.getTimeout());
|
}, privateScope.getTimeout(request.code));
|
||||||
|
|
||||||
if (request.sentOn === null) {
|
if (request.sentOn === null) {
|
||||||
request.sentOn = new Date().getTime();
|
request.sentOn = new Date().getTime();
|
||||||
|
@ -175,8 +200,19 @@ helper.mspQueue = (function (serial, MSP) {
|
||||||
privateScope.queue = [];
|
privateScope.queue = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method puts new request into queue
|
||||||
|
* @param {MspMessageClass} mspRequest
|
||||||
|
* @returns {boolean} true on success, false when queue is locked
|
||||||
|
*/
|
||||||
publicScope.put = function (mspRequest) {
|
publicScope.put = function (mspRequest) {
|
||||||
|
|
||||||
|
if (privateScope.queueLocked === true) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
privateScope.queue.push(mspRequest);
|
privateScope.queue.push(mspRequest);
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
publicScope.getLength = function () {
|
publicScope.getLength = function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue