gofmt
This commit is contained in:
parent
a58f3e8b5f
commit
e2d57edf45
@ -99,7 +99,7 @@ func Load() (config.Config, error) {
|
|||||||
}
|
}
|
||||||
c.Thermo = tc
|
c.Thermo = tc
|
||||||
|
|
||||||
c.Filter.SampleSize = v.GetInt(head+".filter.samples")
|
c.Filter.SampleSize = v.GetInt(head + ".filter.samples")
|
||||||
|
|
||||||
cfg.Channels = append(cfg.Channels, c)
|
cfg.Channels = append(cfg.Channels, c)
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@ const (
|
|||||||
DurWaitRestart = 1000 * time.Millisecond
|
DurWaitRestart = 1000 * time.Millisecond
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Continuously sample each configured channel, apply filter, and save result
|
// Continuously sample each configured channel, apply filter, and save result
|
||||||
// in a mutex controlled shared data object, that can be accessed at any time
|
// in a mutex controlled shared data object, that can be accessed at any time
|
||||||
// by a web-request or similar.
|
// by a web-request or similar.
|
||||||
@ -42,7 +40,7 @@ func startCacheService(t *TH7Adapter) {
|
|||||||
channel_id := t.cfg.Channels[channel].Id
|
channel_id := t.cfg.Channels[channel].Id
|
||||||
channel_gain := t.cfg.Channels[channel].Gain
|
channel_gain := t.cfg.Channels[channel].Gain
|
||||||
|
|
||||||
for i:=0; i<t.cfg.Channels[channel].Filter.SampleSize; i++ {
|
for i := 0; i < t.cfg.Channels[channel].Filter.SampleSize; i++ {
|
||||||
// update vref table
|
// update vref table
|
||||||
t.pcbPort.UpdateTable()
|
t.pcbPort.UpdateTable()
|
||||||
measurement := t.pcbPort.ReadChannel(channel_id, channel_gain)
|
measurement := t.pcbPort.ReadChannel(channel_id, channel_gain)
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Filter struct {
|
type Filter struct {
|
||||||
SampleSize int `json:"sample_size"`
|
SampleSize int `json:"sample_size"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Channel struct {
|
type Channel struct {
|
||||||
@ -13,7 +13,7 @@ type Channel struct {
|
|||||||
Thermo thermocouple.Type `json:"thermocouple"`
|
Thermo thermocouple.Type `json:"thermocouple"`
|
||||||
Gain float64 `json:"gain"`
|
Gain float64 `json:"gain"`
|
||||||
Offset float64 `json:"offset"`
|
Offset float64 `json:"offset"`
|
||||||
Filter Filter `json:"filter"`
|
Filter Filter `json:"filter"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TH7 struct {
|
type TH7 struct {
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
|
|
||||||
type Channel struct {
|
type Channel struct {
|
||||||
Id int `json:"id"`
|
Id int `json:"id"`
|
||||||
Value float64 `json:"value"`
|
Value float64 `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Ratio struct {
|
type Ratio struct {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package filter
|
package filter
|
||||||
|
|
||||||
|
|
||||||
func AlphaBetaFilter(arr []float64, init float64) float64 {
|
func AlphaBetaFilter(arr []float64, init float64) float64 {
|
||||||
|
|
||||||
value := init
|
value := init
|
||||||
|
Loading…
Reference in New Issue
Block a user