Commit a2c58bb2 authored by MagoKimbra's avatar MagoKimbra

Fix Language

parent df08ccf5
......@@ -74,6 +74,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -74,6 +74,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -75,6 +75,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -78,6 +78,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -73,6 +73,7 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_PID_C "PID-C"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
......
......@@ -100,14 +100,15 @@ unsigned char soft_pwm_bed;
enum TRState { TRReset, TRInactive, TRFirstHeating, TRStable, TRRunaway };
void thermal_runaway_protection(TRState* state, millis_t* timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset };
static millis_t thermal_runaway_timer[4]; // = {0,0,0,0};
static TRState thermal_runaway_state_machine[HOTENDS] = { TRReset };
static millis_t thermal_runaway_timer[HOTENDS] = { 0 };
#endif
#if ENABLED(THERMAL_PROTECTION_BED) && TEMP_SENSOR_BED != 0
static TRState thermal_runaway_bed_state_machine = TRReset;
static millis_t thermal_runaway_bed_timer;
#endif
#endif
#if HAS(POWER_CONSUMPTION_SENSOR)
int current_raw_powconsumption = 0; //Holds measured power consumption
static unsigned long raw_powconsumption_value = 0;
......@@ -1321,6 +1322,9 @@ void disable_all_heaters() {
for (int i = 0; i < HOTENDS; i++) setTargetHotend(0, i);
setTargetBed(0);
// If all heaters go down then for sure our print job has stopped
print_job_timer.stop();
#define DISABLE_HEATER(NR) { \
target_temperature[NR] = 0; \
soft_pwm[NR] = 0; \
......@@ -1355,59 +1359,61 @@ void disable_all_heaters() {
}
#if ENABLED(HEATER_0_USES_MAX6675)
#define MAX6675_HEAT_INTERVAL 250u
static millis_t next_max6675_ms = 0;
int max6675_temp = 2000;
static int read_max6675() {
#if ENABLED(MAX6675_IS_MAX31855)
uint32_t max6675_temp = 2000;
#define MAX6675_ERROR_MASK 7
#define MAX6675_DISCARD_BITS 18
#else
uint16_t max6675_temp = 2000;
#define MAX6675_ERROR_MASK 4
#define MAX6675_DISCARD_BITS 3
#endif
millis_t ms = millis();
int Temperature::read_max6675() {
if (ms < next_max6675_ms)
return max6675_temp;
static millis_t next_max6675_ms = 0;
next_max6675_ms = ms + MAX6675_HEAT_INTERVAL;
millis_t ms = millis();
max6675_temp = 0;
if (PENDING(ms, next_max6675_ms)) return (int)max6675_temp;
#ifdef PRR
CBI(PRR, PRSPI);
#elif defined(PRR0)
CBI(PRR0, PRSPI);
#endif
next_max6675_ms = ms + MAX6675_HEAT_INTERVAL;
CBI(
#ifdef PRR
PRR
#elif defined(PRR0)
PRR0
#endif
, PRSPI);
SPCR = _BV(MSTR) | _BV(SPE) | _BV(SPR0);
// enable TT_MAX6675
WRITE(MAX6675_SS, 0);
WRITE(MAX6675_SS, 0); // enable TT_MAX6675
// ensure 100ns delay - a bit extra is fine
asm("nop"); // 50ns on 20Mhz, 62.5ns on 16Mhz
asm("nop"); // 50ns on 20Mhz, 62.5ns on 16Mhz
// read MSB
SPDR = 0;
for (; !TEST(SPSR, SPIF););
max6675_temp = SPDR;
max6675_temp <<= 8;
// read LSB
SPDR = 0;
for (; !TEST(SPSR, SPIF););
max6675_temp |= SPDR;
// disable TT_MAX6675
WRITE(MAX6675_SS, 1);
if (max6675_temp & 4) {
// thermocouple open
max6675_temp = 4000;
}
else {
max6675_temp = max6675_temp >> 3;
asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz
asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz
// Read a big-endian temperature value
max6675_temp = 0;
for (uint8_t i = sizeof(max6675_temp); i--;) {
SPDR = 0;
for (;!TEST(SPSR, SPIF););
max6675_temp |= SPDR;
if (i > 0) max6675_temp <<= 8; // shift left if not the last byte
}
return max6675_temp;
WRITE(MAX6675_SS, 1); // disable TT_MAX6675
if (max6675_temp & MAX6675_ERROR_MASK)
max6675_temp = 4000; // thermocouple open
else
max6675_temp >>= MAX6675_DISCARD_BITS;
return (int)max6675_temp;
}
#endif // HEATER_0_USES_MAX6675
......
......@@ -127,13 +127,23 @@ FORCE_INLINE float degTargetBed() { return target_temperature_bed; }
void start_watching_heater(int h = 0);
#endif
#if ENABLED(THERMAL_PROTECTION_BED)
void start_watching_bed();
#endif
FORCE_INLINE void setTargetHotend(const float& celsius, uint8_t hotend) {
target_temperature[HOTEND_ARG] = celsius;
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
start_watching_heater(HOTEND_ARG);
#endif
}
FORCE_INLINE void setTargetBed(const float& celsius) { target_temperature_bed = celsius; }
FORCE_INLINE void setTargetBed(const float& celsius) {
target_temperature_bed = celsius;
#if ENABLED(THERMAL_PROTECTION_BED)
start_watching_bed();
#endif
}
FORCE_INLINE bool isHeatingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] > current_temperature[HOTEND_ARG]; }
FORCE_INLINE bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment