git.haldean.org sousvide / 4a6c605
A few fixes from testing. Changes: - Don't take out locks when reading; the rpi can't keep up - Set the default to be zero degrees - Increase the heater read interrupt timer Will Brown 8 years ago
3 changed file(s) with 2 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
2727 c.YRange.MinMode.Value = 0
2828 c.YRange.TicSetting.Grid = 1
2929 c.YRange.TicSetting.HideLabels = true
30
31 s.DataLock.Lock()
3230
3331 c.XRange.Fixed(0, float64(len(s.History))+1, float64(len(s.History)/10))
3432
6159 }
6260 errs = append(errs, ep)
6361 }
64 s.DataLock.Unlock()
6562
6663 c.AddData("Temperature", temps, chart.PlotStyleLines, chart.Style{
6764 LineColor: color.NRGBA{0xFF, 0x00, 0x00, 0xFF}, LineWidth: 2,
2828 func (s *SousVide) StartServer() {
2929 http.HandleFunc("/api_data", func(resp http.ResponseWriter, req *http.Request) {
3030 resp.Header().Set("Content-type", "application/json")
31
32 s.DataLock.Lock()
33 defer s.DataLock.Unlock()
3431
3532 if len(s.History) == 0 {
3633 resp.WriteHeader(http.StatusNoContent)
8683
8784 http.Handle("/", http.FileServer(http.Dir("static/")))
8885
89 log.Fatal(http.ListenAndServe(":8080", nil))
86 log.Fatal(http.ListenAndServe(":80", nil))
9087 }
1010 )
1111
1212 const (
13 InterruptDelay = 1 * time.Second
13 InterruptDelay = 3 * time.Second
1414 LogFile = "runlog.txt"
1515 HistoryLength = 2048
1616 LowpassSamples = 2
122122 flag.Parse()
123123
124124 s := New()
125 s.Target = 200
126125 s.Pid.P = 10
127126 s.Pid.I = 0.1
128127 s.Pid.D = 10