mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-22 03:49:18 +02:00
feat(firmware): list all announced versions with usable/unavailable status, support rollback
Firmware update modal now shows every version from Bambu's wiki release history, each badged Usable/Unavailable/Installed. Selecting a usable row — newer or older than current — swaps the release notes and enables install for that version, so rollback no longer requires hand-flashing. Wiki scraper tightened to only read heading-anchor ids (h-XXXXXXXX-YYYYMMDD) instead of any XX.XX.XX.XX substring, eliminating false positives like an AMS firmware version mentioned in an H2D changelog being listed as H2D firmware. Refs #568
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Compare two Bambu Lab firmware version strings (format: "XX.XX.XX.XX").
|
||||
*
|
||||
* Returns a negative number if `a` < `b`, zero if equal, positive if `a` > `b`.
|
||||
* Missing trailing segments are treated as 0.
|
||||
*/
|
||||
export function compareFwVersions(a: string, b: string): number {
|
||||
const pa = a.split('.').map((n) => parseInt(n, 10) || 0);
|
||||
const pb = b.split('.').map((n) => parseInt(n, 10) || 0);
|
||||
while (pa.length < 4) pa.push(0);
|
||||
while (pb.length < 4) pb.push(0);
|
||||
for (let i = 0; i < 4; i++) {
|
||||
if (pa[i] !== pb[i]) return pa[i] - pb[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user