Documentation
¶
Index ¶
Constants ¶
const ( CmdEndMemory = 0x80 // TX Memorias FIN CmdRepeat = 0x90 // TX Memoria REPITE CmdNext = 0xA0 // TX Memoria SIGUIENTE CmdNext24h = 0xB0 // TX Memoria 24h SIGUIENTE CmdStartMemory = 0xC0 // TX Memoria INICIA CmdGetCurrent = 0xE0 // TX Actual (solicitud asíncrona) )
Command base codes (before OR with device address). Final command byte = Base | DeviceAddr (addr 1-14, default 4).
const DefaultAddr = 4
DefaultAddr is the device address shipped from the factory.
Variables ¶
This section is empty.
Functions ¶
func AppendChecksum ¶
AppendChecksum appends a 4-char hex checksum to data and returns the full frame.
func SensorNames ¶
func SensorNames() [8]string
SensorNames returns default display names for the 8 memory-frame channels. Channel 7 (index 6) is the motor/compressor; exact mapping should be verified against the physical chamber wiring.
func VerifyChecksum ¶
VerifyChecksum returns true if the frame passes its checksum.
Memory frame (77 chars):
- bytes 1-73 (0-72 in Go) are data
- bytes 74-77 (73-76) are 4-char uppercase hex sum
Async frame (52 chars):
- bytes 1-48 (0-47) are data
- bytes 49-52 (48-51) are 4-char uppercase hex sum
Types ¶
type Frame ¶
type Frame struct {
RecordIndex int
Timestamp time.Time
Sensors [8]SensorReading
}
Frame is a parsed PITEC memory record (77-char frame). Sensor numbering follows the device's internal channel order (1-8). Channel 7 is the motor/compressor duty channel; the others are thermal sensors.
func ParseFrame ¶
ParseFrame parses a full 77-char memory frame (positions are 1-indexed in the source). Returns an error if the frame is too short or the checksum fails.
type FrameCurrent ¶
type FrameCurrent struct {
RecordIndex int
Timestamp time.Time
Sensors [4]SensorReading
}
FrameCurrent is a parsed PITEC async "current values" response (52-char frame). It carries fewer fields than a full memory frame.
func ParseFrameCurrent ¶
func ParseFrameCurrent(raw []byte) (*FrameCurrent, error)
ParseFrameCurrent parses the shorter 52-char async frame.
type SensorReading ¶
SensorReading holds the raw integer value and alarm flag for one sensor channel. Values are in device units (typically 0.1 °C for temperature, 0.1 % for humidity, or raw counts for motor/fan). Divide by 10.0 to get physical SI values for temp/hum.