Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/lib/bus/spans.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ test("limitText names what governs, lowest first", () => {
expect(limitText(1 << 0)).toBe("Current limit");
expect(limitText((1 << 1) | (1 << 2))).toBe("Stall yield, End stop");
expect(limitText((1 << 0) | (1 << 3))).toBe("Current limit, Stall permit");
expect(limitText(1 << 6)).toBe("Limit 0x40");
expect(limitText((1 << 4) | (1 << 6))).toBe("I2t budget, Rail fold");
expect(limitText(1 << 8)).toBe("Limit 0x100");
});

test("windowFloorText is percent of full duty, or not reported at zero", () => {
Expand Down
11 changes: 10 additions & 1 deletion src/lib/bus/spans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,16 @@ export function faultText(faultFlags: number, faultCode: number): string | undef
}

/** `limit_flags` bits (firmware kernel/limits.rs), lowest bit first. */
const LIMITS: readonly string[] = ["Current limit", "Stall yield", "End stop", "Stall permit"];
const LIMITS: readonly string[] = [
"Current limit",
"Stall yield",
"End stop",
"Stall permit",
"I2t budget",
"Thermal derate",
"Rail fold",
"Goal current",
];

export function limitText(limitFlags: number): string {
const set = LIMITS.filter((_, bit) => (limitFlags & (1 << bit)) !== 0);
Expand Down
Loading