This commit is contained in:
legop3
2026-11-16 23:22:43 -05:00
parent 9626389dbe
commit 2d9b6e4a36
16 changed files with 67 additions and 36 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ func (c *WSClient) applyMixerGain(control string, gain float64) {
return
}
// Convert linear gain to dB, matching softvol max_dB=12.0 in /etc/asound.conf.
// Convert linear gain to dB, matching softvol max_dB=12.0 in the generated ALSA routing.
db := 20.0 * math.Log10(normalized)
if db > 12.0 {
db = 12.0
+3 -8
View File
@@ -272,8 +272,8 @@ func DefaultConfig() Config {
Height: 480,
FPS: 30,
Bitrate: 2000000,
Inverted: true,
SensorMode: "1296:972",
Inverted: false,
SensorMode: "",
},
AudioCapture: AudioCaptureConfig{
Profile: "alsa",
@@ -471,12 +471,7 @@ func validateAudioConfig(cfg *AudioConfig) {
}
func validateMediaConfig(cfg *MediaConfig, serverURL string, roverName string) error {
/*
The nested media config is the source of truth for the publisher scripts,
so defaults that used to live in shell are normalized here before any env
file is written. This keeps the Pi behavior stable while making laptop
and future publisher variants explicit configuration choices.
*/
// Normalize shared settings before they become profile command variables.
if cfg.RTSPPort <= 0 {
cfg.RTSPPort = 8554
}
+15 -11
View File
@@ -20,7 +20,7 @@ const (
)
// HostStats is the wire format sent from roverd to the server. It avoids
// Roomba-specific sensor naming so the browser can treat these values as Pi
// Roomba-specific sensor naming so the browser can treat these values as Linux
// host health, not robot telemetry.
type HostStats struct {
UptimeSec *float64 `json:"uptimeSec,omitempty"`
@@ -136,17 +136,21 @@ func CollectHostStats(ctx context.Context) HostStats {
}
}
if coreV, err := readCoreVoltage(ctx); err != nil {
stats.addError("coreVoltage", err)
} else {
stats.CoreVoltageV = &coreV
}
// Firmware voltage/throttle telemetry is optional on non-Pi hosts.
if _, err := exec.LookPath("vcgencmd"); err == nil {
if coreV, err := readCoreVoltage(ctx); err != nil {
stats.addError("coreVoltage", err)
} else {
stats.CoreVoltageV = &coreV
}
if raw, flags, err := readThrottleFlags(ctx); err != nil {
stats.addError("throttled", err)
} else {
stats.ThrottledRaw = raw
stats.applyThrottleFlags(flags)
}
if raw, flags, err := readThrottleFlags(ctx); err != nil {
stats.addError("throttled", err)
} else {
stats.ThrottledRaw = raw
stats.applyThrottleFlags(flags)
}
if wifi, err := collectWiFiStats(ctx); err != nil {
+1 -1
View File
@@ -239,7 +239,7 @@ func (c *ManagementClient) forwardHostStats(ctx context.Context, conn *websocket
send := func() bool {
// Host stats are collected on demand so each outbound message describes
// the current Pi state. Collection failures are encoded into the stats
// the current host state. Collection failures are encoded into the stats
// payload, which keeps this telemetry path from closing the rover socket.
stats := CollectHostStats(ctx)
// Throughput is derived here because this loop owns the ordered, periodic
+1 -1
View File
@@ -63,7 +63,7 @@
"fps": 30,
"bitrate": 2000000,
"inverted": false,
"sensorMode": "1296:972"
"sensorMode": ""
},
"audioCapture": {
"profile": "alsa",
+1 -1
View File
@@ -671,7 +671,7 @@ func (c *WSClient) handleRebootTimeout() {
c.connMu.Unlock()
c.console.Notify("Control server has been disconnected for 6 minutes. Rebooting the rover now.")
c.log.Printf("rebooting pi after prolonged websocket disconnect")
c.log.Printf("rebooting rover after prolonged websocket disconnect")
cmd := exec.Command("systemctl", "reboot")
if err := cmd.Start(); err != nil {
c.log.Printf("reboot command failed: %v", err)