This repository has been archived on 2025-02-01. You can view files and clone it, but cannot push or open issues or pull requests.
reprapfirmware-dc42/Tool.h
David Crocker d8911b2760 Version 1.00j
Prevent setting of absurdly high hot end temperatures
Added R parameter to G1 to go back to previous location, with optional
offsets
Allow Pronterface and PanelDue M105 requests to execute during file
macros etc.
Added more status information for PanelDue to M105 S2 command
Send replies when prints are paused, resumed or cancelled
Added missing newlines at end of M105 responses
Increased X and Y course homing speeds
2015-02-21 10:43:25 +00:00

156 lines
3.2 KiB
C++

/****************************************************************************************************
RepRapFirmware - Tool
This class implements a tool in the RepRap machine, usually (though not necessarily) an extruder.
Tools may have zero or more drives associated with them and zero or more heaters. There are a fixed number
of tools in a given RepRap, with fixed heaters and drives. All this is specified on reboot, and cannot
be altered dynamically. This restriction may be lifted in the future. Tool descriptions are stored in
GCode macros that are loaded on reboot.
-----------------------------------------------------------------------------------------------------
Version 0.1
Created on: Apr 11, 2014
Adrian Bowyer
RepRap Professional Ltd
http://reprappro.com
Licence: GPL
****************************************************************************************************/
#ifndef TOOL_H_
#define TOOL_H_
class Tool
{
public:
Tool(int toolNumber, long d[], int dCount, long h[], int hCount);
const float *GetOffset() const;
void SetOffset(const float offs[AXES]);
int DriveCount() const;
int Drive(int driveNumber) const;
bool ToolCanDrive(bool extrude) const;
int HeaterCount() const;
int Heater(int heaterNumber) const;
int Number() const;
void SetVariables(const float* standby, const float* active);
void GetVariables(float* standby, float* active) const;
void DefineMix(float* m);
float* GetMix() const;
void TurnMixingOn();
void TurnMixingOff();
bool Mixing() const;
float MaxFeedrate() const;
float InstantDv() const;
void Print(StringRef& reply);
friend class RepRap;
protected:
Tool* Next() const;
void Activate(Tool* currentlyActive);
void Standby();
void AddTool(Tool* tool);
void FlagTemperatureFault(int8_t dudHeater);
void ClearTemperatureFault(int8_t wasDudHeater);
void UpdateExtruderAndHeaterCount(uint16_t &extruders, uint16_t &heaters) const;
private:
void SetTemperatureFault(int8_t dudHeater);
void ResetTemperatureFault(int8_t wasDudHeater);
bool AllHeatersAtHighTemperature(bool forExtrusion) const;
int myNumber;
int* drives;
float* mix;
bool mixing;
int driveCount;
int* heaters;
float* activeTemperatures;
float* standbyTemperatures;
int heaterCount;
Tool* next;
bool active;
bool heaterFault;
float offset[AXES];
};
inline int Tool::Drive(int driveNumber) const
{
return drives[driveNumber];
}
inline int Tool::HeaterCount() const
{
return heaterCount;
}
inline int Tool::Heater(int heaterNumber) const
{
return heaters[heaterNumber];
}
inline Tool* Tool::Next() const
{
return next;
}
inline int Tool::Number() const
{
return myNumber;
}
inline void Tool::DefineMix(float* m)
{
for(int8_t drive = 0; drive < driveCount; drive++)
{
mix[drive] = m[drive];
}
}
inline float* Tool::GetMix() const
{
return mix;
}
inline void Tool::TurnMixingOn()
{
mixing = true;
}
inline void Tool::TurnMixingOff()
{
mixing = false;
}
inline bool Tool::Mixing() const
{
return mixing;
}
inline int Tool::DriveCount() const
{
return driveCount;
}
inline const float *Tool::GetOffset() const
{
return offset;
}
inline void Tool::SetOffset(const float offs[AXES])
{
for(size_t i = 0; i < AXES; ++i)
{
offset[i] = offs[i];
}
}
#endif /* TOOL_H_ */