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/Reprap.h
David Crocker 87980e2966 Version 1.09f
Fixed print quality problems that mostly affected delta printers e.g. on
spiral vase cylinder
When reconnecting a browser, cancel any file upload from the same IP
address
M111 now prints the number of each module with debugging enabled or
disabled
In special moves on delta printers, the F parameter is now interpreted
as the speed of the tower that moves the most
M114 now reports stepper positions as well as head position
Default to output in Marlin mode
M104 command defaults to the only tool if there is only one tool and it
is not selected
Trying different code for M999PERASE command to see if we can get it to
unlock flash and reset more reliably
When step errors are logged, report them immediately if Move debugging
is enabled. Also reports the total number of step errors in M122.
Changed interrupt priority to make tick interrupt higher priority than
step interrupt, because we rely on the tick interrupt to check for over
temperature conditions and kick the watchdog
2015-08-22 11:01:28 +01:00

169 lines
5.1 KiB
C++

/****************************************************************************************************
RepRapFirmware - Reprap
RepRap is a simple class that acts as a container for an instance of all the others.
-----------------------------------------------------------------------------------------------------
Version 0.1
21 May 2013
Adrian Bowyer
RepRap Professional Ltd
http://reprappro.com
Licence: GPL
****************************************************************************************************/
#ifndef REPRAP_H
#define REPRAP_H
const size_t maxMessageLength = 30;
class RepRap
{
public:
RepRap();
void EmergencyStop();
void Init();
void Spin();
void Exit();
void Interrupt();
void Diagnostics();
void Timing();
bool Debug(Module module) const;
void SetDebug(Module m, bool enable);
void SetDebug(bool enable);
void PrintDebug();
Module GetSpinningModule() const;
const char *GetName() const;
void SetName(const char* nm);
bool NoPasswordSet() const;
bool CheckPassword(const char* pw) const;
void SetPassword(const char* pw);
void AddTool(Tool* t);
void DeleteTool(Tool* t);
void SelectTool(int toolNumber);
void StandbyTool(int toolNumber);
Tool* GetCurrentTool() const;
Tool* GetTool(int toolNumber) const;
Tool* GetOnlyTool() const;
//Tool* GetToolByDrive(int driveNumber);
void SetToolVariables(int toolNumber, float* standbyTemperatures, float* activeTemperatures);
void AllowColdExtrude();
void DenyColdExtrude();
bool ColdExtrude() const;
unsigned int GetProhibitedExtruderMovements(unsigned int extrusions, unsigned int retractions);
void PrintTool(int toolNumber, StringRef& reply) const;
void FlagTemperatureFault(int8_t dudHeater);
void ClearTemperatureFault(int8_t wasDudHeater);
Platform* GetPlatform() const;
Move* GetMove() const;
Heat* GetHeat() const;
GCodes* GetGCodes() const;
Network* GetNetwork() const;
Webserver* GetWebserver() const;
PrintMonitor* GetPrintMonitor() const;
void Tick();
uint16_t GetTicksInSpinState() const;
bool IsStopped() const;
uint16_t GetExtrudersInUse() const;
uint16_t GetHeatersInUse() const;
void GetStatusResponse(StringRef& response, uint8_t type, int seq, bool forWebserver);
void GetConfigResponse(StringRef& response);
void GetLegacyStatusResponse(StringRef &response, uint8_t type, int seq) const;
void GetNameResponse(StringRef& response) const;
void GetFilesResponse(StringRef& response, const char* dir, bool flagsDirs) const;
void Beep(int freq, int ms);
void SetMessage(const char *msg);
void MessageToGCodeReply(const char *message);
void AppendMessageToGCodeReply(const char *message);
void AppendCharToStatusResponse(const char c);
const StringRef& GetGcodeReply() const;
static void CopyParameterText(const char* src, char *dst, size_t length);
private:
static void EncodeString(StringRef& response, const char* src, size_t spaceToLeave, bool allowControlChars = false, char prefix = 0);
char GetStatusCharacter() const;
Platform* platform;
Network* network;
Move* move;
Heat* heat;
GCodes* gCodes;
Webserver* webserver;
PrintMonitor* printMonitor;
Tool* toolList;
Tool* currentTool;
uint16_t activeExtruders;
uint16_t activeHeaters;
bool coldExtrude;
uint16_t ticksInSpinState;
Module spinningModule;
float fastLoop, slowLoop;
float lastTime;
uint16_t debug;
bool stopped;
bool active;
bool resetting;
bool processingConfig;
char password[MaxPasswordLength + 1];
char myName[MaxNameLength + 1];
int beepFrequency, beepDuration;
char message[MaxMessageLength + 1];
char gcodeReplyBuffer[MaxGcodeReplyLength];
StringRef gcodeReply;
unsigned int replySeq;
};
inline Platform* RepRap::GetPlatform() const { return platform; }
inline Move* RepRap::GetMove() const { return move; }
inline Heat* RepRap::GetHeat() const { return heat; }
inline GCodes* RepRap::GetGCodes() const { return gCodes; }
inline Network* RepRap::GetNetwork() const { return network; }
inline Webserver* RepRap::GetWebserver() const { return webserver; }
inline PrintMonitor* RepRap::GetPrintMonitor() const { return printMonitor; }
inline bool RepRap::Debug(Module m) const { return debug & (1 << m); }
inline Module RepRap::GetSpinningModule() const { return spinningModule; }
inline Tool* RepRap::GetCurrentTool() const { return currentTool; }
inline uint16_t RepRap::GetExtrudersInUse() const { return activeExtruders; }
inline uint16_t RepRap::GetHeatersInUse() const { return activeHeaters; }
inline bool RepRap::ColdExtrude() const { return coldExtrude; }
inline void RepRap::AllowColdExtrude() { coldExtrude = true; }
inline void RepRap::DenyColdExtrude() { coldExtrude = false; }
inline void RepRap::Interrupt() { move->Interrupt(); }
inline bool RepRap::IsStopped() const { return stopped; }
inline uint16_t RepRap::GetTicksInSpinState() const { return ticksInSpinState; }
inline const StringRef& RepRap::GetGcodeReply() const { return gcodeReply; }
#endif