Fix serial output for MBL, M303

This commit is contained in:
Scott Lahteine 2016-08-10 18:49:25 -07:00
parent 58c8e6cef2
commit b63d70b186
4 changed files with 25 additions and 28 deletions

View File

@ -71,6 +71,7 @@
#define SERIAL_PROTOCOLLNPGM(x) do{ serialprintPGM(PSTR(x "\n")); }while(0)
#define SERIAL_PROTOCOLPAIR(name, value) SERIAL_ECHOPAIR(name, value)
#define SERIAL_PROTOCOLLNPAIR(name, value) do{ SERIAL_ECHOPAIR(name, value); SERIAL_EOL; }while(0)
extern const char errormagic[] PROGMEM;
extern const char echomagic[] PROGMEM;

View File

@ -3280,10 +3280,9 @@ inline void gcode_G28() {
case MeshReport:
if (mbl.has_mesh()) {
SERIAL_PROTOCOLPAIR("State: ", mbl.active() ? "On" : "Off");
SERIAL_PROTOCOLPAIR("\nNum X,Y: ", MESH_NUM_X_POINTS);
SERIAL_PROTOCOLCHAR(','); SERIAL_PROTOCOL(MESH_NUM_Y_POINTS);
SERIAL_PROTOCOLPAIR("\nZ search height: ", MESH_HOME_SEARCH_Z);
SERIAL_PROTOCOLPGM("\nZ offset: "); SERIAL_PROTOCOL_F(mbl.z_offset, 5);
SERIAL_PROTOCOLLNPGM("\nNum X,Y: " STRINGIFY(MESH_NUM_X_POINTS) "," STRINGIFY(MESH_NUM_Y_POINTS));
SERIAL_PROTOCOLLNPGM("Z search height: " STRINGIFY(MESH_HOME_SEARCH_Z));
SERIAL_PROTOCOLPGM("Z offset: "); SERIAL_PROTOCOL_F(mbl.z_offset, 5);
SERIAL_PROTOCOLLNPGM("\nMeasured points:");
for (py = 0; py < MESH_NUM_Y_POINTS; py++) {
for (px = 0; px < MESH_NUM_X_POINTS; px++) {

View File

@ -395,8 +395,7 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
if (file.open(curDir, fname, O_READ)) {
filesize = file.fileSize();
SERIAL_PROTOCOLPAIR(MSG_SD_FILE_OPENED, fname);
SERIAL_PROTOCOLPAIR(MSG_SD_SIZE, filesize);
SERIAL_EOL;
SERIAL_PROTOCOLLNPAIR(MSG_SD_SIZE, filesize);
sdpos = 0;
SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
@ -417,8 +416,7 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
}
else {
saving = true;
SERIAL_PROTOCOLPAIR(MSG_SD_WRITE_TO_FILE, name);
SERIAL_EOL;
SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, name);
lcd_setstatus(fname);
}
}
@ -449,6 +447,7 @@ void CardReader::removeFile(char* name) {
if (!myDir.open(curDir, subdirname, O_READ)) {
SERIAL_PROTOCOLPAIR("open failed, File: ", subdirname);
SERIAL_PROTOCOLCHAR('.');
SERIAL_EOL;
return;
}
else {

View File

@ -322,17 +322,17 @@ unsigned char Temperature::soft_pwm[HOTENDS];
SERIAL_PROTOCOLPAIR(MSG_T_MIN, min);
SERIAL_PROTOCOLPAIR(MSG_T_MAX, max);
if (cycles > 2) {
Ku = (4.0 * d) / (3.14159265 * (max - min) * 0.5);
Ku = (4.0 * d) / (M_PI * (max - min) * 0.5);
Tu = ((float)(t_low + t_high) * 0.001);
SERIAL_PROTOCOLPAIR(MSG_KU, Ku);
SERIAL_PROTOCOLPAIR(MSG_TU, Tu);
workKp = 0.6 * Ku;
workKi = 2 * workKp / Tu;
workKd = workKp * Tu * 0.125;
SERIAL_PROTOCOLLNPGM(MSG_CLASSIC_PID);
SERIAL_PROTOCOLLNPGM("\n" MSG_CLASSIC_PID);
SERIAL_PROTOCOLPAIR(MSG_KP, workKp);
SERIAL_PROTOCOLPAIR(MSG_KI, workKi);
SERIAL_PROTOCOLPAIR(MSG_KD, workKd);
SERIAL_PROTOCOLLNPAIR(MSG_KD, workKd);
/**
workKp = 0.33*Ku;
workKi = workKp/Tu;
@ -390,40 +390,38 @@ unsigned char Temperature::soft_pwm[HOTENDS];
#if HAS_PID_FOR_BOTH
const char* estring = hotend < 0 ? "bed" : "";
SERIAL_PROTOCOLPAIR("#define DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Kp ", workKp);
SERIAL_PROTOCOLPAIR("#define DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Ki ", workKi);
SERIAL_PROTOCOLPAIR("#define DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Kd ", workKd);
SERIAL_PROTOCOLPAIR("#define DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Kp ", workKp); SERIAL_EOL;
SERIAL_PROTOCOLPAIR("#define DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Ki ", workKi); SERIAL_EOL;
SERIAL_PROTOCOLPAIR("#define DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Kd ", workKd); SERIAL_EOL;
#elif ENABLED(PIDTEMP)
SERIAL_PROTOCOLPAIR("#define DEFAULT_Kp ", workKp);
SERIAL_PROTOCOLPAIR("#define DEFAULT_Ki ", workKi);
SERIAL_PROTOCOLPAIR("#define DEFAULT_Kd ", workKd);
SERIAL_PROTOCOLPAIR("#define DEFAULT_Kp ", workKp); SERIAL_EOL;
SERIAL_PROTOCOLPAIR("#define DEFAULT_Ki ", workKi); SERIAL_EOL;
SERIAL_PROTOCOLPAIR("#define DEFAULT_Kd ", workKd); SERIAL_EOL;
#else
SERIAL_PROTOCOLPAIR("#define DEFAULT_bedKp ", workKp);
SERIAL_PROTOCOLPAIR("#define DEFAULT_bedKi ", workKi);
SERIAL_PROTOCOLPAIR("#define DEFAULT_bedKd ", workKd);
SERIAL_PROTOCOLPAIR("#define DEFAULT_bedKp ", workKp); SERIAL_EOL;
SERIAL_PROTOCOLPAIR("#define DEFAULT_bedKi ", workKi); SERIAL_EOL;
SERIAL_PROTOCOLPAIR("#define DEFAULT_bedKd ", workKd); SERIAL_EOL;
#endif
#define _SET_BED_PID() \
#define _SET_BED_PID() do { \
bedKp = workKp; \
bedKi = scalePID_i(workKi); \
bedKd = scalePID_d(workKd); \
updatePID()
updatePID(); } while(0)
#define _SET_EXTRUDER_PID() \
#define _SET_EXTRUDER_PID() do { \
PID_PARAM(Kp, hotend) = workKp; \
PID_PARAM(Ki, hotend) = scalePID_i(workKi); \
PID_PARAM(Kd, hotend) = scalePID_d(workKd); \
updatePID()
updatePID(); } while(0)
// Use the result? (As with "M303 U1")
if (set_result) {
#if HAS_PID_FOR_BOTH
if (hotend < 0) {
if (hotend < 0)
_SET_BED_PID();
}
else {
else
_SET_EXTRUDER_PID();
}
#elif ENABLED(PIDTEMP)
_SET_EXTRUDER_PID();
#else