FIX: voltageStr shows absolute values now

This commit is contained in:
Patrick Haßel 2025-02-03 16:01:52 +01:00
parent c68217b595
commit d62aab85ea
3 changed files with 6 additions and 9 deletions

View File

@ -26,7 +26,7 @@ export class Battery extends Part {
}
get voltageStr(): string {
return siPrefix(this.voltage, 'V', 2);
return siPrefix(Math.abs(this.voltage), 'V', 2);
}
get current(): number {
@ -34,8 +34,7 @@ export class Battery extends Part {
}
get currentStr(): string {
const current = Math.abs(this.current) || 0;
return siPrefix(current, 'A', 2);
return siPrefix(Math.abs(this.current) || 0, 'A', 2);
}
}

View File

@ -39,7 +39,7 @@ export class Light extends Part {
}
get voltageStr(): string {
return siPrefix(this.voltage, 'V', 2);
return siPrefix(Math.abs(this.voltage), 'V', 2);
}
get current(): number {
@ -50,8 +50,7 @@ export class Light extends Part {
}
get currentStr(): string {
const current = Math.abs(this.current) || 0;
return siPrefix(current, 'A', 2);
return siPrefix(Math.abs(this.current) || 0, 'A', 2);
}
fill(): string {

View File

@ -53,7 +53,7 @@ export class Relay extends Part {
}
get voltageStr(): string {
return siPrefix(this.voltage, 'V', 2);
return siPrefix(Math.abs(this.voltage), 'V', 2);
}
get current(): number {
@ -64,8 +64,7 @@ export class Relay extends Part {
}
get currentStr(): string {
const current = Math.abs(this.current) || 0;
return siPrefix(current, 'A', 2);
return siPrefix(Math.abs(this.current) || 0, 'A', 2);
}
override loop(): boolean {