Merge remote-tracking branch 'upstream/MK3' into 4point_xyz_cal
This commit is contained in:
commit
1ee6016fa0
@ -9,7 +9,7 @@
|
||||
|
||||
// Firmware version
|
||||
#define FW_version "3.0.12-RC2"
|
||||
#define FW_build 104
|
||||
#define FW_build 105
|
||||
#define FW_version_build FW_version " b" STR(FW_build)
|
||||
|
||||
|
||||
|
14472
Firmware/Firmware.ino.rambo.hex
Normal file
14472
Firmware/Firmware.ino.rambo.hex
Normal file
File diff suppressed because it is too large
Load Diff
@ -334,6 +334,7 @@ extern int fanSpeedBckp;
|
||||
extern float pause_lastpos[4];
|
||||
extern unsigned long pause_time;
|
||||
extern unsigned long start_pause_print;
|
||||
extern unsigned long t_fan_rising_edge;
|
||||
|
||||
extern bool mesh_bed_leveling_flag;
|
||||
extern bool mesh_bed_run_from_menu;
|
||||
@ -371,6 +372,7 @@ void serialecho_temperatures();
|
||||
void uvlo_();
|
||||
void recover_print(uint8_t automatic);
|
||||
void setup_uvlo_interrupt();
|
||||
void setup_fan_interrupt();
|
||||
|
||||
extern void recover_machine_state_after_power_panic();
|
||||
extern void restore_print_from_eeprom();
|
||||
|
@ -107,6 +107,8 @@
|
||||
#define TEST(n,b) (((n)&BIT(b))!=0)
|
||||
#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (BIT(b))
|
||||
|
||||
//Macro for print fan speed
|
||||
#define FAN_PULSE_WIDTH_LIMIT ((fanSpeed > 100) ? 3 : 4) //time in ms
|
||||
|
||||
// look here for descriptions of G-codes: http://linuxcnc.org/handbook/gcode/g-code.html
|
||||
// http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
|
||||
@ -288,6 +290,7 @@ int fanSpeedBckp = 0;
|
||||
float pause_lastpos[4];
|
||||
unsigned long pause_time = 0;
|
||||
unsigned long start_pause_print = millis();
|
||||
unsigned long t_fan_rising_edge = millis();
|
||||
|
||||
unsigned long load_filament_time;
|
||||
|
||||
@ -987,8 +990,9 @@ void setup()
|
||||
|
||||
check_babystep(); //checking if Z babystep is in allowed range
|
||||
setup_uvlo_interrupt();
|
||||
|
||||
setup_fan_interrupt();
|
||||
fsensor_setup_interrupt();
|
||||
|
||||
|
||||
#ifndef DEBUG_DISABLE_STARTMSGS
|
||||
|
||||
@ -6991,6 +6995,34 @@ void uvlo_()
|
||||
while(1);
|
||||
}
|
||||
|
||||
void setup_fan_interrupt() {
|
||||
//INT7
|
||||
DDRE &= ~(1 << 7); //input pin
|
||||
PORTE &= ~(1 << 7); //no internal pull-up
|
||||
|
||||
//start with sensing rising edge
|
||||
EICRB &= ~(1 << 6);
|
||||
EICRB |= (1 << 7);
|
||||
|
||||
//enable INT7 interrupt
|
||||
EIMSK |= (1 << 7);
|
||||
}
|
||||
|
||||
ISR(INT7_vect) {
|
||||
//measuring speed now works for fanSpeed > 18 (approximately), which is sufficient because MIN_PRINT_FAN_SPEED is higher
|
||||
|
||||
if (fanSpeed < MIN_PRINT_FAN_SPEED) return;
|
||||
if ((1 << 6) & EICRB) { //interrupt was triggered by rising edge
|
||||
t_fan_rising_edge = millis();
|
||||
}
|
||||
else { //interrupt was triggered by falling edge
|
||||
if ((millis() - t_fan_rising_edge) >= FAN_PULSE_WIDTH_LIMIT) {//this pulse was from sensor and not from pwm
|
||||
fan_edge_counter[1] += 2; //we are currently counting all edges so lets count two edges for one pulse
|
||||
}
|
||||
}
|
||||
EICRB ^= (1 << 6); //change edge
|
||||
}
|
||||
|
||||
void setup_uvlo_interrupt() {
|
||||
DDRE &= ~(1 << 4); //input pin
|
||||
PORTE &= ~(1 << 4); //no internal pull-up
|
||||
|
@ -2178,10 +2178,10 @@ void check_fans() {
|
||||
fan_edge_counter[0] ++;
|
||||
fan_state[0] = !fan_state[0];
|
||||
}
|
||||
if (READ(TACH_1) != fan_state[1]) {
|
||||
fan_edge_counter[1] ++;
|
||||
fan_state[1] = !fan_state[1];
|
||||
}
|
||||
//if (READ(TACH_1) != fan_state[1]) {
|
||||
// fan_edge_counter[1] ++;
|
||||
// fan_state[1] = !fan_state[1];
|
||||
//}
|
||||
}
|
||||
|
||||
#ifdef PIDTEMP
|
||||
|
Loading…
Reference in New Issue
Block a user