Skip to content

Commit dca8a7b

Browse files
committed
Reduce size by 1382 bytes (AVR)
1 parent 43d21d5 commit dca8a7b

File tree

2 files changed

+44
-26
lines changed

2 files changed

+44
-26
lines changed

Marlin/src/module/temperature.cpp

+19-1
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,24 @@ volatile bool Temperature::raw_temps_ready = false;
946946

947947
#define DEBUG_MPC_AUTOTUNE 1
948948

949+
millis_t Temperature::MPC_autotuner::curr_time_ms, Temperature::MPC_autotuner::next_report_ms;
950+
951+
float Temperature::MPC_autotuner::elapsed_heating_time;
952+
celsius_float_t Temperature::MPC_autotuner::ambient_temp, Temperature::MPC_autotuner::current_temp;
953+
celsius_float_t Temperature::MPC_autotuner::temp_samples[16];
954+
uint8_t Temperature::MPC_autotuner::sample_count;
955+
uint16_t Temperature::MPC_autotuner::sample_distance;
956+
float Temperature::MPC_autotuner::t1_time;
957+
958+
// Parameters from differential analysis
959+
celsius_float_t Temperature::MPC_autotuner::temp_fastest;
960+
float Temperature::MPC_autotuner::time_fastest, Temperature::MPC_autotuner::rate_fastest;
961+
962+
float Temperature::MPC_autotuner::power_fan0;
963+
#if HAS_FAN
964+
float Temperature::MPC_autotuner::power_fan255;
965+
#endif
966+
949967
Temperature::MPC_autotuner::MPC_autotuner(const uint8_t extruderIdx) : e(extruderIdx) {
950968
TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = false);
951969
}
@@ -973,7 +991,7 @@ volatile bool Temperature::raw_temps_ready = false;
973991
millis_t next_test_ms = curr_time_ms + test_interval_ms;
974992
ambient_temp = current_temp = degHotend(e);
975993
wait_for_heatup = true;
976-
994+
977995
for (;;) { // Can be interrupted with M108
978996
if (housekeeping() == CANCELLED) return CANCELLED;
979997

Marlin/src/module/temperature.h

+25-25
Original file line numberDiff line numberDiff line change
@@ -1229,46 +1229,46 @@ class Temperature {
12291229
MeasurementState measure_heatup();
12301230
MeasurementState measure_transfer();
12311231

1232-
celsius_float_t get_ambient_temp() { return ambient_temp; }
1233-
celsius_float_t get_last_measured_temp() { return current_temp; }
1232+
static celsius_float_t get_ambient_temp() { return ambient_temp; }
1233+
static celsius_float_t get_last_measured_temp() { return current_temp; }
12341234

1235-
float get_elapsed_heating_time() { return elapsed_heating_time; }
1236-
float get_sample_1_time() { return t1_time; }
1237-
float get_sample_1_temp() { return temp_samples[0]; }
1238-
float get_sample_2_temp() { return temp_samples[(sample_count - 1) >> 1]; }
1239-
float get_sample_3_temp() { return temp_samples[sample_count - 1]; }
1240-
float get_sample_interval() { return sample_distance * (sample_count >> 1); }
1235+
static float get_elapsed_heating_time() { return elapsed_heating_time; }
1236+
static float get_sample_1_time() { return t1_time; }
1237+
static float get_sample_1_temp() { return temp_samples[0]; }
1238+
static float get_sample_2_temp() { return temp_samples[(sample_count - 1) >> 1]; }
1239+
static float get_sample_3_temp() { return temp_samples[sample_count - 1]; }
1240+
static float get_sample_interval() { return sample_distance * (sample_count >> 1); }
12411241

1242-
celsius_float_t get_temp_fastest() { return temp_fastest; }
1243-
float get_time_fastest() { return time_fastest; }
1244-
float get_rate_fastest() { return rate_fastest; }
1242+
static celsius_float_t get_temp_fastest() { return temp_fastest; }
1243+
static float get_time_fastest() { return time_fastest; }
1244+
static float get_rate_fastest() { return rate_fastest; }
12451245

1246-
float get_power_fan0() { return power_fan0; }
1246+
static float get_power_fan0() { return power_fan0; }
12471247
#if HAS_FAN
1248-
float get_power_fan255() { return power_fan255; }
1248+
static float get_power_fan255() { return power_fan255; }
12491249
#endif
12501250

12511251
protected:
1252-
void init_timers() { curr_time_ms = next_report_ms = millis(); }
1252+
static void init_timers() { curr_time_ms = next_report_ms = millis(); }
12531253
MeasurementState housekeeping();
12541254

1255-
millis_t curr_time_ms, next_report_ms;
1255+
static millis_t curr_time_ms, next_report_ms;
12561256
uint8_t e;
12571257

1258-
float elapsed_heating_time;
1259-
celsius_float_t ambient_temp, current_temp;
1260-
celsius_float_t temp_samples[16];
1261-
uint8_t sample_count;
1262-
uint16_t sample_distance;
1263-
float t1_time;
1258+
static float elapsed_heating_time;
1259+
static celsius_float_t ambient_temp, current_temp;
1260+
static celsius_float_t temp_samples[16];
1261+
static uint8_t sample_count;
1262+
static uint16_t sample_distance;
1263+
static float t1_time;
12641264

12651265
// Parameters from differential analysis
1266-
celsius_float_t temp_fastest;
1267-
float time_fastest, rate_fastest;
1266+
static celsius_float_t temp_fastest;
1267+
static float time_fastest, rate_fastest;
12681268

1269-
float power_fan0;
1269+
static float power_fan0;
12701270
#if HAS_FAN
1271-
float power_fan255;
1271+
static float power_fan255;
12721272
#endif
12731273
};
12741274

0 commit comments

Comments
 (0)