Skip to content
Snippets Groups Projects
Commit b048a785 authored by Jonas Alexander Landsfeldt's avatar Jonas Alexander Landsfeldt
Browse files

Merge branch 'ChangeTimeWhileCooking' into 'main'

final merge request related to addtime feature

See merge request !17
parents 53ef62b6 8f620930
Branches Defrost
No related tags found
1 merge request!17final merge request related to addtime feature
Pipeline #194526 passed
using System;
using System.Threading;
using Microwave.Classes.Boundary;
using Microwave.Classes.Controllers;
using Timer = Microwave.Classes.Boundary.Timer;
namespace Microwave.App
{
......@@ -40,31 +42,30 @@ namespace Microwave.App
var powerButtonPresses = 20;
for (int i = 0; i < powerButtonPresses; i++)
{
powerButton.Press();
}
defrostButton.Press();
timeButton.Press();
startCancelButton.Press();
for (int i = 0; i < powerButtonPresses; i++)
{
powerButton.Press();
}
// The simple sequence should now run
timeButton.Press();
startCancelButton.Press();
// The simple sequence should now run
System.Console.WriteLine("press 's' to stop program or 't' to extend the cooking time");
System.Console.WriteLine("When you press enter, the program will stop");
// Wait for input
char key = '0';
while (key != 's')
{
key = System.Console.ReadKey().KeyChar;
//string input = System.Console.ReadLine();
//if(input == "t")
// timeButton.Press();
if(key == 't')
timeButton.Press();
}
System.Console.ReadLine();
}
......
using System;
using System.Threading;
using System.Threading.Tasks;
using Microwave.Classes.Interfaces;
namespace Microwave.Classes.Controllers
......@@ -85,17 +86,19 @@ namespace Microwave.Classes.Controllers
}
}
public void Defrost(int power)
public async void Defrost(int power)
{
Console.WriteLine("Defrosting is on");
while (isCooking)
{
Thread.Sleep(10000);
await Task.Delay(10000);
myPowerTube.TurnOff();
Thread.Sleep(10000);
myPowerTube.TurnOn(power);
await Task.Delay(10000);
myPowerTube.TurnOn(power);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment