Commit f3b806d9 authored by service-config's avatar service-config

bug fixing

parent bd440b67
...@@ -79,7 +79,7 @@ LiquidCrystal_I2C lcd(LCD_I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_ ...@@ -79,7 +79,7 @@ LiquidCrystal_I2C lcd(LCD_I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_
// ++++++++++++++++++++++++ Library - LiquidCrystal_I2C ++++++++++++++++++++++++ // ++++++++++++++++++++++++ Library - LiquidCrystal_I2C ++++++++++++++++++++++++
// ++++++++++++++++++++++++ Rotary Encoder ++++++++++++++++++++++++ // ++++++++++++++++++++++++ Rotary Encoder ++++++++++++++++++++++++
volatile int rotaryEncoderVirtualPosition = 0; volatile int rotaryEncoderVirtualPosition = 0;
//volatile int rotaryEncoderMaxPosition = 120; volatile int rotaryEncoderMaxPosition;
volatile int menuSize = 2; volatile int menuSize = 2;
const int PinCLK = 3; // Used for generating interrupts using CLK signal const int PinCLK = 3; // Used for generating interrupts using CLK signal
const int PinDT = 22; // Used for reading DT signal const int PinDT = 22; // Used for reading DT signal
...@@ -135,6 +135,7 @@ enum manual_menu_list { ...@@ -135,6 +135,7 @@ enum manual_menu_list {
manual_temperature, manual_temperature,
manual_time, manual_time,
manual_mode, manual_mode,
manual_mixer,
manual_start, manual_start,
manual_back manual_back
}; };
...@@ -251,32 +252,6 @@ void isr () { // Interrupt service routine is executed when ...@@ -251,32 +252,6 @@ void isr () { // Interrupt service routine is executed when
break; break;
} }
case state_manual_mixer: {
if (!digitalRead(PinDT)) {
if ((interruptTime - lastInterruptTime) < 10) {
rotaryEncoderVirtualPosition = (rotaryEncoderVirtualPosition + 5);
}
else {
rotaryEncoderVirtualPosition = (rotaryEncoderVirtualPosition + 1);
}
}
else {
if ((interruptTime - lastInterruptTime) < 10) {
rotaryEncoderVirtualPosition = (rotaryEncoderVirtualPosition - 5);
}
else {
rotaryEncoderVirtualPosition = (rotaryEncoderVirtualPosition - 1);
}
}
if (rotaryEncoderVirtualPosition > mixerMaxSpeed) {
rotaryEncoderVirtualPosition = mixerMaxSpeed;
}
if (rotaryEncoderVirtualPosition < 0) {
rotaryEncoderVirtualPosition = 0;
}
break;
}
default: { default: {
} }
...@@ -321,7 +296,7 @@ void setup() { ...@@ -321,7 +296,7 @@ void setup() {
// ++++++++++++++++++++++++ Heating Element Relay ++++++++++++++++++++++++ // ++++++++++++++++++++++++ Heating Element Relay ++++++++++++++++++++++++
// ++++++++++++++++++++++++ Mixer ++++++++++++++++++++++++ // ++++++++++++++++++++++++ Mixer ++++++++++++++++++++++++
pinMode(mixerPin, OUTPUT); pinMode(mixerPin, OUTPUT);
analogWrite(mixerPin, mixerSpeed); analogWrite(mixerPin, 0);
// ++++++++++++++++++++++++ Mixer ++++++++++++++++++++++++ // ++++++++++++++++++++++++ Mixer ++++++++++++++++++++++++
// ++++++++++++++++++++++++ Temperature Sensor PT100 ++++++++++++++++++++++++ // ++++++++++++++++++++++++ Temperature Sensor PT100 ++++++++++++++++++++++++
analogReference(EXTERNAL); analogReference(EXTERNAL);
...@@ -856,6 +831,7 @@ void runStart() { ...@@ -856,6 +831,7 @@ void runStart() {
unsigned long runStartTime; unsigned long runStartTime;
unsigned long runTargetTime; unsigned long runTargetTime;
cook_mode_list runCurrentMode; cook_mode_list runCurrentMode;
unsigned long runMixerSpeed;
// Configure environment // Configure environment
boolean clockStart = false; boolean clockStart = false;
...@@ -876,7 +852,16 @@ void runStart() { ...@@ -876,7 +852,16 @@ void runStart() {
// check if time ended and is time to stop and return to menu // check if time ended and is time to stop and return to menu
if(clockStart && clockEnd) { if(clockStart && clockEnd) {
// Turn mixer OFF for safety
analogWrite(mixerPin, 0);
// Turn heading element OFF for safety
digitalWrite(HEATING_ELEMENT,LOW);
// Pause for efect
delay(1000); delay(1000);
return; return;
} }
...@@ -987,6 +972,9 @@ void runStart() { ...@@ -987,6 +972,9 @@ void runStart() {
Serial.print(Rx, 6); Serial.print(Rx, 6);
*/ */
// Operate mixer
analogWrite(mixerPin, runMixerSpeed);
// Operate the heating element // Operate the heating element
Input = runCurrentTemperature; Input = runCurrentTemperature;
Setpoint = runTargetTemperature; Setpoint = runTargetTemperature;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment