Skip to content

Commit

Permalink
- added custom temp option when loding/unloading filament
Browse files Browse the repository at this point in the history
- faster loading/unloading filament
- fixed autotune not working
- fixed statistics crash
- increased thermal runaway tolerances (should fix prints stopping)
- added a error message when thermal runaway error occurs
  • Loading branch information
Silverquark committed Jun 5, 2017
1 parent c5ef7ed commit 84aad58
Show file tree
Hide file tree
Showing 14 changed files with 1,382 additions and 1,375 deletions.
Binary file modified LCDFirmware/DWIN_SET/043 system menu.bmp
Binary file not shown.
Binary file modified LCDFirmware/DWIN_SET/044 system menu press.bmp
Binary file not shown.
Binary file added LCDFirmware/DWIN_SET/068_thermal_runaway.bmp
Binary file not shown.
Binary file modified LCDFirmware/DWIN_SET/13Touch_Control_Config.bin
Binary file not shown.
Binary file modified LCDFirmware/DWIN_SET/14Variable_Config.bin
Binary file not shown.
1 change: 1 addition & 0 deletions LCDFirmware/DWprj.hmi
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ SPADDRESS=5000
65=065_auto_pid_graph.bmp
66=066_pid_finished.bmp
67=067_pid_finished_pressed.bmp
68=068_thermal_runaway.bmp
Binary file modified LCDFirmware/TFT/033 print.bmp.tft
Binary file not shown.
Binary file modified LCDFirmware/TFT/043 system menu.bmp.tft
Binary file not shown.
Binary file added LCDFirmware/TFT/068_thermal_runaway.bmp.tft
Binary file not shown.
Binary file modified Marlin/.vs/Marlin/v14/.suo
Binary file not shown.
1,244 changes: 622 additions & 622 deletions Marlin/Configuration.h

Large diffs are not rendered by default.

1,448 changes: 724 additions & 724 deletions Marlin/Configuration_adv.h

Large diffs are not rendered by default.

