sensors

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Simple filament monitor
	Simple FilamentMonitorType = "simple"
	// Laser for a laser-based monitor
	Laser = "laser"
	// Pulsed filament monitor
	Pulsed = "pulsed"
	// RotatingMagnet filament monitor
	RotatingMagnet = "rotatingMagnet"
	// Unkown for unknown sensor type
	Unkown = "unknown"
)
View Source
const (
	Thermistor    AnalogSensorType = "thermistor"
	PT1000                         = "pt1000"
	MAX31865                       = "rtdmax31865"
	MAX31855                       = "thermocouplemax31855"
	MAX31856                       = "thermocouplemax31856"
	LinearAnalaog                  = "linearanalaog"
	DHT11                          = "dth11"
	DHT21                          = "dht21"
	DHT22                          = "dht22"
	DHTHumidity                    = "dhthumidity"
	CurrentLoop                    = "currentlooppyro"
	McuTemp                        = "mcutemp"
	Drivers                        = "drivers"
	DriversDuex                    = "driversduex"
	Unknown                        = "unknown"
)

Valid AnalogSensorType values

View Source
const (
	// InputPin for a generic input pin
	InputPin EndstopType = "inputPin"
	// ZProbeAsEndstop if the Z-probe acts as endstop
	ZProbeAsEndstop = "zProbeAsEndstop"
	// MotorStallAny stops all the drives when triggered
	MotorStallAny = "motorStallAny"
	// MotorStallIndividual stops individual drives when triggered
	MotorStallIndividual = "motorStallIndividual"
	// EndstopTypeUnknown is the unkown type
	EndstopTypeUnknown = "unknown"
)
View Source
const (
	// DefaultMaxProbeCount of a probe
	DefaultMaxProbeCount = 1
	// DefaultProbingSpeed at which a probing move is performed (in mm/s)
	DefaultProbingSpeed = 2.0
	// DefaultTriggerThreshold of an analog probe
	DefaultTriggerThreshold = 500
	// DefaultTolerance for a deviation between to measurements (in mm)
	DefaultTolerance = 0.03
	// DefaultTravelSpeed between probing locations (in mm/s)
	DefaultTravelSpeed = 100.0
	// DefaultTriggerHeight at which the probe is triggered (in mm)
	DefaultTriggerHeight = 0.7
)

Variables

View Source
var ErrInvalidIndex = errors.New("Invalid index")

ErrInvalidIndex is returned in case an invalid index is accessed

Functions

This section is empty.

Types

type AnalogSensor

type AnalogSensor struct {
	// LastReading of the sensor (in degC) or nil if invalid
	LastReading *float64 `json:"lastReading"`
	// Name of this sensor or empty if not configured
	Name string `json:"name"`
	// Type of this sensor
	Type AnalogSensorType `json:"type"`
}

AnalogSensor represents an analog sensor

type AnalogSensorType

type AnalogSensorType string

AnalogSensorType represents supported analog sensor types

type BaseFilamentMonitor

type BaseFilamentMonitor struct {
	// Enabled indicates if this filament monitor is enabled
	Enabled bool `json:"enabled"`
	// Type of this filament monitor
	Type FilamentMonitorType `json:"type"`
}

BaseFilamentMonitor holds information about a filament monitor

func (*BaseFilamentMonitor) AsFilamentMonitor

func (bfm *BaseFilamentMonitor) AsFilamentMonitor() (FilamentMonitor, error)

AsFilamentMonitor returns this instance as FilamentMonitor

type Endstop

type Endstop struct {
	// Triggered represents the curent trigger state
	Triggered bool `json:"triggered"`
	// Type of this endstop
	Type EndstopType `json:"type"`
	// Probe is the index of the use probe (only valid if Type == ZProbeAsEndstop)
	Probe *int64 `json:"probe"`
}

Endstop holds information about an endstop

type EndstopType

type EndstopType string

