wifinina: fix getMACAddress and getTime

Tested against Adafruit AirLift (compatibile variant of wifinina)
This commit is contained in:
Kenneth Bell
2021-04-13 19:15:42 -07:00
committed by Ron Evans
parent e6a822f68b
commit 2a48b5c25d
+4 -3
View File
@@ -557,8 +557,9 @@ func (d *Device) GetReasonCode() (uint8, error) {
return d.getUint8(d.req0(CmdGetReasonCode)) return d.getUint8(d.req0(CmdGetReasonCode))
} }
func (d *Device) GetTime() (string, error) { // GetTime is the time as a Unix timestamp
return d.getString(d.req0(CmdGetTime)) func (d *Device) GetTime() (uint32, error) {
return d.getUint32(d.req0(CmdGetTime))
} }
func (d *Device) GetTemperature() (float32, error) { func (d *Device) GetTemperature() (float32, error) {
@@ -734,7 +735,7 @@ func (d *Device) getMACAddress(l uint8, err error) (MACAddress, error) {
if l != 6 { if l != 6 {
return 0, ErrUnexpectedLength return 0, ErrUnexpectedLength
} }
return MACAddress(binary.LittleEndian.Uint64(d.buf[0:8]) >> 16), err return MACAddress(binary.LittleEndian.Uint64(d.buf[0:8]) & 0xFFFFFFFFFFFF), err
} }
// req0 sends a command to the device with no request parameters // req0 sends a command to the device with no request parameters