57 changes: 29 additions & 28 deletions Marlin/bi3_plus_lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ void executeLoopedOperation(millis_t ms) {
}
else if (opMode == OPMODE_UNLOAD_FILAMENT) {
if (thermalManager.current_temperature[0] >= thermalManager.target_temperature[0] -10)
enqueue_and_echo_commands_P(PSTR("G1 E-0.5 F60"));
enqueue_and_echo_commands_P(PSTR("G1 E-1 F120"));
nextOpTime = ms + 500;
}
else if (opMode == OPMODE_LOAD_FILAMENT) {
if (thermalManager.current_temperature[0] >= thermalManager.target_temperature[0] -10)
enqueue_and_echo_commands_P(PSTR("G1 E0.5 F60"));
enqueue_and_echo_commands_P(PSTR("G1 E1 F120"));
nextOpTime = ms + 500;
}
}
Expand Down Expand Up @@ -562,7 +562,7 @@ void readLcdSerial() {
lcdBuff[7] = 0xC8; //extruder temp (200)
Serial2.write(lcdBuff, 8);

lcdShowPage(49);//open load/unbload_menu
lcdShowPage(49);//open load/unload_menu
}
else if (lcdData == 1 || lcdData == 2) {
//read bed/hotend temp
Expand Down Expand Up @@ -680,7 +680,7 @@ void readLcdSerial() {
if (thermalManager.degHotend(0) >= 180) {
clear_command_queue();
enqueue_and_echo_commands_P(PSTR("G91"));
enqueue_and_echo_commands_P(PSTR("G1 E5 F60"));
enqueue_and_echo_commands_P(PSTR("G1 E1 F120"));
enqueue_and_echo_commands_P(PSTR("G90"));
}
break;
Expand All @@ -689,7 +689,7 @@ void readLcdSerial() {
if (thermalManager.degHotend(0) >= 180) {
clear_command_queue();
enqueue_and_echo_commands_P(PSTR("G91"));
enqueue_and_echo_commands_P(PSTR("G1 E-5 F60"));
enqueue_and_echo_commands_P(PSTR("G1 E-1 F120"));
enqueue_and_echo_commands_P(PSTR("G90"));
}
break;
Expand Down Expand Up @@ -753,7 +753,7 @@ void readLcdSerial() {

//read user entered values from sram
uint8_t bytesRead = Serial2.readBytes(lcdBuff, 9);
if ((bytesRead == 11) && (lcdBuff[0] == 0x5A) && (lcdBuff[1] == 0xA5)) {
if ((bytesRead == 9) && (lcdBuff[0] == 0x5A) && (lcdBuff[1] == 0xA5)) {
uint16_t hotendTemp = (uint16_t)lcdBuff[7] * 255 + lcdBuff[8];
//Serial.println(hotendTemp);
char command[20];
Expand Down Expand Up @@ -808,58 +808,59 @@ void lcdSendMarlinVersion() {
}

void lcdSendStats() {
Serial.println("Test123456789ABCDEF");
char buffer[21];
duration_t elapsed;

printStatistics stats = print_job_timer.getStats();
lcdBuff[0] = 0x5A;
lcdBuff[1] = 0xA5;
lcdBuff[2] = 0x07;//data length
lcdBuff[3] = 0x82;//write data to sram
lcdBuff[4] = 0x05; //starting at 0x5040 vp
lcdBuff[5] = 0x40;
//Total prints (including aborted)
lcdBuff[6] = highByte((int16_t)stats.totalPrints);
lcdBuff[7] = lowByte((int16_t)stats.totalPrints);
//Finished prints
lcdBuff[8] = highByte((int16_t)stats.finishedPrints);
lcdBuff[9] = lowByte((int16_t)stats.finishedPrints);
printStatistics stats = print_job_timer.getStats();
lcdBuff[0] = 0x5A;
lcdBuff[1] = 0xA5;
lcdBuff[2] = 0x07;//data length
lcdBuff[3] = 0x82;//write data to sram
lcdBuff[4] = 0x05; //starting at 0x5040 vp
lcdBuff[5] = 0x40;
//Total prints (including aborted)
lcdBuff[6] = highByte((int16_t)stats.totalPrints);
lcdBuff[7] = lowByte((int16_t)stats.totalPrints);
//Finished prints
lcdBuff[8] = highByte((int16_t)stats.finishedPrints);
lcdBuff[9] = lowByte((int16_t)stats.finishedPrints);
Serial2.write(lcdBuff, 10);

//total print time
lcdBuff[0] = 0x5A;
lcdBuff[1] = 0xA5;
lcdBuff[2] = 0x18; //data length
lcdBuff[2] = 0x12; //data length
lcdBuff[3] = 0x82; //write data to sram
lcdBuff[4] = 0x05; //starting at 0x0542 vp
lcdBuff[5] = 0x42;
elapsed = stats.printTime;
elapsed.toString(buffer);
strncpy((char*)lcdBuff + 6, buffer, 21);
Serial2.write(lcdBuff, 27);
strncpy((char*)lcdBuff + 6, buffer,15);
Serial2.write(lcdBuff, 21);

//longest print time
lcdBuff[0] = 0x5A;
lcdBuff[1] = 0xA5;
lcdBuff[2] = 0x18; //data length
lcdBuff[2] = 0x12; //data length
lcdBuff[3] = 0x82; //write data to sram
lcdBuff[4] = 0x05; //starting at 0x054D vp
lcdBuff[5] = 0x4D;
elapsed = stats.longestPrint;
elapsed.toString(buffer);
strncpy((char*)lcdBuff + 6, buffer, 21);
Serial2.write(lcdBuff, 27);
strncpy((char*)lcdBuff + 6, buffer, 15);
Serial2.write(lcdBuff, 21);

//total filament used
lcdBuff[0] = 0x5A;
lcdBuff[1] = 0xA5;
lcdBuff[2] = 0x18; //data length
lcdBuff[2] = 0x12; //data length
lcdBuff[3] = 0x82; //write data to sram
lcdBuff[4] = 0x05; //starting at 0x0558 vp
lcdBuff[5] = 0x58;
sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int(stats.filamentUsed / 100) % 10);
strncpy((char*)lcdBuff + 6, buffer, 21);
Serial2.write(lcdBuff, 27);
strncpy((char*)lcdBuff + 6, buffer, 15);
Serial2.write(lcdBuff, 21);

}

Expand Down
7 changes: 6 additions & 1 deletion Marlin/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ void Temperature::manage_heater() {
// Has it failed to increase enough?
if (degHotend(e) < watch_target_temp[e]) {
// Stop!
lcdShowPage(68);
_temp_error(e, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
}
else {
Expand All @@ -759,6 +760,7 @@ void Temperature::manage_heater() {
// Has it failed to increase enough?
if (degBed() < watch_target_bed_temp) {
// Stop!
lcdShowPage(68);
_temp_error(-1, PSTR(MSG_T_HEATING_FAILED), PSTR(MSG_HEATING_FAILED_LCD));
}
else {
Expand Down Expand Up @@ -806,7 +808,9 @@ void Temperature::manage_heater() {
#if TEMP_SENSOR_BED != 0

#if HAS_THERMALLY_PROTECTED_BED
thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, -1, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS);
thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, -1,

_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS);
#endif

#if ENABLED(PIDTEMPBED)
Expand Down Expand Up @@ -1312,6 +1316,7 @@ void Temperature::init() {
else if (PENDING(millis(), *timer)) break;
*state = TRRunaway;
case TRRunaway:
lcdShowPage(68);
_temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), PSTR(MSG_THERMAL_RUNAWAY));
}
}
Expand Down

0 comments on commit 84aad58

Please sign in to comment.