Marlin: Slight cleanup to Marlin_main.cpp

2.0.x
Scott Lahteine 8 years ago
parent 499f9e04e1
commit f105cad43c

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

Loading…
Cancel
Save