Add M136 (DEBUG) to read back PID values, add heater_print function
This commit is contained in:
parent
8540be950a
commit
31634c6a8f
|
|
@ -301,9 +301,9 @@ void process_gcode_command() {
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// M102- extruder reverse
|
// M102- extruder reverse
|
||||||
|
|
||||||
// M5/M103- extruder off
|
// M5/M103- extruder off
|
||||||
case 5:
|
case 5:
|
||||||
case 103:
|
case 103:
|
||||||
#ifdef DC_EXTRUDER
|
#ifdef DC_EXTRUDER
|
||||||
|
|
@ -319,26 +319,26 @@ void process_gcode_command() {
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// M104- set temperature
|
// M104- set temperature
|
||||||
case 104:
|
case 104:
|
||||||
temp_set(next_target.P, next_target.S);
|
temp_set(next_target.P, next_target.S);
|
||||||
if (next_target.S)
|
if (next_target.S)
|
||||||
power_on();
|
power_on();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// M105- get temperature
|
// M105- get temperature
|
||||||
case 105:
|
case 105:
|
||||||
temp_print(next_target.P);
|
temp_print(next_target.P);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// M7/M106- fan on
|
// M7/M106- fan on
|
||||||
case 7:
|
case 7:
|
||||||
case 106:
|
case 106:
|
||||||
#ifdef HEATER_FAN
|
#ifdef HEATER_FAN
|
||||||
heater_set(HEATER_FAN, 255);
|
heater_set(HEATER_FAN, 255);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
// M107- fan off
|
// M107- fan off
|
||||||
case 9:
|
case 9:
|
||||||
case 107:
|
case 107:
|
||||||
#ifdef HEATER_FAN
|
#ifdef HEATER_FAN
|
||||||
|
|
@ -346,7 +346,7 @@ void process_gcode_command() {
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// M109- set temp and wait
|
// M109- set temp and wait
|
||||||
case 109:
|
case 109:
|
||||||
temp_set(next_target.P, next_target.S);
|
temp_set(next_target.P, next_target.S);
|
||||||
if (next_target.S) {
|
if (next_target.S) {
|
||||||
|
|
@ -359,65 +359,71 @@ void process_gcode_command() {
|
||||||
enqueue(NULL);
|
enqueue(NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// M110- set line number
|
// M110- set line number
|
||||||
case 110:
|
case 110:
|
||||||
next_target.N_expected = next_target.S - 1;
|
next_target.N_expected = next_target.S - 1;
|
||||||
break;
|
break;
|
||||||
// M111- set debug level
|
// M111- set debug level
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
case 111:
|
case 111:
|
||||||
debug_flags = next_target.S;
|
debug_flags = next_target.S;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
// M112- immediate stop
|
// M112- immediate stop
|
||||||
case 112:
|
case 112:
|
||||||
timer_stop();
|
timer_stop();
|
||||||
queue_flush();
|
queue_flush();
|
||||||
power_off();
|
power_off();
|
||||||
break;
|
break;
|
||||||
// M113- extruder PWM
|
// M113- extruder PWM
|
||||||
// M114- report XYZEF to host
|
// M114- report XYZEF to host
|
||||||
case 114:
|
case 114:
|
||||||
sersendf_P(PSTR("X:%ld,Y:%ld,Z:%ld,E:%ld,F:%ld"), current_position.X, current_position.Y, current_position.Z, current_position.E, current_position.F);
|
sersendf_P(PSTR("X:%ld,Y:%ld,Z:%ld,E:%ld,F:%ld"), current_position.X, current_position.Y, current_position.Z, current_position.E, current_position.F);
|
||||||
// newline is sent from gcode_parse after we return
|
// newline is sent from gcode_parse after we return
|
||||||
break;
|
break;
|
||||||
// M115- capabilities string
|
// M115- capabilities string
|
||||||
case 115:
|
case 115:
|
||||||
sersendf_P(PSTR("FIRMWARE_NAME:FiveD_on_Arduino FIRMWARE_URL:http%%3A//github.com/triffid/FiveD_on_Arduino/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:%d TEMP_SENSOR_COUNT:%d HEATER_COUNT:%d"), 1, NUM_TEMP_SENSORS, NUM_HEATERS);
|
sersendf_P(PSTR("FIRMWARE_NAME:FiveD_on_Arduino FIRMWARE_URL:http%%3A//github.com/triffid/FiveD_on_Arduino/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:%d TEMP_SENSOR_COUNT:%d HEATER_COUNT:%d"), 1, NUM_TEMP_SENSORS, NUM_HEATERS);
|
||||||
// newline is sent from gcode_parse after we return
|
// newline is sent from gcode_parse after we return
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// M130- heater P factor
|
// M130- heater P factor
|
||||||
case 130:
|
case 130:
|
||||||
if (next_target.seen_S)
|
if (next_target.seen_S)
|
||||||
pid_set_p(next_target.P, next_target.S);
|
pid_set_p(next_target.P, next_target.S);
|
||||||
break;
|
break;
|
||||||
// M131- heater I factor
|
// M131- heater I factor
|
||||||
case 131:
|
case 131:
|
||||||
if (next_target.seen_S)
|
if (next_target.seen_S)
|
||||||
pid_set_i(next_target.P, next_target.S);
|
pid_set_i(next_target.P, next_target.S);
|
||||||
break;
|
break;
|
||||||
// M132- heater D factor
|
// M132- heater D factor
|
||||||
case 132:
|
case 132:
|
||||||
if (next_target.seen_S)
|
if (next_target.seen_S)
|
||||||
pid_set_d(next_target.P, next_target.S);
|
pid_set_d(next_target.P, next_target.S);
|
||||||
break;
|
break;
|
||||||
// M133- heater I limit
|
// M133- heater I limit
|
||||||
case 133:
|
case 133:
|
||||||
if (next_target.seen_S)
|
if (next_target.seen_S)
|
||||||
pid_set_i_limit(next_target.P, next_target.S);
|
pid_set_i_limit(next_target.P, next_target.S);
|
||||||
break;
|
break;
|
||||||
// M134- save PID settings to eeprom
|
// M134- save PID settings to eeprom
|
||||||
case 134:
|
case 134:
|
||||||
heater_save_settings();
|
heater_save_settings();
|
||||||
break;
|
break;
|
||||||
// M135- set heater output
|
// M135- set heater output
|
||||||
case 135:
|
case 135:
|
||||||
if (next_target.seen_S) {
|
if (next_target.seen_S) {
|
||||||
heater_set(next_target.P, next_target.S);
|
heater_set(next_target.P, next_target.S);
|
||||||
power_on();
|
power_on();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef DEBUG
|
||||||
|
// M136- PRINT PID settings to host
|
||||||
|
case 136:
|
||||||
|
heater_print(next_target.P);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case 140: //Set heated bed temperature
|
case 140: //Set heated bed temperature
|
||||||
#ifdef HEATER_BED
|
#ifdef HEATER_BED
|
||||||
|
|
@ -427,7 +433,7 @@ void process_gcode_command() {
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// M190- power on
|
// M190- power on
|
||||||
case 190:
|
case 190:
|
||||||
power_on();
|
power_on();
|
||||||
x_enable();
|
x_enable();
|
||||||
|
|
@ -435,7 +441,7 @@ void process_gcode_command() {
|
||||||
z_enable();
|
z_enable();
|
||||||
steptimeout = 0;
|
steptimeout = 0;
|
||||||
break;
|
break;
|
||||||
// M191- power off
|
// M191- power off
|
||||||
case 191:
|
case 191:
|
||||||
x_disable();
|
x_disable();
|
||||||
y_disable();
|
y_disable();
|
||||||
|
|
@ -444,7 +450,7 @@ void process_gcode_command() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// M240- echo off
|
// M240- echo off
|
||||||
case 240:
|
case 240:
|
||||||
debug_flags &= ~DEBUG_ECHO;
|
debug_flags &= ~DEBUG_ECHO;
|
||||||
serial_writestr_P(PSTR("Echo off"));
|
serial_writestr_P(PSTR("Echo off"));
|
||||||
|
|
@ -457,7 +463,7 @@ void process_gcode_command() {
|
||||||
// newline is sent from gcode_parse after we return
|
// newline is sent from gcode_parse after we return
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// DEBUG: return current position, end position, queue
|
// DEBUG: return current position, end position, queue
|
||||||
case 250:
|
case 250:
|
||||||
sersendf_P(PSTR("{X:%ld,Y:%ld,Z:%ld,E:%ld,F:%lu,c:%lu}\t{X:%ld,Y:%ld,Z:%ld,E:%ld,F:%lu,c:%lu}\t"), current_position.X, current_position.Y, current_position.Z, current_position.E, current_position.F, movebuffer[mb_tail].c, movebuffer[mb_tail].endpoint.X, movebuffer[mb_tail].endpoint.Y, movebuffer[mb_tail].endpoint.Z, movebuffer[mb_tail].endpoint.E, movebuffer[mb_tail].endpoint.F,
|
sersendf_P(PSTR("{X:%ld,Y:%ld,Z:%ld,E:%ld,F:%lu,c:%lu}\t{X:%ld,Y:%ld,Z:%ld,E:%ld,F:%lu,c:%lu}\t"), current_position.X, current_position.Y, current_position.Z, current_position.E, current_position.F, movebuffer[mb_tail].c, movebuffer[mb_tail].endpoint.X, movebuffer[mb_tail].endpoint.Y, movebuffer[mb_tail].endpoint.Z, movebuffer[mb_tail].endpoint.E, movebuffer[mb_tail].endpoint.F,
|
||||||
#ifdef ACCELERATION_REPRAP
|
#ifdef ACCELERATION_REPRAP
|
||||||
|
|
@ -470,7 +476,7 @@ void process_gcode_command() {
|
||||||
print_queue();
|
print_queue();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// DEBUG: read arbitrary memory location
|
// DEBUG: read arbitrary memory location
|
||||||
case 253:
|
case 253:
|
||||||
if (next_target.seen_P == 0)
|
if (next_target.seen_P == 0)
|
||||||
next_target.P = 1;
|
next_target.P = 1;
|
||||||
|
|
@ -481,7 +487,7 @@ void process_gcode_command() {
|
||||||
// newline is sent from gcode_parse after we return
|
// newline is sent from gcode_parse after we return
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// DEBUG: write arbitrary memory locatiom
|
// DEBUG: write arbitrary memory locatiom
|
||||||
case 254:
|
case 254:
|
||||||
sersendf_P(PSTR("%x:%x->%x"), next_target.S, *(volatile uint8_t *)(next_target.S), next_target.P);
|
sersendf_P(PSTR("%x:%x->%x"), next_target.S, *(volatile uint8_t *)(next_target.S), next_target.P);
|
||||||
(*(volatile uint8_t *)(next_target.S)) = next_target.P;
|
(*(volatile uint8_t *)(next_target.S)) = next_target.P;
|
||||||
|
|
|
||||||
4
heater.c
4
heater.c
|
|
@ -313,3 +313,7 @@ void pid_set_i_limit(heater_t index, int32_t i_limit) {
|
||||||
heaters_pid[index].i_limit = i_limit;
|
heaters_pid[index].i_limit = i_limit;
|
||||||
#endif /* BANG_BANG */
|
#endif /* BANG_BANG */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void heater_print(uint16_t i) {
|
||||||
|
sersendf_P(PSTR("P:%ld I:%ld D:%ld Ilim:%u crc:%u "), heaters_pid[i].p_factor, heaters_pid[i].i_factor, heaters_pid[i].d_factor, heaters_pid[i].i_limit, crc_block(&heaters_pid[i].p_factor, 14));
|
||||||
|
}
|
||||||
|
|
|
||||||
2
heater.h
2
heater.h
|
|
@ -31,4 +31,6 @@ void pid_set_i(heater_t index, int32_t i);
|
||||||
void pid_set_d(heater_t index, int32_t d);
|
void pid_set_d(heater_t index, int32_t d);
|
||||||
void pid_set_i_limit(heater_t index, int32_t i_limit);
|
void pid_set_i_limit(heater_t index, int32_t i_limit);
|
||||||
|
|
||||||
|
void heater_print(uint16_t i);
|
||||||
|
|
||||||
#endif /* _HEATER_H */
|
#endif /* _HEATER_H */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue