diff --git a/Makefile-common b/Makefile-common index 31cd81b..15c67e6 100644 --- a/Makefile-common +++ b/Makefile-common @@ -49,7 +49,7 @@ OBJDUMP = $(TOOLCHAIN)objdump OBJCOPY = $(TOOLCHAIN)objcopy -OBJ = $(patsubst %.c,$(BUILDDIR)/%.o,$(SOURCES)) $(BUILDDIR)/canned_gcode.o +OBJ = $(patsubst %.c,$(BUILDDIR)/%.o,$(SOURCES)) .PHONY: all clean doc functionsbysize .PRECIOUS: %.o %.elf @@ -57,7 +57,7 @@ OBJ = $(patsubst %.c,$(BUILDDIR)/%.o,$(SOURCES)) $(BUILDDIR)/canned_gcode.o all: $(BUILDDIR) $(TARGET) clean: - rm -rf $(BUILDDIR) $(TARGET) *~ canned_gcode.c + rm -rf $(BUILDDIR) $(TARGET) *~ doc: Doxyfile *.c *.h doxygen $< @@ -107,11 +107,3 @@ $(BUILDDIR)/%.bin: $(BUILDDIR)/%.elf $(BUILDDIR)/%.sym: $(BUILDDIR)/%.elf @echo " SYM $@" @$(OBJDUMP) -t $< | perl -ne 'BEGIN { printf " ADDR NAME SIZE\n"; } /([0-9a-f]+)\s+(\w+)\s+O\s+\.(bss|data)\s+([0-9a-f]+)\s+(\w+)/ && printf "0x%04x %-20s +%d\n", eval("0x$$1") & 0xFFFF, $$5, eval("0x$$4")' | sort -k1 > $@ - -canned_gcode.c: canned_gcode.g - @echo " GEN $@" - @echo "#include \"canned_gcode.h\"" > $@ - @echo "" >> $@ - @echo -n "const char canned_gcode_P[] PROGMEM = \"" >> $@ - @perl -pe 's/\n/\\n/gs' $< >> $@ - @echo "\";" >> $@ diff --git a/canned_gcode.g b/canned_gcode.g deleted file mode 100644 index 7605b24..0000000 --- a/canned_gcode.g +++ /dev/null @@ -1,3 +0,0 @@ -G28 -G1 X100 -G1 X0 diff --git a/canned_gcode.h b/canned_gcode.h deleted file mode 100644 index 6942bc1..0000000 --- a/canned_gcode.h +++ /dev/null @@ -1,3 +0,0 @@ -#include - -extern const char canned_gcode_P[] PROGMEM; diff --git a/config.default.h b/config.default.h index c6185ca..c96e019 100644 --- a/config.default.h +++ b/config.default.h @@ -571,6 +571,22 @@ PWM value for 'off' */ #define ENDSTOP_STEPS 4 +/** \def CANNED_CYCLE + + G-code commands in this string will be executed over and over again, without + user interaction or even a serial connection. It's purpose is e.g. for + exhibitions or when using Teacup for other purposes than printing. You can + add any G-code supported by Teacup. + + Note: don't miss these newlines (\n) and backslashes (\). +*/ +/* +#define CANNED_CYCLE "G1 X100 F3000\n" \ +"G4 P500\n" \ +"G1 X0\n" \ +"G4 P500\n" +*/ + /***************************************************************************\ diff --git a/mendel.c b/mendel.c index c56d67e..98e53eb 100644 --- a/mendel.c +++ b/mendel.c @@ -58,6 +58,10 @@ SIMINFO_SERIAL_OUT("D1", "-", BAUD); #endif +#ifdef CANNED_CYCLE + const char PROGMEM canned_gcode_P[] = CANNED_CYCLE; +#endif + /// initialise all I/O - set pins as input or output, turn off unused subsystems, etc void io_init(void) { // disable modules we don't use @@ -254,11 +258,6 @@ int main (void) #endif init(); - #ifdef CANNED_CYCLE - #include "canned_gcode.h" - uint32_t canned_gcode_pos = 0; - #endif /* CANNED_CYCLE */ - // main loop for (;;) { @@ -287,6 +286,8 @@ int main (void) If ever print-from-SD card is implemented, these changes may become necessary. */ + static uint32_t canned_gcode_pos = 0; + gcode_parse_char(pgm_read_byte(&(canned_gcode_P[canned_gcode_pos]))); canned_gcode_pos++; diff --git a/testcases/config.h.Profiling b/testcases/config.h.Profiling index 6441a3d..e36b469 100644 --- a/testcases/config.h.Profiling +++ b/testcases/config.h.Profiling @@ -570,6 +570,21 @@ PWM value for 'off' */ #define ENDSTOP_STEPS 4 +/** \def CANNED_CYCLE + + G-code commands in this string will be executed over and over again, without + user interaction or even a serial connection. It's purpose is e.g. for + exhibitions or when using Teacup for other purposes than printing. You can + add any G-code supported by Teacup. + + Note: don't miss these newlines (\n) and backslashes (\). +*/ +/* +#define CANNED_CYCLE "G1 X100 F3000\n" \ +"G4 P500\n" \ +"G1 X0\n" \ +"G4 P500\n" +*/ /***************************************************************************\