Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed M105 response for EXTRUDERS > 1 #70

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// build by the user have been successfully uploaded into firmware.
#define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
#ifndef STRING_CONFIG_H_AUTHOR
#define STRING_CONFIG_H_AUTHOR "Version DEV" // Who made the changes.
#define STRING_CONFIG_H_AUTHOR "Version IDEL" // Who made the changes.
#endif

// SERIAL_PORT selects which serial port should be used for communication with the host.
Expand All @@ -22,6 +22,10 @@
#define BAUDRATE 250000
//#define BAUDRATE 115200



#define IDEL_TEMP_CORRECTION //Temperaturkorrektur für Ultimaker2

//// The following define selects which electronics board you have. Please choose the one that matches your setup
// 10 = Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics"
// 11 = Gen7 v1.1, v1.2 = 11
Expand Down Expand Up @@ -64,7 +68,7 @@

// This defines the number of extruders
#ifndef EXTRUDERS
#define EXTRUDERS 1
#define EXTRUDERS 2
#endif

//// The following define selects which power supply you have. Please choose the one that matches your setup
Expand Down Expand Up @@ -202,7 +206,7 @@
#define DEFAULT_Kp 10.0
#define DEFAULT_Ki 2.5
#define DEFAULT_Kd 100.0

// Makergear
// #define DEFAULT_Kp 7.0
// #define DEFAULT_Ki 0.1
Expand Down Expand Up @@ -251,7 +255,7 @@
#define DEFAULT_bedKp 124.55
#define DEFAULT_bedKi 23.46
#define DEFAULT_bedKd 165.29

// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
#endif // PIDTEMPBED

Expand Down
74 changes: 64 additions & 10 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#include <SPI.h>
#endif

#define VERSION_STRING "1.0.0"
#define VERSION_STRING "2.0.0"

// look here for descriptions of gcodes: http://linuxcnc.org/handbook/gcode/g-code.html
// http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes
Expand All @@ -69,6 +69,7 @@
// G90 - Use Absolute Coordinates
// G91 - Use Relative Coordinates
// G92 - Set current position to coordinates given
// G99 - Ignore following G-Codes (by IDEL)

//RepRap M Codes
// M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
Expand Down Expand Up @@ -270,6 +271,9 @@ static uint8_t tmp_extruder;

uint8_t Stopped = false;

unsigned long idel_GCodeCountToWait = 0; //for G99 by IDEL
unsigned long idel_GCodeCountToIgnore = 0; //for G99 by IDEL

#if NUM_SERVOS > 0
Servo servos[NUM_SERVOS];
#endif
Expand Down Expand Up @@ -887,7 +891,21 @@ void process_commands()
printing_state = PRINT_STATE_NORMAL;
if(code_seen('G'))
{
switch((int)code_value())
int _codeValue = (int)code_value();

//G99 - Ignore G-Commands by IDEL
//G99 geht immer, damit man es auch wieder abschalten kann!
if((_codeValue) != 99){
if(idel_GCodeCountToIgnore > 0){
if(idel_GCodeCountToWait-- == 0){
idel_GCodeCountToWait = 0;
idel_GCodeCountToIgnore--;
return;
}
}
}

switch(_codeValue)
{
case 0: // G0 -> G1
case 1: // G1
Expand Down Expand Up @@ -1147,6 +1165,19 @@ void process_commands()
}
}
}
break;
case 99: // G99 - Ignore following G-Codes (by IDEL)
// P: Anzahl der G-Befehle, die noch abgearbeitet werden (P = Pause)
// S: Anzahl der Befehle, die ignoriert werden (S = Skip)
// z.B. G99 P5 S3
// Nach dem G99 werden 5 Befehle normal abgearbeitet. Danach werden 3 Befehle ignoriert
// Ein Aufruf ohne Parameter, setzt die Funktion zurück. Danach werden wieder alle Befehle abgearbeitet

idel_GCodeCountToWait = 0;
idel_GCodeCountToIgnore = 0;
if(code_seen('P')) idel_GCodeCountToWait = code_value();
if(code_seen('S')) idel_GCodeCountToIgnore = code_value();

break;
}
}
Expand All @@ -1159,6 +1190,10 @@ void process_commands()
case 0: // M0 - Unconditional stop - Wait for user button press on LCD
case 1: // M1 - Conditional stop - Wait for user button press on LCD
{
//Reset G99 - Ignore Following G-Codes
idel_GCodeCountToWait = 0; //for G99 by IDEL
idel_GCodeCountToIgnore = 0; //for G99 by IDEL

printing_state = PRINT_STATE_WAIT_USER;
LCD_MESSAGEPGM(MSG_USERWAIT);
codenum = 0;
Expand Down Expand Up @@ -1358,19 +1393,34 @@ void process_commands()
SERIAL_PROTOCOL_F(degBed(),1);
SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL_F(degTargetBed(),1);
SERIAL_PROTOCOLPGM(" B@:");
SERIAL_PROTOCOL(getHeaterPower(-1));
#endif //TEMP_BED_PIN

SERIAL_PROTOCOLPGM(" @:");
SERIAL_PROTOCOL(getHeaterPower(tmp_extruder));

#if (EXTRUDERS > 1)
for (int8_t e = 0; e < EXTRUDERS; ++e) {
SERIAL_PROTOCOLPGM(" T");
SERIAL_PROTOCOL(e);
SERIAL_PROTOCOLPGM(":");
SERIAL_PROTOCOL_F(degHotend(e), 1);
SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL_F(degTargetHotend(e), 1);
SERIAL_PROTOCOLPGM(" @");
SERIAL_PROTOCOL(e);
SERIAL_PROTOCOLPGM(":");
SERIAL_PROTOCOL(getHeaterPower(e));
}
#endif
#else
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_NO_THERMISTORS);
#endif

SERIAL_PROTOCOLPGM(" @:");
SERIAL_PROTOCOL(getHeaterPower(tmp_extruder));

SERIAL_PROTOCOLPGM(" B@:");
SERIAL_PROTOCOL(getHeaterPower(-1));

SERIAL_PROTOCOLLN("");

SERIAL_PROTOCOLLN("");

return;
break;
case 109:
Expand Down Expand Up @@ -2317,6 +2367,10 @@ void process_commands()
}
break;
case 999: // M999: Restart after being stopped
//Reset G99 - Ignore Following G-Codes
idel_GCodeCountToWait = 0; //for G99 by IDEL
idel_GCodeCountToIgnore = 0; //for G99 by IDEL

Stopped = false;
lcd_reset_alert_level();
gcode_LastN = Stopped_gcode_LastN;
Expand Down
6 changes: 5 additions & 1 deletion Marlin/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,11 @@ static float analog2temp(int raw, uint8_t e) {
// Overflow: Set to last value in the table
if (i == heater_ttbllen_map[e]) celsius = PGM_RD_W((*tt)[i-1][1]);

return celsius;
#ifdef IDEL_TEMP_CORRECTION
return celsius * 1.05769231; //Sensor Read: 260°C => Real 275°C
#else
return celsius;
#endif
}
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
}
Expand Down