Browse Source

Вывод списка файлов в куре

pull/1/head
Sergey 5 years ago
parent
commit
97e8aa4517
  1. 2
      Marlin/Configuration.h
  2. 2
      Marlin/Configuration_adv.h
  3. 38
      Marlin/src/gcode/gcode.cpp
  4. 5
      Marlin/src/gcode/temp/M105.cpp
  5. 4
      Marlin/src/module/mks_wifi/mks_wifi.cpp
  6. 63
      Marlin/src/module/mks_wifi/mks_wifi_gcodes.cpp
  7. 3
      Marlin/src/module/mks_wifi/mks_wifi_gcodes.h
  8. 6
      Marlin/src/module/temperature.cpp
  9. 15
      Marlin/src/sd/cardreader.cpp

2
Marlin/Configuration.h

@ -1065,7 +1065,7 @@
// @section extruder
// For direct drive extruder v9 set to true, for geared extruder set to false.
#define INVERT_E0_DIR true
#define INVERT_E0_DIR false //for std driver
#define INVERT_E1_DIR false
#define INVERT_E2_DIR false
#define INVERT_E3_DIR false

2
Marlin/Configuration_adv.h

@ -2750,7 +2750,7 @@
/**
* Include capabilities in M115 output
*/
//#define EXTENDED_CAPABILITIES_REPORT
#define EXTENDED_CAPABILITIES_REPORT
/**
* Expected Printer Check

38
Marlin/src/gcode/gcode.cpp

@ -408,7 +408,18 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 24: M24(); break; // M24: Start SD print
case 25: M25(); break; // M25: Pause SD print
case 26: M26(); break; // M26: Set SD index
case 27: M27(); break; // M27: Get SD status
case 27:
#if ENABLED(MKS_WIFI)
if(!serial_port_index){
M27();
}else{
mks_m27();
return;
}
#else
M27();
#endif
break; // M27: Get SD status
case 28: M28(); break; // M28: Start SD write
case 29: M29(); break; // M29: Stop SD write
case 30: M30(); break; // M30 <filename> Delete File
@ -457,7 +468,17 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 109: M109(); break; // M109: Wait for hotend temperature to reach target
#endif
case 105: M105(); return; // M105: Report Temperatures (and say "ok")
case 105:
#if ENABLED(MKS_WIFI)
if(serial_port_index){
mks_m105();
}else{
M105();
}
#else
M105();
#endif
return; // M105: Report Temperatures (and say "ok")
#if FAN_COUNT > 0
case 106: M106(); break; // M106: Fan On
@ -529,7 +550,18 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 85: M85(); break; // M85: Set inactivity stepper shutdown timeout
case 92: M92(); break; // M92: Set the steps-per-unit for one or more axes
case 114: M114(); break; // M114: Report current position
case 115: M115(); break; // M115: Report capabilities
case 115:
#if ENABLED(MKS_WIFI)
if(serial_port_index){
mks_m115();
return;
}else{
M115();
}
#else
M115();
#endif
break; // M115: Report capabilities
case 117: M117(); break; // M117: Set LCD message text, if possible
case 118: M118(); break; // M118: Display a message in the host console
case 119: M119(); break; // M119: Report endstop states

5
Marlin/src/gcode/temp/M105.cpp

@ -33,11 +33,6 @@ void GcodeSuite::M105() {
SERIAL_ECHOPGM(STR_OK);
#if ENABLED(MKS_WIFI)
if ( serial_port_index){
SERIAL_EOL();
};
#endif
#if HAS_TEMP_SENSOR

4
Marlin/src/module/mks_wifi/mks_wifi.cpp

@ -1,5 +1,7 @@
#include "mks_wifi.h"
uint8_t mks_in_buffer[ESP_PACKET_DATA_MAX_SIZE];
uint8_t mks_out_buffer[ESP_PACKET_DATA_MAX_SIZE];
uint32_t line_index=0;
@ -77,6 +79,7 @@ void mks_wifi_out_add(uint8_t *data, uint32_t size){
esp_frame.data=mks_out_buffer;
packet_size=mks_wifi_build_packet(esp_packet,&esp_frame);
//DEBUG("Send %s",mks_out_buffer);
//выпихнуть в uart
mks_wifi_send(esp_packet, packet_size);
//очистить буфер
@ -254,6 +257,7 @@ uint16_t mks_wifi_build_packet(uint8_t *packet, ESP_PROTOC_FRAME *esp_frame){
void mks_wifi_send(uint8_t *packet, uint16_t size){
safe_delay(10);
for( uint32_t i=0; i < (uint32_t)(size+1); i++){
while(MYSERIAL1.availableForWrite()==0){
safe_delay(10);

63
Marlin/src/module/mks_wifi/mks_wifi_gcodes.cpp

@ -1,33 +1,50 @@
#include "mks_wifi_gcodes.h"
const uint8_t pak[5]={0xA5,0x07,0x00,0x00,0xFC};
const char m997_idle[]="M997 IDLE\n";
const char m997_printing[]="M997 PRINTING\n";
const char m997_pause[]="M997 PAUSE\n";
void mks_m991(void){
const char m115_firmware[]="FIRMWARE_NAME:TFT24\n";
void mks_m991(void){
char tempBuf[100];
const int8_t target_extruder = GcodeSuite::get_target_extruder_from_command();
if (target_extruder < 0) return;
#if HAS_TEMP_SENSOR
memset(tempBuf,0,100);
sprintf((char *)tempBuf,"T:%d /%d B:%d /%d T0:%d /%d T1:0 /0 @:0 B@:0\n",
(int)Temperature::degHotend(target_extruder),Temperature::degTargetHotend(target_extruder),
(int)Temperature::degBed(),Temperature::degTargetBed(),
(int)Temperature::degHotend(target_extruder),Temperature::degTargetHotend(target_extruder));
mks_wifi_out_add((uint8_t *)tempBuf,strlen(tempBuf));
}
thermalManager.print_heater_states(target_extruder
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
, parser.boolval('R')
#endif
);
void mks_m105(void){
char tempBuf[100];
const int8_t target_extruder = GcodeSuite::get_target_extruder_from_command();
if (target_extruder < 0) return;
SERIAL_EOL();
memset(tempBuf,0,100);
#else
SERIAL_ECHOPGM(STR_OK);
SERIAL_EOL();
SERIAL_ECHOLNPGM(" T:0"); // Some hosts send M105 to test the serial connection
sprintf((char *)tempBuf,"T:%.1f /%.1f B:%.1f /%.1f T0:%.1f /%.1f T1:0.0 /0.0 @:0 B@:0\n",
Temperature::degHotend(target_extruder),(float)Temperature::degTargetHotend(target_extruder),
Temperature::degBed(),(float)Temperature::degTargetBed(),
Temperature::degHotend(target_extruder),(float)Temperature::degTargetHotend(target_extruder));
#endif
mks_wifi_out_add((uint8_t *)tempBuf,strlen(tempBuf));
}
void mks_m997(void){
static uint8_t call_cnt=0;
if(CardReader::isPrinting()){
mks_wifi_out_add((uint8_t *)m997_printing,strlen(m997_printing));
@ -37,4 +54,26 @@ void mks_m997(void){
mks_wifi_out_add((uint8_t *)m997_idle,strlen(m997_idle));
}
}
if(call_cnt == 0){
call_cnt=1;
mks_wifi_send((uint8_t *)pak, 4); //Внутри +1
}
}
void mks_m115(void){
SERIAL_ECHOPGM(STR_OK);
SERIAL_EOL();
mks_wifi_out_add((uint8_t *)m115_firmware,strlen(m115_firmware));
}
void mks_m27(void){
if (CardReader::isPrinting()) {
SERIAL_ECHOPGM(STR_SD_PRINTING_BYTE);
SERIAL_ECHO(0);
SERIAL_CHAR('/');
SERIAL_ECHOLN(100);
}
}

3
Marlin/src/module/mks_wifi/mks_wifi_gcodes.h

@ -8,5 +8,8 @@
void mks_m991(void);
void mks_m997(void);
void mks_m115(void);
void mks_m105(void);
void mks_m27(void);
#endif

6
Marlin/src/module/temperature.cpp

@ -3002,11 +3002,7 @@ void Temperature::tick() {
default: k = 'B'; break;
#endif
}
#if ENABLED(MKS_WIFI)
if (!serial_port_index){
SERIAL_CHAR(' ');
}
#endif
SERIAL_CHAR(' ');
SERIAL_CHAR(k);
#if HOTENDS > 1
if (e >= 0) SERIAL_CHAR('0' + e);

15
Marlin/src/sd/cardreader.cpp

@ -261,13 +261,16 @@ void CardReader::printListing(SdFile parent, const char * const prepend/*=nullpt
if (serial_port_index){
printLongPath(filename);
}else{
SERIAL_ECHO(filename);
SERIAL_ECHOLN(filename);
SERIAL_CHAR(' ');
SERIAL_ECHOLN(p.fileSize);
}
#else
SERIAL_ECHO(filename);
#endif
SERIAL_ECHO(filename);
SERIAL_CHAR(' ');
SERIAL_ECHOLN(p.fileSize);
#endif
}
}
}
@ -349,13 +352,7 @@ void CardReader::ls() {
} // while i<pathLen
#if ENABLED(MKS_WIFI)
if(!serial_port_index){
SERIAL_EOL();
};
#else
SERIAL_EOL();
#endif
}
#endif // LONG_FILENAME_HOST_SUPPORT

Loading…
Cancel
Save