Browse Source

fix mill

beelzebub 0.2.6
Gisle Aune 2 weeks ago
parent
commit
204f372be2
  1. 9
      services/mill/wifi.go

9
services/mill/wifi.go

@ -20,7 +20,8 @@ type WifiBridge struct {
ID string ID string
IP string IP string
state *device.State
state *device.State
desiredState device.State
mx sync.Mutex mx sync.Mutex
started bool started bool
@ -36,6 +37,8 @@ func (w *WifiBridge) SetState(id string, state device.State) bool {
return false return false
} }
w.desiredState = state
return true return true
} }
@ -93,9 +96,7 @@ func (w *WifiBridge) refresh() error {
}) })
} }
w.state.Temperature = gentools.Ptr(*w.state.Temperature - math.Mod(*w.state.Temperature, 0.5))
if math.Abs(temp-*w.state.Temperature) >= 0.1 {
if w.desiredState.Temperature != nil && math.Abs(temp-*w.desiredState.Temperature) >= 0.1 {
if err := w.writeTemperature(); err != nil { if err := w.writeTemperature(); err != nil {
return err return err
} }

Loading…
Cancel
Save