th7/pcb/dummy.go
2023-12-13 08:17:16 +00:00

41 lines
659 B
Go

package pcb
import (
"log"
"math/rand"
"th7/data/pcb"
"time"
)
type DummyAdapter struct {
table pcb.Table
}
func NewDummyAdapter() (*DummyAdapter, error) {
rand.Seed(time.Now().UnixNano())
return &DummyAdapter{}, nil
}
func (d *DummyAdapter) Deinit() error {
log.Println("dummy pcb adapter deinit")
return nil
}
func (d *DummyAdapter) UpdateTable() {
d.table.Pivdd = 5.0
d.table.Vadj = 0.9
d.table.Vref = 3.6
}
func (d *DummyAdapter) GetTable() pcb.Table {
return d.table
}
func (d *DummyAdapter) ReadChannel(id int, gain float64) float64 {
return -9000.0 * rand.Float64()
}
func (d *DummyAdapter) ReadPCBTemp() float64 {
return 25.0
}