Commit 82f65e4f authored by MagoKimbra's avatar MagoKimbra

Same fix

parent 5729de2f
...@@ -5873,7 +5873,7 @@ inline void gcode_T(uint8_t tmp_extruder) { ...@@ -5873,7 +5873,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
long csteps; long csteps;
if (tmp_extruder >= EXTRUDERS) { if (tmp_extruder >= EXTRUDERS) {
ECHO_SMV(DB, "T", tmp_extruder); ECHO_SMV(DB, "T", tmp_extruder);
ECHO_EM(MSG_INVALID_EXTRUDER); ECHO_EM(" " MSG_INVALID_EXTRUDER);
} }
else { else {
target_extruder = tmp_extruder; target_extruder = tmp_extruder;
...@@ -6996,9 +6996,20 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { ...@@ -6996,9 +6996,20 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
if (max_inactive_time && ms > previous_cmd_ms + max_inactive_time) kill(PSTR(MSG_KILLED)); if (max_inactive_time && ms > previous_cmd_ms + max_inactive_time) kill(PSTR(MSG_KILLED));
if (stepper_inactive_time && ms > previous_cmd_ms + stepper_inactive_time if (stepper_inactive_time && ms > previous_cmd_ms + stepper_inactive_time && !ignore_stepper_queue && !blocks_queued()) {
&& !ignore_stepper_queue && !blocks_queued()) #if DISABLE_X == true
disable_all_steppers(); disable_x();
#endif
#if DISABLE_Y == true
disable_y();
#endif
#if DISABLE_Z == true
disable_z();
#endif
#if DISABLE_E == true
disable_e();
#endif
}
#ifdef CHDK // Check if pin should be set to LOW after M240 set it to HIGH #ifdef CHDK // Check if pin should be set to LOW after M240 set it to HIGH
if (chdkActive && ms > chdkHigh + CHDK_DELAY) { if (chdkActive && ms > chdkHigh + CHDK_DELAY) {
......
...@@ -353,11 +353,11 @@ void CardReader::openFile(char* name, bool read, bool replace_current/*=true*/, ...@@ -353,11 +353,11 @@ void CardReader::openFile(char* name, bool read, bool replace_current/*=true*/,
if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) { if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
ECHO_MV(MSG_SD_OPEN_FILE_FAIL, fname); ECHO_MV(MSG_SD_OPEN_FILE_FAIL, fname);
ECHO_PGM(".\n"); ECHO_PGM(".\n");
if(lcd_status) lcd_setstatus(fname);
} }
else { else {
saving = true; saving = true;
ECHO_EMV(MSG_SD_WRITE_TO_FILE, name); ECHO_EMV(MSG_SD_WRITE_TO_FILE, name);
if(lcd_status) lcd_setstatus(fname);
} }
} }
} }
......
...@@ -824,7 +824,7 @@ void Config_ResetDefault() { ...@@ -824,7 +824,7 @@ void Config_ResetDefault() {
} }
char time[30]; char time[30];
int day = printer_usage_seconds / 60 / 60 / 24, hours = (printer_usage_seconds / 60 / 60) % 24, minutes = (printer_usage_seconds / 60) % 60; int day = printer_usage_seconds / 60 / 60 / 24, hours = (printer_usage_seconds / 60 / 60) % 24, minutes = (printer_usage_seconds / 60) % 60;
sprintf_P(time, PSTR("%i " MSG_END_DAY " %i " MSG_END_HOUR " %i " MSG_END_MINUTE), day, hours, minutes); sprintf_P(time, PSTR(" %i " MSG_END_DAY " %i " MSG_END_HOUR " %i " MSG_END_MINUTE), day, hours, minutes);
ECHO_LV(DB, time); ECHO_LV(DB, time);
} }
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
#define MSG_FILE_PRINTED "Done printing file" #define MSG_FILE_PRINTED "Done printing file"
#define MSG_BEGIN_FILE_LIST "Begin file list" #define MSG_BEGIN_FILE_LIST "Begin file list"
#define MSG_END_FILE_LIST "End file list" #define MSG_END_FILE_LIST "End file list"
#define MSG_INVALID_EXTRUDER " Invalid extruder " #define MSG_INVALID_EXTRUDER "Invalid extruder"
#define MSG_INVALID_SOLENOID "Invalid solenoid" #define MSG_INVALID_SOLENOID "Invalid solenoid"
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature" #define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
#define MSG_HEATING "Heating..." #define MSG_HEATING "Heating..."
......
...@@ -76,6 +76,7 @@ unsigned char soft_pwm_bed; ...@@ -76,6 +76,7 @@ unsigned char soft_pwm_bed;
#if defined(THERMAL_PROTECTION_HOTENDS) || defined(THERMAL_PROTECTION_BED) #if defined(THERMAL_PROTECTION_HOTENDS) || defined(THERMAL_PROTECTION_BED)
enum TRState { TRReset, TRInactive, TRFirstHeating, TRStable, TRRunaway }; enum TRState { TRReset, TRInactive, TRFirstHeating, TRStable, TRRunaway };
static float tr_target_temperature[HOTENDS + 1] = { 0.0 };
void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc); void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
#ifdef THERMAL_PROTECTION_HOTENDS #ifdef THERMAL_PROTECTION_HOTENDS
static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset }; static TRState thermal_runaway_state_machine[4] = { TRReset, TRReset, TRReset, TRReset };
...@@ -312,12 +313,14 @@ void PID_autotune(float temp, int hotend, int ncycles) { ...@@ -312,12 +313,14 @@ void PID_autotune(float temp, int hotend, int ncycles) {
if (hotend < 0) { if (hotend < 0) {
p = soft_pwm_bed; p = soft_pwm_bed;
ECHO_SMV(OK, MSG_B, input); ECHO_SMV(OK, MSG_B, input);
ECHO_MV(" /", temp, 1);
ECHO_EMV(" " MSG_AT, p); ECHO_EMV(" " MSG_AT, p);
} }
else { else {
p = soft_pwm[hotend]; p = soft_pwm[hotend];
ECHO_SMV(OK, MSG_T, input, 1); ECHO_SMV(OK, MSG_T, input, 1);
ECHO_EMV(MSG_AT, p); ECHO_MV(" /", temp, 1);
ECHO_EMV(" " MSG_AT, p);
} }
temp_ms = ms; temp_ms = ms;
...@@ -733,12 +736,7 @@ static float analog2temp(int raw, uint8_t e) { ...@@ -733,12 +736,7 @@ static float analog2temp(int raw, uint8_t e) {
return celsius; return celsius;
} }
#ifdef __SAM3X8E__
return ((raw * ((3.3 * 100) / 1024) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
#else
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
#endif
} }
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
...@@ -763,12 +761,8 @@ static float analog2tempBed(int raw) { ...@@ -763,12 +761,8 @@ static float analog2tempBed(int raw) {
return celsius; return celsius;
#elif defined BED_USES_AD595 #elif defined BED_USES_AD595
#ifdef __SAM3X8E__
return ((raw * ((3.3 * 100) / 1024) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
#else
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
#endif #else
#else //NO BED_USES_THERMISTOR
return 0; return 0;
#endif #endif
} }
...@@ -916,12 +910,6 @@ void tp_init() { ...@@ -916,12 +910,6 @@ void tp_init() {
#endif // HEATER_0_USES_MAX6675 #endif // HEATER_0_USES_MAX6675
#ifdef __SAM3X8E__
// Use timer0 for temperature measurement
// Interleave temperature interrupt with millies interrupt
HAL_temp_timer_start(TEMP_TIMER_NUM);
HAL_timer_enable_interrupt (TEMP_TIMER_NUM);
#else
#ifdef DIDR2 #ifdef DIDR2
#define ANALOG_SELECT(pin) do{ if (pin < 8) DIDR0 |= BIT(pin); else DIDR2 |= BIT(pin - 8); }while(0) #define ANALOG_SELECT(pin) do{ if (pin < 8) DIDR0 |= BIT(pin); else DIDR2 |= BIT(pin - 8); }while(0)
#else #else
...@@ -960,7 +948,6 @@ void tp_init() { ...@@ -960,7 +948,6 @@ void tp_init() {
// Interleave temperature interrupt with millies interrupt // Interleave temperature interrupt with millies interrupt
OCR0B = 128; OCR0B = 128;
TIMSK0 |= BIT(OCIE0B); TIMSK0 |= BIT(OCIE0B);
#endif
// Wait for temperature measurement to settle // Wait for temperature measurement to settle
delay(250); delay(250);
...@@ -1015,7 +1002,6 @@ void tp_init() { ...@@ -1015,7 +1002,6 @@ void tp_init() {
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#ifdef BED_MINTEMP #ifdef BED_MINTEMP
/* No bed MINTEMP error implemented?!? */ /*
while(analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) { while(analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) {
#if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP #if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP
bed_minttemp_raw += OVERSAMPLENR; bed_minttemp_raw += OVERSAMPLENR;
...@@ -1023,7 +1009,6 @@ void tp_init() { ...@@ -1023,7 +1009,6 @@ void tp_init() {
bed_minttemp_raw -= OVERSAMPLENR; bed_minttemp_raw -= OVERSAMPLENR;
#endif #endif
} }
*/
#endif //BED_MINTEMP #endif //BED_MINTEMP
#ifdef BED_MAXTEMP #ifdef BED_MAXTEMP
while(analog2tempBed(bed_maxttemp_raw) > BED_MAXTEMP) { while(analog2tempBed(bed_maxttemp_raw) > BED_MAXTEMP) {
...@@ -1056,8 +1041,6 @@ void tp_init() { ...@@ -1056,8 +1041,6 @@ void tp_init() {
void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) { void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) {
static float tr_target_temperature[EXTRUDERS+1] = { 0.0 };
/* /*
ECHO_SM(DB, "Thermal Thermal Runaway Running. Heater ID: "); ECHO_SM(DB, "Thermal Thermal Runaway Running. Heater ID: ");
if (heater_id < 0) ECHO_M("bed"); else ECHO_V(heater_id); if (heater_id < 0) ECHO_M("bed"); else ECHO_V(heater_id);
...@@ -1067,7 +1050,7 @@ void tp_init() { ...@@ -1067,7 +1050,7 @@ void tp_init() {
ECHO_EMV(" ; Target Temp:", target_temperature); ECHO_EMV(" ; Target Temp:", target_temperature);
*/ */
int heater_index = heater_id >= 0 ? heater_id : EXTRUDERS; int heater_index = heater_id >= 0 ? heater_id : HOTENDS;
// If the target temperature changes, restart // If the target temperature changes, restart
if (tr_target_temperature[heater_index] != target_temperature) if (tr_target_temperature[heater_index] != target_temperature)
...@@ -1168,8 +1151,8 @@ void disable_all_heaters() { ...@@ -1168,8 +1151,8 @@ void disable_all_heaters() {
WRITE(MAX6675_SS, 0); WRITE(MAX6675_SS, 0);
// ensure 100ns delay - a bit extra is fine // 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
asm("nop");// 50ns on 20Mhz, 62.5ns on 16Mhz asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz
// read MSB // read MSB
SPDR = 0; SPDR = 0;
......
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