Skip to content

Commit b4697dc

Browse files
committed
Abstract
1 parent bce1548 commit b4697dc

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

locales/en/messages.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,9 @@
582582
"firmwareUpgradeRequired": {
583583
"message": "The firmware on this device needs upgrading to a newer version. Use CLI for backup before flashing. CLI backup/restore procedure is in the documentation.<br />Alternatively download and use an old version of the app if you are not ready to upgrade."
584584
},
585+
"firmwareVersionNotYetSupported": {
586+
"message": "This firmware version ($1) is <span class=\"message-negative\">not yet supported</span>."
587+
},
585588
"resetToCustomDefaultsDialog": {
586589
"message": "There are custom defaults for this board available. Normally, a board will not work properly unless custom defaults are applied.<br />Do you want to apply the custom defaults for this board?"
587590
},

src/js/serial_backend.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,8 @@ function abortConnection() {
286286
function showVersionMismatchAndCli(message) {
287287
const dialog = $(".dialogConnectWarning")[0];
288288

289-
$(".dialogConnectWarning-content").html(
290-
message || i18n.getMessage("firmwareVersionNotSupported", [CONFIGURATOR.API_VERSION_ACCEPTED]),
291-
);
292-
293-
$(".dialogConnectWarning-closebtn").one("click", function () {
294-
dialog.close();
295-
});
289+
$(".dialogConnectWarning-content").html(message);
290+
$(".dialogConnectWarning-closebtn").one("click", () => dialog.close());
296291

297292
dialog.showModal();
298293

@@ -342,14 +337,15 @@ function onOpen(openInfo) {
342337
return;
343338
}
344339

345-
// Check version compatibility first
346340
if (
347341
!semver.satisfies(
348342
FC.CONFIG.apiVersion,
349343
`<=${semver.major(CONFIGURATOR.API_VERSION_MAX_SUPPORTED)}.${semver.minor(CONFIGURATOR.API_VERSION_MAX_SUPPORTED)}`,
350344
)
351345
) {
352-
showVersionMismatchAndCli();
346+
showVersionMismatchAndCli(
347+
i18n.getMessage("firmwareVersionNotYetSupported", [CONFIGURATOR.API_VERSION_MAX_SUPPORTED]),
348+
);
353349
return;
354350
}
355351

@@ -371,16 +367,13 @@ function onOpen(openInfo) {
371367
});
372368
});
373369
} else {
374-
showVersionMismatchAndCli(i18n.getMessage("firmwareTypeNotSupported"));
370+
showVersionMismatchAndCli(
371+
i18n.getMessage("firmwareTypeNotSupported", [CONFIGURATOR.API_VERSION_ACCEPTED]),
372+
);
375373
}
376374
});
377375
} else {
378-
if (!serial.connected) {
379-
abortConnection();
380-
return;
381-
}
382-
383-
showVersionMismatchAndCli();
376+
showVersionMismatchAndCli(i18n.getMessage("firmwareUpgradeRequired"));
384377
}
385378
});
386379
} else {

0 commit comments

Comments
 (0)