diff --git a/Marlin/src/module/mks_wifi/mks_wifi_sd.cpp b/Marlin/src/module/mks_wifi/mks_wifi_sd.cpp index ac8c352cfc..808016a373 100644 --- a/Marlin/src/module/mks_wifi/mks_wifi_sd.cpp +++ b/Marlin/src/module/mks_wifi/mks_wifi_sd.cpp @@ -3,6 +3,7 @@ #include "../../lcd/ultralcd.h" #include "../../libs/fatfs/ff.h" #include "../../libs/buzzer.h" +#include "../temperature.h" FRESULT result; FATFS FATFS_Obj; @@ -73,11 +74,16 @@ void mks_wifi_start_file_upload(ESP_PROTOC_FRAME *packet){ volatile uint32_t dma_timeout; uint16_t data_size; FRESULT res; - - //Отключить все нагреватели - OUT_WRITE(HEATER_0_PIN, LOW); - OUT_WRITE(HEATER_1_PIN, LOW); - OUT_WRITE(HEATER_BED_PIN, LOW); + int16_t save_bed,save_e0; + + save_bed=thermalManager.degTargetBed(); + save_e0=thermalManager.degTargetHotend(0); + + DEBUG("Saved target temp E0 %d Bed %d",save_e0,save_bed); + + thermalManager.setTargetBed(0); + thermalManager.setTargetHotend(0,0); + OUT_WRITE(HEATER_1_PIN,HIGH); //Установить имя файла. Смещение на 3 байта, чтобы добавить путь к диску str[0]='0'; @@ -200,7 +206,7 @@ void mks_wifi_start_file_upload(ESP_PROTOC_FRAME *packet){ sprintf(str,"Upload %ld%%",file_inc_size*100/file_size); ui.set_status((const char *)str,true); ui.update(); - + memset((uint8_t *)file_buff,0,(ESP_FILE_BUFF_COUNT*ESP_PACKET_SIZE)); file_data_size=0; WRITE(MKS_WIFI_IO4, LOW); //Записано, сигнал ESP продолжать @@ -291,4 +297,7 @@ void mks_wifi_start_file_upload(ESP_PROTOC_FRAME *packet){ WRITE(MKS_WIFI_IO4, LOW); //Включить передачу от ESP DEBUG("Settings restored"); + thermalManager.setTargetBed(save_bed); + thermalManager.setTargetHotend(save_e0,0); + } diff --git a/Marlin/src/module/mks_wifi/small_cmsis.h b/Marlin/src/module/mks_wifi/small_cmsis.h index f86eb51c58..8a4d52bd0e 100644 --- a/Marlin/src/module/mks_wifi/small_cmsis.h +++ b/Marlin/src/module/mks_wifi/small_cmsis.h @@ -155,7 +155,9 @@ typedef struct #define DMA2_Channel4_BASE (AHBPERIPH_BASE + 0x00000444U) #define SDIO_BASE (PERIPH_BASE + 0x00018000U) #define I2C1_BASE (APB1PERIPH_BASE + 0x00005400U) +#define PORTA_BASE (APB2PERIPH_BASE + 0x00000800U) #define PORTB_BASE (APB2PERIPH_BASE + 0x00000C00U) +#define PORTC_BASE (APB2PERIPH_BASE + 0x00001000U) #define AFIOBASE (APB2PERIPH_BASE + 0x00000000U) #define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ #define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ @@ -169,7 +171,9 @@ typedef struct #define DMA2_Channel4 ((DMA_Channel_TypeDef *)DMA2_Channel4_BASE) #define DMA2 ((DMA_TypeDef *)DMA2_BASE) #define I2C1 ((I2C_TypeDef *)I2C1_BASE) +#define PORTA ((GPIO_TypeDef *)PORTA_BASE) #define PORTB ((GPIO_TypeDef *)PORTB_BASE) +#define PORTC ((GPIO_TypeDef *)PORTC_BASE) #define AFIO ((AFIO_TypeDef *)AFIOBASE) #define CoreDebug ((CoreDebug_Type *)CoreDebug_BASE) /*!< Core Debug configuration struct */ #define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */