#include "StreamOutput.h"
NullStreamOutput StreamOutput::NullStream;
+
+int StreamOutput::printf(const char *format, ...)
+{
+ char b[64];
+ char *buffer;
+ // Make the message
+ va_list args;
+ va_start(args, format);
+
+ int size = vsnprintf(b, 64, format, args) + 1; // we add one to take into account space for the terminating \0
+
+ if (size < 64) {
+ buffer = b;
+ } else {
+ buffer = new char[size];
+ vsnprintf(buffer, size, format, args);
+ }
+ va_end(args);
+
+ puts(buffer);
+
+ if (buffer != b)
+ delete[] buffer;
+
+ return size - 1;
+}
StreamOutput(){}
virtual ~StreamOutput(){}
- virtual int printf(const char* format, ...) __attribute__ ((format(printf, 2, 3))) {
- char b[64];
- char *buffer;
- // Make the message
- va_list args;
- va_start(args, format);
-
- int size = vsnprintf(b, 64, format, args)
- + 1; // we add one to take into account space for the terminating \0
-
- if (size < 64)
- buffer = b;
- else
- {
- buffer = new char[size];
- vsnprintf(buffer, size, format, args);
- }
- va_end(args);
-
- puts(buffer);
-
- if (buffer != b)
- delete[] buffer;
-
- return size - 1;
- }
+ virtual int printf(const char *format, ...) __attribute__ ((format(printf, 2, 3)));
virtual int _putc(int c) { return 1; }
virtual int _getc(void) { return 0; }
virtual int puts(const char* str) = 0;
#define GCODE_H
#include <string>
using std::string;
-#include "libs/StreamOutput.h"
-// Object to represent a Gcode command
#include <stdlib.h>
+class StreamOutput;
+
+// Object to represent a Gcode command
class Gcode {
public:
Gcode(const string&, StreamOutput*);
- Gcode(const Gcode& to_copy);
+ Gcode(const Gcode& to_copy);
Gcode& operator= (const Gcode& to_copy);
-
+
bool has_letter ( char letter );
float get_value ( char letter );
#include "checksumm.h"
#include "utils.h"
#include "ConfigValue.h"
+#include "libs/StreamOutput.h"
#define default_seek_rate_checksum CHECKSUM("default_seek_rate")
#define default_feed_rate_checksum CHECKSUM("default_feed_rate")
#include "checksumm.h"
#include "utils.h"
#include "ConfigValue.h"
+#include "libs/StreamOutput.h"
#define ALPHA_AXIS 0
#define BETA_AXIS 1
#include "checksumm.h"
#include "ConfigValue.h"
#include "Gcode.h"
+#include "libs/StreamOutput.h"
#include <mri.h>
#include "Gcode.h"
#include "checksumm.h"
#include "ConfigValue.h"
+#include "libs/StreamOutput.h"
#include "MRI_Hooks.h"
#include "SlowTicker.h"
#include "Gcode.h"
#include "TemperatureControl.h"
+#include "libs/StreamOutput.h"
#include <cmath> // std::abs
return r;
}
+/* Run a calibration routine for a delta
+ 1. Home
+ 2. probe for z bed
+ 3. move to base of each tower at 5mm above bed
+ 4. probe down to bed
+ 5. probe next tower
+ 6. calculate trim offsets and apply them
+ 7. Home
+ 8. Probe center
+ 9. calculate delta radius and apply it
+ 10. check level
+*/
+
+bool ZProbe::calibrate_delta(Gcode *gcode)
+{
+
+ return true;
+}
+
void ZProbe::on_gcode_received(void *argument)
{
Gcode *gcode = static_cast<Gcode *>(argument);
}else{
gcode->stream->printf("ZProbe not triggered\n");
}
+
+ }else if( gcode->g == 32 ) {
+ gcode->mark_as_taken();
+ if(is_delta) {
+ calibrate_delta(gcode);
+ }else{
+ gcode->stream->printf("Not supported yet\n");
+ }
}
} else if(gcode->has_m) {
#include "Pin.h"
class StepperMotor;
+class Gcode;
class ZProbe: public Module
{
private:
bool wait_for_probe(int distance[]);
bool run_probe(int *steps);
+ bool calibrate_delta(Gcode *gcode);
float feedrate;
float steps_per_mm[3];
#include "libs/nuts_bolts.h"
#include "libs/utils.h"
#include "ConfigValue.h"
+#include "libs/StreamOutput.h"
#include "Gcode.h"
#include "Config.h"
#include "libs/SerialMessage.h"
#include "Gcode.h"
#include "LcdBase.h"
+#include "libs/StreamOutput.h"
#include <string>
#include <vector>