summaryrefslogtreecommitdiffstats
path: root/server/dashboard.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/dashboard.go')
-rw-r--r--server/dashboard.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/dashboard.go b/server/dashboard.go
index 1dca024..a31625b 100644
--- a/server/dashboard.go
+++ b/server/dashboard.go
@@ -24,7 +24,7 @@ type Dashboard struct {
type DashboardHandler struct {
target share.Val[Humidity]
building Building
- dutyCycle share.Val[DutyCycle]
+ dutyCycle Record[DutyCycle]
}
func (h DashboardHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
@@ -56,10 +56,12 @@ func (h DashboardHandler) buildDashboard() Dashboard {
average = -1
}
+ c := make(chan Entry[DutyCycle])
+ h.dutyCycle.getRecent <- c
var duty DutyCycle
- if dutyp, ok := h.dutyCycle.TryGet(); ok {
- duty = *dutyp
- } else {
+ if e, ok := <-c; ok {
+ duty = e.v
+ } else {
duty = -1
}