meter

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MeterConfig

type MeterConfig struct {
	Source        string
	Rotate        float64
	lcd.LcdConfig `yaml:",inline"`
	Range         []struct {
		Key string
		Min float64
		Max float64
	}
	BadImage            string // Save bad image to this file.
	Timeout             int    // Timeout in seconds
	Sample              int    // Sample interval in milliseconds
	History             int    // Size of moving average cache
	MaxLevels           int    // Size of calibration level map
	SavedLevels         int    // Number of levels saved
	Recalibrate         bool   // Recalibrate
	Calibration         string // Calibration save file
	RecalibrateInterval int    // Recalibrate interval in seconds
}

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader is a meter specific reader.

func NewReader

func NewReader(c *MeterConfig, trace bool) (*Reader, error)

Creates a new reader.

func (*Reader) GoodScan

func (r *Reader) GoodScan(res *lcd.DecodeResult)

The image was successfully scanned and decoded, at least within the heuristics that are possible. There is no guarantee that the decode was completely correct e.g it is possible to misread one or more digits such as mistaking a 1 for a 7. Given that this is considered a successful decode, use the levels that were sampled in this image to adjust the calibration levels being used in the decoder. This allows the decoder to dynamically adjust to changing image conditions.

func (*Reader) Read

func (r *Reader) Read(img image.Image) (string, float64, error)

Scan and decode the digits in the image.

func (*Reader) Recalibrate

func (r *Reader) Recalibrate()

If enabled, save the calibration data and recalibrate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL