From c4fb1a6cd4a03fed193eb7f089d62bd546877dc3 Mon Sep 17 00:00:00 2001 From: Alessandro Monticelli Date: Mon, 4 Dec 2023 18:03:12 +0100 Subject: [PATCH 1/2] [CONFIG] Update parameters --- smart_bridge/src/config/config.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/smart_bridge/src/config/config.h b/smart_bridge/src/config/config.h index 608fbfc..df82e6f 100644 --- a/smart_bridge/src/config/config.h +++ b/smart_bridge/src/config/config.h @@ -31,13 +31,9 @@ // SERVO #define SERVO_PIN 9 -/** - * TODO: TIMING, time constants for example N4.... etc - */ -#define N1 2 -// Time for the gate to open after car presence (in seconds) -#define MINDIST 10.0f // Minimum distance for car fully entering (in cm) -#define N2 10 // Time to consider car fully entered (in seconds) +#define N1 2 // Time for the gate to open after car presence (in seconds) +#define MINDIST 5.0f // Minimum distance for car fully entering (in cm) +#define N2 5 // Time to consider car fully entered (in seconds) #define N3 15 // Time for the washing process (in seconds) #define MAXDIST 30 // Maximum distance to consider car leaving (in cm) #define N4_FOR_DIST 10 // Time to consider car fully left (in seconds) From 2f8bb1818cce9685eb6599c5e27643f60406213d Mon Sep 17 00:00:00 2001 From: Alessandro Monticelli Date: Tue, 5 Dec 2023 00:29:01 +0100 Subject: [PATCH 2/2] [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