// Calculate applied wattage, based on the distance from the target temperature
// Calculate applied wattage, based on the distance from the target temperature
if(overTemperature){
if(overTemperature){
dWattage=0.0;// turn it off
//dWattage = 0.0; // turn it off
heatingElement.setWattage(heatingElement.getNullWattage());// turn it off
}
}
else{
else{
if(difference<=0.5){
if(difference<=0.5){
if(cookTemperature>99.0){
if(cookTemperature>99.0){
dWattage=2000.0;// pulse hardly at 2000 watt
//dWattage = 2000.0; // pulse hardly at 2000 watt
heatingElement.setWattage(heatingElement.getTwoThirdWattage());// pulse hardly at 2000 watt
}
}
else{
else{
if(cookTemperature>70.0){
if(cookTemperature>70.0){
dWattage=1000.0;// pulse moderately at 1000 watt
//dWattage = 1000.0; // pulse moderately at 1000 watt
heatingElement.setWattage(heatingElement.getOneThirdWattage());// pulse moderately at 1000 watt
}
}
else{
else{
dWattage=500.0;// pulse lightly at 500 watt
//dWattage = 500.0; // pulse lightly at 500 watt
heatingElement.setWattage(heatingElement.getOneSixthWattage());// pulse lightly at 500 watt
}
}
}
}
}
}
else{
else{
if(difference<=1.0){
if(difference<=1.0){
if(cookTemperature>99.0){
if(cookTemperature>99.0){
dWattage=2000.0;// pulse hardly at 2000 watt
//dWattage = 2000.0; // pulse hardly at 2000 watt
heatingElement.setWattage(heatingElement.getTwoThirdWattage());// pulse hardly at 2000 watt
}
}
else{
else{
dWattage=1000.0;// pulse moderately at 1000 watt
//dWattage = 1000.0; // pulse moderately at 1000 watt
heatingElement.setWattage(heatingElement.getOneThirdWattage());// pulse moderately at 1000 watt
}
}
}
}
else{
else{
if(difference<=3.0){
if(difference<=3.0){
dWattage=2000.0;// pulse hardly at 2000 watt
//dWattage = 2000.0; // pulse hardly at 2000 watt
heatingElement.setWattage(heatingElement.getTwoThirdWattage());// pulse hardly at 2000 watt
}
}
else{
else{
dWattage=HEATING_ELEMENT_MAX_WATTAGE;// pulse constantly at HEATING_ELEMENT_MAX_WATTAGE watt
//dWattage = HEATING_ELEMENT_MAX_WATTAGE; // pulse constantly at HEATING_ELEMENT_MAX_WATTAGE watt
heatingElement.setWattage(heatingElement.getMaxWattage());// pulse constantly at HEATING_ELEMENT_MAX_WATTAGE watt
}
}
}
}
}
}
}
}
// Update the recorded time for the begining of the window, if the previous window has passed. Then apply wattage to the element at the right time
heatingElement.process();
/*
// Update the recorded time for the begining of the window, if the previous window has passed
// Update the recorded time for the begining of the window, if the previous window has passed
while ((millis() - windowStartTime) > iWindowSize) { // Check if it's time to vary the pulse width modulation and if so do it by shifting the "Relay in ON" Window
while ((millis() - windowStartTime) > iWindowSize) { // Check if it's time to vary the pulse width modulation and if so do it by shifting the "Relay in ON" Window
digitalWrite(_iOutputPin,_uiOffValue);// Turn heading element OFF for safety
_bStatusElement=false;
}
doubleHeatingElement::process(doubledWattage){
setWattage(dWattage);
returnprocess();
}
doubleHeatingElement::process(){
// Update the recorded time for the begining of the window, if the previous window has passed
while((millis()-_windowStartTime)>_iWindowSize){// Check if it's time to vary the pulse width modulation and if so do it by shifting the "Relay in ON" Window