diff --git a/smart_bridge/lib/README b/smart_bridge/lib/README index 6debab1..f909a21 100644 --- a/smart_bridge/lib/README +++ b/smart_bridge/lib/README @@ -3,7 +3,7 @@ This directory is intended for project specific (private) libraries. PlatformIO will compile them to static libraries and link into executable file. The source code of each library should be placed in a an own separate directory -("lib/your_library_name/[here are source files]"). +("lib/your_library_name/[here are source files]")). For example, see a structure of the following two libraries `Foo` and `Bar`: diff --git a/smart_bridge/platformio.ini b/smart_bridge/platformio.ini index 0e3c3a7..8c92aeb 100644 --- a/smart_bridge/platformio.ini +++ b/smart_bridge/platformio.ini @@ -16,6 +16,5 @@ board = uno framework = arduino lib_deps = marcoschwartz/LiquidCrystal_I2C@^1.1.4 - Wire - paulstoffregen/TimerOne@^1.1.1 nabontra/ServoTimer2@0.0.0-alpha+sha.2bf7fb3c17 + Wire diff --git a/smart_bridge/src/UI/view.py b/smart_bridge/src/UI/view.py index c75c87a..d700535 100644 --- a/smart_bridge/src/UI/view.py +++ b/smart_bridge/src/UI/view.py @@ -145,7 +145,7 @@ def start_serial(): global serialInst serialInst = serial.Serial() serialInst.baudrate = 9600 - serialInst.port = 'COM3' #COM3 depends on the port where Arduino is connected + serialInst.port = '/dev/ttyACM0' #COM3 depends on the port where Arduino is connected serialInst.open() root.after(100, update_serial) diff --git a/smart_bridge/src/components/impl/LCD.cpp b/smart_bridge/src/components/impl/LCD.cpp index 5817db9..c067b96 100644 --- a/smart_bridge/src/components/impl/LCD.cpp +++ b/smart_bridge/src/components/impl/LCD.cpp @@ -15,7 +15,8 @@ void LCD::clear() void LCD::write(const char *string, int start_col, int start_rows) { - Serial.println("LCD::Sto scrivendo sul display" + String(string)); + // Serial.print(F("LCD::Sto scrivendo sul display ")); + // Serial.println(String(string)); lcd.setCursor(start_col, start_rows); lcd.print(string); } \ No newline at end of file diff --git a/smart_bridge/src/kernel/DependantTask.h b/smart_bridge/src/kernel/DependantTask.h index da07b89..15c3239 100644 --- a/smart_bridge/src/kernel/DependantTask.h +++ b/smart_bridge/src/kernel/DependantTask.h @@ -30,7 +30,7 @@ class DependantTask : virtual public Task { if (nDependencies <= MAX_DEPENDENCIES) { - Serial.println("DependantTask::addDependency()"); + // Serial.println(F("DependantTask::addDependency()")); this->dependencies[nDependencies++] = dependency; } } diff --git a/smart_bridge/src/kernel/Scheduler.cpp b/smart_bridge/src/kernel/Scheduler.cpp index 87237d3..633c671 100644 --- a/smart_bridge/src/kernel/Scheduler.cpp +++ b/smart_bridge/src/kernel/Scheduler.cpp @@ -15,7 +15,7 @@ void Scheduler::addTask(Task *task) { tasks[numTasks++] = task; #ifdef __DEBUG - Serial.println("tasks[" + String(numTasks - 1) + "]: [" + String(reinterpret_cast(tasks[numTasks - 1])) + "]"); + // Serial.println(F("tasks[" + String(numTasks - 1) + "]: [" + String(reinterpret_cast(tasks[numTasks - 1])) + "]")); #endif } } @@ -35,16 +35,16 @@ void Scheduler::schedule() if (tasks[i]->updateAndCheckTime(schedulerPeriod)) // Check if it's time to execute { #ifdef __DEBUG - Serial.println("Scheduler::tasks[" + String(i) + "]: " + String(reinterpret_cast(tasks[i])) + " tick"); + // Serial.println(F("Scheduler::tasks[" + String(i) + "]: " + String(reinterpret_cast(tasks[i])) + " tick")); #endif tasks[i]->tick(); // Execute task - // Serial.println("Scheduler::numTasks: " + numTasks); + // // Serial.println(F("Scheduler::numTasks: " + numTasks); } } else // Task is aperiodic { #ifdef __DEBUG - Serial.println("Scheduler::tasks[" + String(i) + "]: " + String(reinterpret_cast(tasks[i])) + " tick"); + // Serial.println(F("Scheduler::tasks[" + String(i) + "]: " + String(reinterpret_cast(tasks[i])) + " tick")); #endif tasks[i]->tick(); // Execute task without checking time } diff --git a/smart_bridge/src/kernel/Scheduler.h b/smart_bridge/src/kernel/Scheduler.h index 574ea73..9d64081 100644 --- a/smart_bridge/src/kernel/Scheduler.h +++ b/smart_bridge/src/kernel/Scheduler.h @@ -3,7 +3,7 @@ #include "Task.h" -#define MAX_TASKS 50 +#define MAX_TASKS 15 /** * @class Scheduler diff --git a/smart_bridge/src/kernel/SerialReceiver.cpp b/smart_bridge/src/kernel/SerialReceiver.cpp index 4ebaea7..e0ed99b 100644 --- a/smart_bridge/src/kernel/SerialReceiver.cpp +++ b/smart_bridge/src/kernel/SerialReceiver.cpp @@ -2,23 +2,23 @@ bool SerialReceiver::readData() { - if (this->simulateDataReceived) { - this->simulateDataReceived = false; - return true; - } - - // if (Serial.available() > 0) { //if some data has been received - // String data = Serial.readString(); - // data.trim(); - // if (data=="mnt:done") { - // Serial.println("Arduino received message: " + data); - // return true; - // } + // if (this->simulateDataReceived) { + // this->simulateDataReceived = false; + // return true; // } - // return false; + + if (Serial.available() > 0) { //if some data has been received + String data = Serial.readString(); + data.trim(); + if (data=="mnt:done") { + // Serial.println(F("Arduino received message: " + data); + return true; + } + } + return false; } void SerialReceiver::simulateReadData() { this->simulateDataReceived = true; - Serial.println("Arduino received message: simulates mnt:done"); + // Serial.println(F("Arduino received message: simulates mnt:done")); } \ No newline at end of file diff --git a/smart_bridge/src/kernel/TaskWithState.h b/smart_bridge/src/kernel/TaskWithState.h index 3acfe31..85857d8 100644 --- a/smart_bridge/src/kernel/TaskWithState.h +++ b/smart_bridge/src/kernel/TaskWithState.h @@ -14,11 +14,10 @@ class TaskWithState : public TaskWithTimer { public: - TaskWithState() : TaskWithTimer(), previousState(0){}; // Default constructor + TaskWithState() : TaskWithTimer(){}; // Default constructor void setState(const int state) { - this->previousState = this->state; this->state = state; this->stateTimestamp = millis(); } @@ -28,13 +27,7 @@ class TaskWithState : public TaskWithTimer return this->state; } - int getPreviousState() - { - return this->previousState; - } - private: - int previousState; int state; long stateTimestamp; }; diff --git a/smart_bridge/src/main.cpp b/smart_bridge/src/main.cpp index 635a632..3f2edad 100644 --- a/smart_bridge/src/main.cpp +++ b/smart_bridge/src/main.cpp @@ -1,27 +1,25 @@ -#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() { @@ -29,38 +27,38 @@ void setup() 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(); } \ No newline at end of file diff --git a/smart_bridge/src/tasks/BlinkTask.h b/smart_bridge/src/tasks/BlinkTask.h index b6dc58b..8796484 100644 --- a/smart_bridge/src/tasks/BlinkTask.h +++ b/smart_bridge/src/tasks/BlinkTask.h @@ -20,7 +20,7 @@ class BlinkTask : public TaskWithState */ BlinkTask(int pin, int period) : TaskWithState() { - Serial.println("BlinkTask created"); + // Serial.println(F("BlinkTask created")); this->pin = pin; this->init(period); } @@ -31,7 +31,7 @@ class BlinkTask : public TaskWithState */ BlinkTask(int pin) : TaskWithState() { - Serial.println("BlinkTask created"); + // Serial.println(F("BlinkTask created")); this->pin = pin; if (this->isActive()) { diff --git a/smart_bridge/src/tasks/CheckInTask.cpp b/smart_bridge/src/tasks/CheckInTask.cpp index a4612a3..dd46b7b 100644 --- a/smart_bridge/src/tasks/CheckInTask.cpp +++ b/smart_bridge/src/tasks/CheckInTask.cpp @@ -11,7 +11,7 @@ void CheckInTask::tick() lcd->write("SMART WASHING", 0, 1); L1->switchOn(); // Turn on L1 #ifdef __LOG - Serial.println("CheckInTask::Turned on L1"); + // Serial.println(F("CheckInTask::Turned on L1")); #endif this->resetTime(); // Reset the elapsed time this->setState(WAITING); // Set the state to WAITING @@ -21,11 +21,11 @@ void CheckInTask::tick() { L1->switchOff(); // Turn off L1 #ifdef __LOG - Serial.println("CheckInTask::Turned off L1"); + // Serial.println(F("CheckInTask::Turned off L1")); #endif gate->write(90); // Open the gate #ifdef __LOG - Serial.println("CheckInTask::Opened the gate"); + // Serial.println(F("CheckInTask::Opened the gate")); #endif this->setCompleted(); // Mark the task as completed } diff --git a/smart_bridge/src/tasks/CheckInTask.h b/smart_bridge/src/tasks/CheckInTask.h index 51db934..44e456f 100644 --- a/smart_bridge/src/tasks/CheckInTask.h +++ b/smart_bridge/src/tasks/CheckInTask.h @@ -25,7 +25,7 @@ class CheckInTask : public DependantTaskWithState this->gate = new ServoImpl(SERVO_PIN); this->init(); this->setState(STARTED); - Serial.println("CheckInTask created"); + // Serial.println(F("CheckInTask created")); }; void tick() override; diff --git a/smart_bridge/src/tasks/CheckOutTask.cpp b/smart_bridge/src/tasks/CheckOutTask.cpp index 6b4a6c6..020c3d3 100644 --- a/smart_bridge/src/tasks/CheckOutTask.cpp +++ b/smart_bridge/src/tasks/CheckOutTask.cpp @@ -5,7 +5,7 @@ CheckOutTask::CheckOutTask() GATE_OPEN_POSITION(90), GATE_CLOSE_POSITION(0) { - Serial.println("CheckOutTask created"); + // Serial.println(F("CheckOutTask created")); this->sonar = new Sonar(SONAR_TRIG_PIN, SONAR_ECHO_PIN, SONAR_MAX_TIME); this->L3 = new Led(L3_PIN); this->gate = new ServoImpl(SERVO_PIN); @@ -39,13 +39,13 @@ void CheckOutTask::tick() void CheckOutTask::handleTurnOnL3() { this->L3->switchOn(); - Serial.println("CheckOutTask::L3 turned on"); + // Serial.println(F("CheckOutTask::L3 turned on")); this->setState(OPENS_GATE); } void CheckOutTask::handleOpensGate() { this->gate->write(GATE_OPEN_POSITION); - Serial.println("CheckOutTask::Gate opened"); + // Serial.println(F("CheckOutTask::Gate opened")); this->setCompleted(); } \ No newline at end of file diff --git a/smart_bridge/src/tasks/CountDown.cpp b/smart_bridge/src/tasks/CountDown.cpp index aa5e387..aa12185 100644 --- a/smart_bridge/src/tasks/CountDown.cpp +++ b/smart_bridge/src/tasks/CountDown.cpp @@ -2,7 +2,7 @@ CountDown::CountDown(int countDown) : Task() { - Serial.println("CountDownTask created"); + // Serial.println(F("CountDownTask created")); this->setStatus(false); this->lcd = new LCD(0x27, 16, 2); this->resetCountDown(N3); @@ -64,14 +64,14 @@ void CountDown::endsCountDown() this->isCompleted(); this->printsEndsCountdown(); this->resetCountDown(N3); - Serial.println("CountDown::Countdown resetted"); + // Serial.println(F("CountDown::Countdown resetted")); this->setCompleted(); } } void CountDown::printsEndsCountdown() { - Serial.println("CountDown::Countdown ended!"); + // Serial.println(F("CountDown::Countdown ended!")); } bool CountDown::isCountDownActive() diff --git a/smart_bridge/src/tasks/ExitTransitTask.cpp b/smart_bridge/src/tasks/ExitTransitTask.cpp index 4cb9833..cdda8a0 100644 --- a/smart_bridge/src/tasks/ExitTransitTask.cpp +++ b/smart_bridge/src/tasks/ExitTransitTask.cpp @@ -5,7 +5,7 @@ ExitTransitTask::ExitTransitTask() GATE_OPEN_POSITION(90), GATE_CLOSE_POSITION(0) { - Serial.println("ExitTransitTask created"); + // Serial.println(F("ExitTransitTask created")); this->sonar = new Sonar(SONAR_TRIG_PIN, SONAR_ECHO_PIN, SONAR_MAX_TIME); this->L3 = new Led(L3_PIN); this->gate = new ServoImpl(SERVO_PIN); @@ -46,7 +46,7 @@ void ExitTransitTask::tick() void ExitTransitTask::handleReadingDistance() { this->distance = sonar->detectDistance(); - Serial.println("ExitTransitTask::Distance: " + String(this->distance)); + // Serial.println("ExitTransitTask::Distance: " + String(this->distance)); this->setState(CHECKING_DISTANCE); } @@ -66,13 +66,13 @@ void ExitTransitTask::handleCheckingDistance() void ExitTransitTask::handleClosesGate() { this->gate->write(GATE_CLOSE_POSITION); - Serial.println("ExitTransitTask::Gate closed"); + // Serial.println(F("ExitTransitTask::Gate closed")); this->setState(SWITCH_OFF_L3); } void ExitTransitTask::handleSwitchOffL3() { this->L3->switchOff(); - Serial.println("ExitTransitTask::L3 switched off"); + // Serial.println(F("ExitTransitTask::L3 switched off")); this->setCompleted(); } \ No newline at end of file diff --git a/smart_bridge/src/tasks/ServoTestTask.cpp b/smart_bridge/src/tasks/ServoTestTask.cpp index bd90e26..5ec124c 100644 --- a/smart_bridge/src/tasks/ServoTestTask.cpp +++ b/smart_bridge/src/tasks/ServoTestTask.cpp @@ -2,18 +2,18 @@ // void ServoTestTask::tick() // { -// Serial.println("ServoTestTask::tick()"); +// // Serial.println(F("ServoTestTask::tick()")); // switch (this->getState()) // { // case OPEN: -// Serial.println("ServoTestTask::OPEN"); +// // Serial.println(F("ServoTestTask::OPEN")); // this->servo.writeMicroseconds(1500); // this->setState(CLOSE); // break; // case CLOSE: // // if (this->elapsedTime() >= 1000) // { -// Serial.println("ServoTestTask::CLOSE"); +// // Serial.println(F("ServoTestTask::CLOSE")); // this->servo.writeMicroseconds(0); // this->setState(OPEN); // } diff --git a/smart_bridge/src/tasks/ServoTestTask.h b/smart_bridge/src/tasks/ServoTestTask.h index ff5be23..29c15a7 100644 --- a/smart_bridge/src/tasks/ServoTestTask.h +++ b/smart_bridge/src/tasks/ServoTestTask.h @@ -12,7 +12,7 @@ // { // // this->servo = new Servo(); // this->servo.detach(); -// Serial.println("Servo::attach" + String(this->servo.attach(SERVO_PIN))); +// // Serial.println(F("Servo::attach" + String(this->servo.attach(SERVO_PIN))); // this->init(1000); // Periodic task, executed every 1000ms // this->setActive(true); // this->setState(OPEN); diff --git a/smart_bridge/src/tasks/SleepingTask.cpp b/smart_bridge/src/tasks/SleepingTask.cpp index d8e58c9..66e7250 100644 --- a/smart_bridge/src/tasks/SleepingTask.cpp +++ b/smart_bridge/src/tasks/SleepingTask.cpp @@ -18,7 +18,7 @@ void SleepingTask::tick() case ALIVE: if (pir->checkDetectedStatus()) { - Serial.println("OBJECT revealed"); + // Serial.println(F("OBJECT revealed")); this->setState(OBJECT_DETECTED); } break; diff --git a/smart_bridge/src/tasks/SleepingTask.h b/smart_bridge/src/tasks/SleepingTask.h index ab954ab..5c341e1 100644 --- a/smart_bridge/src/tasks/SleepingTask.h +++ b/smart_bridge/src/tasks/SleepingTask.h @@ -22,7 +22,7 @@ class SleepingTask : public TaskWithState public: SleepingTask() : TaskWithState() { - Serial.println("SleepingTask created"); + // Serial.println(F("SleepingTask created")); this->pir = new Pir(PIR_PIN); this->lcd=new LCD(0x27, 16,2); this->init(); diff --git a/smart_bridge/src/tasks/TemperatureTask.cpp b/smart_bridge/src/tasks/TemperatureTask.cpp index bc4fc72..30da2c9 100644 --- a/smart_bridge/src/tasks/TemperatureTask.cpp +++ b/smart_bridge/src/tasks/TemperatureTask.cpp @@ -5,7 +5,7 @@ TemperatureTask::TemperatureTask() voltageConversionFactor(30), voltageOffset(0.5) { - Serial.println("TemperatureTask created"); + // Serial.println(F("TemperatureTask created")); this->lcd = new LCD(0x27, 16, 2); this->setTemperature(this->getTemperature()); this->init(1000); @@ -61,12 +61,12 @@ bool TemperatureTask::checkForCriticalTemperature() void TemperatureTask::criticalTemperatureReachedMessage() { - Serial.println("Critical temperature reached!"); + // Serial.println(F("Critical temperature reached!")); } void TemperatureTask::temperatureMaintenanceMessage() { - // Serial.println("Detected a Problem - Please Wait"); + // // Serial.println(F("Detected a Problem - Please Wait")); lcd->write("Detected a Problem - Please Wait: ", 0, 0); } diff --git a/smart_bridge/src/tasks/TransitTask.cpp b/smart_bridge/src/tasks/TransitTask.cpp index 104842b..1388398 100644 --- a/smart_bridge/src/tasks/TransitTask.cpp +++ b/smart_bridge/src/tasks/TransitTask.cpp @@ -14,14 +14,15 @@ void TransitTask::tick() this->L2->switchOn(); this->distance = sonar->detectDistance(); #ifdef __LOG - Serial.println("TransitTask::Distance: " + String(this->distance)); + // Serial.println(F("TransitTask::Distance: ")); + // Serial.print(String(this->distance)); #endif if (this->distance < MINDIST) { this->resetTime(); this->setState(CHECKING_DISTANCE); #ifdef __LOG - Serial.println("TransitTask::Checking distance"); + // Serial.println(F("TransitTask::Checking distance")); #endif } break; @@ -33,19 +34,22 @@ void TransitTask::tick() } this->distance = sonar->detectDistance(); #ifdef __LOG - Serial.println("TransitTask::Distance: " + String(this->distance)); + // Serial.print(F("TransitTask::Distance: ")); + // Serial.println(String(this->distance)); #endif if (this->distance < MINDIST) { #ifdef __DEBUG - Serial.println("TransitTask::Elapsed: " + String(this->elapsedTime())); + // Serial.print(F("TransitTask::Elapsed: ")); + // Serial.println(String(this->elapsedTime())); #endif if (this->elapsedTime() >= (N2 * 1000)) { #ifdef __LOG - Serial.println("TransitTask::Distance: " + String(this->distance)); - Serial.println("TransitTask::Car entered"); - Serial.println("TransitTask::Closing gate"); + // Serial.println(F("TransitTask::Distance: ")); + // Serial.println(String(this->distance)); + // Serial.println(F("TransitTask::Car entered")); + // Serial.println(F("TransitTask::Closing gate")); #endif this->gate->write(0); if (this->blinkTask->isActive()) @@ -59,7 +63,7 @@ void TransitTask::tick() else { #ifdef __LOG - Serial.println("TransitTask::Reading distance"); + // Serial.println(F("TransitTask::Reading distance")); #endif if (this->blinkTask->isActive()) { @@ -70,7 +74,7 @@ void TransitTask::tick() } break; default: - Serial.println("TransitTask::Invalid state"); + // Serial.println(F("TransitTask::Invalid state")); break; } } diff --git a/smart_bridge/src/tasks/TransitTask.h b/smart_bridge/src/tasks/TransitTask.h index 3d1f111..f67c2da 100644 --- a/smart_bridge/src/tasks/TransitTask.h +++ b/smart_bridge/src/tasks/TransitTask.h @@ -24,7 +24,7 @@ class TransitTask : public DependantTaskWithState */ TransitTask(BlinkTask *blinkTask) : DependantTaskWithState() { - Serial.println("TransitTask created"); + // Serial.println(F("TransitTask created")); this->sonar = new Sonar(SONAR_TRIG_PIN, SONAR_ECHO_PIN, SONAR_MAX_TIME); this->L2 = new Led(L2_PIN); this->lcd = new LCD(0x27, 16, 2); diff --git a/smart_bridge/src/tasks/WaitForClickTask.cpp b/smart_bridge/src/tasks/WaitForClickTask.cpp index b32c955..ece53c3 100644 --- a/smart_bridge/src/tasks/WaitForClickTask.cpp +++ b/smart_bridge/src/tasks/WaitForClickTask.cpp @@ -9,13 +9,13 @@ void WaitForClickTask::tick() this->lcd->write("Press START to", 0, 0); this->lcd->write("begin washing", 0, 1); #ifdef __LOG - Serial.println("WaitForClickTask::Waiting for START click"); + // Serial.println(F("WaitForClickTask::Waiting for START click")); #endif this->start->sync(); if (this->start->isPressed()) { #ifdef __LOG - Serial.println("WaitForClickTask::START pressed"); + // Serial.println(F("WaitForClickTask::START pressed")); #endif this->lcd->clear(); this->lcd->write("Starting to wash", 0, 0); diff --git a/smart_bridge/src/tasks/WaitForClickTask.h b/smart_bridge/src/tasks/WaitForClickTask.h index bbae0c9..3f110e6 100644 --- a/smart_bridge/src/tasks/WaitForClickTask.h +++ b/smart_bridge/src/tasks/WaitForClickTask.h @@ -22,7 +22,7 @@ class WaitForClickTask : public DependantTask this->start = new Button(BUTTON_PIN); this->lcd = new LCD(0x27, 16, 2); this->init(); - Serial.println("WaitForClickTask created"); + // Serial.println(F("WaitForClickTask created")); }; void tick() override; diff --git a/smart_bridge/src/tasks/WaitingTask.cpp b/smart_bridge/src/tasks/WaitingTask.cpp index 757cc09..9226e75 100644 --- a/smart_bridge/src/tasks/WaitingTask.cpp +++ b/smart_bridge/src/tasks/WaitingTask.cpp @@ -10,7 +10,8 @@ void WaitingTask::tick() switch (this->getState()) { case STARTED: - Serial.println("sono qui in waiting"); + break; + // Serial.println(F("sono qui in waiting")); } } diff --git a/smart_bridge/src/tasks/WaitingTask.h b/smart_bridge/src/tasks/WaitingTask.h index a9ab900..d97ecb4 100644 --- a/smart_bridge/src/tasks/WaitingTask.h +++ b/smart_bridge/src/tasks/WaitingTask.h @@ -18,7 +18,7 @@ class WaitingTask : public DependantTaskWithState this->pir=new Pir(PIR_PIN); //attached to the INTERRUPT_PIN 2 this->init(); this->setState(STARTED); - Serial.println("WaitingTask created"); + // Serial.println(F("WaitingTask created")); }; void tick() override; diff --git a/smart_bridge/src/tasks/WashingTask.cpp b/smart_bridge/src/tasks/WashingTask.cpp index 85c4049..2814bcd 100644 --- a/smart_bridge/src/tasks/WashingTask.cpp +++ b/smart_bridge/src/tasks/WashingTask.cpp @@ -5,7 +5,7 @@ WashingTask::WashingTask(BlinkTask *blinkTask, TemperatureTask *temperatureTask) : DependantTaskWithState() { - Serial.println("WashingTask created"); + // Serial.println(F("WashingTask created")); this->L2 = new Led(L2_PIN); this->L3 = new Led(L3_PIN); this->tempSensor = new Temp(TMP_PIN); @@ -96,7 +96,6 @@ void WashingTask::handleError() this->countDownTask->pauseCountDown(); this->temperatureTask->criticalTemperatureReachedMessage(); this->temperatureTask->temperatureMaintenanceMessage(); - this->serialReceiver->simulateReadData(); // TODO: remove, but now simulate receiving "mnt:done" if (serialReceiver->readData() == true) { this->countDownTask->resumeCountDown();