Introduce gcode_init() and honor E_ABSOLUTE as the default.

This commit is contained in:
Markus Hitter 2012-03-05 22:25:52 +01:00
parent ac22a57329
commit eaf6c453be
11 changed files with 31 additions and 1 deletions

View File

@ -115,6 +115,8 @@
/** \def E_ABSOLUTE
Some G-Code creators produce relative length commands for the extruder, others absolute ones. G-Code using absolute lengths can be recognized when there are G92 E0 commands from time to time. If you have G92 E0 in your G-Code, define this flag.
This is the startup default and can be changed with M82/M83 while running.
*/
// #define E_ABSOLUTE

View File

@ -111,6 +111,8 @@
/** \def E_ABSOLUTE
Some G-Code creators produce relative length commands for the extruder, others absolute ones. G-Code using absolute lengths can be recognized when there are G92 E0 commands from time to time. If you have G92 E0 in your G-Code, define this flag.
This is the startup default and can be changed with M82/M83 while running.
*/
// #define E_ABSOLUTE

View File

@ -117,6 +117,8 @@
/** \def E_ABSOLUTE
Some G-Code creators produce relative length commands for the extruder, others absolute ones. G-Code using absolute lengths can be recognized when there are G92 E0 commands from time to time. If you have G92 E0 in your G-Code, define this flag.
This is the startup default and can be changed with M82/M83 while running.
*/
// #define E_ABSOLUTE

View File

@ -120,6 +120,8 @@
/** \def E_ABSOLUTE
Some G-Code creators produce relative length commands for the extruder, others absolute ones. G-Code using absolute lengths can be recognized when there are G92 E0 commands from time to time. If you have G92 E0 in your G-Code, define this flag.
This is the startup default and can be changed with M82/M83 while running.
*/
// #define E_ABSOLUTE

View File

@ -118,6 +118,8 @@
/** \def E_ABSOLUTE
Some G-Code creators produce relative length commands for the extruder, others absolute ones. G-Code using absolute lengths can be recognized when there are G92 E0 commands from time to time. If you have G92 E0 in your G-Code, define this flag.
This is the startup default and can be changed with M82/M83 while running.
*/
// #define E_ABSOLUTE

View File

@ -117,6 +117,8 @@
/** \def E_ABSOLUTE
Some G-Code creators produce relative length commands for the extruder, others absolute ones. G-Code using absolute lengths can be recognized when there are G92 E0 commands from time to time. If you have G92 E0 in your G-Code, define this flag.
This is the startup default and can be changed with M82/M83 while running.
*/
// #define E_ABSOLUTE

View File

@ -117,6 +117,8 @@
/** \def E_ABSOLUTE
Some G-Code creators produce relative length commands for the extruder, others absolute ones. G-Code using absolute lengths can be recognized when there are G92 E0 commands from time to time. If you have G92 E0 in your G-Code, define this flag.
This is the startup default and can be changed with M82/M83 while running.
*/
// #define E_ABSOLUTE

View File

@ -117,6 +117,8 @@
/** \def E_ABSOLUTE
Some G-Code creators produce relative length commands for the extruder, others absolute ones. G-Code using absolute lengths can be recognized when there are G92 E0 commands from time to time. If you have G92 E0 in your G-Code, define this flag.
This is the startup default and can be changed with M82/M83 while running.
*/
// #define E_ABSOLUTE

View File

@ -75,6 +75,18 @@ static int32_t decfloat_to_int(decfloat *df, uint32_t multiplicand) {
return df->sign ? -(int32_t)r : (int32_t)r;
}
void gcode_init(void) {
// gcc guarantees us all variables are initialised to 0.
// assume a G1 by default
next_target.seen_G = 1;
next_target.G = 1;
#ifndef E_ABSOLUTE
next_target.option_e_relative = 1;
#endif
}
// TODO TODO: write a gcode_init(), next_target is used uninitialised. For a hint on what to do, see line 340ff.
/// Character Received - add it to our command

View File

@ -66,6 +66,8 @@ typedef struct {
/// the command being processed
extern GCODE_COMMAND next_target;
void gcode_init(void);
/// accept the next character and process it
void gcode_parse_char(uint8_t c);

View File

@ -275,7 +275,7 @@ void init(void) {
serial_init();
// set up G-code parsing
// gcode_init();
gcode_init();
// set up inputs and outputs
io_init();