-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from aleemont1/alessandro
Optimize ram consumption
- Loading branch information
Showing
28 changed files
with
107 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
#include "Task.h" | ||
|
||
#define MAX_TASKS 50 | ||
#define MAX_TASKS 15 | ||
|
||
/** | ||
* @class Scheduler | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,64 @@ | ||
#include "Arduino.h" | ||
// #include "Arduino.h" | ||
|
||
#include "config/config.h" | ||
|
||
#include "kernel/Scheduler.h" | ||
#include "kernel/SerialReceiver.h" | ||
|
||
#include "components/api/LCD.h" | ||
|
||
#include "tasks/BlinkTask.h" | ||
#include "tasks/CountDown.h" | ||
#include "tasks/TemperatureTask.h" | ||
#include "tasks/SleepingTask.h" | ||
#include "tasks/CheckInTask.h" | ||
#include "tasks/TransitTask.h" | ||
#include "tasks/WaitingTask.h" | ||
#include "tasks/WashingTask.h" | ||
#include "tasks/SleepingTask.h" | ||
#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; | ||
|
||
SerialReceiver *serialReceiver; | ||
LCD *lcd; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
scheduler.init(50); // NOTE: Might be set higher to use less power, needs testing. | ||
|
||
/**CREATE TASKS**/ | ||
CheckInTask *checkInTask = new CheckInTask(); | ||
BlinkTask *blinkTask = new BlinkTask(L2_PIN); | ||
TransitTask *transitTask = new TransitTask(blinkTask); | ||
WaitForClickTask *waitForClickTask = new WaitForClickTask(); | ||
CountDown *countDownTask = new CountDown(N3); | ||
TemperatureTask *temperatureTask = new TemperatureTask(); | ||
WashingTask *washingTask = new WashingTask(blinkTask, countDownTask, temperatureTask); | ||
CheckOutTask *checkOutTask = new CheckOutTask(); | ||
ExitTransitTask *exitTransitTask = new ExitTransitTask(); | ||
|
||
BlinkTask blinkTask = BlinkTask(L2_PIN); | ||
CountDown countDownTask = CountDown(N3); | ||
TemperatureTask temperatureTask = TemperatureTask(); | ||
SleepingTask sleepingTask = SleepingTask(); | ||
CheckInTask checkInTask = CheckInTask(); | ||
TransitTask transitTask = TransitTask(&blinkTask); | ||
WaitForClickTask waitForClickTask = WaitForClickTask(); | ||
WashingTask washingTask = WashingTask(&blinkTask, nullptr, &temperatureTask); | ||
CheckOutTask checkOutTask = CheckOutTask(); | ||
ExitTransitTask exitTransitTask = ExitTransitTask(); | ||
/**DEPENDENCIES**/ | ||
transitTask->addDependency(checkInTask); | ||
waitForClickTask->addDependency(transitTask); | ||
washingTask->addDependency(waitForClickTask); | ||
checkOutTask->addDependency(washingTask); | ||
exitTransitTask->addDependency(checkOutTask); | ||
checkInTask.addDependency(&sleepingTask); | ||
transitTask.addDependency(&checkInTask); | ||
waitForClickTask.addDependency(&transitTask); | ||
washingTask.addDependency(&waitForClickTask); | ||
checkOutTask.addDependency(&washingTask); | ||
exitTransitTask.addDependency(&checkOutTask); | ||
|
||
/**ADD TASKS TO THE SCHEDULER**/ | ||
scheduler.addTask(checkInTask); | ||
scheduler.addTask(transitTask); | ||
scheduler.addTask(blinkTask); | ||
scheduler.addTask(waitForClickTask); | ||
scheduler.addTask(washingTask); | ||
scheduler.addTask(countDownTask); | ||
scheduler.addTask(temperatureTask); | ||
scheduler.addTask(checkOutTask); | ||
scheduler.addTask(exitTransitTask); | ||
scheduler.addTask(&sleepingTask); | ||
scheduler.addTask(&checkInTask); | ||
scheduler.addTask(&transitTask); | ||
scheduler.addTask(&blinkTask); | ||
scheduler.addTask(&countDownTask); | ||
scheduler.addTask(&temperatureTask); | ||
scheduler.addTask(&waitForClickTask); | ||
scheduler.addTask(&washingTask); | ||
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 | ||
scheduler.schedule(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.