Adding some extra data elements to a build request (#3194)
* Adding some extra data elements to a build request - so as to be able to provide better support, and analysis * Renamed "info" to more appropriate "response"10.9-maintenance
parent
a0ba23865f
commit
17d4738b34
|
@ -58,6 +58,13 @@ function appReady() {
|
||||||
i18n.init(function() {
|
i18n.init(function() {
|
||||||
startProcess();
|
startProcess();
|
||||||
|
|
||||||
|
// pass the configurator version as a custom header for every AJAX request.
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CFG-VER': `${CONFIGURATOR.version}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
initializeSerialBackend();
|
initializeSerialBackend();
|
||||||
|
|
||||||
$('.connect_b a.connect').removeClass('disabled');
|
$('.connect_b a.connect').removeClass('disabled');
|
||||||
|
|
|
@ -650,6 +650,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
FC.CONFIG.uid[0] = data.readU32();
|
FC.CONFIG.uid[0] = data.readU32();
|
||||||
FC.CONFIG.uid[1] = data.readU32();
|
FC.CONFIG.uid[1] = data.readU32();
|
||||||
FC.CONFIG.uid[2] = data.readU32();
|
FC.CONFIG.uid[2] = data.readU32();
|
||||||
|
FC.CONFIG.deviceIdentifier = FC.CONFIG.uid[0].toString(16) + FC.CONFIG.uid[1].toString(16) + FC.CONFIG.uid[2].toString(16);
|
||||||
break;
|
break;
|
||||||
case MSPCodes.MSP_ACC_TRIM:
|
case MSPCodes.MSP_ACC_TRIM:
|
||||||
FC.CONFIG.accelerometerTrims[0] = data.read16(); // pitch
|
FC.CONFIG.accelerometerTrims[0] = data.read16(); // pitch
|
||||||
|
|
|
@ -89,6 +89,7 @@ class ReleaseLoader {
|
||||||
data: JSON.stringify(request),
|
data: JSON.stringify(request),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
onSuccess(data);
|
onSuccess(data);
|
||||||
},
|
},
|
||||||
|
|
|
@ -404,7 +404,7 @@ function checkReportProblems() {
|
||||||
|
|
||||||
function processUid() {
|
function processUid() {
|
||||||
MSP.send_message(MSPCodes.MSP_UID, false, false, function () {
|
MSP.send_message(MSPCodes.MSP_UID, false, false, function () {
|
||||||
const uniqueDeviceIdentifier = FC.CONFIG.uid[0].toString(16) + FC.CONFIG.uid[1].toString(16) + FC.CONFIG.uid[2].toString(16);
|
const uniqueDeviceIdentifier = FC.CONFIG.uniqueDeviceIdentifier;
|
||||||
|
|
||||||
connectionTimestamp = Date.now();
|
connectionTimestamp = Date.now();
|
||||||
GUI.log(i18n.getMessage('uniqueDeviceIdReceived', [uniqueDeviceIdentifier]));
|
GUI.log(i18n.getMessage('uniqueDeviceIdReceived', [uniqueDeviceIdentifier]));
|
||||||
|
|
|
@ -522,12 +522,14 @@ firmware_flasher.initialize = function (callback) {
|
||||||
FC.CONFIG.apiVersion = '0.0.0';
|
FC.CONFIG.apiVersion = '0.0.0';
|
||||||
}
|
}
|
||||||
console.log(FC.CONFIG.apiVersion);
|
console.log(FC.CONFIG.apiVersion);
|
||||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_39)) {
|
MSP.send_message(MSPCodes.MSP_UID, false, false, () => {
|
||||||
MSP.send_message(MSPCodes.MSP_BOARD_INFO, false, false, onFinish);
|
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_39)) {
|
||||||
} else {
|
MSP.send_message(MSPCodes.MSP_BOARD_INFO, false, false, onFinish);
|
||||||
console.log('Firmware version not supported for reading board information');
|
} else {
|
||||||
onClose();
|
console.log('Firmware version not supported for reading board information');
|
||||||
}
|
onClose();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,6 +782,9 @@ firmware_flasher.initialize = function (callback) {
|
||||||
release: summary.release,
|
release: summary.release,
|
||||||
options: [],
|
options: [],
|
||||||
classicBuild: false,
|
classicBuild: false,
|
||||||
|
client: {
|
||||||
|
version: CONFIGURATOR.version,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
request.classicBuild = !summary.cloudBuild || $('input[name="classicBuildModeCheckbox"]').is(':checked');
|
request.classicBuild = !summary.cloudBuild || $('input[name="classicBuildModeCheckbox"]').is(':checked');
|
||||||
|
@ -811,53 +816,54 @@ firmware_flasher.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.releaseLoader.requestBuild(request, (info) => {
|
console.info("Build request:", request);
|
||||||
console.info("Build requested:", info);
|
self.releaseLoader.requestBuild(request, (response) => {
|
||||||
|
console.info("Build response:", response);
|
||||||
|
|
||||||
// Complete the summary object to be used later
|
// Complete the summary object to be used later
|
||||||
summary.file = info.file;
|
summary.file = response.file;
|
||||||
|
|
||||||
if (!summary.cloudBuild) {
|
if (!summary.cloudBuild) {
|
||||||
// it is a previous release, so simply load the hex
|
// it is a previous release, so simply load the hex
|
||||||
self.releaseLoader.loadTargetHex(info.url, (hex) => onLoadSuccess(hex, info.file), onLoadFailed);
|
self.releaseLoader.loadTargetHex(response.url, (hex) => onLoadSuccess(hex, response.file), onLoadFailed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStatus('Pending', info.key, 0, false);
|
updateStatus('Pending', response.key, 0, false);
|
||||||
let retries = 1;
|
let retries = 1;
|
||||||
self.releaseLoader.requestBuildStatus(info.key, (status) => {
|
self.releaseLoader.requestBuildStatus(response.key, (status) => {
|
||||||
if (status.status !== "queued") {
|
if (status.status !== "queued") {
|
||||||
// will be cached already, no need to wait.
|
// will be cached already, no need to wait.
|
||||||
if (status.status === 'success') {
|
if (status.status === 'success') {
|
||||||
updateStatus('SuccessCached', info.key, 100, true);
|
updateStatus('SuccessCached', response.key, 100, true);
|
||||||
$('.buildProgress').val(100);
|
$('.buildProgress').val(100);
|
||||||
self.releaseLoader.loadTargetHex(info.url, (hex) => onLoadSuccess(hex, info.file), onLoadFailed);
|
self.releaseLoader.loadTargetHex(response.url, (hex) => onLoadSuccess(hex, response.file), onLoadFailed);
|
||||||
} else {
|
} else {
|
||||||
updateStatus('Failed', info.key, 0, true);
|
updateStatus('Failed', response.key, 0, true);
|
||||||
onLoadFailed();
|
onLoadFailed();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
self.releaseLoader.requestBuildStatus(info.key, (status) => {
|
self.releaseLoader.requestBuildStatus(response.key, (status) => {
|
||||||
if (status.status !== 'queued' || retries > 10) {
|
if (status.status !== 'queued' || retries > 10) {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
if (status.status === 'success') {
|
if (status.status === 'success') {
|
||||||
updateStatus('Success', info.key, 100, true);
|
updateStatus('Success', response.key, 100, true);
|
||||||
self.releaseLoader.loadTargetHex(info.url, (hex) => onLoadSuccess(hex, info.file), onLoadFailed);
|
self.releaseLoader.loadTargetHex(response.url, (hex) => onLoadSuccess(hex, response.file), onLoadFailed);
|
||||||
} else {
|
} else {
|
||||||
if (retries > 10) {
|
if (retries > 10) {
|
||||||
updateStatus('TimedOut', info.key, 0, true);
|
updateStatus('TimedOut', response.key, 0, true);
|
||||||
} else {
|
} else {
|
||||||
updateStatus('Failed', info.key, 0, true);
|
updateStatus('Failed', response.key, 0, true);
|
||||||
}
|
}
|
||||||
onLoadFailed();
|
onLoadFailed();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStatus('Processing', info.key, retries * 10, false);
|
updateStatus('Processing', response.key, retries * 10, false);
|
||||||
retries = retries + 1;
|
retries = retries + 1;
|
||||||
});
|
});
|
||||||
}, 4000);
|
}, 4000);
|
||||||
|
|
Loading…
Reference in New Issue