Add timestamp to mk2info

This commit is contained in:
Hendrik van Wyk
2017-09-16 15:36:24 +02:00
parent 33ad6b8d1d
commit dd8ee443e2
2 changed files with 5 additions and 0 deletions

View File

@@ -130,6 +130,7 @@ func (mk2 *mk2Ser) addError(err error) {
func (mk2 *mk2Ser) updateReport() { func (mk2 *mk2Ser) updateReport() {
mk2.Lock() mk2.Lock()
defer mk2.Unlock() defer mk2.Unlock()
mk2.info.Timestamp = time.Now()
mk2.report = mk2.info mk2.report = mk2.info
select { select {
case mk2.infochan <- mk2.info: case mk2.infochan <- mk2.info:

View File

@@ -1,5 +1,7 @@
package mk2if package mk2if
import "time"
const ( const (
LED_TEMPERATURE = 128 LED_TEMPERATURE = 128
LED_LOW_BATTERY = 64 LED_LOW_BATTERY = 64
@@ -51,6 +53,8 @@ type Mk2Info struct {
LedListBlink []int LedListBlink []int
Errors []error Errors []error
Timestamp time.Time
} }
type Mk2If interface { type Mk2If interface {