Merge pull request #344 from XPila/MK3

Mk3
This commit is contained in:
XPila 2017-12-23 03:45:33 +01:00 committed by GitHub
commit 527b870700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15180 additions and 77 deletions

View File

@ -8,10 +8,10 @@
#define STR(x) STR_HELPER(x) #define STR(x) STR_HELPER(x)
// Firmware version // Firmware version
#define FW_version "3.1.1-RC2" #define FW_version "3.1.1-RC3"
#define FW_build 137 #define FW_build 138
//#define FW_build --BUILD-NUMBER-- //#define FW_build --BUILD-NUMBER--
#define FW_version_build FW_version " b" STR(FW_build) "z" #define FW_version_build FW_version " b" STR(FW_build)
#define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC "PRUSA3DFW"

View File

@ -96,7 +96,8 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// this value is litlebit higher that real limit, because ambient termistor is on the board and is temperated from it, // this value is litlebit higher that real limit, because ambient termistor is on the board and is temperated from it,
// temperature inside the case is around 31C for ambient temperature 25C, when the printer is powered on long time and idle // temperature inside the case is around 31C for ambient temperature 25C, when the printer is powered on long time and idle
// the real limit is 15C (same as MINTEMP limit), this is because 15C is end of scale for both used thermistors (bed, heater) // the real limit is 15C (same as MINTEMP limit), this is because 15C is end of scale for both used thermistors (bed, heater)
#define MINTEMP_MINAMBIENT 18 #define MINTEMP_MINAMBIENT 18
#define MINTEMP_MINAMBIENT_RAW 991
//DEBUG //DEBUG
@ -181,8 +182,8 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define TMC2130_SG_THRS_E 3 // stallguard sensitivity for E axis #define TMC2130_SG_THRS_E 3 // stallguard sensitivity for E axis
//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only) //new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only)
#define TMC2130_CURRENTS_H {13, 20, 20, 35} // default holding currents for all axes #define TMC2130_CURRENTS_H {13, 20, 25, 35} // default holding currents for all axes
#define TMC2130_CURRENTS_R {13, 20, 20, 35} // default running currents for all axes #define TMC2130_CURRENTS_R {13, 20, 25, 35} // default running currents for all axes
//#define TMC2130_DEBUG //#define TMC2130_DEBUG
//#define TMC2130_DEBUG_WR //#define TMC2130_DEBUG_WR

File diff suppressed because it is too large Load Diff

View File

