Browse Source

Ответ на 991 и 997

pull/1/head
Sergey 4 years ago
parent
commit
63b525165e
  1. 8
      Marlin/src/gcode/gcode.cpp
  2. 4
      Marlin/src/gcode/temp/M105.cpp
  3. 40
      Marlin/src/module/mks_wifi/mks_wifi_gcodes.cpp
  4. 12
      Marlin/src/module/mks_wifi/mks_wifi_gcodes.h

8
Marlin/src/gcode/gcode.cpp

@ -36,6 +36,10 @@ GcodeSuite gcode;
#include "queue.h"
#include "../module/motion.h"
#if ENABLED(MKS_WIFI)
#include "../module/mks_wifi/mks_wifi_gcodes.h"
#endif
#if ENABLED(PRINTCOUNTER)
#include "../module/printcounter.h"
#endif
@ -852,8 +856,8 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#endif
#if ENABLED(MKS_WIFI)
case 991: M105(); return;
case 991: mks_m991(); return;
case 997: mks_m997(); return;
#endif
#if ENABLED(PLATFORM_M997_SUPPORT)

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

@ -31,8 +31,10 @@ void GcodeSuite::M105() {
const int8_t target_extruder = get_target_extruder_from_command();
if (target_extruder < 0) return;
#if DISABLED(MKS_WIFI)
SERIAL_ECHOPGM(STR_OK);
#if ENABLED(MKS_WIFI)
SERIAL_EOL();
#endif
#if HAS_TEMP_SENSOR

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

@ -0,0 +1,40 @@
#include "mks_wifi_gcodes.h"
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 int8_t target_extruder = GcodeSuite::get_target_extruder_from_command();
if (target_extruder < 0) return;
#if HAS_TEMP_SENSOR
thermalManager.print_heater_states(target_extruder
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
, parser.boolval('R')
#endif
);
SERIAL_EOL();
#else
SERIAL_ECHOLNPGM(" T:0"); // Some hosts send M105 to test the serial connection
#endif
}
void mks_m997(void){
if(CardReader::isPrinting()){
mks_wifi_out_add((uint8_t *)m997_printing,strlen(m997_printing));
}else if(CardReader::isPaused()){
mks_wifi_out_add((uint8_t *)m997_pause,strlen(m997_pause));
}else{
mks_wifi_out_add((uint8_t *)m997_idle,strlen(m997_idle));
}
}

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

@ -0,0 +1,12 @@
#ifndef MKS_WIFI_GCODES_H
#define MKS_WIFI_GCODES_H
#include "../../gcode/gcode.h"
#include "../temperature.h"
#include "../../sd/cardreader.h"
#include "mks_wifi.h"
void mks_m991(void);
void mks_m997(void);
#endif
Loading…
Cancel
Save