EndstopType represents the type of a configured enstop

type FilamentMonitor

type FilamentMonitor map[string]interface{}

FilamentMonitor holds information about a filament monitor

func (FilamentMonitor) GetType

GetType returns the FilamentMonitorType of this instance

type FilamentMonitorCalibrated

type FilamentMonitorCalibrated struct {
	FilamentMonitorProperties `mapstructure:",squash"`

	// TotalDistance extruded (in mm)
	TotalDistance float64 `json:"totalDistance"`
}

FilamentMonitorCalibrated shared by all concrete type structs

type FilamentMonitorConfigured

type FilamentMonitorConfigured struct {
	FilamentMonitorProperties `mapstructure:",squash"`

	// SampleDistance in mm
	SampleDistance float64 `json:"sampleDistance"`
}

FilamentMonitorConfigured shared by all concrete type structs

type FilamentMonitorProperties

type FilamentMonitorProperties struct {
	// PercentMax is the maximum allowed movement percentage (0..1 or greater)
	PercentMax float64 `json:"percentMax"`
	// PercentMin is the minimum allowed movement percentage (0..1 or greater)
	PercentMin float64 `json:"percentMin"`
}

FilamentMonitorProperties shared by all FilamentMonitorCalibrated and FilamentMonitorConfigured structs

type FilamentMonitorType

type FilamentMonitorType string

FilamentMonitorType represents supported filament monitors

type FilamentMonitors

type FilamentMonitors []FilamentMonitor

FilamentMonitors is a slice of FilamentMonitor

func (FilamentMonitors) GetAsBaseFilamentMonitor

func (fm FilamentMonitors) GetAsBaseFilamentMonitor(i int) (*BaseFilamentMonitor, error)

GetAsBaseFilamentMonitor returns the instance at the given index as BaseFilamentMonitor

func (FilamentMonitors) GetAsLaserFilamentMonitor

func (fm FilamentMonitors) GetAsLaserFilamentMonitor(i int) (*LaserFilamentMonitor, error)

GetAsLaserFilamentMonitor returns the instance at the given index as LaserFilamentMonitor

func (FilamentMonitors) GetAsPulsedFilamentMonitor

func (fm FilamentMonitors) GetAsPulsedFilamentMonitor(i int) (*PulsedFilamentMonitor, error)

GetAsPulsedFilamentMonitor returns the instance at the given index as PulsedFilamentMonitor

func (FilamentMonitors) GetAsRotatingMagnetFilamentMonitor

func (fm FilamentMonitors) GetAsRotatingMagnetFilamentMonitor(i int) (*RotatingMagnetFilamentMonitor, error)

GetAsRotatingMagnetFilamentMonitor returns the instance at the given index as RotatingMagnetFilamentMonitor

func (FilamentMonitors) GetAsSimpleFilamentMonitor added in v2.1.2

func (fm FilamentMonitors) GetAsSimpleFilamentMonitor(i int) (*SimpleFilamentMonitor, error)

GetAsSimpleFilamentMonitor returns the instance at the given index as SimpleFilamentMonitor

type GpInputPort

type GpInputPort struct {
	// Value of this port in range 0..1
	Value float64 `json:"value"`
}

GpInputPort holds details about a general-purpose input port

type LaserFilamentMonitor

type LaserFilamentMonitor struct {
	SimpleFilamentMonitor `mapstructure:",squash"`

	// Calibrated holds calibrated properties of this filament sensor
	Calibrated LaserFilamentMonitorCalibrated `json:"calibrated"`
	// Configured holds configured properties of this filament sensor
	Configured LaserFilamentMonitorConfigured `json:"configured"`
}

LaserFilamentMonitor holds information about a laser filament monitor

func (*LaserFilamentMonitor) AsFilamentMonitor

func (lfm *LaserFilamentMonitor) AsFilamentMonitor() (FilamentMonitor, error)

