#include #line 1 "C:\\Users\\espi_\\Documents\\Arduino\\vesper\\vesper.ino" #include #include #include #include #include #include #include #include #define PCF8574_ADDR 0x24 Adafruit_PCF8574 relays; #define DEV_ID "id-96638646" struct melody_attributes { std::string name; // Contains the name of each Melody saved uint16_t id; // The (internal) ID of the selected melody uint32_t duration; // Indicates the total Duration in Minutes bool infinite_play; // Infinite Loop Indicator (If True the melody will loop forever or until stoped, with pauses of "interval duration in between loops") uint16_t interval_duration; // Indicates the Duration of the Interval between finished loops, IF "inf" is true uint16_t speed; // Indicates the Speed in 9 Steps. 1-9 (Steps can be adjusted in the bellEngine function) }; melody_attributes melody; std::vector melody_steps; volatile bool playing = false; uint16_t relayMask = 0; // Bitmask indicating which relays to activate uint8_t relayDurations[16] = {100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100}; // Deactivation timers for each relay in milliseconds volatile uint64_t startTime = 0; bool forceStop = false; #include "functions.hpp" #include "config.h" // Sustituir con datos de vuestra red #include "MQTT.hpp" #include "ESP32_Utils.hpp" #include "ESP32_Utils_MQTT_Async.hpp" #include "bellEngine.hpp" #include "hammerTime.hpp" #include "Timers.hpp" TaskHandle_t bellEngineHandle = NULL; #line 47 "C:\\Users\\espi_\\Documents\\Arduino\\vesper\\vesper.ino" void setup(); #line 99 "C:\\Users\\espi_\\Documents\\Arduino\\vesper\\vesper.ino" void loop(); #line 47 "C:\\Users\\espi_\\Documents\\Arduino\\vesper\\vesper.ino" void setup() { // Initialize Serial Communications & I2C Bus (for debugging) Serial.begin(115200); delay(50); // Initialize PCF8574 Wire.begin(4,15); relays.begin(PCF8574_ADDR, &Wire); // Initialize Relays for (uint8_t p=0; p<6; p++){ relays.pinMode(p, OUTPUT); relays.digitalWrite(p, HIGH); } // Initialize SPIFFS if (!SPIFFS.begin(true)) { // 'true' means format SPIFFS if initialization fails Serial.println("Failed to mount SPIFFS"); return; } Serial.println("SPIFFS mounted successfully"); delay(50); // Initialize WiFi and MQTT WiFi.onEvent(WiFiEvent); InitMqtt(); ConnectWiFi_STA(); delay(1000); xTaskCreatePinnedToCore( bellEngine, // Task function "bellEngine", // Task name 8192, // Stack size NULL, // Task input parameters 1, // Task priority, be carefull when changing this &bellEngineHandle, // Task handle, add one if you want control over the task (resume or suspend the task) 1 // Core to run the task on ); xTaskCreatePinnedToCore( durationTimer, // Task function "durationTimer", // Task name 8192, // Stack size NULL, // Task input parameters 1, // Task priority, be carefull when changing this NULL, // Task handle, add one if you want control over the task (resume or suspend the task) 1 // Core to run the task on ); } void loop() { }