Browse Source

Marlin: Slight cleanup to Marlin_main.cpp

pull/1/head
Scott Lahteine 8 years ago
parent
commit
f105cad43c
  1. 22
      Marlin/Marlin_main.cpp

22
Marlin/Marlin_main.cpp

@ -661,18 +661,12 @@ static bool send_ok[BUFSIZE];
#define KEEPALIVE_STATE(n) ;
#endif // HOST_KEEPALIVE_FEATURE
#define DEFINE_PGM_READ_ANY(type, reader) \
static inline type pgm_read_any(const type *p) \
{ return pgm_read_##reader##_near(p); }
DEFINE_PGM_READ_ANY(float, float)
DEFINE_PGM_READ_ANY(signed char, byte)
static inline float pgm_read_any(const float *p) { return pgm_read_float_near(p); }
static inline signed char pgm_read_any(const signed char *p) { return pgm_read_byte_near(p); }
#define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \
static const PROGMEM type array##_P[XYZ] = \
{ X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \
static inline type array(int axis) \
{ return pgm_read_any(&array##_P[axis]); }
static const PROGMEM type array##_P[XYZ] = { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \
static inline type array(AxisEnum axis) { return pgm_read_any(&array##_P[axis]); }
XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS)
XYZ_CONSTS_FROM_CONFIG(float, base_max_pos, MAX_POS)
@ -848,12 +842,8 @@ static bool drain_injected_commands_P() {
cmd[sizeof(cmd) - 1] = '\0';
while ((c = cmd[i]) && c != '\n') i++; // find the end of this gcode command
cmd[i] = '\0';
if (shove_and_echo_command(cmd)) { // success?
if (c) // newline char?
injected_commands_P += i + 1; // advance to the next command
else
injected_commands_P = NULL; // nul char? no more commands
}
if (shove_and_echo_command(cmd)) // success?
injected_commands_P = c ? injected_commands_P + i + 1 : NULL; // next command or done
}
return (injected_commands_P != NULL); // return whether any more remain
}

Loading…
Cancel
Save