|
@@ -661,18 +661,12 @@ static bool send_ok[BUFSIZE];
|
661
|
661
|
#define KEEPALIVE_STATE(n) ;
|
662
|
662
|
#endif // HOST_KEEPALIVE_FEATURE
|
663
|
663
|
|
664
|
|
-#define DEFINE_PGM_READ_ANY(type, reader) \
|
665
|
|
- static inline type pgm_read_any(const type *p) \
|
666
|
|
- { return pgm_read_##reader##_near(p); }
|
667
|
|
-
|
668
|
|
-DEFINE_PGM_READ_ANY(float, float)
|
669
|
|
-DEFINE_PGM_READ_ANY(signed char, byte)
|
|
664
|
+static inline float pgm_read_any(const float *p) { return pgm_read_float_near(p); }
|
|
665
|
+static inline signed char pgm_read_any(const signed char *p) { return pgm_read_byte_near(p); }
|
670
|
666
|
|
671
|
667
|
#define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \
|
672
|
|
- static const PROGMEM type array##_P[XYZ] = \
|
673
|
|
- { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \
|
674
|
|
- static inline type array(int axis) \
|
675
|
|
- { return pgm_read_any(&array##_P[axis]); }
|
|
668
|
+ static const PROGMEM type array##_P[XYZ] = { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \
|
|
669
|
+ static inline type array(AxisEnum axis) { return pgm_read_any(&array##_P[axis]); }
|
676
|
670
|
|
677
|
671
|
XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS)
|
678
|
672
|
XYZ_CONSTS_FROM_CONFIG(float, base_max_pos, MAX_POS)
|
|
@@ -848,12 +842,8 @@ static bool drain_injected_commands_P() {
|
848
|
842
|
cmd[sizeof(cmd) - 1] = '\0';
|
849
|
843
|
while ((c = cmd[i]) && c != '\n') i++; // find the end of this gcode command
|
850
|
844
|
cmd[i] = '\0';
|
851
|
|
- if (shove_and_echo_command(cmd)) { // success?
|
852
|
|
- if (c) // newline char?
|
853
|
|
- injected_commands_P += i + 1; // advance to the next command
|
854
|
|
- else
|
855
|
|
- injected_commands_P = NULL; // nul char? no more commands
|
856
|
|
- }
|
|
845
|
+ if (shove_and_echo_command(cmd)) // success?
|
|
846
|
+ injected_commands_P = c ? injected_commands_P + i + 1 : NULL; // next command or done
|
857
|
847
|
}
|
858
|
848
|
return (injected_commands_P != NULL); // return whether any more remain
|
859
|
849
|
}
|