AsFilamentMonitor returns this instance as FilamentMonitor

type LaserFilamentMonitorCalibrated

type LaserFilamentMonitorCalibrated struct {
	FilamentMonitorCalibrated `mapstructure:",squash"`
	// Sensitivity from calibration
	Sensitivity float64 `json:"sensitivity"`
}

LaserFilamentMonitorCalibrated reprent the calibrated properties of a laser filament monitor

type LaserFilamentMonitorConfigured

type LaserFilamentMonitorConfigured FilamentMonitorConfigured

LaserFilamentMonitorConfigured represents configured properties of a laser filament sensor

type Probe

type Probe struct {
	// CalibrationTemperature in degC
	CalibrationTemperature float64 `json:"calibrationTemperature"`
	// DeployedByUser indicates if the user has deployed the probe
	DeployedByUser bool `json:"deployedByUser"`
	// DisablesHeaters is true if the heater(s) are disabled while probing
	DisablesHeaters bool `json:"disablesHeaters"`
	// DiveHeight is how far above the probe point a probing move starts (in mm)
	DiveHeight float64 `json:"diveHeight"`
	// MaxProbeCount is the maximum number of times to probe after a bad reading
	// was determined
	MaxProbeCount uint64 `json:"maxProbeCount"`
	// Offsets for X and Y (in mm)
	Offsets []float64 `json:"offsets"`
	// RecoveryTime (in s)
	RecoveryTime float64 `json:"recoveryTime"`
	// Speed at which probing is performed (in mm/s)
	Speed float64 `json:"speed"`
	// TemperatureCoefficient of the probe
	TemperatureCoefficient float64 `json:"temperatureCoefficient"`
	// Threshold at which the probe is considered to be triggered (0..1023)
	Threshold int64 `json:"threshold"`
	// Tolerance is the allowed deviation between two measurements (in mm)
	Tolerance float64 `json:"tolerance"`
	// TravelSpeed when probing multiple points (in mm/s)
	TravelSpeed float64 `json:"travelSpeed"`
	// TriggerHeight is th  Z height at which the probe is triggered (in mm)
	TriggerHeight float64 `json:"triggerHeight"`
	// Type of the configured probe
	Type ProbeType `json:"type"`
	// Value are the current analog values of the probe
	Value []int64 `json:"value"`
}

Probe holds information about a configured probe

type ProbeType

type ProbeType uint64

ProbeType represents supported probe types

const (
	// None for no probe
	None ProbeType = iota
	// Analog is a simple unmodulated probe (like dc42's infrared probe)
	Analog
	// DumbModulated probe (like the original one shipped with RepRapPro Ormerod)
	DumbModulated
	// AlternateAnalog probe (like ultrasonic probe)
	AlternateAnalog
	// EndstopSwitch_Obsolete should not be used anymore (switch connected to endstop pin)
	EndstopSwitch_Obsolete
	// Digital is a switch that is triggered when the probe is activated (filtered)
	Digital
	// E1Switch_Obsolete should not be used anymore (switch connected to E1 endstop pin)
	E1Switch_Obsolete
	// ZSwitch_Obsolete should not be used anymore (switch connected to Z endstop pin)
	ZSwitch_Obsolete
	// UnfilteredDigital is a switch that is triggered when the probe is activated (unfiltered)
	UnfilteredDigital
	// BLTouch probe
	BLTouch
	// ZMotorStall provided by the stepper driver
	ZMotorStall
)

type PulsedFilamentMonitor

type PulsedFilamentMonitor struct {
	BaseFilamentMonitor `mapstructure:",squash"`

	// Calibrated holds calibrated properties of this filament monitor
	Calibrated PulsedFilamentMonitorCalibrated `json:"calibrated"`
	// Configured holds configured properties of this filament monitor
	Configured PulsedFilamentMonitorConfigured `json:"configured"`
}

PulsedFilamentMonitor holds information about a pulsed filament monitor

