initial version
This commit is contained in:
parent
a9cbd91321
commit
61592f9bfa
|
|
@ -356,3 +356,7 @@ void temp_compensation_start();
|
|||
void wait_for_heater(long codenum);
|
||||
void serialecho_temperatures();
|
||||
void proc_commands();
|
||||
bool check_commands();
|
||||
bool search_end_command();
|
||||
void empty_buffer();
|
||||
void show_buffer();
|
||||
|
|
@ -1405,8 +1405,34 @@ void proc_commands() {
|
|||
}
|
||||
}
|
||||
|
||||
bool check_commands() {
|
||||
bool ret = false;
|
||||
|
||||
if (buflen)
|
||||
{
|
||||
//SERIAL_ECHOLNPGM("search_end ");
|
||||
ret = search_end_command();
|
||||
if (!cmdbuffer_front_already_processed)
|
||||
cmdqueue_pop_front();
|
||||
cmdbuffer_front_already_processed = false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void show_buffer() {
|
||||
SERIAL_ECHOPGM("bufindr:");
|
||||
MYSERIAL.println(bufindr);
|
||||
SERIAL_ECHOPGM("bufindw:");
|
||||
MYSERIAL.println(bufindw);
|
||||
}
|
||||
|
||||
void empty_buffer() {
|
||||
bufindr = bufindw;
|
||||
}
|
||||
|
||||
void get_command()
|
||||
{
|
||||
//show_buffer();
|
||||
// Test and reserve space for the new command string.
|
||||
if (!cmdqueue_could_enqueue_back(MAX_CMD_SIZE - 1))
|
||||
return;
|
||||
|
|
@ -2076,6 +2102,16 @@ void ramming() {
|
|||
}
|
||||
}
|
||||
*/
|
||||
|
||||
bool search_end_command()
|
||||
{
|
||||
//SERIAL_ECHOLNPGM("E");
|
||||
bool return_value = false;
|
||||
if (code_seen("M84")) return_value = true;
|
||||
return return_value;
|
||||
|
||||
}
|
||||
|
||||
void process_commands()
|
||||
{
|
||||
#ifdef FILAMENT_RUNOUT_SUPPORT
|
||||
|
|
|
|||
|
|
@ -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)
|
|||
|
||||
}
|
||||
|
||||
void CardReader::getFileSize()
|
||||
{
|
||||
public_fileSize = filesize;
|
||||
}
|
||||
|
||||
void CardReader::getStatus()
|
||||
{
|
||||
if(sdprinting){
|
||||
|
|
@ -964,7 +970,7 @@ void CardReader::printingHasFinished()
|
|||
if(SD_FINISHED_STEPPERRELEASE)
|
||||
{
|
||||
//finishAndDisableSteppers();
|
||||
enquecommand_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
||||
//enquecommand_P(PSTR(SD_FINISHED_RELEASECOMMAND));
|
||||
}
|
||||
autotempShutdown();
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public:
|
|||
void release();
|
||||
void startFileprint();
|
||||
void pauseSDPrint();
|
||||
void getFileSize();
|
||||
void getStatus();
|
||||
void printingHasFinished();
|
||||
|
||||
|
|
@ -69,9 +70,11 @@ public:
|
|||
bool cardOK ;
|
||||
char filename[13];
|
||||
uint16_t creationTime, creationDate;
|
||||
uint32_t public_fileSize;
|
||||
char longFilename[LONG_FILENAME_LENGTH];
|
||||
bool filenameIsDir;
|
||||
int lastnr; //last number of the autostart;
|
||||
uint32_t sdpos;
|
||||
private:
|
||||
SdFile root,*curDir,workDir,workDirParents[MAX_DIR_DEPTH];
|
||||
uint16_t workDirDepth;
|
||||
|
|
@ -133,7 +136,7 @@ private:
|
|||
uint32_t filesize;
|
||||
//int16_t n;
|
||||
unsigned long autostart_atmillis;
|
||||
uint32_t sdpos ;
|
||||
//uint32_t sdpos ;
|
||||
|
||||
bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
|
||||
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -315,4 +315,5 @@
|
|||
#define(length=17, lines=1) MSG_SORT_TIME "Sort: [Time]"
|
||||
#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(length=20, lines=1) MSG_SORTING "Sorting files"
|
||||
#define MSG_FILE_INCOMPLETE "File incomplete. Continue anyway?"
|
||||
|
|
@ -4964,17 +4964,61 @@ static void menu_action_setlang(unsigned char lang) {
|
|||
static void menu_action_function(menuFunc_t data) {
|
||||
(*data)();
|
||||
}
|
||||
|
||||
/*check_file() {
|
||||
|
||||
}*/
|
||||
|
||||
static bool check_file(const char* filename) {
|
||||
bool result = false;
|
||||
card.openFile(filename, true);
|
||||
card.getFileSize();
|
||||
//SERIAL_ECHOPGM("Filesize my:");
|
||||
//MYSERIAL.println(card.public_fileSize);
|
||||
card.setIndex((card.public_fileSize) - 10000);
|
||||
//SERIAL_ECHOPGM("Position:");
|
||||
//MYSERIAL.println(card.sdpos);
|
||||
|
||||
while (!card.eof() && !result) {
|
||||
//show_buffer();
|
||||
|
||||
// SERIAL_ECHOPGM("Position prior:");
|
||||
// MYSERIAL.println(card.sdpos);
|
||||
card.sdprinting = true;
|
||||
get_command();
|
||||
//result = search_end_command();
|
||||
result = check_commands();
|
||||
|
||||
|
||||
/* SERIAL_ECHOPGM("Position after:");
|
||||
MYSERIAL.println(card.sdpos);
|
||||
SERIAL_ECHOPGM("Command find:");
|
||||
MYSERIAL.println(int(result));*/
|
||||
}
|
||||
//empty_buffer();
|
||||
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"));
|
||||
lcd_return_to_status();
|
||||
*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) lcd_return_to_status();
|
||||
else {
|
||||
enquecommand(cmd);
|
||||
enquecommand_P(PSTR("M24"));
|
||||
lcd_return_to_status();
|
||||
}
|
||||
}
|
||||
static void menu_action_sddirectory(const char* filename, char* longFilename)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue