implement some features of Venus OS
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-02-19 15:37:41 +11:00
parent d72e88ab7b
commit e8153e2953
21 changed files with 4143 additions and 90 deletions

View File

@@ -208,13 +208,19 @@ func (w *WebGui) handleSetRemotePanelState(rw http.ResponseWriter, r *http.Reque
return
}
if err := w.writer.SetPanelState(switchState, req.CurrentLimit); err != nil {
logEntry.WithError(err).Error("Failed to apply remote panel state")
var setErr error
if sourceAware, ok := w.writer.(mk2driver.SourceAwareSettingsWriter); ok {
setErr = sourceAware.SetPanelStateWithSource(mk2driver.CommandSourceUI, switchState, req.CurrentLimit)
} else {
setErr = w.writer.SetPanelState(switchState, req.CurrentLimit)
}
if setErr != nil {
logEntry.WithError(setErr).Error("Failed to apply remote panel state")
w.updateRemotePanelState(func(state *remotePanelState) {
state.LastCommand = "set_remote_panel_state"
state.LastError = err.Error()
state.LastError = setErr.Error()
})
http.Error(rw, err.Error(), http.StatusBadGateway)
http.Error(rw, setErr.Error(), http.StatusBadGateway)
return
}
@@ -243,7 +249,13 @@ func (w *WebGui) handleSetRemotePanelStandby(rw http.ResponseWriter, r *http.Req
}
log.WithField("standby", req.Standby).Info("Applying standby state from API")
if err := w.writer.SetStandby(req.Standby); err != nil {
var err error
if sourceAware, ok := w.writer.(mk2driver.SourceAwareSettingsWriter); ok {
err = sourceAware.SetStandbyWithSource(mk2driver.CommandSourceUI, req.Standby)
} else {
err = w.writer.SetStandby(req.Standby)
}
if err != nil {
log.WithError(err).WithField("standby", req.Standby).Error("Failed to apply standby state")
w.updateRemotePanelState(func(state *remotePanelState) {
state.LastCommand = "set_remote_panel_standby"