machine

package
v0.0.0-...-9c34073 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: LGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package machine contains all structs and functions related to the machine model.

Index

Constants

View Source
const (
	DefaultFilamentsPath = "0:/filaments"
	DefaultGCodesPath    = "0:/gcodes"
	DefaultMacrosPath    = "0:/macros"
	DefaultSystemPath    = "0:/sys"
	DefaultWWWPath       = "0:/www"
	DefaultMenuPath      = "0:/menu"
)
View Source
const (
	// Cartesian kinematics
	Cartesian KinematicsType = "cartesian"
	// CoreXY kinematics
	CoreXY = "corexy"
	// CoreXYU is a CoreXY kinematics with extra U axis
	CoreXYU = "corexyu"
	// CoreXYUV is a CoreXY kinematics with extra UV axes
	CoreXYUV = "corexyuv"
	// CoreXZ kinmatics
	CoreXZ = "corexz"
	// Hangprinter kinematics
	Hangprinter = "hangprinter"
	// Delta kinematics
	Delta = "delta"
	// Polar kinematics
	Polar = "polar"
	// RotaryDelta kinematics
	RotaryDelta = "rotary delta"
	// SCARA kinematics
	SCARA = "scara"
	// Unknown kinematics
	Unknown = "unknown"
)
View Source
const (
	// DefaultName of the machine
	DefaultName = "My Duet"
	// DefaultHostName as fallback if Name is invalid
	DefaultHostName = "duet"
	// DefaultPassword of the machine
	DefaultPassword = "reprap"
)
View Source
const (
	// HTTP protocol
	HTTP NetworkProtocol = "http"
	// FTP protocol
	FTP = "ftp"
	// Telnet protocol
	Telnet = "telnet"
)
View Source
const (
	// Disconnected if the scanner is not present
	Disconnected ScannerStatus = "D"
	// Idle for a scanner that is registered and idle
	Idle = "I"
	// Scanning while the scanner is scanning
	Scanning = "S"
	// PostProcessing while the scanner is post-processing a file
	PostProcessing = "P"
	// Calibrating while the scanner is calibrating
	Calibrating = "C"
	// Uploading while the scanner is uploading
	Uploading = "U"
)
View Source
const (
	// DefaultTriggerThreshold of an analog probe
	DefaultTriggerThreshold = 500
	// DefaultProbingSpeed at which a probing move is performed (in mm/s)
	DefaultProbingSpeed = 2.0
	// DefaultTriggerHeight at which the probe is triggered (in mm)
	DefaultTriggerHeight = 0.7
	// DefaultTravelSpeed between probing locations (in mm/s)
	DefaultTravelSpeed = 100.0
	// DefaultTolerance for a deviation between to measurements (in mm)
	DefaultTolerance = 0.03
)
View Source
const (
	// FFF is Fused Filament Fabrication (default)
	FFF MachineMode = "FFF"
	// CNC is computer numerical control
	CNC = "CNC"
	// MachineModeLaser for laser operation mode (e.g. laser cutters)
	MachineModeLaser = "Laser"
)
View Source
const (
	// Updating while firmware is being updated
	Updating MachineStatus = "Updating"
	// MachineStatusOff if the machine is turned off (i.e. the input voltage is too low for operation)
	MachineStatusOff = "Off"
	// Halted if the machine has encountered an emergency stop and is ready to reset
	Halted = "Halted"
	// Pausing if the machine is baout to pause a file job
	Pausing = "Pausing"
	// Paused if the machine has paused a file job
	Paused = "Paused"
	// Resuming if the machine is about to resume a paused file job
	Resuming = "Resuming"
	// Processing if the machine is processing a file job
	Processing = "Processing"
	// Simulating while the machine is simulation a file job to determine its processing time
	Simulating = "Simulating"
	// Busy if the machine is busy doing something (e.g. moving)
	Busy = "Busy"
	// ChangingTool if the machine is chaging tools
	ChangingTool = "ChangingTool"
	// MachineStatusIdle if the machine is on but idle
	MachineStatusIdle = "Idle"
)
View Source
const (
	// AbsoluteZero temperature in degC
	AbsoluteZero = -273.15
)
View Source
const (
	// NoTool is the tool index if no tool is selected
	NoTool = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Axis

type Axis struct {
	// Letter assigned to this axis (always upper-case)
	Letter string `json:"letter"`
	// Drives is a list of drive indices assigned to this axis
	Drives []int64 `json:"drives"`
	// Homed is true if the axis has been homed
	Homed bool `json:"homed"`
	// MachinePosition is the current machine position (in mm or nil if unknown)
	MachinePosition *float64 `json:"machinePosition"`
	// Min travel of this axis (in mm or nil if unknown)
	Min *float64 `json:"min"`
	// MinEndstop is the index of the endstop that is used for the low end
	// or nil if none is configured
	MinEndstop *int64 `json:"minEndstop"`
	// MinProbed is true if the minimum was probed
	MinProbed bool `json:"minProbed"`
	// Max travel of this axis (in mm or nil if unknown)
	Max *float64 `json:"max"`
	// MaxEndstop is the index of the endstop that is used for the high end
	// or nil if none is configured
	MaxEndstop *int64 `json:"maxEndstop"`
	// MaxProbed is ture if the maximum was probed
	MaxProbed bool `json:"maxProbed"`
	// Visible is true if the axis is not explicitely hidden
	Visible bool `json:"visible"`
}

Axis holds information about a configured axis

type BedOrChamber

type BedOrChamber struct {
	// Active temperatures (in degC)
	Active []float64 `json:"active"`
	// Standby temperatures (in degC)
	Standby []float64 `json:"standby"`
	// Name of the bed or chamber
	Name string `json:"name"`
	// Heaters is a list of heater indices controlled by this bed or chamber
	Heaters []int64 `json:"heaters"`
}

BedOrChamber holds information about a bed or a chamber heater

type BeepDetails

type BeepDetails struct {
	// Frequency of the requested beep (in Hz)
	Frequency uint64 `json:"frequency"`
	// Duration of the requested beep (in ms)
	Duration float64 `json:"duration"`
}

BeepDetails about a requested beep

type Channel

type Channel struct {
	// Compatibility is the emulation used on this channel
	Compatibility Compatibility `json:"compatibility"`
	// Feedrate is the current feedrate in mm/s
	Feedrate float64 `json:"feedrate"`
	// RelativeExtrusion represents usage of relative extrusion
	RelativeExtrusion bool `json:"relativeExtrusion"`
	// VolumetricExtrusion represents usage of volumetric extrusion
	VolumetricExtrusion bool `json:"volumetricExtrusion"`
	// RelativePositioning represents usage of relative positioning
	RelativePositioning bool `json:"relativePositioning"`
	// UsingInches represents the usage of inches instead of mm
	UsingInches bool `json:"usingInches"`
	// StackDepth is the depth of the stack
	StackDepth uint8 `json:"stackDepth"`
	// LineNumber is the number of the current line
	LineNumber int64 `json:"lineNumber"`
}

Channel holds information about G/M/T-code channels

type Channels

type Channels struct {
	// HTTP is the G/M/T-code channel for HTTP requests
	HTTP Channel `json:"http"`
	// Telnet is the G/M/T-code channel for Telnet requests
	Telnet Channel `json:"telnet"`
	// File is the G/M/T-code channel for file jobs
	File Channel `json:"file"`
	// USB is the G/M/T-code channel for USB
	USB Channel `json:"usb"`
	// AUX is the G/M/T-code channel for serial devices (e.g. UART, PanelDue)
	AUX Channel `json:"aux"`
	// Trigger is the G/M/T-code channel to deal with triggers and config.g
	Trigger Channel `json:"trigger"`
	// CodeQueue is the G/M/T-code channel for the code queue
	CodeQueue Channel `json:"codeQueue"`
	// LCD is the G/M/T-code channel for auxiliary LCD devices
	LCD Channel `json:"lcd"`
	// SPI is the G/M/T-code channel for generic codes via SPI
	SPI Channel `json:"spi"`
	// Daemon is the code channel that executes the daemon process
	Daemon Channel `json:"daemon"`
	// AutoPause is the G/M/T-code channel for auto pause events
	AutoPause Channel `json:"autoPause"`
}

Channels holds all available code channels

func NewChannels

func NewChannels() Channels

NewChannels creates a new Channels with default Compatibility set for certain channels

func (*Channels) Get

func (ch *Channels) Get(cc types.CodeChannel) Channel

Get will return the Channel to the given types.CodeChannel. It will return SPI for unknown types.

type Compatibility

type Compatibility uint64

Compatibility level for emulation

const (
	// No emulation (same as RepRapFirmware)
	Me Compatibility = iota
	// RepRapFirmware emulation (i.e. no emulation)
	RepRapFirmware
	// Marlin emulation
	Marlin
	// Teacup emulation
	Teacup
	// Sprinter emulation
	Sprinter
	// Repetier emulation
	Repetier
	// NanoDLP emulation (special)
	NanoDLP
)

type CurrentMove

type CurrentMove struct {
	// RequestedSpeed of the current move (in mm/s)
	RequestedSpeed float64 `json:"requestedSpeed"`
	// TopSpeed actually reached for the current move (in mm/s)
	TopSpeed float64 `json:"topSpeed"`
}

CurrentMove holds information about the current move

type Directories

type Directories struct {
	// Filaments is the path to filaments directory
	Filaments string `json:"filaments"`
	// GCodes is the path to the gcodes directory
	GCodes string `json:"gCodes"`
	// Macros is the path to the macros directory
	Macros string `json:"macros"`
	// System is the path to the sys directory
	System string `json:"system"`
	// WWW is the path to the www directory
	WWW string `json:"www"`
	// Menu is the path to the menu directory (12864 displays)
	Menu string `json:"menu"`
}

Directories holds information about the directory structure

func NewDirectories

func NewDirectories() *Directories

NewDirectories returns an instance with all paths set to their defaults

type Drive

type Drive struct {
	// Position is the current user position of this drive (in mm)
	Position float64 `json:"position"`
	// Microstepping configured for this drive
	Microstepping DriveMicrostepping `json:"microstepping"`
	// Current configured for this drive (in mA)
	Current uint64 `json:"current"`
	// Acceleration of this drive (in mm/s²)
	Acceleration float64 `json:"acceleration"`
	// MinSpeed allowed for this drive (in mm/s)
	MinSpeed float64 `json:"minSpeed"`
	// MaxSpeed allowed for this drive (in mm/s)
	MaxSpeed float64 `json:"maxSpeed"`
}

Drive holds information about a drive

type DriveMicrostepping

type DriveMicrostepping struct {
	// Value of the microstepping (e.g. x16)
	Value uint64 `json:"value"`
	// Interpolated is true if interpolation is used
	Interpolated bool `json:"interpolated"`
}

DriveMicrostepping holds information about configured microstepping

type Electronics

type Electronics struct {
	// Version of Duet Software Framework package
	Version string `json:"version"`
	// Type name of the main board
	Type string `json:"type"`
	/// ShortName is the short code of the board
	ShortName string `json:"shortName"`
	// Name is the full name of the board
	Name string `json:"name"`
	// Revision of the board
	Revision string `json:"revision"`
	// Firmware of the attached main board
	Firmware Firmware `json:"firmware"`
	// ProcessorId of the main board
	ProcessorId string `json:"processorId"`
	// VIn represents input voltage details of the main board in V or nil if unknown
	VIn *MinMaxCurrent `json:"vIn"`
	// McuTemp represents the MCU temperature details of the main boad in degC or nil if unknown
	McuTemp *MinMaxCurrent `json:"mcuTemp"`
	// ExpansionBoards is a list of attached expansion boards
	ExpansionBoards []ExpansionBoard `json:"expansionBoards"`
}

Electronics holds information about the electronics used

type Endstop

type Endstop struct {
	// Action to perform when this endstop is hit
	Action EndstopAction `json:"action"`
	// 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 == EndstopTypeProbe)
	Probe int64 `json:"probe"`
}

Endstop holds information about an endstop

type EndstopAction

type EndstopAction uint64

EndstopAction is the action performed when an endstop is hit

const (
	// EndstopActionNone means no action
	EndstopActionNone EndstopAction = iota
	// ReduceSpeed because an endstop or Z-probe is close to triggering (analog only)
	ReduceSpeed
	// StopDriver stops a single motor driver
	StopDriver
	// StopAxis stops all drivers for an axis
	StopAxis
	// StopAll stops all drivers in the system
	StopAll
)

type EndstopType

type EndstopType uint64

EndstopType represents the type of a configured enstop

const (
	// ActiveLow will pull the endstop signal from HIGH to LOW when hit
	ActiveLow EndstopType = iota
	// ActiveHigh will pull the endstops signal from LOW to HIGH when hit
	ActiveHigh
	// EndstopTypeProbe represents a probe being used for this endstop (most often on Z)
	EndstopTypeProbe
	// MotorStallAny uses motor load detection and stops all when one motor stalls
	MotorStallAny
	// MotorStallIndividual uses motor load detection and stops each motor acoording to its
	// stall detection status
	MotorStallIndividual
)

type ExpansionBoard

type ExpansionBoard struct {
	// ShortName is the short code of the board
	ShortName string `json:"shortName"`
	// Name is the full name of the attached expansion board
	Name string `json:"name"`
	// Revision of the expansion board
	Revision string `json:"revision"`
	// Firmware of the expansion board
	Firmware Firmware `json:"firmware"`
	// VIn represents input voltage details of the expansion board in V or nil if unknown
	VIn *MinMaxCurrent `json:"vIn"`
	// McuTemp represents the MCU temperature details of the expansion board in degC or nil if unknown
	McuTemp *MinMaxCurrent `json:"mcuTemp"`
	// MaxHeaters is the maximum number of heater that can be attached to this board
	MaxHeaters int64 `json:"maxHeaters"`
	// MaxMotors is the maximum number of motors that can be attched to this board
	MaxMotors int64 `json:"maxMotors"`
}

ExpansionBoard represents information about an attached expansion board

type ExtraHeater

type ExtraHeater struct {
	// Current temperature (in degC)
	Current float64 `json:"current"`
	// Name of the extra heater
	Name string `json:"name"`
	// State of the exra heater or nil if unknown/unset
	State *HeaterState `json:"state"`
	// Sensor number of the extra heater or nil if unknown/unset
	Sensor *int64 `json:"sensor"`
}

ExtraHeater holds information about an extra heater (virtual)

type Extruder

type Extruder struct {
	// Drives is a list of drive indices of this extruder
	Drives []int64 `json:"drives"`
	// Factor is the extrusion factor (1.0 equals 100%)
	Factor float64 `json:"factor"`
	// NonLinear extrusion parameters (see M592)
	NonLinear ExtruderNonLinear `json:"nonLinear"`
}

Extruder holds information about an extruder drive

type ExtruderNonLinear

type ExtruderNonLinear struct {
	// A coefficient in the extrusion formula
	A float64 `json:"a"`
	// B coefficient in the extrusion formula
	B float64 `json:"b"`
	// UpperLimit of the nonlinear extrusion compensation
	UpperLimit float64 `json:"upperLimit"`
	// Temperature at which these values are valid in degC (future use only)
	Temperature float64 `json:"temperature"`
}

ExtruderNonLinear contains non-linear extrusion parameters (see M592)

type Fan

type Fan struct {
	// Value is the current speed on a scale betweem 0 to 1
	Value float64 `json:"value"`
	// Name of the fan
	Name string `json:"name"`
	// Rpm is the current RPM of this fan TODO: can be nil?
	Rpm int64 `json:"rpm"`
	// Inverted represents the inversion state of the fan PWM signal
	Inverted bool `json:"inverted"`
	// Frequency is the fan PWM frequency in Hz
	Frequency float64 `json:"frequency"`
	// Min speed of this fan on a scale between 0 and 1
	Min float64 `json:"min"`
	// Max speed of this fan on a scale between 0 and 1
	Max float64 `json:"max"`
	// Blip value indicating how long the fan is supposed to run at 100%
	// when turning it on to get it started (in s)
	Blip float64 `json:"blip"`
	// Thermostatic control parameters
	Thermostatic Thermostatic `json:"thermostatic"`
	// Pin number of the assigned fan
	Pin uint64 `json:"pin"`
}

Fan represents information about an attached fan

type Firmware

type Firmware struct {
	// Name of the firmware
	Name string `json:"name"`
	// Version of the firmare
	Version string `json:"version"`
	// Date the firmware was built
	Date string `json:"date"`
}

Firmware holds information about the firmware version

type Heat

type Heat struct {
	// Beds is a list of configured beds
	Beds []BedOrChamber `json:"beds"`
	// Chambers is a list of configured chambers
	Chambers []BedOrChamber `json:"chambers"`
	// ColdExtrusionTemp is the minimum temperature required for extrusion moves (in degC)
	ColdExtrusionTemp float64 `json:"coldExtrusionTemp"`
	// ColdRetractTemp is the minimum temperature required for retraction moves (in degC)
	ColdRetractTemp float64 `json:"coldRetractTemp"`
	// Extra is a list of configured extra heaters
	Extra []ExtraHeater `json:"extra"`
	// Heaters is a list of configured heaters
	Heaters []Heater `json:"heaters"`
}

Heat holds information about the heat subsystem

type Heater

type Heater struct {
	// Current temperature (in degC)
	Current float64 `json:"current"`
	// Name of the heater
	Name string `json:"name"`
	// State of the heater
	State HeaterState `json:"state"`
	// Model hold information about the heater model
	Model HeaterModel `json:"model"`
	// Max allowed temperature of this heater (in degC)
	Max float64 `json:"max"`
	// Sensor number of this heater or nil if unknown
	Sensor *int64 `json:"sensor"`
}

Heater holds information about a heater

type HeaterModel

type HeaterModel struct {
	// Gain value or nil if unknown
	Gain *float64 `json:"gain"`
	// TimeConstant or nil if unknown
	TimeConstant *float64 `json:"timeConstant"`
	// DeadTime of this heater or nil if unknown
	DeadTime *float64 `json:"deadTime"`
	// MaxPwm value for this heater (0 if unknown)
	MaxPwm float64 `json:"maxPwm"`
	// StandardVoltage of this heater (0 if unknown)
	StandardVoltage float64 `json:"standardVoltage"`
	// UsePID indicates usage of PID (instead of bang-bang)
	UsePID bool `json:"usePID"`
	// CustomPID indicates the usage of custom PID values
	CustomPID bool `json:"customPID"`
	// P is the proportional value of the PID regulator
	P float64 `json:"p"`
	// I is the integral value of the PID regulator
	I float64 `json:"i"`
	// D is the derivative value pf the PID regulator
	D float64 `json:"d"`
}

HeaterModel holds information about the way a heater heats up

type HeaterState

type HeaterState uint64

HeaterState represents available heater states

const (
	// Off for a turned off heater
	Off HeaterState = iota
	// Standby for a heater in standby mode
	Standby
	// Active for an active heater
	Active
	// Tuning for a tuning heater
	Tuning
	// Offline for a heater that cannot be reached
	Offline
)

type HttpEndpoint

type HttpEndpoint struct {
	// EndpointType is the type of this endpoint
	EndpointType types.HttpEndpointType `json:"endpointType"`
	// Namespace of this endpoint
	Namespace string `json:"namespace"`
	// Path to the endpoint
	Path string `json:"path"`
	// UnixSocket is the path to the corresponding UNIX socket
	UnixSocket string `json:"unixSocket"`
}

HttpEndpoint represents an extra HTTP endpoint

type InterfaceType

type InterfaceType string

InterfaceType represents supported interface types

const (
	// WiFi is a wireless network interface
	WiFi InterfaceType = "wifi"
	// LAN is a wired network interface
	LAN = "lan"
)

type Job

type Job struct {
	// File holds ParsedFileInfo about the file being processed
	File types.ParsedFileInfo `json:"file"`
	// FilePosition is the current position in the file being processed in bytes
	FilePosition uint64 `json:"filePosition"`
	// LastFileName is the name of the last processed file
	LastFileName string `json:"lastFileName"`
	// LastFileAborted indicated if the last file was aborted (unexpected cancellation)
	LastFileAborted bool `json:"lastFileAborted"`
	// LastFileCancelled indicates if the last file was cancelled by the user
	LastFileCancelled bool `json:"lastFileCancelled"`
	// LastFileSimulated indicates if the last file was simulated
	LastFileSimulated bool `json:"lastFileSimulated"`
	// ExtrudedRaw is a list of virtual amounts of extruded filament according to the
	// G-code file in mm
	ExtrudedRaw []float64 `json:"extrudedRaw"`
	// Duration is the total duration of the current job in s
	Duration float64 `json:"duration"`
	// Layer number of the current layer or 0 if none has been started yet
	Layer float64 `json:"layer"`
	// LayerTime is time elapsed since the beginning of the current layer in s
	LayerTime float64 `json:"layerTime"`
	// Layers is a list of Layer information about past layers
	Layers []Layer `json:"layers"`
	// WarmUpDuration is the time needed to heat up the heaters in se
	WarmUpDuration float64 `json:"warmUpDuration"`
	// TimesLeft contains estimated remaining times
	TimesLeft TimesLeft `json:"timesLeft"`
}

Job holds information about the current file job (if any)

type Kinematics

type Kinematics struct {
	// Type of currently configured kinematics
	Type KinematicsType `json:"type"`
	// Anchors of a hangprinter A, B, C, Dz (10 values)
	Anchors []float64 `json:"anchors"`
	// PrintRadius for Hangprinter and Delta kinematics in mm
	PrintRadius float64 `json:"printRadius"`
	// Diagonals for a delta
	Diagonals []float64 `json:"diagonals"`
	// Radius of a delta in mm
	Radius float64 `json:"radius"`
	// HomedHeight of a delta in mm
	HomedHeight float64 `json:"homedHeight"`
	// AngleCorrections ABC for delta kinematics
	AngleCorrections []float64 `json:"angleCorrections"`
	// EndstopAdjustments of the XYZ axes in mm
	EndstopAdjustments []float64 `json:"endstopAdjustments"`
	// Tilt values of the XY axes
	Tilt []float64 `json:"tilt"`
}

Kinematics holds information about the configured kinematics Note to developers: this is called "Geometry" upstream

type KinematicsType

type KinematicsType string

KinematicsType represents the supported kinmatics types

type Laser

type Laser struct {
	// ActualPwm on a scale between 0 and 1
	ActualPwm float64 `json:"actualPwm"`
	// RequestedPwm on a scale between 0 and 1 from a G1 move
	RequestedPwm float64 `json:"requestedPwm"`
}

Laser holds information about an attached laser diode

type Layer

type Layer struct {
	// Duration of the layer in s (nil if unknown)
	Duration *float64 `json:"duration"`
	// Height of the layer in mm (0 if unknown)
	Height float64 `json:"height"`
	// Filament represents the actual amount of filament extruded during
	// this layer in mm
	Filament []float64 `json:"filament"`
	// FractionPrinted represents the fraction of the whole file printed
	// during this layer on a scale between 0 and 1
	FractionPrinted float64 `json:"fractionPrinted"`
}

Layer holds information about a layer from a file being printed

type MachineMode

type MachineMode string

MachineMode represents supported operation modes of the machine

type MachineModel

type MachineModel struct {
	// Channels holds information about every available G/M/T-code channel
	Channels Channels `json:"channels"`
	// Directories holds information about the individual directories
	Directories Directories `json:"directories"`
	// Electronics holds information about the main and expansion boards
	Electronics Electronics `json:"electronics"`
	// Fans is a list of configured fans
	Fans []Fan `json:"fans"`
	// Heat holds information about the heat subsystem
	Heat Heat `json:"heat"`
	// HttpEndpoints is a list of registered third-party HTTP endpoints
	HttpEndpoints []HttpEndpoint `json:"httpEndpoints"`
	// Job holds information about the current file job (if any)
	Job Job `json:"job"`
	// Lasers is a list of configured laser diodes
	Lasers []Laser `json:"lasers"`
	// MessageBox holds information about message box requests
	MessageBox MessageBox `json:"messageBox"`
	// Messages is a list of generic messages that do not belong explicitly to codes
	// being executed. This includes status message, generic errors and outputs generated
	// by M118
	Messages []commands.Message `json:"messages"`
	// Move holds information about the move subsystem
	Move Move `json:"move"`
	// Network holds information about connected network adapters
	Network Network `json:"network"`
	// Scanner holds information about the 3D scanner subsystem
	Scanner Scanner `json:"scanner"`
	// Sensors holds information about connected sensors including Z-probes and endstops
	Sensors Sensors `json:"sensors"`
	// Spindles is a list of configured CNC spindles
	Spindles []Spindle `json:"spindles"`
	// State holds information about the machine state
	State State `json:"state"`
	// Storages is a list of configured storage devices
	Storages []Storage `json:"storages"`
	// Tools is a list of configure tools
	Tools []Tool `json:"tools"`
	// UserSessions is a list of user session
	UserSessions []UserSession `json:"userSessions"`
	// UserVariables is a list of user-defined variables
	UserVariables []UserVariable `json:"userVariables"`
}

MachineModel represents the full machine model as maintained by DuetControlServer

func NewMachineModel

func NewMachineModel() *MachineModel

NewMachineModel creates a new MachineModel

type MachineStatus

type MachineStatus string

MachineStatus represents possibile states of the firmware

type MessageBox

type MessageBox struct {
	// Mode of the message box to display or nil if none is shown
	Mode *MessageBoxMode `json:"mode"`
	// Title of the message box
	Title string `json:"title"`
	// Message of the message box
	Message string `json:"message"`
	// AxisControls is a list of axis indices to show movement controls for
	AxisControls []uint8 `json:"axisControls"`
	// Seq is a counter that is incremented whenever a new message box is shown
	Seq int64 `json:"seq"`
}

MessageBox holds information about the message box to show

type MessageBoxMode

type MessageBoxMode uint64

MessageBoxMode represents supported modes of displaying a message box

const (
	// NoButtons displays a message box without any buttons
	NoButtons MessageBoxMode = iota
	// CloseOnly displays a message box with only a Close button
	CloseOnly
	// OkOnly displays a message box with only an Ok button which is supposed to send M292 when clicked
	OkOnly
	// OkCancel displays a message box with an Ok button that sends M292 P0 and
	// a Cancel button that sends M292 P1 when clicked
	OkCancel
)

type MinMaxCurrent

type MinMaxCurrent struct {
	// Current value
	Current float64 `json:"current"`
	// Minimum value encountered
	Min float64 `json:"min"`
	// Maximum value encountered
	Max float64 `json:"max"`
}

MinMaxCurrent represents a data structure to hold current, min and max values

type MotorsIdleControl

type MotorsIdleControl struct {
	// Timeout after which the motor currents are reduced (in s)
	Timeout float64 `json:"timeout"`
	// Factor of the reduction on a scale between 0 and 1
	Factor float64 `json:"factor"`
}

MotorsIdleControl holds idle factor parameters for automatic MotorsIdleControl current reduction

type Move

type Move struct {
	// Axes is a list of configured axes
	Axes []Axis `json:"axes"`
	// BabystepZ is the current babystep amount in Z direction in mm
	BabystepZ float64 `json:"babystepZ"`
	// CurrentMove holds information about the current move
	CurrentMove CurrentMove `json:"currentMove"`
	// Compensation is the name of the currently used bed compensation
	// (one of "Mesh", "[n] Point", "None")
	Compensation string `json:"compensation"`
	// HeightmapFile is the path to the current heightmap file if Compensation is "Mesh"
	HeightmapFile string `json:"heightmapFile"`
	// Drives is a list of configured drives
	Drives []Drive `json:"drives"`
	// Extruders is a list of configured extrudersr
	Extruders []Extruder `json:"extruders"`
	// Kinematics holds information about the currently configured kinematics
	Kinematics Kinematics `json:"Geometry"`
	// Idle current reduction parameters
	Idle MotorsIdleControl `json:"idle"`
	// ProbeGrid holds information about the configured mesh compensation (see M557)
	ProbeGrid ProbeGrid `json:"probeGrid"`
	// SpeedFactor applied to every regular move (1.0 equals 100%)
	SpeedFactor float64 `json:"speedFactor"`
	// CurrentWorkplace is the index of the selected workspace
	CurrentWorkplace int64 `json:"currentWorkplace"`
	// WorkplaceCoordinates are the axis offsets of each available workspace in mm
	WorkplaceCoordinates [][]float64 `json:"workplaceCoordinates"`
}

Move holds information about the move subsystem

type Network

type Network struct {
	// Name of the machine
	Name string `json:"name"`
	// Hostname of the machine
	Hostname string `json:"hostname"`
	// Password required to access this machine
	Password string `json:"password"`
	// Interfaces is a list of available network interfaces
	Interfaces []NetworkInterface `json:"interfaces"`
}

Network holds information about the network subsytem

type NetworkInterface

type NetworkInterface struct {
	// Type of this network interface
	Type InterfaceType `json:"type"`
	// FirmwareVersion of the network interface (empty for unknonw)
	// This is primarily intended for the ESP8266-based network interfaces as used on the Duet WiFi
	FirmwareVersion string `json:"firmwareVersion"`
	// Speed of the network interface (in MBit, nil if unknown, 0 if not connected)
	Speed *uint64 `json:"speed"`
	// Signal strength of the WiFi adapter (in dBm)
	Signal int64 `json:"signal"`
	// MacAddress of the network adapter
	MacAddress string `json:"macAddress"`
	// ConfiguredIP is the IPv4 address of the network adapter
	ConfiguredIP string `json:"configuredIP"`
	// ActualIP tis the actual IPv4 address of the network adapter
	ActualIP string `json:"actualIP"`
	// Subnet mask of the network adapter
	Subnet string `json:"subnet"`
	// Gateway address for this network adapter
	Gateway string `json:"gateway"`
	// NumReconnnects is the number of reconnect attempts
	NumReconnnects uint64 `json:"numReconnnects"`
	// ActiveProtocols is a list of active network protocols
	ActiveProtocols []NetworkProtocol `json:"activeProtocols"`
}

NeworkInterface holds information about a network interface

type NetworkProtocol

type NetworkProtocol string

NetworkProtocol represents supported network protocols

type Probe

type Probe struct {
	// Type of the configured probe
	Type ProbeType `json:"type"`
	// Value is the current analog value of the probe
	Value int64 `json:"value"`
	// SecondaryValues of the probe
	SecondaryValues []int64 `json:"secondaryValues"`
	// Threshold at which the probe is considered to be triggered (0..1023)
	Threshold int64 `json:"threshold"`
	// Speed at which probing is performed (in mm/s)
	Speed float64 `json:"speed"`
	// DiveHeight is how far above the probe point a probing move starts (in mm)
	DiveHeight float64 `json:"diveHeight"`
	// Offsets for X and Y (in mm)
	Offsets []float64 `json:"offsets"`
	// TriggerHeight is th  Z height at which the probe is triggered (in mm)
	TriggerHeight float64 `json:"triggerHeight"`
	// Filtered is true if the probe signal is filtered
	Filtered bool `json:"filtered"`
	// Inverted is true if the probe signal is inverted
	Inverted bool `json:"inverted"`
	// RecoveryTime (in s)
	RecoveryTime float64 `json:"recoveryTime"`
	// TravelSpeed when probing multiple points (in mm/s)
	TravelSpeed float64 `json:"travelSpeed"`
	// MaxProbeCount is the maximum number of times to probe after a bad reading
	// was determined
	MaxProbeCount uint64 `json:"maxProbeCount"`
	// Tolerance is the allowed deviation between two measurements (in mm)
	Tolerance float64 `json:"tolerance"`
	// DisablesBed is true if the bed heater(s) are disabled while probing
	DisablesBed bool `json:"disablesBed"`
	// Persistent indicates if the probe parameters are supposed to be
	// saved to config-override.g
	Persistent bool `json:"persistent"`
}

Probe holds information about a configured probe

type ProbeGrid

type ProbeGrid struct {
	// XMin is the X start coordinate of the heightmap
	XMin float64 `json:"xMin"`
	// XMax is the X end coordinate of the heightmap
	XMax float64 `json:"xMax"`
	// XSpacing is the spacing between probe points in X direction
	XSpacing float64 `json:"xSpacing"`
	// YMin is the Y start coordinate of the heightmap
	YMin float64 `json:"yMin"`
	// YMax is the Y end coordinate of the heightmap
	YMax float64 `json:"yMax"`
	// YSpacing is the spacing between probe points in Y direction
	YSpacing float64 `json:"ySpacing"`
	// Radius is the probing radius on delta kinematics
	Radius float64 `json:"radius"`
	// Spacing between the probe points for delta kinematics
	Spacing float64 `json:"spacing"`
}

ProbeGrid holds information about the configured probe grid (see M557)

type ProbeType

type ProbeType uint64

ProbeType represents supported probe types

const (
	// ProbeTypeNone for no probe
	ProbeTypeNone ProbeType = iota
	// Unmodulated i a simple unmodulated probe (like dc42's infrared probe)
	Unmodulated
	// Modulated probe (like the original one shipped with RepRapPro Ormerod)
	Modulated
	// Switch that is triggered when probe is activated
	Switch
	// BLTouch probe
	BLTouch
	// MotorLoadDetection provided by the stepper driver
	MotorLoadDetection
)

type Scanner

type Scanner struct {
	// Progress of the current action on scale between 0 and 1
	Progress float64 `json:"progress"`
	// Status of the 3D scanner
	Status ScannerStatus `json:"status"`
}

Scanner holds information about the 3D scanner subsytem

type ScannerStatus

type ScannerStatus string

ScannerStatus represents possible states of an attached 3D scanner

type Sensors

type Sensors struct {
	// Endstops is a list of configured endstops
	Endstops []Endstop `json:"endstops"`
	// Probes is a list of configured probes
	Probes []Probe `json:"probes"`
}

Sensors holds information about sensors

type Spindle

type Spindle struct {
	// Active RPM
	Active float64 `json:"active"`
	// Current RPM
	Current float64 `json:"current"`
}

Spindle holds information about a CNC spindle

type State

type State struct {
	// AtxPower is the state of the ATX power pin (nil if not configured)
	AtxPower *bool `json:"atxPower"`
	// Beed holds information about a requested beep
	Beep BeepDetails `json:"beep"`
	// CurrentTool is the number of the currently selected tool or -1 if none is selected
	CurrentTool int64 `json:"currentTool"`
	// DisplayMessage is a persistent message to display (see M117)
	DisplayMessage string `json:"displayMessage"`
	// LogFile being written to (empty if logging is disabled)
	LogFile string `json:"logFile"`
	// Mode the machine is currently in
	Mode MachineMode `json:"mode"`
	// Status the machine has currently
	Status MachineStatus `json:"status"`
}

State holds information about the machine state

type Storage

type Storage struct {
	// Mounted represents mount state
	Mounted bool `json:"mounted"`
	// Speed of the storage device in bytes/s (0 for unknown)
	Speed uint64 `json:"speed"`
	// Capacity is the total capacity of the storage device in bytes (0 for unknown)
	Capacity uint64 `json:"capacity"`
	// Free is the amount of space still available (nil if unknown)
	Free *uint64 `json:"free"`
	// OpenFiles is the number of currently open files or nil if unknown
	OpenFiles *uint64 `json:"openFiles"`
	// Path is the logical path of the storage device
	Path string `json:"path"`
}

Storage holds information about a storage device

type Thermostatic

type Thermostatic struct {
	// Control represents whether thermostatic control is enabled
	Control bool `json:"control"`
	// Heaters is a list of heaters to minitor
	Heaters []int64 `json:"heaters"`
	// Temperature at which the fan will be turned on in degC
	Temperature float64 `json:"temperature"`
}

Thermostatic parameters of a fan

type TimesLeft

type TimesLeft struct {
	// File progress based estimation in s (nil if unknown)
	File *float64 `json:"file"`
	// Filament consumption based estimation in s (nil if unknown)
	Filament *float64 `json:"filament"`
	// Layer progress based estimation in s (nil if unknown)
	Layer *float64 `json:"layer"`
}

TimesLeft holds information about estimated remaining times

type Tool

type Tool struct {
	// Number of the tool
	Number int64 `json:"number"`
	// Active temperature of the tool
	Active []float64 `json:"active"`
	// Standby temperature of the tool
	Standby []float64 `json:"standby"`
	// Name of the tool
	Name string `json:"name"`
	// FilamentExtruder is the extruder drive index for resolving the tool filament (-1 if undefined)
	FilamentExtruder int64 `json:"filamentExtruder"`
	// Filament is the name of the currently loaded filament
	Filament string `json:"filament"`
	// Fans is a list of associated fan indices
	Fans []int64 `json:"fans"`
	// Heaters is a list of associated heater indices
	Heaters []int64 `json:"heaters"`
	// Extruders is a list of extruder drives of this tool
	Extruders []int64 `json:"extruders"`
	// Mix ratios of the associated extruder drives
	Mix []float64 `json:"mix"`
	// Spindle index associated to this tool (-1 if none is defined)
	Spindle int64 `json:"spindle"`
	// Axes associated to this tool. At present only X and Y can be mapped per tool.
	// The order is the same as the visual axes, so by default the layout is
	// [
	//   [0],        // X
	//   [1]         // Y
	// ]
	// Make sure to set each item individually so the change events are called
	Axes [][]uint64 `json:"axes"`
	// Offets for this tool (in mm).
	// The list is in the same order as Move.Axes
	Offsets []float64 `json:"offsets"`
	// OffsetsProbed bitmap of the axes which were probed
	OffsetsProbed int64 `json:"offsetsProbed"`
}

Tool holds information about a configured tool

type UserSession

type UserSession struct {
	// Id is the identifier of this session
	Id int64 `json:"id"`
	// AccessLevel of this session
	AccessLevel types.AccessLevel `json:"accessLevel"`
	// SessionType of this session
	SessionType types.SessionType `json:"sessionType"`
	// Origin of this session. For remote sessions this equals the remote IP address
	Origin string `json:"origin"`
	// OriginId is the corresponding identifier. If it is a remote session it is the remote port
	// else it defaults to the PID of the current process
	OriginId int `json:"originId"`
}

UserSession represents a user session

type UserVariable

type UserVariable struct {
	// Name (key) of the variable
	Name string `json:"name"`
	// Value of the variable
	Value string `json:"value"`
}

UserVariable is a key-value pair for user-defined variables

Jump to

Keyboard shortcuts

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