@ -660,7 +660,7 @@ void manage_heater()
#endif #endif
// Check if temperature is within the correct range // Check if temperature is within the correct range
if((current_temperature[e] > minttemp[e]) && (current_temperature[e] < maxttemp[e])) if(((current_temperature_ambient < MINTEMP_MINAMBIENT) || (current_temperature[e] > minttemp[e])) && (current_temperature[e] < maxttemp[e]))
{ {
soft_pwm[e] = (int)pid_output >> 1; soft_pwm[e] = (int)pid_output >> 1;
} }
@ -745,7 +745,7 @@ void manage_heater()
pid_output = constrain(target_temperature_bed, 0, MAX_BED_POWER); pid_output = constrain(target_temperature_bed, 0, MAX_BED_POWER);
#endif //PID_OPENLOOP #endif //PID_OPENLOOP
if((current_temperature_bed > BED_MINTEMP) && (current_temperature_bed < BED_MAXTEMP)) if(((current_temperature_bed > BED_MINTEMP) || (current_temperature_ambient < MINTEMP_MINAMBIENT)) && (current_temperature_bed < BED_MAXTEMP))
{ {
soft_pwm_bed = (int)pid_output >> 1; soft_pwm_bed = (int)pid_output >> 1;
} }
@ -1418,7 +1418,7 @@ void min_temp_error(uint8_t e) {
#ifdef DEBUG_DISABLE_MINTEMP #ifdef DEBUG_DISABLE_MINTEMP
return; return;
#endif #endif
if (current_temperature_ambient < MINTEMP_MINAMBIENT) return; //if (current_temperature_ambient < MINTEMP_MINAMBIENT) return;
disable_heater(); disable_heater();
if(IsStopped() == false) { if(IsStopped() == false) {
SERIAL_ERROR_START; SERIAL_ERROR_START;
@ -1452,7 +1452,7 @@ void bed_min_temp_error(void) {
#ifdef DEBUG_DISABLE_MINTEMP #ifdef DEBUG_DISABLE_MINTEMP
return; return;
#endif #endif
if (current_temperature_ambient < MINTEMP_MINAMBIENT) return; //if (current_temperature_ambient < MINTEMP_MINAMBIENT) return;
#if HEATER_BED_PIN > -1 #if HEATER_BED_PIN > -1
WRITE(HEATER_BED_PIN, 0); WRITE(HEATER_BED_PIN, 0);
#endif #endif
@ -1544,6 +1544,11 @@ void adc_ready(void) //callback from adc when sampling finished
ISR(TIMER0_COMPB_vect) ISR(TIMER0_COMPB_vect)
{ {
if (!temp_meas_ready) adc_cycle(); if (!temp_meas_ready) adc_cycle();
else
{
check_max_temp();
check_min_temp();
}
lcd_buttons_update(); lcd_buttons_update();
static unsigned char pwm_count = (1 << SOFT_PWM_SCALE); static unsigned char pwm_count = (1 << SOFT_PWM_SCALE);
@ -1879,85 +1884,49 @@ ISR(TIMER0_COMPB_vect)
check_fans(); check_fans();
} }
void check_min_max_temp() void check_max_temp()
{ {
/* //heater
#if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
if(current_temperature_raw[0] <= maxttemp_raw[0]) { if (current_temperature_raw[0] <= maxttemp_raw[0]) {
#else #else
if(current_temperature_raw[0] >= maxttemp_raw[0]) { if (current_temperature_raw[0] >= maxttemp_raw[0]) {
#endif #endif
max_temp_error(0); max_temp_error(0);
} }
#if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP //bed
if(current_temperature_raw[0] >= minttemp_raw[0]) {
#else
if(current_temperature_raw[0] <= minttemp_raw[0]) {
#endif
min_temp_error(0);
}
#if EXTRUDERS > 1
#if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP
if(current_temperature_raw[1] <= maxttemp_raw[1]) {
#else
if(current_temperature_raw[1] >= maxttemp_raw[1]) {
#endif
max_temp_error(1);
}
#if HEATER_1_RAW_LO_TEMP > HEATER_1_RAW_HI_TEMP
if(current_temperature_raw[1] >= minttemp_raw[1]) {
#else
if(current_temperature_raw[1] <= minttemp_raw[1]) {
#endif
min_temp_error(1);
}
#endif
#if EXTRUDERS > 2
#if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP
if(current_temperature_raw[2] <= maxttemp_raw[2]) {
#else
if(current_temperature_raw[2] >= maxttemp_raw[2]) {
#endif
max_temp_error(2);
}
#if HEATER_2_RAW_LO_TEMP > HEATER_2_RAW_HI_TEMP
if(current_temperature_raw[2] >= minttemp_raw[2]) {
#else
if(current_temperature_raw[2] <= minttemp_raw[2]) {
#endif
min_temp_error(2);
}
#endif
// No bed MINTEMP error?
#if defined(BED_MAXTEMP) && (TEMP_SENSOR_BED != 0) #if defined(BED_MAXTEMP) && (TEMP_SENSOR_BED != 0)
# if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
if(current_temperature_bed_raw <= bed_maxttemp_raw) { if (current_temperature_bed_raw <= bed_maxttemp_raw) {
#else #else
if(current_temperature_bed_raw >= bed_maxttemp_raw) { if (current_temperature_bed_raw >= bed_maxttemp_raw) {
#endif #endif
target_temperature_bed = 0; target_temperature_bed = 0;
bed_max_temp_error(); bed_max_temp_error();
} }
}
# if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
if(current_temperature_bed_raw >= bed_minttemp_raw) {
#else
if(current_temperature_bed_raw <= bed_minttemp_raw) {
#endif #endif
bed_min_temp_error();
} }
#endif*/ void check_min_temp()
{
if (current_temperature_raw_ambient > OVERSAMPLENR*MINTEMP_MINAMBIENT_RAW) return;
//heater
#if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
if (current_temperature_raw[0] >= minttemp_raw[0]) {
#else
if (current_temperature_raw[0] <= minttemp_raw[0]) {
#endif
min_temp_error(0);
}
//bed
#if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP
if (current_temperature_bed_raw >= bed_minttemp_raw) {
#else
if (current_temperature_bed_raw <= bed_minttemp_raw) {
#endif
bed_min_temp_error();
}
} }
void check_fans() { void check_fans() {

View File

@ -231,6 +231,8 @@ void checkFanSpeed();
void fanSpeedError(unsigned char _fan); void fanSpeedError(unsigned char _fan);
void check_fans(); void check_fans();
void check_min_temp();
void check_max_temp();
#endif #endif

View File

@ -221,6 +221,8 @@ uint8_t tmc2130_sample_diag()
return mask; return mask;
} }
extern bool is_usb_printing;
void tmc2130_st_isr(uint8_t last_step_mask) void tmc2130_st_isr(uint8_t last_step_mask)
{ {
if (tmc2130_mode == TMC2130_MODE_SILENT || tmc2130_sg_stop_on_crash == false) return; if (tmc2130_mode == TMC2130_MODE_SILENT || tmc2130_sg_stop_on_crash == false) return;
@ -253,7 +255,7 @@ void tmc2130_st_isr(uint8_t last_step_mask)
if (diag_mask & 0x04) tmc2130_sg_cnt[2]++; if (diag_mask & 0x04) tmc2130_sg_cnt[2]++;
if (diag_mask & 0x08) tmc2130_sg_cnt[3]++; if (diag_mask & 0x08) tmc2130_sg_cnt[3]++;
}*/ }*/
if (tmc2130_sg_stop_on_crash && crash) if (!is_usb_printing && tmc2130_sg_stop_on_crash && crash)
{ {
tmc2130_sg_crash = true; tmc2130_sg_crash = true;
tmc2130_sg_stop_on_crash = false; tmc2130_sg_stop_on_crash = false;