Documentation
¶
Index ¶
Constants ¶
View Source
const ( RetryDelay = 3 * time.Second SerialReadTimeout = 5 * time.Second BaudRate = 9600 )
View Source
const ( ErrEOF = "ERR_EOF" ErrTimeout = "ERR_TIMEOUT" ErrRead = "ERR_READ" ErrConnection = "ERR_SCALE_CONN" )
Variables ¶
View Source
var BrandCommands = map[string]string{
"rhino": "P",
"rhino bar 8rs": "P",
}
BrandCommands maps scale brands to their weight request commands
View Source
var ErrorDescriptions = map[string]string{ ErrEOF: "EOF recibido. Posible desconexión.", ErrTimeout: "Timeout de lectura.", ErrRead: "Error de lectura.", ErrConnection: "No se pudo conectar al puerto serial.", }
Functions ¶
func GenerateSimulatedWeights ¶
func GenerateSimulatedWeights() []float64
GenerateSimulatedWeights creates a sequence of realistic weight readings Returns 5 fluctuating values followed by a stable reading
func GetCommand ¶
GetCommand returns the command for a given brand Defaults to "P" if brand is unknown
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader manages serial port communication with the scale
func (*Reader) ClosePort ¶
func (r *Reader) ClosePort()
ClosePort closes the serial port for config changes
Click to show internal directories.
Click to hide internal directories.