From 2f8bb1818cce9685eb6599c5e27643f60406213d Mon Sep 17 00:00:00 2001 From: Alessandro Monticelli Date: Tue, 5 Dec 2023 00:29:01 +0100 Subject: [PATCH] [MAIN] Clean main --- smart_bridge/src/main.cpp | 52 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/smart_bridge/src/main.cpp b/smart_bridge/src/main.cpp index fb75000..31afead 100644 --- a/smart_bridge/src/main.cpp +++ b/smart_bridge/src/main.cpp @@ -10,6 +10,11 @@ #include "tasks/CheckOutTask.h" #include "tasks/CountDown.h" #include "tasks/WaitForClickTask.h" +#include "tasks/WashingTask.h" +#include "tasks/CheckOutTask.h" +#include "tasks/ExitTransitTask.h" +#include "tasks/TemperatureTask.h" + // #include "tasks/ServoTestTask.h" Scheduler scheduler; @@ -19,51 +24,46 @@ SerialReceiver *serialReceiver; void setup() { Serial.begin(9600); - scheduler.init(100); // NOTE: Might be set higher to use less power, needs testing. + scheduler.init(50); // NOTE: Might be set higher to use less power, needs testing. + /**CREATE TASKS**/ - // ServoTestTask *servoTask = new ServoTestTask(); - BlinkTask *blinkTask = new BlinkTask(L2_PIN); - // TODO: BlinkTask *blinkTaskForCheckOutTransit = new BlinkTask(L2_PIN); + BlinkTask *blinkTaskTransit = new BlinkTask(L2_PIN); + BlinkTask *blinkTaskWashing = new BlinkTask(L2_PIN); + // CountDown *countDownTask = new CountDown(N3); + TemperatureTask *temperatureTask = new TemperatureTask(); // SleepingTask *sleepingTask = new SleepingTask(); - // WaitingTask *waitingTask = new WaitingTask(); CheckInTask *checkInTask = new CheckInTask(); - TransitTask *transitTask = new TransitTask(blinkTask); + TransitTask *transitTask = new TransitTask(blinkTaskTransit); WaitForClickTask *waitForClickTask = new WaitForClickTask(); - // WashingTask *washingTask = new WashingTask(blinkTask, new CountDown(N3)); - // TODO: CheckOutTask *checkOutTask = new CheckOutTask(blinkTaskForCheckOutTransit); - // CountDown *countDown = new CountDown(N3); // NOTE: This is just a test. - // countDown->setActive(true); // NOTE: This is just a test. - - /// serialReceiver = new SerialReceiver(); //test test test test receiver - - + // WashingTask *washingTask = new WashingTask(blinkTaskTransit, nullptr, temperatureTask); + // CheckOutTask *checkOutTask = new CheckOutTask(); + // ExitTransitTask *exitTransitTask = new ExitTransitTask(); /**DEPENDENCIES**/ - // checkInTask->addDependency(waitingTask); + // checkInTask->addDependency(sleepingTask); transitTask->addDependency(checkInTask); waitForClickTask->addDependency(transitTask); - // washingTask->addDependency(transitTask); + //washingTask->addDependency(waitForClickTask); // checkOutTask->addDependency(washingTask); + // exitTransitTask->addDependency(checkOutTask); /**ADD TASKS TO THE SCHEDULER**/ - // scheduler.addTask(servoTask); - // scheduler.addTask(countDown); // NOTE: This is just a test. - // scheduler.addTask(waitingTask); + // scheduler.addTask(sleepingTask); scheduler.addTask(checkInTask); - //Serial.println("err:errore"); scheduler.addTask(transitTask); - scheduler.addTask(blinkTask); + scheduler.addTask(blinkTaskTransit); + scheduler.addTask(blinkTaskWashing); + // scheduler.addTask(countDownTask); + scheduler.addTask(temperatureTask); scheduler.addTask(waitForClickTask); - // scheduler.addTask(washingTask); - - // TODO: scheduler.addTask(checkOutTask); - // TODO: scheduler.addTask(blinkTaskForCheckOutTransit); + // scheduler.addTask(checkOutTask); + // scheduler.addTask(exitTransitTask); } void loop() { // serialReceiver->readData(); //@EMANUELE this is a test to try the serialReceiver, it must go instantiate when the arduino is in error state - //read the class briefs + // read the class briefs scheduler.schedule(); } \ No newline at end of file