Browse Source

Merge pull request #7031 from thinkyhead/bf_save_218_bytes

Reduce Marlin by ~218 bytes
pull/1/head
Scott Lahteine 8 years ago
committed by GitHub
parent
commit
634b7fa7d4
  1. 94
      Marlin/Marlin_main.cpp
  2. 2
      Marlin/temperature.cpp
  3. 2
      Marlin/temperature.h

94
Marlin/Marlin_main.cpp

@ -5889,7 +5889,7 @@ inline void gcode_M17() {
} }
static bool pause_print(const float &retract, const float &z_lift, const float &x_pos, const float &y_pos, static bool pause_print(const float &retract, const float &z_lift, const float &x_pos, const float &y_pos,
const float &unload_length = 0 , int8_t max_beep_count = 0, bool show_lcd = false const float &unload_length = 0 , const int8_t max_beep_count = 0, const bool show_lcd = false
) { ) {
if (move_away_flag) return false; // already paused if (move_away_flag) return false; // already paused
@ -5989,7 +5989,7 @@ inline void gcode_M17() {
return true; return true;
} }
static void wait_for_filament_reload(int8_t max_beep_count = 0) { static void wait_for_filament_reload(const int8_t max_beep_count = 0) {
bool nozzle_timed_out = false; bool nozzle_timed_out = false;
// Wait for filament insert by user and press button // Wait for filament insert by user and press button
@ -6014,7 +6014,7 @@ inline void gcode_M17() {
KEEPALIVE_STATE(IN_HANDLER); KEEPALIVE_STATE(IN_HANDLER);
} }
static void resume_print(const float &load_length = 0, const float &initial_extrude_length = 0, int8_t max_beep_count = 0) { static void resume_print(const float &load_length = 0, const float &initial_extrude_length = 0, const int8_t max_beep_count = 0) {
bool nozzle_timed_out = false; bool nozzle_timed_out = false;
if (!move_away_flag) return; if (!move_away_flag) return;
@ -6974,39 +6974,57 @@ inline void gcode_M104() {
#if HAS_TEMP_HOTEND || HAS_TEMP_BED #if HAS_TEMP_HOTEND || HAS_TEMP_BED
void print_heater_state(const float &c, const float &t,
#if ENABLED(SHOW_TEMP_ADC_VALUES)
const float r,
#endif
const int8_t e=-2
) {
SERIAL_PROTOCOLCHAR(' ');
SERIAL_PROTOCOLCHAR(
#if HAS_TEMP_BED && HAS_TEMP_HOTEND
e == -1 ? 'B' : 'T'
#elif HAS_TEMP_HOTEND
'T'
#else
'B'
#endif
);
#if HOTENDS > 1
if (e >= 0) SERIAL_PROTOCOLCHAR('0' + e);
#endif
SERIAL_PROTOCOLCHAR(':');
SERIAL_PROTOCOL(c);
SERIAL_PROTOCOLPAIR(" /" , t);
#if ENABLED(SHOW_TEMP_ADC_VALUES)
SERIAL_PROTOCOLPAIR(" (", r / OVERSAMPLENR);
SERIAL_PROTOCOLCHAR(')');
#endif
}
void print_heaterstates() { void print_heaterstates() {
#if HAS_TEMP_HOTEND #if HAS_TEMP_HOTEND
SERIAL_PROTOCOLPGM(" T:"); print_heater_state(thermalManager.degHotend(target_extruder), thermalManager.degTargetHotend(target_extruder)
SERIAL_PROTOCOL(thermalManager.degHotend(target_extruder));
SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL(thermalManager.degTargetHotend(target_extruder));
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
SERIAL_PROTOCOLPAIR(" (", thermalManager.rawHotendTemp(target_extruder) / OVERSAMPLENR); , thermalManager.rawHotendTemp(target_extruder)
SERIAL_PROTOCOLCHAR(')');
#endif #endif
);
#endif #endif
#if HAS_TEMP_BED #if HAS_TEMP_BED
SERIAL_PROTOCOLPGM(" B:"); print_heater_state(thermalManager.degBed(), thermalManager.degTargetBed(),
SERIAL_PROTOCOL(thermalManager.degBed());
SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL(thermalManager.degTargetBed());
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
SERIAL_PROTOCOLPAIR(" (", thermalManager.rawBedTemp() / OVERSAMPLENR); thermalManager.rawBedTemp(),
SERIAL_PROTOCOLCHAR(')');
#endif #endif
-1 // BED
);
#endif #endif
#if HOTENDS > 1 #if HOTENDS > 1
HOTEND_LOOP() { HOTEND_LOOP() print_heater_state(thermalManager.degHotend(e), thermalManager.degTargetHotend(e),
SERIAL_PROTOCOLPAIR(" T", e);
SERIAL_PROTOCOLCHAR(':');
SERIAL_PROTOCOL(thermalManager.degHotend(e));
SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL(thermalManager.degTargetHotend(e));
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
SERIAL_PROTOCOLPAIR(" (", thermalManager.rawHotendTemp(e) / OVERSAMPLENR); thermalManager.rawHotendTemp(e),
SERIAL_PROTOCOLCHAR(')');
#endif #endif
} e
);
#endif #endif
SERIAL_PROTOCOLPGM(" @:"); SERIAL_PROTOCOLPGM(" @:");
SERIAL_PROTOCOL(thermalManager.getHeaterPower(target_extruder)); SERIAL_PROTOCOL(thermalManager.getHeaterPower(target_extruder));
@ -7206,16 +7224,12 @@ inline void gcode_M109() {
print_heaterstates(); print_heaterstates();
#if TEMP_RESIDENCY_TIME > 0 #if TEMP_RESIDENCY_TIME > 0
SERIAL_PROTOCOLPGM(" W:"); SERIAL_PROTOCOLPGM(" W:");
if (residency_start_ms) { if (residency_start_ms)
long rem = (((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL; SERIAL_PROTOCOL(long((((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
SERIAL_PROTOCOLLN(rem); else
} SERIAL_PROTOCOLCHAR('?');
else {
SERIAL_PROTOCOLLNPGM("?");
}
#else
SERIAL_EOL();
#endif #endif
SERIAL_EOL();
} }
idle(); idle();
@ -7339,16 +7353,12 @@ inline void gcode_M109() {
print_heaterstates(); print_heaterstates();
#if TEMP_BED_RESIDENCY_TIME > 0 #if TEMP_BED_RESIDENCY_TIME > 0
SERIAL_PROTOCOLPGM(" W:"); SERIAL_PROTOCOLPGM(" W:");
if (residency_start_ms) { if (residency_start_ms)
long rem = (((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL; SERIAL_PROTOCOL(long((((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
SERIAL_PROTOCOLLN(rem); else
} SERIAL_PROTOCOLCHAR('?');
else {
SERIAL_PROTOCOLLNPGM("?");
}
#else
SERIAL_EOL();
#endif #endif
SERIAL_EOL();
} }
idle(); idle();

2
Marlin/temperature.cpp

@ -113,7 +113,7 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
#if ENABLED(PREVENT_COLD_EXTRUSION) #if ENABLED(PREVENT_COLD_EXTRUSION)
bool Temperature::allow_cold_extrude = false; bool Temperature::allow_cold_extrude = false;
uint16_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP; int16_t Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
#endif #endif
// private: // private:

2
Marlin/temperature.h

@ -172,7 +172,7 @@ class Temperature {
#if ENABLED(PREVENT_COLD_EXTRUSION) #if ENABLED(PREVENT_COLD_EXTRUSION)
static bool allow_cold_extrude; static bool allow_cold_extrude;
static uint16_t extrude_min_temp; static int16_t extrude_min_temp;
static bool tooColdToExtrude(uint8_t e) { static bool tooColdToExtrude(uint8_t e) {
#if HOTENDS == 1 #if HOTENDS == 1
UNUSED(e); UNUSED(e);

Loading…
Cancel
Save