|
|
|
@ -178,14 +178,14 @@ void changeFlashMode(const bool dmaMode) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool longName2DosName(const char *longName, uint8_t *dosName) {
|
|
|
|
|
static bool longName2DosName(const char *longName, char *dosName) {
|
|
|
|
|
uint8_t i;
|
|
|
|
|
for (i = FILENAME_LENGTH; i--;) dosName[i] = '\0';
|
|
|
|
|
while (*longName) {
|
|
|
|
|
uint8_t c = *longName++;
|
|
|
|
|
if (c == '.') { // For a dot...
|
|
|
|
|
if (i == 0) return false;
|
|
|
|
|
strcat_P((char *)dosName, PSTR(".GCO"));
|
|
|
|
|
strcat_P(dosName, PSTR(".GCO"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -196,7 +196,7 @@ static bool longName2DosName(const char *longName, uint8_t *dosName) {
|
|
|
|
|
dosName[i++] = c + (WITHIN(c, 'a', 'z') ? 'A' - 'a' : 0); // Uppercase required for 8.3 name
|
|
|
|
|
}
|
|
|
|
|
if (i >= 5) {
|
|
|
|
|
strcat_P((char *)dosName, PSTR("~1.GCO"));
|
|
|
|
|
strcat_P(dosName, PSTR("~1.GCO"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -478,7 +478,7 @@ char wait_ip_back_flag = 0;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
int write_index;
|
|
|
|
|
char saveFileName[30];
|
|
|
|
|
uint8_t saveFileName[30];
|
|
|
|
|
uint8_t fileTransfer;
|
|
|
|
|
uint32_t fileLen;
|
|
|
|
|
uint32_t tick_begin;
|
|
|
|
@ -593,7 +593,7 @@ uint8_t Explore_Disk(char *path , uint8_t recu_level) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void wifi_gcode_exec(uint8_t *cmd_line) {
|
|
|
|
|
char tempBuf[100] = { 0 };
|
|
|
|
|
int8_t tempBuf[100] = { 0 };
|
|
|
|
|
uint8_t *tmpStr = 0;
|
|
|
|
|
int cmd_value;
|
|
|
|
|
volatile int print_rate;
|
|
|
|
@ -631,7 +631,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
|
|
|
|
while (tmpStr[index] == ' ') index++;
|
|
|
|
|
|
|
|
|
|
if (gCfgItems.wifi_type == ESP_WIFI) {
|
|
|
|
|
char *path = tempBuf;
|
|
|
|
|
char *path = (char *)tempBuf;
|
|
|
|
|
|
|
|
|
|
if (strlen((char *)&tmpStr[index]) < 80) {
|
|
|
|
|
send_to_wifi((uint8_t *)"Begin file list\r\n", strlen("Begin file list\r\n"));
|
|
|
|
@ -680,7 +680,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
|
|
|
|
strcat_P((char *)list_file.file_name[sel_id], PSTR("/"));
|
|
|
|
|
|
|
|
|
|
if (file_writer.fileTransfer == 1) {
|
|
|
|
|
uint8_t dosName[FILENAME_LENGTH];
|
|
|
|
|
char dosName[FILENAME_LENGTH];
|
|
|
|
|
uint8_t fileName[sizeof(list_file.file_name[sel_id])];
|
|
|
|
|
fileName[0] = '\0';
|
|
|
|
|
if (has_path_selected == 1) {
|
|
|
|
@ -690,8 +690,8 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
|
|
|
|
else strcat((char *)fileName, (char *)&tmpStr[index]);
|
|
|
|
|
if (!longName2DosName((const char *)fileName, dosName))
|
|
|
|
|
strcpy_P(list_file.file_name[sel_id], PSTR("notValid"));
|
|
|
|
|
strcat((char *)list_file.file_name[sel_id], (char *)dosName);
|
|
|
|
|
strcat((char *)list_file.long_name[sel_id], (char *)dosName);
|
|
|
|
|
strcat((char *)list_file.file_name[sel_id], dosName);
|
|
|
|
|
strcat((char *)list_file.long_name[sel_id], dosName);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
strcat((char *)list_file.file_name[sel_id], (char *)&tmpStr[index]);
|
|
|
|
@ -828,8 +828,8 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
|
|
|
|
if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)|| (uiCfg.print_state == REPRINTING)) {
|
|
|
|
|
print_rate = uiCfg.totalSend;
|
|
|
|
|
ZERO(tempBuf);
|
|
|
|
|
sprintf_P(tempBuf, PSTR("M27 %d\r\n"), print_rate);
|
|
|
|
|
send_to_wifi((uint8_t *)tempBuf, strlen(tempBuf));
|
|
|
|
|
sprintf_P((char *)tempBuf, PSTR("M27 %d\r\n"), print_rate);
|
|
|
|
|
send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -841,15 +841,15 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
|
|
|
|
while (tmpStr[index] == ' ') index++;
|
|
|
|
|
|
|
|
|
|
if (strstr_P((char *)&tmpStr[index], PSTR(".g")) || strstr_P((char *)&tmpStr[index], PSTR(".G"))) {
|
|
|
|
|
strcpy(file_writer.saveFileName, (char *)&tmpStr[index]);
|
|
|
|
|
strcpy((char *)file_writer.saveFileName, (char *)&tmpStr[index]);
|
|
|
|
|
|
|
|
|
|
if (gCfgItems.fileSysType == FILE_SYS_SD) {
|
|
|
|
|
ZERO(tempBuf);
|
|
|
|
|
sprintf_P(tempBuf, PSTR("%s"), file_writer.saveFileName);
|
|
|
|
|
sprintf_P((char *)tempBuf, PSTR("%s"), file_writer.saveFileName);
|
|
|
|
|
}
|
|
|
|
|
else if (gCfgItems.fileSysType == FILE_SYS_USB) {
|
|
|
|
|
ZERO(tempBuf);
|
|
|
|
|
sprintf_P(tempBuf, PSTR("%s"), file_writer.saveFileName);
|
|
|
|
|
sprintf_P((char *)tempBuf, PSTR("%s"), (char *)file_writer.saveFileName);
|
|
|
|
|
}
|
|
|
|
|
mount_file_sys(gCfgItems.fileSysType);
|
|
|
|
|
|
|
|
|
@ -858,11 +858,11 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
|
|
|
|
card.openFileWrite(cur_name);
|
|
|
|
|
if (card.isFileOpen()) {
|
|
|
|
|
ZERO(file_writer.saveFileName);
|
|
|
|
|
strcpy(file_writer.saveFileName, (char *)&tmpStr[index]);
|
|
|
|
|
strcpy((char *)file_writer.saveFileName, (char *)&tmpStr[index]);
|
|
|
|
|
ZERO(tempBuf);
|
|
|
|
|
sprintf_P(tempBuf, PSTR("Writing to file: %s\r\n"), file_writer.saveFileName);
|
|
|
|
|
sprintf_P((char *)tempBuf, PSTR("Writing to file: %s\r\n"), (char *)file_writer.saveFileName);
|
|
|
|
|
wifi_ret_ack();
|
|
|
|
|
send_to_wifi((uint8_t *)tempBuf, strlen(tempBuf));
|
|
|
|
|
send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf));
|
|
|
|
|
wifi_link_state = WIFI_WAIT_TRANS_START;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -882,7 +882,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
|
|
|
|
|
|
|
|
|
SEND_OK_TO_WIFI;
|
|
|
|
|
|
|
|
|
|
char *outBuf = tempBuf;
|
|
|
|
|
char *outBuf = (char *)tempBuf;
|
|
|
|
|
char tbuf[34];
|
|
|
|
|
|
|
|
|
|
sprintf_P(tbuf, PSTR("%d /%d"), (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
|
|
|
|
@ -917,7 +917,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
|
|
|
|
strcat_P(outBuf, PSTR(" @:0 B@:0\r\n"));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sprintf_P(tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"),
|
|
|
|
|
sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"),
|
|
|
|
|
thermalManager.degHotend(0), thermalManager.degTargetHotend(0),
|
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
|
thermalManager.degBed(), thermalManager.degTargetBed(),
|
|
|
|
@ -933,16 +933,16 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
send_to_wifi((uint8_t *)tempBuf, strlen(tempBuf));
|
|
|
|
|
send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf));
|
|
|
|
|
queue.enqueue_one_P(PSTR("M105"));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 992:
|
|
|
|
|
if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)) {
|
|
|
|
|
ZERO(tempBuf);
|
|
|
|
|
sprintf_P(tempBuf, PSTR("M992 %d%d:%d%d:%d%d\r\n"), print_time.hours/10, print_time.hours%10, print_time.minutes/10, print_time.minutes%10, print_time.seconds/10, print_time.seconds%10);
|
|
|
|
|
sprintf_P((char *)tempBuf, PSTR("M992 %d%d:%d%d:%d%d\r\n"), print_time.hours/10, print_time.hours%10, print_time.minutes/10, print_time.minutes%10, print_time.seconds/10, print_time.seconds%10);
|
|
|
|
|
wifi_ret_ack();
|
|
|
|
|
send_to_wifi((uint8_t *)tempBuf, strlen(tempBuf));
|
|
|
|
|
send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -950,9 +950,9 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
|
|
|
|
if ((uiCfg.print_state == WORKING) || (uiCfg.print_state == PAUSED)) {
|
|
|
|
|
ZERO(tempBuf);
|
|
|
|
|
if (strlen((char *)list_file.file_name[sel_id]) > (100 - 1)) return;
|
|
|
|
|
sprintf_P(tempBuf, PSTR("M994 %s;%d\n"), list_file.file_name[sel_id], (int)gCfgItems.curFilesize);
|
|
|
|
|
sprintf_P((char *)tempBuf, PSTR("M994 %s;%d\n"), list_file.file_name[sel_id], (int)gCfgItems.curFilesize);
|
|
|
|
|
wifi_ret_ack();
|
|
|
|
|
send_to_wifi((uint8_t *)tempBuf, strlen(tempBuf));
|
|
|
|
|
send_to_wifi((uint8_t *)tempBuf, strlen((char *)tempBuf));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -1279,7 +1279,7 @@ static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) {
|
|
|
|
|
|
|
|
|
|
ZERO(public_buf);
|
|
|
|
|
|
|
|
|
|
if (strlen(file_writer.saveFileName) > sizeof(saveFilePath))
|
|
|
|
|
if (strlen((const char *)file_writer.saveFileName) > sizeof(saveFilePath))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ZERO(saveFilePath);
|
|
|
|
@ -1305,7 +1305,7 @@ static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) {
|
|
|
|
|
|
|
|
|
|
char dosName[FILENAME_LENGTH];
|
|
|
|
|
|
|
|
|
|
if (!longName2DosName(file_writer.saveFileName, dosName)) {
|
|
|
|
|
if (!longName2DosName((const char *)file_writer.saveFileName, dosName)) {
|
|
|
|
|
clear_cur_ui();
|
|
|
|
|
upload_result = 2;
|
|
|
|
|
wifiTransError.flag = 1;
|
|
|
|
@ -1313,7 +1313,7 @@ static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) {
|
|
|
|
|
lv_draw_dialog(DIALOG_TYPE_UPLOAD_FILE);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
strcpy(saveFilePath, dosName);
|
|
|
|
|
strcpy((char *)saveFilePath, dosName);
|
|
|
|
|
|
|
|
|
|
card.cdroot();
|
|
|
|
|
upload_file.close();
|
|
|
|
|