Cleanup mk2 logging
This commit is contained in:
@@ -4,10 +4,11 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"math"
|
"math"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type scaling struct {
|
type scaling struct {
|
||||||
@@ -131,7 +132,7 @@ func (m *mk2Ser) frameLocker() {
|
|||||||
} else {
|
} else {
|
||||||
if checkChecksum(frameLength, tmp, frame[:frameLengthOffset]) {
|
if checkChecksum(frameLength, tmp, frame[:frameLengthOffset]) {
|
||||||
m.frameLock = true
|
m.frameLock = true
|
||||||
log.Printf("Locked")
|
logrus.Info("Locked")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,7 +209,7 @@ func (m *mk2Ser) handleFrame(l byte, frame []byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Printf("Invalid incoming frame checksum: %x", frame)
|
logrus.Errorf("Invalid incoming frame checksum: %x", frame)
|
||||||
m.frameLock = false
|
m.frameLock = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -236,7 +237,7 @@ func (m *mk2Ser) scaleDecode(frame []byte) {
|
|||||||
tmp := scaling{}
|
tmp := scaling{}
|
||||||
if len(frame) <= 2 {
|
if len(frame) <= 2 {
|
||||||
tmp.supported = false
|
tmp.supported = false
|
||||||
log.Printf("Skiping scaling factors for: %d", m.scaleCount)
|
logrus.Warnf("Skiping scaling factors for: %d", m.scaleCount)
|
||||||
} else {
|
} else {
|
||||||
tmp.supported = true
|
tmp.supported = true
|
||||||
scl := uint16(frame[2])<<8 + uint16(frame[1])
|
scl := uint16(frame[2])<<8 + uint16(frame[1])
|
||||||
@@ -254,9 +255,8 @@ func (m *mk2Ser) scaleDecode(frame []byte) {
|
|||||||
if m.scaleCount < ramVarMaxOffset {
|
if m.scaleCount < ramVarMaxOffset {
|
||||||
m.reqScaleFactor(byte(m.scaleCount))
|
m.reqScaleFactor(byte(m.scaleCount))
|
||||||
} else {
|
} else {
|
||||||
log.Print("Monitoring starting.")
|
logrus.Info("Monitoring starting.")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode the version number
|
// Decode the version number
|
||||||
|
|||||||
Reference in New Issue
Block a user