Canned G-code: setup right in config.h.
This works with Arduino IDE as well and should be easier to figure for inexperienced users.
This commit is contained in:
parent
7f990a298c
commit
5cc84a069a
|
|
@ -49,7 +49,7 @@ OBJDUMP = $(TOOLCHAIN)objdump
|
||||||
OBJCOPY = $(TOOLCHAIN)objcopy
|
OBJCOPY = $(TOOLCHAIN)objcopy
|
||||||
|
|
||||||
|
|
||||||
OBJ = $(patsubst %.c,$(BUILDDIR)/%.o,$(SOURCES)) $(BUILDDIR)/canned_gcode.o
|
OBJ = $(patsubst %.c,$(BUILDDIR)/%.o,$(SOURCES))
|
||||||
|
|
||||||
.PHONY: all clean doc functionsbysize
|
.PHONY: all clean doc functionsbysize
|
||||||
.PRECIOUS: %.o %.elf
|
.PRECIOUS: %.o %.elf
|
||||||
|
|
@ -57,7 +57,7 @@ OBJ = $(patsubst %.c,$(BUILDDIR)/%.o,$(SOURCES)) $(BUILDDIR)/canned_gcode.o
|
||||||
all: $(BUILDDIR) $(TARGET)
|
all: $(BUILDDIR) $(TARGET)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILDDIR) $(TARGET) *~ canned_gcode.c
|
rm -rf $(BUILDDIR) $(TARGET) *~
|
||||||
|
|
||||||
doc: Doxyfile *.c *.h
|
doc: Doxyfile *.c *.h
|
||||||
doxygen $<
|
doxygen $<
|
||||||
|
|
@ -107,11 +107,3 @@ $(BUILDDIR)/%.bin: $(BUILDDIR)/%.elf
|
||||||
$(BUILDDIR)/%.sym: $(BUILDDIR)/%.elf
|
$(BUILDDIR)/%.sym: $(BUILDDIR)/%.elf
|
||||||
@echo " SYM $@"
|
@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 > $@
|
@$(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 "\";" >> $@
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
G28
|
|
||||||
G1 X100
|
|
||||||
G1 X0
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
extern const char canned_gcode_P[] PROGMEM;
|
|
||||||
|
|
@ -571,6 +571,22 @@ PWM value for 'off'
|
||||||
*/
|
*/
|
||||||
#define ENDSTOP_STEPS 4
|
#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"
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************\
|
/***************************************************************************\
|
||||||
|
|
|
||||||
11
mendel.c
11
mendel.c
|
|
@ -58,6 +58,10 @@
|
||||||
SIMINFO_SERIAL_OUT("D1", "-", BAUD);
|
SIMINFO_SERIAL_OUT("D1", "-", BAUD);
|
||||||
#endif
|
#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
|
/// initialise all I/O - set pins as input or output, turn off unused subsystems, etc
|
||||||
void io_init(void) {
|
void io_init(void) {
|
||||||
// disable modules we don't use
|
// disable modules we don't use
|
||||||
|
|
@ -254,11 +258,6 @@ int main (void)
|
||||||
#endif
|
#endif
|
||||||
init();
|
init();
|
||||||
|
|
||||||
#ifdef CANNED_CYCLE
|
|
||||||
#include "canned_gcode.h"
|
|
||||||
uint32_t canned_gcode_pos = 0;
|
|
||||||
#endif /* CANNED_CYCLE */
|
|
||||||
|
|
||||||
// main loop
|
// main loop
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
|
@ -287,6 +286,8 @@ int main (void)
|
||||||
If ever print-from-SD card is implemented, these changes may become
|
If ever print-from-SD card is implemented, these changes may become
|
||||||
necessary.
|
necessary.
|
||||||
*/
|
*/
|
||||||
|
static uint32_t canned_gcode_pos = 0;
|
||||||
|
|
||||||
gcode_parse_char(pgm_read_byte(&(canned_gcode_P[canned_gcode_pos])));
|
gcode_parse_char(pgm_read_byte(&(canned_gcode_P[canned_gcode_pos])));
|
||||||
|
|
||||||
canned_gcode_pos++;
|
canned_gcode_pos++;
|
||||||
|
|
|
||||||
|
|
@ -570,6 +570,21 @@ PWM value for 'off'
|
||||||
*/
|
*/
|
||||||
#define ENDSTOP_STEPS 4
|
#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"
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************\
|
/***************************************************************************\
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue