Signal SD completion later (#21840)
This commit is contained in:
committed by
Scott Lahteine
parent
83309c1ac8
commit
c5c8ef436c
@ -91,8 +91,8 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) {
|
||||
cur_name = strrchr(list_file.file_name[sel_id], '/');
|
||||
|
||||
SdFile file, *curDir;
|
||||
card.endFilePrint();
|
||||
const char * const fname = card.diveToFile(true, curDir, cur_name);
|
||||
card.abortFilePrintNow();
|
||||
const char * const fname = card.diveToFile(false, curDir, cur_name);
|
||||
if (!fname) return;
|
||||
if (file.open(curDir, fname, O_READ)) {
|
||||
gCfgItems.curFilesize = file.fileSize();
|
||||
@ -108,7 +108,7 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) {
|
||||
planner.flow_percentage[1] = 100;
|
||||
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
|
||||
#endif
|
||||
card.startFileprint();
|
||||
card.startOrResumeFilePrinting();
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.prepare();
|
||||
#endif
|
||||
@ -124,8 +124,8 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) {
|
||||
lv_draw_ready_print();
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
uiCfg.print_state = IDLE;
|
||||
card.flag.abort_sd_printing = true;
|
||||
uiCfg.print_state = IDLE;
|
||||
card.abortFilePrintSoon();
|
||||
#endif
|
||||
}
|
||||
else if (DIALOG_IS(TYPE_FINISH_PRINT)) {
|
||||
|
@ -638,19 +638,18 @@ char *creat_title_text() {
|
||||
W25QXX.SPI_FLASH_BufferWrite(bmp_public_buf, BAK_VIEW_ADDR_TFT35 + row * 400, 400);
|
||||
#endif
|
||||
row++;
|
||||
card.abortFilePrintNow();
|
||||
if (row >= 200) {
|
||||
size = 809;
|
||||
row = 0;
|
||||
|
||||
gcode_preview_over = false;
|
||||
|
||||
card.closefile();
|
||||
char *cur_name = strrchr(list_file.file_name[sel_id], '/');
|
||||
|
||||
SdFile file;
|
||||
SdFile *curDir;
|
||||
card.endFilePrint();
|
||||
const char * const fname = card.diveToFile(true, curDir, cur_name);
|
||||
const char * const fname = card.diveToFile(false, curDir, cur_name);
|
||||
if (!fname) return;
|
||||
if (file.open(curDir, fname, O_READ)) {
|
||||
gCfgItems.curFilesize = file.fileSize();
|
||||
@ -667,13 +666,12 @@ char *creat_title_text() {
|
||||
planner.flow_percentage[1] = 100;
|
||||
planner.e_factor[1] = planner.flow_percentage[1] * 0.01;
|
||||
#endif
|
||||
card.startFileprint();
|
||||
card.startOrResumeFilePrinting();
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
|
||||
once_flag = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
card.closefile();
|
||||
#endif // SDSUPPORT
|
||||
}
|
||||
|
||||
|
@ -505,7 +505,7 @@ int write_to_file(char *buf, int len) {
|
||||
|
||||
if (res == -1) {
|
||||
upload_file.close();
|
||||
const char * const fname = card.diveToFile(true, upload_curDir, saveFilePath);
|
||||
const char * const fname = card.diveToFile(false, upload_curDir, saveFilePath);
|
||||
|
||||
if (upload_file.open(upload_curDir, fname, O_WRITE)) {
|
||||
upload_file.setpos(&pos);
|
||||
@ -732,12 +732,10 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
||||
if (!gcode_preview_over) {
|
||||
char *cur_name = strrchr(list_file.file_name[sel_id], '/');
|
||||
|
||||
card.endFilePrint();
|
||||
|
||||
SdFile file;
|
||||
SdFile *curDir;
|
||||
card.endFilePrint();
|
||||
const char * const fname = card.diveToFile(true, curDir, cur_name);
|
||||
card.abortFilePrintNow();
|
||||
const char * const fname = card.diveToFile(false, curDir, cur_name);
|
||||
if (!fname) return;
|
||||
if (file.open(curDir, fname, O_READ)) {
|
||||
gCfgItems.curFilesize = file.fileSize();
|
||||
@ -754,7 +752,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
||||
planner.flow_percentage[1] = 100;
|
||||
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
|
||||
#endif
|
||||
card.startFileprint();
|
||||
card.startOrResumeFilePrinting();
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
|
||||
once_flag = false;
|
||||
}
|
||||
@ -814,7 +812,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
||||
clear_cur_ui();
|
||||
#if ENABLED(SDSUPPORT)
|
||||
uiCfg.print_state = IDLE;
|
||||
card.flag.abort_sd_printing = true;
|
||||
card.abortFilePrintSoon();
|
||||
#endif
|
||||
|
||||
lv_draw_ready_print();
|
||||
@ -1317,7 +1315,7 @@ static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) {
|
||||
|
||||
card.cdroot();
|
||||
upload_file.close();
|
||||
const char * const fname = card.diveToFile(true, upload_curDir, saveFilePath);
|
||||
const char * const fname = card.diveToFile(false, upload_curDir, saveFilePath);
|
||||
|
||||
if (!upload_file.open(upload_curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
|
||||
clear_cur_ui();
|
||||
@ -1370,7 +1368,7 @@ static void file_fragment_msg_handle(uint8_t * msg, uint16_t msgLen) {
|
||||
int res = upload_file.write(public_buf, file_writer.write_index);
|
||||
if (res == -1) {
|
||||
upload_file.close();
|
||||
const char * const fname = card.diveToFile(true, upload_curDir, saveFilePath);
|
||||
const char * const fname = card.diveToFile(false, upload_curDir, saveFilePath);
|
||||
if (upload_file.open(upload_curDir, fname, O_WRITE)) {
|
||||
upload_file.setpos(&pos);
|
||||
res = upload_file.write(public_buf, file_writer.write_index);
|
||||
@ -1378,7 +1376,7 @@ static void file_fragment_msg_handle(uint8_t * msg, uint16_t msgLen) {
|
||||
}
|
||||
upload_file.close();
|
||||
SdFile file, *curDir;
|
||||
const char * const fname = card.diveToFile(true, curDir, saveFilePath);
|
||||
const char * const fname = card.diveToFile(false, curDir, saveFilePath);
|
||||
if (file.open(curDir, fname, O_RDWR)) {
|
||||
gCfgItems.curFilesize = file.fileSize();
|
||||
file.close();
|
||||
@ -1744,7 +1742,7 @@ void mks_wifi_firmware_update() {
|
||||
if (wifi_upload(0) >= 0) {
|
||||
card.removeFile((char *)ESP_FIRMWARE_FILE_RENAME);
|
||||
SdFile file, *curDir;
|
||||
const char * const fname = card.diveToFile(true, curDir, ESP_FIRMWARE_FILE);
|
||||
const char * const fname = card.diveToFile(false, curDir, ESP_FIRMWARE_FILE);
|
||||
if (file.open(curDir, fname, O_READ)) {
|
||||
file.rename(curDir, (char *)ESP_FIRMWARE_FILE_RENAME);
|
||||
file.close();
|
||||
|
@ -625,7 +625,7 @@ void upload_spin() {
|
||||
|
||||
// Try to upload the given file at the given address
|
||||
void SendUpdateFile(const char *file, uint32_t address) {
|
||||
const char * const fname = card.diveToFile(true, update_curDir, ESP_FIRMWARE_FILE);
|
||||
const char * const fname = card.diveToFile(false, update_curDir, ESP_FIRMWARE_FILE);
|
||||
if (!update_file.open(update_curDir, fname, O_READ)) return;
|
||||
|
||||
esp_upload.fileSize = update_file.fileSize();
|
||||
|
Reference in New Issue
Block a user