func (*PulsedFilamentMonitor) AsFilamentMonitor

func (pfm *PulsedFilamentMonitor) AsFilamentMonitor() (FilamentMonitor, error)

AsFilamentMonitor returns this instance as FilamentMonitor

type PulsedFilamentMonitorCalibrated

type PulsedFilamentMonitorCalibrated struct {
	FilamentMonitorCalibrated `mapstructure:",squash"`
	// MmPerPulse is extruded distance per pulse (in mm)
	MmPerPulse float64 `json:"mmPerPulse"`
}

PulsedFilamentMonitorCalibrated represents calibrated properties of pulsed filament monitor

type PulsedFilamentMonitorConfigured

type PulsedFilamentMonitorConfigured struct {
	FilamentMonitorConfigured `mapstructure:",squash"`
	// MmPerPulse is extruded distance per pulse (in mm)
	MmPerPulse float64 `json:"mmPerPulse"`
}

PulsedFilamentMonitorConfigured represents configured properties of a pulsed filament sensor

type RotatingMagnetFilamentMonitor

type RotatingMagnetFilamentMonitor struct {
	SimpleFilamentMonitor `mapstructure:",squash"`

	// Calibrated holds calibrated properties of this filament monitor
	Calibrated RotatingMagnetFilamentMonitorCalibrated `json:"calibrated"`
	// Configured holds configured properties of this filament monitor
	Configured RotatingMagnetFilamentMonitorConfigured `json:"configured"`
}

RotatingMagnetFilamentMonitor holds information about a rotating magnet filament monitor

func (*RotatingMagnetFilamentMonitor) AsFilamentMonitor

func (rmfm *RotatingMagnetFilamentMonitor) AsFilamentMonitor() (FilamentMonitor, error)

AsFilamentMonitor returns this instance as FilamentMonitor

type RotatingMagnetFilamentMonitorCalibrated

type RotatingMagnetFilamentMonitorCalibrated struct {
	FilamentMonitorCalibrated `mapstructure:",squash"`
	// MmPerRev is extruded distance per revolution (in mm)
	MmPerRev float64 `json:"mmPerRev"`
}

RotatingMagnetFilamentMonitorCalibrated represents calibrated properties of pulsed filament monitor

type RotatingMagnetFilamentMonitorConfigured

type RotatingMagnetFilamentMonitorConfigured struct {
	FilamentMonitorConfigured `mapstructure:",squash"`
	// MmPerRev is extruded distance per revolution (in mm)
	MmPerRev float64 `json:"mmPerRev"`
}

RotatingMagnetFilamentMonitorConfigured represents configured properties of a pulsed filament sensor

type Sensors

type Sensors struct {
	// Analog is a list of analog sensors
	Analog []AnalogSensor `json:"analog"`
	// Endstops is a list of configured endstops
	Endstops []Endstop `json:"endstops"`
	// FilamentMonitors is a list of configured filament monitors
	FilamentMonitors FilamentMonitors `json:"filamentMonitors"`
	// Inputs is a list of general-purpose input ports
	GpIn []*GpInputPort `json:"gpIn"`
	// Probes is a list of configured probes
	Probes []Probe `json:"probes"`
}

Sensors holds information about sensors

type SimpleFilamentMonitor added in v2.1.2

type SimpleFilamentMonitor struct {
	BaseFilamentMonitor `mapstructure:",squash"`

	// FilamentPresent indicates if filament is present or nil if not available
	FilamentPresent *bool `json:"filamentPresent"`
}

SimpleFilamentMonitor represents a simple filament monitor

func (*SimpleFilamentMonitor) AsFilamentMonitor added in v2.1.2

func (sfm *SimpleFilamentMonitor) AsFilamentMonitor() (FilamentMonitor, error)

AsFilamentMonitor returns this instance as FilamentMonitor

Jump to

Keyboard shortcuts

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