Skip to content

Commit 1af3d3e

Browse files
authored
Corrected when analytics is being sent (#4553)
- this is due to the data coming in later TODO: will move more to async / await calls
1 parent bfdeb0d commit 1af3d3e

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

src/js/serial_backend.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,21 @@ export function initializeSerialBackend() {
8080
PortUsage.initialize();
8181
}
8282

83+
async function sendConfigTracking() {
84+
tracking.sendEvent(tracking.EVENT_CATEGORIES.FLIGHT_CONTROLLER, "Loaded", {
85+
boardIdentifier: FC.CONFIG.boardIdentifier,
86+
targetName: FC.CONFIG.targetName,
87+
boardName: FC.CONFIG.boardName,
88+
hardware: FC.CONFIG.hardwareName,
89+
manufacturerId: FC.CONFIG.manufacturerId,
90+
apiVersion: FC.CONFIG.apiVersion,
91+
flightControllerVersion: FC.CONFIG.flightControllerVersion,
92+
flightControllerIdentifier: FC.CONFIG.flightControllerIdentifier,
93+
mcu: FC.CONFIG.targetName,
94+
deviceIdentifier: CryptoES.SHA1(FC.CONFIG.deviceIdentifier).toString(),
95+
});
96+
}
97+
8398
function connectDisconnect() {
8499
const selectedPort = PortHandler.portPicker.selectedPort;
85100

@@ -403,18 +418,6 @@ function processBoardInfo() {
403418
} else {
404419
processCustomDefaults();
405420
}
406-
tracking.sendEvent(tracking.EVENT_CATEGORIES.FLIGHT_CONTROLLER, "Loaded", {
407-
boardIdentifier: FC.CONFIG.boardIdentifier,
408-
targetName: FC.CONFIG.targetName,
409-
boardName: FC.CONFIG.boardName,
410-
hardware: FC.CONFIG.hardwareName,
411-
manufacturerId: FC.CONFIG.manufacturerId,
412-
apiVersion: FC.CONFIG.apiVersion,
413-
flightControllerVersion: FC.CONFIG.flightControllerVersion,
414-
flightControllerIdentifier: FC.CONFIG.flightControllerIdentifier,
415-
mcu: FC.CONFIG.targetName,
416-
deviceIdentifier: CryptoES.SHA1(FC.CONFIG.deviceIdentifier).toString(),
417-
});
418421
}
419422

420423
function checkReportProblems() {
@@ -502,7 +505,7 @@ async function processBuildOptions() {
502505

503506
buildApi.requestBuildOptions(FC.CONFIG.buildKey, onLoadCloudBuild, processCraftName);
504507
} else {
505-
processCraftName();
508+
await processCraftName();
506509
}
507510
}
508511

@@ -515,7 +518,7 @@ async function processBuildConfiguration() {
515518
gui_log(i18n.getMessage("buildKey", FC.CONFIG.buildKey));
516519
}
517520

518-
processBuildOptions();
521+
await processBuildOptions();
519522
}
520523

521524
async function processUid() {
@@ -525,7 +528,8 @@ async function processUid() {
525528

526529
gui_log(i18n.getMessage("uniqueDeviceIdReceived", FC.CONFIG.deviceIdentifier));
527530

528-
processBuildConfiguration();
531+
await sendConfigTracking();
532+
await processBuildConfiguration();
529533
}
530534

531535
async function processCraftName() {

0 commit comments

Comments
 (0)