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
J Blackman 2023-01-01 15:11:10 +11:00 committed by GitHub
parent a0ba23865f
commit 17d4738b34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 22 deletions

View File

@ -58,6 +58,13 @@ function appReady() {
i18n.init(function() {
startProcess();
// pass the configurator version as a custom header for every AJAX request.
$.ajaxSetup({
headers: {
'X-CFG-VER': `${CONFIGURATOR.version}`,
},
});
initializeSerialBackend();
$('.connect_b a.connect').removeClass('disabled');

View File

@ -650,6 +650,7 @@ MspHelper.prototype.process_data = function(dataHandler) {
FC.CONFIG.uid[0] = data.readU32();
FC.CONFIG.uid[1] = 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;
case MSPCodes.MSP_ACC_TRIM:
FC.CONFIG.accelerometerTrims[0] = data.read16(); // pitch

View File

@ -89,6 +89,7 @@ class ReleaseLoader {
data: JSON.stringify(request),
contentType: "application/json",
dataType: "json",
success: function(data) {
onSuccess(data);
},

View File

@ -404,7 +404,7 @@ function checkReportProblems() {
function processUid() {
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();
GUI.log(i18n.getMessage('uniqueDeviceIdReceived', [uniqueDeviceIdentifier]));

View File

@ -522,6 +522,7 @@ firmware_flasher.initialize = function (callback) {
FC.CONFIG.apiVersion = '0.0.0';
}
console.log(FC.CONFIG.apiVersion);
MSP.send_message(MSPCodes.MSP_UID, false, false, () => {
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_39)) {
MSP.send_message(MSPCodes.MSP_BOARD_INFO, false, false, onFinish);
} else {
@ -529,6 +530,7 @@ firmware_flasher.initialize = function (callback) {
onClose();
}
});
});
}
function onConnect(openInfo) {
@ -780,6 +782,9 @@ firmware_flasher.initialize = function (callback) {
release: summary.release,
options: [],
classicBuild: false,
client: {
version: CONFIGURATOR.version,
},
};
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 requested:", info);
console.info("Build request:", request);
self.releaseLoader.requestBuild(request, (response) => {
console.info("Build response:", response);
// Complete the summary object to be used later
summary.file = info.file;
summary.file = response.file;
if (!summary.cloudBuild) {
// 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;
}
updateStatus('Pending', info.key, 0, false);
updateStatus('Pending', response.key, 0, false);
let retries = 1;
self.releaseLoader.requestBuildStatus(info.key, (status) => {
self.releaseLoader.requestBuildStatus(response.key, (status) => {
if (status.status !== "queued") {
// will be cached already, no need to wait.
if (status.status === 'success') {
updateStatus('SuccessCached', info.key, 100, true);
updateStatus('SuccessCached', response.key, 100, true);
$('.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 {
updateStatus('Failed', info.key, 0, true);
updateStatus('Failed', response.key, 0, true);
onLoadFailed();
}
return;
}
const timer = setInterval(() => {
self.releaseLoader.requestBuildStatus(info.key, (status) => {
self.releaseLoader.requestBuildStatus(response.key, (status) => {
if (status.status !== 'queued' || retries > 10) {
clearInterval(timer);
if (status.status === 'success') {
updateStatus('Success', info.key, 100, true);
self.releaseLoader.loadTargetHex(info.url, (hex) => onLoadSuccess(hex, info.file), onLoadFailed);
updateStatus('Success', response.key, 100, true);
self.releaseLoader.loadTargetHex(response.url, (hex) => onLoadSuccess(hex, response.file), onLoadFailed);
} else {
if (retries > 10) {
updateStatus('TimedOut', info.key, 0, true);
updateStatus('TimedOut', response.key, 0, true);
} else {
updateStatus('Failed', info.key, 0, true);
updateStatus('Failed', response.key, 0, true);
}
onLoadFailed();
}
return;
}
updateStatus('Processing', info.key, retries * 10, false);
updateStatus('Processing', response.key, retries * 10, false);
retries = retries + 1;
});
}, 4000);