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 wait_for_heater(long codenum);
|
||||||
void serialecho_temperatures();
|
void serialecho_temperatures();
|
||||||
void proc_commands();
|
void proc_commands();
|
||||||
|
bool check_commands();
|
||||||
|
|
||||||
#ifdef HOST_KEEPALIVE_FEATURE
|
#ifdef HOST_KEEPALIVE_FEATURE
|
||||||
|
|
||||||
|
|
@ -386,3 +387,4 @@ void gcode_M701();
|
||||||
|
|
||||||
|
|
||||||
#endif //ifndef marlin.h
|
#endif //ifndef marlin.h
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1947,6 +1947,19 @@ static float probe_pt(float x, float y, float z_before) {
|
||||||
}
|
}
|
||||||
#endif // LIN_ADVANCE
|
#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) {
|
void homeaxis(int axis) {
|
||||||
#define HOMEAXIS_DO(LETTER) \
|
#define HOMEAXIS_DO(LETTER) \
|
||||||
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
|
((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
|
* \return The value one, true, is returned for success and
|
||||||
* the value zero, false, is returned for failure.
|
* the value zero, false, is returned for failure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
bool SdBaseFile::getFilename(char* name) {
|
bool SdBaseFile::getFilename(char* name) {
|
||||||
if (!isOpen()) return false;
|
if (!isOpen()) return false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
|
||||||
} // while readDir
|
} // while readDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CardReader::ls()
|
void CardReader::ls()
|
||||||
{
|
{
|
||||||
lsAction=LS_SerialPrint;
|
lsAction=LS_SerialPrint;
|
||||||
|
|
@ -500,6 +501,11 @@ void CardReader::removeFile(char* name)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t CardReader::getFileSize()
|
||||||
|
{
|
||||||
|
return filesize;
|
||||||
|
}
|
||||||
|
|
||||||
void CardReader::getStatus()
|
void CardReader::getStatus()
|
||||||
{
|
{
|
||||||
if(sdprinting){
|
if(sdprinting){
|
||||||
|
|
@ -963,8 +969,8 @@ void CardReader::printingHasFinished()
|
||||||
sdprinting = false;
|
sdprinting = false;
|
||||||
if(SD_FINISHED_STEPPERRELEASE)
|
if(SD_FINISHED_STEPPERRELEASE)
|
||||||
{
|
{
|
||||||
//finishAndDisableSteppers();
|
finishAndDisableSteppers();
|
||||||
enquecommand_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
//enquecommand_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
||||||
}
|
}
|
||||||
autotempShutdown();
|
autotempShutdown();
|
||||||
#ifdef SDCARD_SORT_ALPHA
|
#ifdef SDCARD_SORT_ALPHA
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ public:
|
||||||
void release();
|
void release();
|
||||||
void startFileprint();
|
void startFileprint();
|
||||||
void pauseSDPrint();
|
void pauseSDPrint();
|
||||||
|
uint32_t getFileSize();
|
||||||
void getStatus();
|
void getStatus();
|
||||||
void printingHasFinished();
|
void printingHasFinished();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1092,6 +1092,11 @@ const char * const MSG_FILAMENT_LOADING_T3_LANG_TABLE[LANG_NUM] PROGMEM = {
|
||||||
MSG_FILAMENT_LOADING_T3_DE
|
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 MSG_FILE_PRINTED_EN[] PROGMEM = "Done printing file";
|
||||||
const char * const MSG_FILE_PRINTED_LANG_TABLE[1] PROGMEM = {
|
const char * const MSG_FILE_PRINTED_LANG_TABLE[1] PROGMEM = {
|
||||||
MSG_FILE_PRINTED_EN
|
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)
|
#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];
|
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)
|
#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];
|
extern const char* const MSG_FILE_PRINTED_LANG_TABLE[1];
|
||||||
#define MSG_FILE_PRINTED LANG_TABLE_SELECT_EXPLICIT(MSG_FILE_PRINTED_LANG_TABLE, 0)
|
#define MSG_FILE_PRINTED LANG_TABLE_SELECT_EXPLICIT(MSG_FILE_PRINTED_LANG_TABLE, 0)
|
||||||
extern const char* const MSG_FILE_SAVED_LANG_TABLE[1];
|
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_ALPHA "Sort: [Alphabet]"
|
||||||
#define(length=17, lines=1) MSG_SORT_NONE "Sort: [None]"
|
#define(length=17, lines=1) MSG_SORT_NONE "Sort: [None]"
|
||||||
#define(length=20, lines=1) MSG_SORTING "Sorting files"
|
#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(length=17, lines=1) MSG_WIZARD "Wizard"
|
||||||
#define MSG_WIZARD_LANGUAGE "Please choose your language"
|
#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?"
|
#define MSG_WIZARD_WELCOME "Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?"
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ int lcd_commands_step=0;
|
||||||
bool isPrintPaused = false;
|
bool isPrintPaused = false;
|
||||||
uint8_t farm_mode = 0;
|
uint8_t farm_mode = 0;
|
||||||
int farm_no = 0;
|
int farm_no = 0;
|
||||||
int farm_timer = 30;
|
int farm_timer = 8;
|
||||||
int farm_status = 0;
|
int farm_status = 0;
|
||||||
unsigned long allert_timer = millis();
|
unsigned long allert_timer = millis();
|
||||||
bool printer_connected = true;
|
bool printer_connected = true;
|
||||||
|
|
@ -408,15 +408,15 @@ static void lcd_status_screen()
|
||||||
farm_timer--;
|
farm_timer--;
|
||||||
if (farm_timer < 1)
|
if (farm_timer < 1)
|
||||||
{
|
{
|
||||||
farm_timer = 180;
|
farm_timer = 10;
|
||||||
prusa_statistics(0);
|
prusa_statistics(0);
|
||||||
}
|
}
|
||||||
switch (farm_timer)
|
switch (farm_timer)
|
||||||
{
|
{
|
||||||
case 45:
|
case 8:
|
||||||
prusa_statistics(21);
|
prusa_statistics(21);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 5:
|
||||||
if (IS_SD_PRINTING)
|
if (IS_SD_PRINTING)
|
||||||
{
|
{
|
||||||
prusa_statistics(20);
|
prusa_statistics(20);
|
||||||
|
|
@ -2493,7 +2493,7 @@ void prusa_statistics(int _message, uint8_t _fil_nr) {
|
||||||
prusa_stat_printerstatus(status_number);
|
prusa_stat_printerstatus(status_number);
|
||||||
prusa_stat_farm_number();
|
prusa_stat_farm_number();
|
||||||
SERIAL_ECHOLN("}");
|
SERIAL_ECHOLN("}");
|
||||||
farm_timer = 5;
|
farm_timer = 4;
|
||||||
break;
|
break;
|
||||||
case 21: // temperatures
|
case 21: // temperatures
|
||||||
SERIAL_ECHO("{");
|
SERIAL_ECHO("{");
|
||||||
|
|
@ -2520,7 +2520,7 @@ void prusa_statistics(int _message, uint8_t _fil_nr) {
|
||||||
SERIAL_ECHOLN("}");
|
SERIAL_ECHOLN("}");
|
||||||
break;
|
break;
|
||||||
case 92: // Error - Min temp
|
case 92: // Error - Min temp
|
||||||
SERIAL_ECHOLN("{[ERR:3]");
|
SERIAL_ECHO("{[ERR:3]");
|
||||||
prusa_stat_farm_number();
|
prusa_stat_farm_number();
|
||||||
SERIAL_ECHOLN("}");
|
SERIAL_ECHOLN("}");
|
||||||
break;
|
break;
|
||||||
|
|
@ -4175,8 +4175,8 @@ unsigned char lcd_choose_color() {
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
unsigned char items_no = 2;
|
unsigned char items_no = 2;
|
||||||
const char *item[items_no];
|
const char *item[items_no];
|
||||||
item[0] = "Black";
|
item[0] = "Orange";
|
||||||
item[1] = "Orange";
|
item[1] = "Black";
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
unsigned char active_rows;
|
unsigned char active_rows;
|
||||||
static int first = 0;
|
static int first = 0;
|
||||||
|
|
@ -4198,10 +4198,9 @@ unsigned char lcd_choose_color() {
|
||||||
|
|
||||||
manage_heater();
|
manage_heater();
|
||||||
manage_inactivity(true);
|
manage_inactivity(true);
|
||||||
|
proc_commands();
|
||||||
|
if (abs((enc_dif - encoderDiff)) > 12) {
|
||||||
|
|
||||||
if (abs((enc_dif - encoderDiff)) > 4) {
|
|
||||||
|
|
||||||
if ((abs(enc_dif - encoderDiff)) > 1) {
|
|
||||||
if (enc_dif > encoderDiff) {
|
if (enc_dif > encoderDiff) {
|
||||||
cursor_pos--;
|
cursor_pos--;
|
||||||
}
|
}
|
||||||
|
|
@ -4235,7 +4234,6 @@ unsigned char lcd_choose_color() {
|
||||||
lcd.print(">");
|
lcd.print(">");
|
||||||
enc_dif = encoderDiff;
|
enc_dif = encoderDiff;
|
||||||
delay(100);
|
delay(100);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4243,7 +4241,11 @@ unsigned char lcd_choose_color() {
|
||||||
while (lcd_clicked());
|
while (lcd_clicked());
|
||||||
delay(10);
|
delay(10);
|
||||||
while (lcd_clicked());
|
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 _ret = 0;
|
||||||
int _t = 0;
|
int _t = 0;
|
||||||
|
|
||||||
|
enc_dif = encoderDiff;
|
||||||
lcd_implementation_clear();
|
lcd_implementation_clear();
|
||||||
|
|
||||||
lcd.setCursor(0, 0);
|
lcd.setCursor(0, 0);
|
||||||
|
|
@ -4266,8 +4268,7 @@ void lcd_confirm_print()
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
if (abs(enc_dif - encoderDiff) > 12) {
|
||||||
if (abs((enc_dif - encoderDiff)) > 2) {
|
|
||||||
if (enc_dif > encoderDiff) {
|
if (enc_dif > encoderDiff) {
|
||||||
cursor_pos--;
|
cursor_pos--;
|
||||||
}
|
}
|
||||||
|
|
@ -4275,6 +4276,7 @@ void lcd_confirm_print()
|
||||||
if (enc_dif < encoderDiff) {
|
if (enc_dif < encoderDiff) {
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
}
|
}
|
||||||
|
enc_dif = encoderDiff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor_pos > 2) { cursor_pos = 2; }
|
if (cursor_pos > 2) { cursor_pos = 2; }
|
||||||
|
|
@ -4322,6 +4324,7 @@ void lcd_confirm_print()
|
||||||
|
|
||||||
manage_heater();
|
manage_heater();
|
||||||
manage_inactivity();
|
manage_inactivity();
|
||||||
|
proc_commands();
|
||||||
|
|
||||||
} while (_ret == 0);
|
} while (_ret == 0);
|
||||||
|
|
||||||
|
|
@ -5504,16 +5507,43 @@ static void menu_action_setlang(unsigned char lang) {
|
||||||
static void menu_action_function(menuFunc_t data) {
|
static void menu_action_function(menuFunc_t data) {
|
||||||
(*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)
|
static void menu_action_sdfile(const char* filename, char* longFilename)
|
||||||
{
|
{
|
||||||
loading_flag = false;
|
loading_flag = false;
|
||||||
char cmd[30];
|
char cmd[30];
|
||||||
char* c;
|
char* c;
|
||||||
|
bool result = true;
|
||||||
sprintf_P(cmd, PSTR("M23 %s"), filename);
|
sprintf_P(cmd, PSTR("M23 %s"), filename);
|
||||||
for (c = &cmd[4]; *c; c++)
|
for (c = &cmd[4]; *c; c++)
|
||||||
*c = tolower(*c);
|
*c = tolower(*c);
|
||||||
enquecommand(cmd);
|
if (!check_file(filename)) {
|
||||||
enquecommand_P(PSTR("M24"));
|
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();
|
lcd_return_to_status();
|
||||||
}
|
}
|
||||||
static void menu_action_sddirectory(const char* filename, char* longFilename)
|
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 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
|
#endif //__CONFIGURATION_PRUSA_H
|
||||||
|
|
|
||||||
|
|
@ -403,4 +403,6 @@ THERMISTORS SETTINGS
|
||||||
|
|
||||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration
|
#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
|
#endif //__CONFIGURATION_PRUSA_H
|
||||||
|
|
|
||||||
|
|
@ -400,4 +400,6 @@ THERMISTORS SETTINGS
|
||||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
||||||
|
|
||||||
#endif //__CONFIGURATION_PRUSA_H
|
#endif //__CONFIGURATION_PRUSA_H
|
||||||
|
|
|
||||||
|
|
@ -402,4 +402,6 @@ THERMISTORS SETTINGS
|
||||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
||||||
|
|
||||||
#endif //__CONFIGURATION_PRUSA_H
|
#endif //__CONFIGURATION_PRUSA_H
|
||||||
|
|
|
||||||
|
|
@ -400,4 +400,6 @@ THERMISTORS SETTINGS
|
||||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
||||||
|
|
||||||
#endif //__CONFIGURATION_PRUSA_H
|
#endif //__CONFIGURATION_PRUSA_H
|
||||||
|
|
|
||||||
|
|
@ -402,4 +402,6 @@ THERMISTORS SETTINGS
|
||||||
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
|
||||||
|
|
||||||
#endif //__CONFIGURATION_PRUSA_H
|
#endif //__CONFIGURATION_PRUSA_H
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue