mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
guh
This commit is contained in:
@@ -42,14 +42,14 @@ export default function AuthPanel() {
|
||||
{loading ? 'Logging in…' : 'Login'}
|
||||
</button>
|
||||
</form>
|
||||
<div className="flex gap-0.5 text-sm">
|
||||
{/* <div className="flex gap-0.5 text-sm">
|
||||
<button type="button" onClick={() => setRole('user')} className="flex-1 button-dark">
|
||||
Driver
|
||||
</button>
|
||||
<button type="button" onClick={() => setRole('spectator')} className="flex-1 button-dark">
|
||||
Spectator
|
||||
</button>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ export default function TelemetryPanel() {
|
||||
<CliffBar value={sensors.cliffFrontRightSignal} />
|
||||
<CliffBar value={sensors.cliffRightSignal} />
|
||||
</div>
|
||||
<MotorCurrentBar label="Left Wheel" value={sensors.wheelLeftCurrentMa} overcurrent={sensors.wheelOverCurrents.leftWheel}/>
|
||||
</>
|
||||
|
||||
)}
|
||||
@@ -143,3 +144,19 @@ function Metric({ label, value }) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// a reusable motor current bar, with overcurrent coloring. Use the overcurrent from sensors for each motor.
|
||||
// include a label to indicate which motor it is, with the label to the left of the bar
|
||||
function MotorCurrentBar({ label, value, overcurrent }) {
|
||||
const pct = value == null ? 0 : Math.max(0, Math.min(100, (value / 5000) * 100));
|
||||
const height = `${pct}%`;
|
||||
const barColor = overcurrent ? 'bg-red-500' : 'bg-emerald-500';
|
||||
return (
|
||||
<div className="flex items-center gap-0.5">
|
||||
<span className="text-sm text-slate-200">{label}</span>
|
||||
<div className="surface-muted h-6 w-20">
|
||||
<div className={barColor} style={{ height }} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user