diff --git a/platformio.ini b/platformio.ini index 7b4935c..89e16ed 100644 --- a/platformio.ini +++ b/platformio.ini @@ -16,4 +16,3 @@ lib_deps = adafruit/Adafruit BusIO@^1.16.1 dfrobot/DFRobotDFPlayerMini@^1.0.6 fmalpartida/LiquidCrystal@^1.5.0 - powerbroker2/DFPlayerMini_Fast@^1.2.4 diff --git a/src/context.cpp b/src/context.cpp index d4da98f..3e05729 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -1,6 +1,6 @@ #include "Context.h" -Context::Context(Station* stations, const int stationCount, const unsigned long delta, DFPlayerMini_Fast* dfPlayer) +Context::Context(Station* stations, const int stationCount, const unsigned long delta, DFRobotDFPlayerMini* dfPlayer) { this->stations = stations; this->stationCount = stationCount; diff --git a/src/context.h b/src/context.h index f521a3c..993522c 100644 --- a/src/context.h +++ b/src/context.h @@ -1,15 +1,15 @@ #pragma once -#include +#include #include "station.h" class Context { public: - Context(Station* stations, int stationCount, unsigned long delta, DFPlayerMini_Fast* dfPlayer); + Context(Station* stations, int stationCount, unsigned long delta, DFRobotDFPlayerMini* dfPlayer); Station* stations; int stationCount; unsigned long delta; - DFPlayerMini_Fast* dfPlayer; + DFRobotDFPlayerMini* dfPlayer; int getStationIndex(const Station* station) const; bool isPlaying() const; diff --git a/src/main.cpp b/src/main.cpp index 130f17c..3c10689 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include "station.h" #include "statemachine.h" @@ -22,7 +22,7 @@ constexpr int rs = 9, en = 8, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); SoftwareSerial softSerial(6, 7); // RX, TX -DFPlayerMini_Fast dfPlayer; +DFRobotDFPlayerMini dfPlayer; Station stations[5] = { Station(1680767519, "Yellow"), Station(3346823711, "Green"), Station(3569318175, "Pink"), @@ -176,7 +176,6 @@ void setup(void) while (true) { delay(100); - dfPlayer.printError(); // printMp3Detail(&lcd, dfPlayer.readType(), dfPlayer.read()); } } diff --git a/src/states.cpp b/src/states.cpp index 2aa65be..51bcf15 100644 --- a/src/states.cpp +++ b/src/states.cpp @@ -150,6 +150,7 @@ State* Hacking::update(const Context context) { Serial.println(String(context.delta)); const bool done = timer.update(context.delta); + if (done) { const int currentStationIndex = context.getStationIndex(currentStation);