Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean main #35

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions smart_bridge/src/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
52 changes: 26 additions & 26 deletions smart_bridge/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}