|
@@ -125,7 +125,6 @@
|
|
|
|
|
|
|
|
|
#include "ultralcd.h"
|
|
|
-
|
|
|
#include "sound.h"
|
|
|
|
|
|
#include "cmdqueue.h"
|
|
@@ -1148,8 +1147,7 @@ void setup()
|
|
|
spi_init();
|
|
|
|
|
|
lcd_splash();
|
|
|
-
|
|
|
- Sound_Init();
|
|
|
+ Sound_Init();
|
|
|
|
|
|
#ifdef W25X20CL
|
|
|
if (!w25x20cl_init())
|
|
@@ -1723,10 +1721,6 @@ void setup()
|
|
|
#endif
|
|
|
|
|
|
#ifdef UVLO_SUPPORT
|
|
|
-
|
|
|
-MYSERIAL.println(">>> Setup");
|
|
|
-MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_UVLO),DEC);
|
|
|
-
|
|
|
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != 0) {
|
|
|
|
|
|
if (lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_RECOVER_PRINT), false)) recover_print();
|
|
@@ -1753,8 +1747,7 @@ MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_UVLO),DEC);
|
|
|
#endif
|
|
|
if ( lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_RECOVER_PRINT), false) ) recover_print(0);
|
|
|
else {
|
|
|
-
|
|
|
-
|
|
|
+ eeprom_update_byte((uint8_t*)EEPROM_UVLO, 0);
|
|
|
lcd_update_enable(true);
|
|
|
lcd_update(2);
|
|
|
lcd_setstatuspgm(_T(WELCOME_MSG));
|
|
@@ -3355,6 +3348,10 @@ void process_commands()
|
|
|
else if (code_seen("thx")) {
|
|
|
no_response = false;
|
|
|
}
|
|
|
+ else if (code_seen("uvlo")) {
|
|
|
+ eeprom_update_byte((uint8_t*)EEPROM_UVLO,0);
|
|
|
+ enquecommand_P(PSTR("M24"));
|
|
|
+ }
|
|
|
else if (code_seen("MMURES")) {
|
|
|
fprintf_P(uart2io, PSTR("X0"));
|
|
|
}
|
|
@@ -4766,8 +4763,6 @@ void process_commands()
|
|
|
card.openFile(strchr_pointer + 4,true);
|
|
|
break;
|
|
|
case 24:
|
|
|
-
|
|
|
-eeprom_update_byte((uint8_t*)EEPROM_UVLO,0);
|
|
|
if (!card.paused)
|
|
|
failstats_reset_print();
|
|
|
card.startFileprint();
|
|
@@ -6341,8 +6336,7 @@ Sigma_Exit:
|
|
|
unsigned long waiting_start_time = millis();
|
|
|
uint8_t wait_for_user_state = 0;
|
|
|
lcd_display_message_fullscreen_P(_T(MSG_PRESS_TO_UNLOAD));
|
|
|
-
|
|
|
-bool bFirst=true;
|
|
|
+ bool bFirst=true;
|
|
|
while (!(wait_for_user_state == 0 && lcd_clicked())){
|
|
|
|
|
|
|
|
@@ -6355,13 +6349,10 @@ bool bFirst=true;
|
|
|
}
|
|
|
SET_OUTPUT(BEEPER);
|
|
|
if (counterBeep == 0) {
|
|
|
-
|
|
|
-
|
|
|
-if((eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst))
|
|
|
-{
|
|
|
-bFirst=false;
|
|
|
- WRITE(BEEPER, HIGH);
|
|
|
-}
|
|
|
+ if((eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst)) {
|
|
|
+ bFirst=false;
|
|
|
+ WRITE(BEEPER, HIGH);
|
|
|
+ }
|
|
|
}
|
|
|
if (counterBeep == 20) {
|
|
|
WRITE(BEEPER, LOW);
|
|
@@ -6964,26 +6955,12 @@ bFirst=false;
|
|
|
disable_e2();
|
|
|
delay(100);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-Sound_MakeSound(e_SOUND_CLASS_Prompt,e_SOUND_TYPE_StandardPrompt);
|
|
|
-
|
|
|
- WRITE(BEEPER, HIGH);
|
|
|
- uint8_t counterBeep = 0;
|
|
|
- while (!lcd_clicked() && (counterBeep < 50)) {
|
|
|
- if (counterBeep > 5) WRITE(BEEPER, LOW);
|
|
|
- delay_keep_alive(100);
|
|
|
- counterBeep++;
|
|
|
- }
|
|
|
- WRITE(BEEPER, LOW);
|
|
|
-*/
|
|
|
-uint8_t counterBeep = 0;
|
|
|
-while (!lcd_clicked() && (counterBeep < 50)) {
|
|
|
- delay_keep_alive(100);
|
|
|
- counterBeep++;
|
|
|
-}
|
|
|
-
|
|
|
+ Sound_MakeSound(e_SOUND_CLASS_Prompt,e_SOUND_TYPE_StandardPrompt);
|
|
|
+ uint8_t counterBeep = 0;
|
|
|
+ while (!lcd_clicked() && (counterBeep < 50)) {
|
|
|
+ delay_keep_alive(100);
|
|
|
+ counterBeep++;
|
|
|
+ }
|
|
|
st_synchronize();
|
|
|
while (lcd_clicked()) delay_keep_alive(100);
|
|
|
|
|
@@ -8356,8 +8333,6 @@ void uvlo_()
|
|
|
{
|
|
|
unsigned long time_start = millis();
|
|
|
bool sd_print = card.sdprinting;
|
|
|
-
|
|
|
-MYSERIAL.println(">>> uvlo()");
|
|
|
|
|
|
disable_x();
|
|
|
disable_y();
|
|
@@ -8495,33 +8470,17 @@ MYSERIAL.println(">>> uvlo()");
|
|
|
st_synchronize();
|
|
|
#endif
|
|
|
|
|
|
-
|
|
|
- cli();
|
|
|
- volatile unsigned int ppcount = 0;
|
|
|
- SET_OUTPUT(BEEPER);
|
|
|
- WRITE(BEEPER, HIGH);
|
|
|
- for(ppcount = 0; ppcount < 2000; ppcount ++){
|
|
|
- asm("nop");
|
|
|
- }
|
|
|
- WRITE(BEEPER, LOW);
|
|
|
- while(1){
|
|
|
-#if 1
|
|
|
- WRITE(BEEPER, LOW);
|
|
|
- for(ppcount = 0; ppcount < 8000; ppcount ++){
|
|
|
- asm("nop");
|
|
|
- }
|
|
|
-#endif
|
|
|
-
|
|
|
- };
|
|
|
+wdt_enable(WDTO_500MS);
|
|
|
+WRITE(BEEPER,HIGH);
|
|
|
+while(1)
|
|
|
+ ;
|
|
|
}
|
|
|
|
|
|
|
|
|
void uvlo_tiny()
|
|
|
{
|
|
|
uint16_t z_microsteps=0;
|
|
|
-bool sd_print=card.sdprinting;
|
|
|
|
|
|
-MYSERIAL.println(">>> uvloTiny()");
|
|
|
|
|
|
disable_x();
|
|
|
disable_y();
|
|
@@ -8542,6 +8501,7 @@ sei();
|
|
|
plan_buffer_line(
|
|
|
current_position[X_AXIS],
|
|
|
current_position[Y_AXIS],
|
|
|
+
|
|
|
current_position[Z_AXIS]+UVLO_Z_AXIS_SHIFT+float((1024-z_microsteps+7)>>4)/axis_steps_per_unit[Z_AXIS],
|
|
|
current_position[E_AXIS],
|
|
|
40, active_extruder);
|
|
@@ -8558,6 +8518,11 @@ eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), current_posit
|
|
|
|
|
|
eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) + 1);
|
|
|
eeprom_update_word((uint16_t*)EEPROM_POWER_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT) + 1);
|
|
|
+
|
|
|
+wdt_enable(WDTO_500MS);
|
|
|
+WRITE(BEEPER,HIGH);
|
|
|
+while(1)
|
|
|
+ ;
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -8611,20 +8576,8 @@ void setup_uvlo_interrupt() {
|
|
|
ISR(INT4_vect) {
|
|
|
EIMSK &= ~(1 << 4);
|
|
|
SERIAL_ECHOLNPGM("INT4");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-if(IS_SD_PRINTING && (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO))) ) uvlo_();
|
|
|
-if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)) uvlo_tiny();
|
|
|
-
|
|
|
-if(IS_SD_PRINTING)
|
|
|
- {
|
|
|
-MYSERIAL.println(">>> ");
|
|
|
- if(!(eeprom_read_byte((uint8_t*)EEPROM_UVLO)))
|
|
|
- uvlo_();
|
|
|
- else uvlo_tiny();
|
|
|
- }
|
|
|
-*/
|
|
|
+ if(IS_SD_PRINTING && (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO))) ) uvlo_();
|
|
|
+ if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)) uvlo_tiny();
|
|
|
}
|
|
|
|
|
|
void recover_print(uint8_t automatic) {
|
|
@@ -8633,18 +8586,12 @@ void recover_print(uint8_t automatic) {
|
|
|
lcd_update(2);
|
|
|
lcd_setstatuspgm(_i("Recovering print "));
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-MYSERIAL.println(">>> RecoverPrint");
|
|
|
-MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_UVLO),DEC);
|
|
|
-bool bTiny=(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==2);
|
|
|
-recover_machine_state_after_power_panic(bTiny);
|
|
|
+ bool bTiny=(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==2);
|
|
|
+ recover_machine_state_after_power_panic(bTiny);
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-if(!bTiny&&(current_position[Z_AXIS]<25))
|
|
|
- enquecommand_P(PSTR("G1 Z25 F800"));
|
|
|
+ if(!bTiny&&(current_position[Z_AXIS]<25))
|
|
|
+ enquecommand_P(PSTR("G1 Z25 F800"));
|
|
|
|
|
|
enquecommand_P(PSTR("G28 X Y"));
|
|
|
|
|
@@ -8660,15 +8607,6 @@ if(!bTiny&&(current_position[Z_AXIS]<25))
|
|
|
}
|
|
|
enquecommand_P(PSTR("G1 E" STRINGIFY(-DEFAULT_RETRACTION)" F480"));
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-MYSERIAL.println("===== before");
|
|
|
-
|
|
|
-MYSERIAL.println("===== after");
|
|
|
-
|
|
|
- delay_keep_alive(1000);
|
|
|
- }*/
|
|
|
-
|
|
|
printf_P(_N("After waiting for temp:\nCurrent pos X_AXIS:%.3f\nCurrent pos Y_AXIS:%.3f\n"), current_position[X_AXIS], current_position[Y_AXIS]);
|
|
|
|
|
|
|
|
@@ -8686,16 +8624,12 @@ void recover_machine_state_after_power_panic(bool bTiny)
|
|
|
current_position[Y_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4));
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
if(bTiny)
|
|
|
current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z)) +
|
|
|
UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS)) + 7) >> 4) / axis_steps_per_unit[Z_AXIS];
|
|
|
else
|
|
|
current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) +
|
|
|
UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / axis_steps_per_unit[Z_AXIS];
|
|
|
-
|
|
|
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS)) {
|
|
|
current_position[E_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E));
|
|
|
sprintf_P(cmd, PSTR("G92 E"));
|
|
@@ -8828,10 +8762,8 @@ void restore_print_from_eeprom() {
|
|
|
|
|
|
sprintf_P(cmd, PSTR("M26 S%lu"), position);
|
|
|
enquecommand(cmd);
|
|
|
-
|
|
|
-enquecommand_P(PSTR("G4 S0"));
|
|
|
-
|
|
|
- enquecommand_P(PSTR("M24"));
|
|
|
+ enquecommand_P(PSTR("G4 S0"));
|
|
|
+ enquecommand_P(PSTR("PRUSA uvlo"));
|
|
|
}
|
|
|
#endif
|
|
|
|