Our full code can be found here.
While the heating element is heating up, the display is meant to show the temperature of the element in real-time. This way, the user can monitor the setup and exit the heating phase or stop the machine in case it gets too hot. We ran into a problem where the display was not updating in real-time during the heating phase. On top of this, the heating phase did not stop until we exited it manually with the rotary encoder. This meant that the temperature was not being read in the first place. We discovered that there was not enough time to read the thermocouple measurement. To fix this problem, a delay was added to the readThermocouple() function between where the reading is taken and the information is saved in a variable. Through experimentation, the best delay was found to be 200 milliseconds.
Another problem we encountered was that the desired temperature changed too slowly when we turned the rotary encoder knob. The temperature only changed by 1 degree Celsius per rotation, which is inconvenient for a user setting a new temperature signifcantly higher or lower than the previous desired temperature. We added a double click feature that we found in the encoder library, and it allows the user to turn on "acceleration" by double-clicking the encoder. This causes the temperature value to change by increments of 5 instead of 1.
Furthermore, we originally coded the device so that the user cannot click the encoder to return to the main menu until the process ends. We then realized the user may want to change the desired temperature during the process, so we modified the code to allow the user to exit the process screen and keep the system in the same phase. However, during testing, we found that the system began to lag when we tried to change desired temp while it was still heating or cooling. Therefore, we made the system enter the off state if the user clicks out in the middle of the process, and the process would need to restart if "start" was clicked again. This is still useful if the user wants to pull the fused filament out before the process ends and fuse more filaments without hard resetting the system.
One more issue was that the display was not printing the success screen when the process finished. We concluded that the success screen may have been being skipped because we change "put system" in the off state in the if statement for the success state at the end of the process. We removed that line and called a method that turns off the fans and heating element instead.