Reduce code size with plain inlines
This commit is contained in:
@ -51,8 +51,6 @@ enum MeshPointType : char { INVALID, REAL, SET_IN_BITMAP };
|
||||
|
||||
extern uint8_t ubl_cnt;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if ENABLED(ULTRA_LCD)
|
||||
void lcd_quick_feedback(const bool clear_buttons);
|
||||
#endif
|
||||
@ -346,11 +344,11 @@ class unified_bed_leveling {
|
||||
return z0;
|
||||
}
|
||||
|
||||
FORCE_INLINE static float mesh_index_to_xpos(const uint8_t i) {
|
||||
static inline float mesh_index_to_xpos(const uint8_t i) {
|
||||
return i < GRID_MAX_POINTS_X ? pgm_read_float(&_mesh_index_to_xpos[i]) : MESH_MIN_X + i * (MESH_X_DIST);
|
||||
}
|
||||
|
||||
FORCE_INLINE static float mesh_index_to_ypos(const uint8_t i) {
|
||||
static inline float mesh_index_to_ypos(const uint8_t i) {
|
||||
return i < GRID_MAX_POINTS_Y ? pgm_read_float(&_mesh_index_to_ypos[i]) : MESH_MIN_Y + i * (MESH_Y_DIST);
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
#endif
|
||||
);
|
||||
|
||||
FORCE_INLINE void set_color(uint8_t r, uint8_t g, uint8_t b
|
||||
inline void set_color(uint8_t r, uint8_t g, uint8_t b
|
||||
#if HAS_WHITE_LED
|
||||
, uint8_t w=0
|
||||
#if ENABLED(NEOPIXEL_LED)
|
||||
@ -164,23 +164,23 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
FORCE_INLINE static void set_off() { set_color(LEDColorOff()); }
|
||||
FORCE_INLINE static void set_green() { set_color(LEDColorGreen()); }
|
||||
FORCE_INLINE static void set_white() { set_color(LEDColorWhite()); }
|
||||
static inline void set_off() { set_color(LEDColorOff()); }
|
||||
static inline void set_green() { set_color(LEDColorGreen()); }
|
||||
static inline void set_white() { set_color(LEDColorWhite()); }
|
||||
|
||||
#if ENABLED(LED_COLOR_PRESETS)
|
||||
static const LEDColor defaultLEDColor;
|
||||
FORCE_INLINE static void set_default() { set_color(defaultLEDColor); }
|
||||
FORCE_INLINE static void set_red() { set_color(LEDColorRed()); }
|
||||
FORCE_INLINE static void set_orange() { set_color(LEDColorOrange()); }
|
||||
FORCE_INLINE static void set_yellow() { set_color(LEDColorYellow()); }
|
||||
FORCE_INLINE static void set_blue() { set_color(LEDColorBlue()); }
|
||||
FORCE_INLINE static void set_indigo() { set_color(LEDColorIndigo()); }
|
||||
FORCE_INLINE static void set_violet() { set_color(LEDColorViolet()); }
|
||||
static inline void set_default() { set_color(defaultLEDColor); }
|
||||
static inline void set_red() { set_color(LEDColorRed()); }
|
||||
static inline void set_orange() { set_color(LEDColorOrange()); }
|
||||
static inline void set_yellow() { set_color(LEDColorYellow()); }
|
||||
static inline void set_blue() { set_color(LEDColorBlue()); }
|
||||
static inline void set_indigo() { set_color(LEDColorIndigo()); }
|
||||
static inline void set_violet() { set_color(LEDColorViolet()); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRINTER_EVENT_LEDS)
|
||||
FORCE_INLINE static LEDColor get_color() { return lights_on ? color : LEDColorOff(); }
|
||||
static inline LEDColor get_color() { return lights_on ? color : LEDColorOff(); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(LED_CONTROL_MENU) || ENABLED(PRINTER_EVENT_LEDS)
|
||||
@ -189,7 +189,7 @@ public:
|
||||
#endif
|
||||
#if ENABLED(LED_CONTROL_MENU)
|
||||
static void toggle(); // swap "off" with color
|
||||
FORCE_INLINE static void update() { set_color(color); }
|
||||
static inline void update() { set_color(color); }
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -38,23 +38,23 @@ private:
|
||||
|
||||
public:
|
||||
#if HAS_TEMP_HOTEND
|
||||
FORCE_INLINE static LEDColor onHotendHeatingStart() { old_intensity = 0; return leds.get_color(); }
|
||||
static inline LEDColor onHotendHeatingStart() { old_intensity = 0; return leds.get_color(); }
|
||||
static void onHotendHeating(const float &start, const float ¤t, const float &target);
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
FORCE_INLINE static LEDColor onBedHeatingStart() { old_intensity = 127; return leds.get_color(); }
|
||||
static inline LEDColor onBedHeatingStart() { old_intensity = 127; return leds.get_color(); }
|
||||
static void onBedHeating(const float &start, const float ¤t, const float &target);
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_HOTEND || HAS_HEATED_BED
|
||||
FORCE_INLINE static void onHeatingDone() { leds.set_color(LEDColorWhite()); }
|
||||
FORCE_INLINE static void onPidTuningDone(LEDColor c) { leds.set_color(c); }
|
||||
static inline void onHeatingDone() { leds.set_color(LEDColorWhite()); }
|
||||
static inline void onPidTuningDone(LEDColor c) { leds.set_color(c); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
FORCE_INLINE static void onPrintCompleted() {
|
||||
static inline void onPrintCompleted() {
|
||||
leds.set_green();
|
||||
#if HAS_LEDS_OFF_FLAG
|
||||
leds_off_after_print = true;
|
||||
@ -64,7 +64,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
FORCE_INLINE static void onResumeAfterWait() {
|
||||
static inline void onResumeAfterWait() {
|
||||
#if HAS_LEDS_OFF_FLAG
|
||||
if (leds_off_after_print) {
|
||||
leds.set_off();
|
||||
|
@ -180,9 +180,9 @@ class FilamentSensorTypeSwitch : public FilamentSensorTypeBase {
|
||||
}
|
||||
|
||||
public:
|
||||
FORCE_INLINE static void block_complete(const block_t *b) {}
|
||||
static inline void block_complete(const block_t *b) {}
|
||||
|
||||
FORCE_INLINE static void run() {
|
||||
static inline void run() {
|
||||
if (!poll_runout_pin(active_extruder))
|
||||
filament_present(active_extruder);
|
||||
}
|
||||
@ -220,7 +220,7 @@ class FilamentSensorTypeEncoder : public FilamentSensorTypeBase {
|
||||
motion_detected = 0;
|
||||
}
|
||||
|
||||
FORCE_INLINE static void run() { poll_motion_sensor(); }
|
||||
static inline void run() { poll_motion_sensor(); }
|
||||
};
|
||||
|
||||
/********************************* RESPONSE TYPE *********************************/
|
||||
@ -240,7 +240,7 @@ class FilamentSensorTypeEncoder : public FilamentSensorTypeBase {
|
||||
public:
|
||||
static float runout_distance_mm;
|
||||
|
||||
FORCE_INLINE static bool has_runout() {
|
||||
static inline bool has_runout() {
|
||||
return get_mm_since_runout(active_extruder) > runout_distance_mm;
|
||||
}
|
||||
|
||||
@ -281,11 +281,11 @@ class FilamentSensorTypeEncoder : public FilamentSensorTypeBase {
|
||||
static constexpr uint8_t FIL_RUNOUT_THRESHOLD = 5;
|
||||
static uint8_t runout_count;
|
||||
public:
|
||||
FORCE_INLINE static bool has_runout() { return runout_count > FIL_RUNOUT_THRESHOLD; }
|
||||
FORCE_INLINE static void block_complete(const block_t *b) {}
|
||||
FORCE_INLINE static void filament_present(const uint8_t extruder) { runout_count = 0; UNUSED(extruder); }
|
||||
FORCE_INLINE static void run() { runout_count++; }
|
||||
FORCE_INLINE static void reset() { runout_count = 0; }
|
||||
static inline bool has_runout() { return runout_count > FIL_RUNOUT_THRESHOLD; }
|
||||
static inline void block_complete(const block_t *b) {}
|
||||
static inline void filament_present(const uint8_t extruder) { runout_count = 0; UNUSED(extruder); }
|
||||
static inline void run() { runout_count++; }
|
||||
static inline void reset() { runout_count = 0; }
|
||||
};
|
||||
|
||||
#endif // !FILAMENT_RUNOUT_DISTANCE_MM
|
||||
|
Reference in New Issue
Block a user