uvlo initial version

This commit is contained in:
PavelSindler 2017-07-01 18:51:02 +02:00
parent 43d696659f
commit c4be651d2b
9 changed files with 72 additions and 6 deletions

View file

@ -47,6 +47,8 @@
#define EEPROM_TEMP_CAL_ACTIVE (EEPROM_PROBE_TEMP_SHIFT - 1)
#define EEPROM_BOWDEN_LENGTH (EEPROM_TEMP_CAL_ACTIVE - 2*4) //4 x int for bowden lengths for multimaterial
#define EEPROM_CALIBRATION_STATUS_PINDA (EEPROM_BOWDEN_LENGTH - 1) //0 - not calibrated; 1 - calibrated
#define EEPROM_UVLO (EEPROM_CALIBRATION_STATUS_PINDA - 1) //1 - uvlo during print
#define EEPROM_UVLO_CURRENT_POSITION (EEPROM_UVLO-2*4) // 2 x float for current_position in X and Y axes
// Currently running firmware, each digit stored as uint16_t.
// The flavor differentiates a dev, alpha, beta, release candidate or a release version.

View file

@ -351,4 +351,8 @@ float temp_comp_interpolation(float temperature);
void temp_compensation_apply();
void temp_compensation_start();
void wait_for_heater(long codenum);
void serialecho_temperatures();
void serialecho_temperatures();
void uvlo();
void recover_print();
#define UVLO !(PINE & (1<<4))

View file

@ -1197,6 +1197,9 @@ void setup()
if (eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA) == 255) {
eeprom_write_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0);
}
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) == 255) {
eeprom_write_byte((uint8_t*)EEPROM_UVLO, 0);
}
check_babystep(); //checking if Z babystep is in allowed range
@ -1217,12 +1220,18 @@ void setup()
// Show the message.
lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW);
}
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) == 1) { //previous print was terminated by UVLO
if (lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_RECOVER_PRINT)) recover_print();
}
for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
lcd_update_enable(true);
// Store the currently running firmware into an eeprom,
// so the next time the firmware gets updated, it will know from which version it has been updated.
update_current_firmware_version_to_eeprom();
}
void trace();
@ -6618,4 +6627,42 @@ void serialecho_temperatures() {
SERIAL_PROTOCOLPGM(" B:");
SERIAL_PROTOCOL_F(degBed(), 1);
SERIAL_PROTOCOLLN("");
}
}
void uvlo() {
eeprom_update_byte((uint8_t*)EEPROM_UVLO, 1);
eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 0), current_position[X_AXIS]);
eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4), current_position[Y_AXIS]);
//current_position[Z_AXIS] += 3;
/*
st_synchronize();
while (1);*/
//WRITE(BEEPER, HIGH);
/*while (1) {
//first turn off heatbed
//DDRG |= (1 << DDG5); //set as output
PORTG &= ~(1 << 5); //set output low
//turn off nozzle
//DDRE |= (1 << DDE5);
PORTE &= ~(1 << 5);
WRITE(BEEPER, HIGH);
}*/
}
void recover_print() {
homeaxis(X_AXIS);
homeaxis(Y_AXIS);
current_position[X_AXIS] = eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER + 0));
current_position[Y_AXIS] = eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER + 4));
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS], active_extruder);
st_synchronize();
eeprom_update_byte((uint8_t*)EEPROM_UVLO, 0);
}

View file

@ -2203,6 +2203,11 @@ const char * const MSG_REBOOT_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_REBOOT_DE
};
const char MSG_RECOVER_PRINT_EN[] PROGMEM = "Blackout occured. Recover print?";
const char * const MSG_RECOVER_PRINT_LANG_TABLE[1] PROGMEM = {
MSG_RECOVER_PRINT_EN
};
const char MSG_RECTRACT_EN[] PROGMEM = "Rectract";
const char * const MSG_RECTRACT_LANG_TABLE[1] PROGMEM = {
MSG_RECTRACT_EN

View file

@ -414,6 +414,8 @@ extern const char* const MSG_PRUSA3D_HOWTO_LANG_TABLE[LANG_NUM];
#define MSG_PRUSA3D_HOWTO LANG_TABLE_SELECT(MSG_PRUSA3D_HOWTO_LANG_TABLE)
extern const char* const MSG_REBOOT_LANG_TABLE[LANG_NUM];
#define MSG_REBOOT LANG_TABLE_SELECT(MSG_REBOOT_LANG_TABLE)
extern const char* const MSG_RECOVER_PRINT_LANG_TABLE[1];
#define MSG_RECOVER_PRINT LANG_TABLE_SELECT_EXPLICIT(MSG_RECOVER_PRINT_LANG_TABLE, 0)
extern const char* const MSG_RECTRACT_LANG_TABLE[1];
#define MSG_RECTRACT LANG_TABLE_SELECT_EXPLICIT(MSG_RECTRACT_LANG_TABLE, 0)
extern const char* const MSG_REFRESH_LANG_TABLE[1];

View file

@ -302,4 +302,4 @@
#define(length=17, lines=1) MSG_EXTRUDER_2 "Extruder 2"
#define(length=17, lines=1) MSG_EXTRUDER_3 "Extruder 3"
#define(length=17, lines=1) MSG_EXTRUDER_4 "Extruder 4"
#define(length=20, lines=2) MSG_RECOVER_PRINT "Blackout occured. Recover print?"

View file

@ -399,8 +399,9 @@
#define BEEPER 84 // Beeper on AUX-4
#define LCD_PINS_RS 82
#define LCD_PINS_ENABLE 18
#define LCD_PINS_D4 19
#define LCD_PINS_ENABLE 61
#define LCD_PINS_D4 59
#define LCD_PINS_D5 70
#define LCD_PINS_D6 85
#define LCD_PINS_D7 71
@ -412,7 +413,7 @@
#define SDCARDDETECT 15
#define TACH_0 81
#define TACH_0 79
#define TACH_1 80
#endif //NEWPANEL

View file

@ -333,6 +333,7 @@ FORCE_INLINE void trapezoid_generator_reset() {
// It pops blocks from the block_buffer and executes them by pulsing the stepper pins appropriately.
ISR(TIMER1_COMPA_vect)
{
if (UVLO) uvlo();
// If there is no current block, attempt to pop one from the buffer
if (current_block == NULL) {
// Anything in the buffer?

View file

@ -407,6 +407,9 @@ void setExtruderAutoFanState(int pin, bool state)
void countFanSpeed()
{
SERIAL_ECHOPGM("UVLO:");
MYSERIAL.println(UVLO);
fan_speed[0] = (fan_edge_counter[0] * (float(250) / (millis() - extruder_autofan_last_check)));
fan_speed[1] = (fan_edge_counter[1] * (float(250) / (millis() - extruder_autofan_last_check)));
@ -1456,6 +1459,7 @@ int read_max6675()
// Timer 0 is shared with millies
ISR(TIMER0_COMPB_vect)
{
if (UVLO) uvlo();
//these variables are only accesible from the ISR, but static, so they don't lose their value
static unsigned char temp_count = 0;
static unsigned long raw_temp_0_value = 0;