Merge pull request #199 from PavelSindler/filecheck
Checking if file is complete, farm mode updates
This commit is contained in:
commit
c6d8b0878c
|
|
@ -362,6 +362,7 @@ void temp_compensation_start();
|
|||
void wait_for_heater(long codenum);
|
||||
void serialecho_temperatures();
|
||||
void proc_commands();
|
||||
bool check_commands();
|
||||
|
||||
#ifdef HOST_KEEPALIVE_FEATURE
|
||||
|
||||
|
|
@ -386,3 +387,4 @@ void gcode_M701();
|
|||
|
||||
|
||||
#endif //ifndef marlin.h
|
||||
|
||||
|
|
|
|||
|
|
@ -1947,6 +1947,19 @@ static float probe_pt(float x, float y, float z_before) {
|
|||
}
|
||||
#endif // LIN_ADVANCE
|
||||
|
||||
bool check_commands() {
|
||||
bool end_command_found = false;
|
||||
|
||||
if (buflen)
|
||||
{
|
||||
if ((code_seen("M84")) || (code_seen("M 84"))) end_command_found = true;
|
||||
if (!cmdbuffer_front_already_processed)
|
||||
cmdqueue_pop_front();
|
||||
cmdbuffer_front_already_processed = false;
|
||||
}
|
||||
return end_command_found;
|
||||
}
|
||||
|
||||
void homeaxis(int axis) {
|
||||
#define HOMEAXIS_DO(LETTER) \
|
||||
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
|
||||
|
|
|
|||
|
|
@ -277,6 +277,8 @@ int16_t SdBaseFile::fgets(char* str, int16_t num, char* delim) {
|
|||
* \return The value one, true, is returned for success and
|
||||
* the value zero, false, is returned for failure.
|
||||
*/
|
||||
|
||||
|
||||
bool SdBaseFile::getFilename(char* name) {
|
||||
if (!isOpen()) return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
|
|||
} // while readDir
|
||||
}
|
||||
|
||||
|
||||
void CardReader::ls()
|
||||
{
|
||||
lsAction=LS_SerialPrint;
|
||||
|
|
@ -500,6 +501,11 @@ void CardReader::removeFile(char* name)
|
|||
|
||||
}
|
||||
|
||||
uint32_t CardReader::getFileSize()
|
||||
{
|
||||
return filesize;
|
||||
}
|
||||
|
||||
void CardReader::getStatus()
|
||||
{
|
||||
if(sdprinting){
|
||||
|
|
@ -963,8 +969,8 @@ void CardReader::printingHasFinished()
|
|||
sdprinting = false;
|
||||
if(SD_FINISHED_STEPPERRELEASE)
|
||||
{
|
||||
//finishAndDisableSteppers();
|
||||
enquecommand_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
||||
finishAndDisableSteppers();
|
||||
//enquecommand_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
||||
}
|
||||
autotempShutdown();
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public:
|
|||
void release();
|
||||
void startFileprint();
|
||||
void pauseSDPrint();
|
||||
uint32_t getFileSize();
|
||||
void getStatus();
|
||||
void printingHasFinished();
|
||||
|
||||
|
|
|
|||
|
|
@ -1092,6 +1092,11 @@ const char * const MSG_FILAMENT_LOADING_T3_LANG_TABLE[LANG_NUM] PROGMEM = {
|
|||
MSG_FILAMENT_LOADING_T3_DE
|
||||
};
|
||||
|
||||
const char MSG_FILE_INCOMPLETE_EN[] PROGMEM = "File incomplete. Continue anyway?";
|
||||
const char * const MSG_FILE_INCOMPLETE_LANG_TABLE[1] PROGMEM = {
|
||||
MSG_FILE_INCOMPLETE_EN
|
||||
};
|
||||
|
||||
const char MSG_FILE_PRINTED_EN[] PROGMEM = "Done printing file";
|
||||
const char * const MSG_FILE_PRINTED_LANG_TABLE[1] PROGMEM = {
|
||||
MSG_FILE_PRINTED_EN
|
||||
|
|
|
|||
|
|
@ -218,6 +218,8 @@ extern const char* const MSG_FILAMENT_LOADING_T2_LANG_TABLE[LANG_NUM];
|
|||
#define MSG_FILAMENT_LOADING_T2 LANG_TABLE_SELECT(MSG_FILAMENT_LOADING_T2_LANG_TABLE)
|
||||
extern const char* const MSG_FILAMENT_LOADING_T3_LANG_TABLE[LANG_NUM];
|
||||
#define MSG_FILAMENT_LOADING_T3 LANG_TABLE_SELECT(MSG_FILAMENT_LOADING_T3_LANG_TABLE)
|
||||
extern const char* const MSG_FILE_INCOMPLETE_LANG_TABLE[1];
|
||||
#define MSG_FILE_INCOMPLETE LANG_TABLE_SELECT_EXPLICIT(MSG_FILE_INCOMPLETE_LANG_TABLE, 0)
|
||||
extern const char* const MSG_FILE_PRINTED_LANG_TABLE[1];
|
||||
#define MSG_FILE_PRINTED LANG_TABLE_SELECT_EXPLICIT(MSG_FILE_PRINTED_LANG_TABLE, 0)
|
||||
extern const char* const MSG_FILE_SAVED_LANG_TABLE[1];
|
||||
|
|
|
|||
|
|
@ -316,6 +316,7 @@
|
|||
#define(length=17, lines=1) MSG_SORT_ALPHA "Sort: [Alphabet]"
|
||||
#define(length=17, lines=1) MSG_SORT_NONE "Sort: [None]"
|
||||
#define(length=20, lines=1) MSG_SORTING "Sorting files"
|
||||
#define MSG_FILE_INCOMPLETE "File incomplete. Continue anyway?"
|
||||
#define(length=17, lines=1) MSG_WIZARD "Wizard"
|
||||
#define MSG_WIZARD_LANGUAGE "Please choose your language"
|
||||
#define MSG_WIZARD_WELCOME "Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?"
|
||||
|
|
@ -338,4 +339,4 @@
|
|||
#define MSG_WIZARD_PLA_FILAMENT "Is it PLA filament?"
|
||||
#define MSG_WIZARD_INSERT_CORRECT_FILAMENT "Please load PLA filament and then resume Wizard by rebooting the printer."
|
||||
#define MSG_PLA_FILAMENT_LOADED "Is PLA filament loaded?"
|
||||
#define MSG_PLEASE_LOAD_PLA "Please load PLA filament first."
|
||||
#define MSG_PLEASE_LOAD_PLA "Please load PLA filament first."
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ int lcd_commands_step=0;
|
|||
bool isPrintPaused = false;
|
||||
uint8_t farm_mode = 0;
|
||||
int farm_no = 0;
|
||||
int farm_timer = 30;
|
||||
int farm_timer = 8;
|
||||
int farm_status = 0;
|
||||
unsigned long allert_timer = millis();
|
||||
bool printer_connected = true;
|
||||
|
|
@ -408,15 +408,15 @@ static void lcd_status_screen()
|
|||
farm_timer--;
|
||||
if (farm_timer < 1)
|
||||
{
|
||||
farm_timer = 180;
|
||||
farm_timer = 10;
|
||||
prusa_statistics(0);
|
||||
}
|
||||
switch (farm_timer)
|
||||
{
|
||||
case 45:
|
||||
case 8:
|
||||
prusa_statistics(21);
|
||||
break;
|
||||
case 10:
|
||||
case 5:
|
||||
if (IS_SD_PRINTING)
|
||||
{
|
||||
prusa_statistics(20);
|
||||
|
|
@ -2493,7 +2493,7 @@ void prusa_statistics(int _message, uint8_t _fil_nr) {
|
|||
prusa_stat_printerstatus(status_number);
|
||||
prusa_stat_farm_number();
|
||||
SERIAL_ECHOLN("}");
|
||||
farm_timer = 5;
|
||||
farm_timer = 4;
|
||||
break;
|
||||
case 21: // temperatures
|
||||
SERIAL_ECHO("{");
|
||||
|
|
@ -2520,7 +2520,7 @@ void prusa_statistics(int _message, uint8_t _fil_nr) {
|
|||
SERIAL_ECHOLN("}");
|
||||
break;
|
||||
case 92: // Error - Min temp
|
||||
SERIAL_ECHOLN("{[ERR:3]");
|
||||
SERIAL_ECHO("{[ERR:3]");
|
||||
prusa_stat_farm_number();
|
||||
SERIAL_ECHOLN("}");
|
||||
break;
|
||||
|
|
@ -4175,8 +4175,8 @@ unsigned char lcd_choose_color() {
|
|||
//-----------------------------------------------------
|
||||
unsigned char items_no = 2;
|
||||
const char *item[items_no];
|
||||
item[0] = "Black";
|
||||
item[1] = "Orange";
|
||||
item[0] = "Orange";
|
||||
item[1] = "Black";
|
||||
//-----------------------------------------------------
|
||||
unsigned char active_rows;
|
||||
static int first = 0;
|
||||
|
|
@ -4198,10 +4198,9 @@ unsigned char lcd_choose_color() {
|
|||
|
||||
manage_heater();
|
||||
manage_inactivity(true);
|
||||
|
||||
if (abs((enc_dif - encoderDiff)) > 4) {
|
||||
|
||||
if ((abs(enc_dif - encoderDiff)) > 1) {
|
||||
proc_commands();
|
||||
if (abs((enc_dif - encoderDiff)) > 12) {
|
||||
|
||||
if (enc_dif > encoderDiff) {
|
||||
cursor_pos--;
|
||||
}
|
||||
|
|
@ -4209,7 +4208,7 @@ unsigned char lcd_choose_color() {
|
|||
if (enc_dif < encoderDiff) {
|
||||
cursor_pos++;
|
||||
}
|
||||
|
||||
|
||||
if (cursor_pos > active_rows) {
|
||||
cursor_pos = active_rows;
|
||||
if (first < items_no - active_rows) {
|
||||
|
|
@ -4235,7 +4234,6 @@ unsigned char lcd_choose_color() {
|
|||
lcd.print(">");
|
||||
enc_dif = encoderDiff;
|
||||
delay(100);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -4243,7 +4241,11 @@ unsigned char lcd_choose_color() {
|
|||
while (lcd_clicked());
|
||||
delay(10);
|
||||
while (lcd_clicked());
|
||||
return(cursor_pos + first - 1);
|
||||
switch(cursor_pos + first - 1) {
|
||||
case 0: return 1; break;
|
||||
case 1: return 0; break;
|
||||
default: return 99; break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4258,7 +4260,7 @@ void lcd_confirm_print()
|
|||
int _ret = 0;
|
||||
int _t = 0;
|
||||
|
||||
|
||||
enc_dif = encoderDiff;
|
||||
lcd_implementation_clear();
|
||||
|
||||
lcd.setCursor(0, 0);
|
||||
|
|
@ -4266,8 +4268,7 @@ void lcd_confirm_print()
|
|||
|
||||
do
|
||||
{
|
||||
|
||||
if (abs((enc_dif - encoderDiff)) > 2) {
|
||||
if (abs(enc_dif - encoderDiff) > 12) {
|
||||
if (enc_dif > encoderDiff) {
|
||||
cursor_pos--;
|
||||
}
|
||||
|
|
@ -4275,6 +4276,7 @@ void lcd_confirm_print()
|
|||
if (enc_dif < encoderDiff) {
|
||||
cursor_pos++;
|
||||
}
|
||||
enc_dif = encoderDiff;
|
||||
}
|
||||
|
||||
if (cursor_pos > 2) { cursor_pos = 2; }
|
||||
|
|
@ -4319,9 +4321,10 @@ void lcd_confirm_print()
|
|||
NcTime = millis();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
manage_heater();
|
||||
manage_inactivity();
|
||||
proc_commands();
|
||||
|
||||
} while (_ret == 0);
|
||||
|
||||
|
|
@ -5504,16 +5507,43 @@ static void menu_action_setlang(unsigned char lang) {
|
|||
static void menu_action_function(menuFunc_t data) {
|
||||
(*data)();
|
||||
}
|
||||
|
||||
static bool check_file(const char* filename) {
|
||||
bool result = false;
|
||||
uint32_t filesize;
|
||||
card.openFile(filename, true);
|
||||
filesize = card.getFileSize();
|
||||
if (filesize > END_FILE_SECTION) {
|
||||
card.setIndex(filesize - END_FILE_SECTION);
|
||||
}
|
||||
|
||||
while (!card.eof() && !result) {
|
||||
card.sdprinting = true;
|
||||
get_command();
|
||||
result = check_commands();
|
||||
}
|
||||
card.printingHasFinished();
|
||||
strncpy_P(lcd_status_message, WELCOME_MSG, LCD_WIDTH);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void menu_action_sdfile(const char* filename, char* longFilename)
|
||||
{
|
||||
{
|
||||
loading_flag = false;
|
||||
char cmd[30];
|
||||
char* c;
|
||||
bool result = true;
|
||||
sprintf_P(cmd, PSTR("M23 %s"), filename);
|
||||
for (c = &cmd[4]; *c; c++)
|
||||
*c = tolower(*c);
|
||||
enquecommand(cmd);
|
||||
enquecommand_P(PSTR("M24"));
|
||||
*c = tolower(*c);
|
||||
if (!check_file(filename)) {
|
||||
result = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILE_INCOMPLETE, false, false);
|
||||
lcd_update_enable(true);
|
||||
}
|
||||
if (result) {
|
||||
enquecommand(cmd);
|
||||
enquecommand_P(PSTR("M24"));
|
||||
}
|
||||
lcd_return_to_status();
|
||||
}
|
||||
static void menu_action_sddirectory(const char* filename, char* longFilename)
|
||||
|
|
|
|||
|
|
@ -403,4 +403,6 @@ THERMISTORS SETTINGS
|
|||
|
||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration
|
||||
|
||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
||||
|
||||
#endif //__CONFIGURATION_PRUSA_H
|
||||
|
|
|
|||
|
|
@ -403,4 +403,6 @@ THERMISTORS SETTINGS
|
|||
|
||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration
|
||||
|
||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
||||
|
||||
#endif //__CONFIGURATION_PRUSA_H
|
||||
|
|
|
|||
|
|
@ -400,4 +400,6 @@ THERMISTORS SETTINGS
|
|||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
||||
#endif
|
||||
|
||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
||||
|
||||
#endif //__CONFIGURATION_PRUSA_H
|
||||
|
|
|
|||
|
|
@ -402,4 +402,6 @@ THERMISTORS SETTINGS
|
|||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
||||
#endif
|
||||
|
||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
||||
|
||||
#endif //__CONFIGURATION_PRUSA_H
|
||||
|
|
|
|||
|
|
@ -400,4 +400,6 @@ THERMISTORS SETTINGS
|
|||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
||||
#endif
|
||||
|
||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
||||
|
||||
#endif //__CONFIGURATION_PRUSA_H
|
||||
|
|
|
|||
|
|
@ -402,4 +402,6 @@ THERMISTORS SETTINGS
|
|||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
||||
#endif
|
||||
|
||||
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
||||
|
||||
#endif //__CONFIGURATION_PRUSA_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue