Information
for(int i = 0; i<NO_AVERAGES_VALUES; i++){
sumTemp += tempAvg[i];
}
sumTemp /= NO_AVERAGES_VALUES;
// show on display actual and preset temperature
sprintf(text, "%3d/%3dC", sumTemp, setTemperature);
ssd1306_setFixedFont(ssd1306xled_font6x8);
ssd1306_printFixedN(0, 16, text, STYLE_NORMAL, FONT_SIZE_2X);
/*
* debug output into display and to serial
*/
/*
sprintf(text, "PID=%03d", valuePID);
ssd1306_printFixed(0, 0, text, STYLE_NORMAL);
sprintf(text, "%3d;%3d", valuePID, sumTemp);
Serial.println(text);
*/
return sumTemp;
}
/*
* call every 50ms timer for buttons action and heating
* execute buttons function according to heating state
* change material profile
*/
void timerAction(){
static int elapsedTime = 0;
static char statusHeating = STATE_HEATING;
static char stateMotor = MOTOR_STOP, lastMotorState = MOTOR_STOP;
static int timeMotorReverse = 0;
// decide temperature state (heating, cooling, ready) and show it on display
if(++elapsedTime==2){ // 100ms
elapsedTime = 0;
int actualTemperature = heating();
// tolerant zone where temperature is ABOVE preset temperature,
// but it is possible to do extrusion/reverse
if(actualTemperature > setTemperature + 10){










