Initial commit.
This commit is contained in:
78
pitrix.ino
Normal file
78
pitrix.ino
Normal file
@ -0,0 +1,78 @@
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
#include <WiFiUdp.h>
|
||||
#include <ArduinoOTA.h>
|
||||
#include "FastLED.h"
|
||||
#include <NTPClient.h>
|
||||
#include <PubSubClient.h>
|
||||
|
||||
#include "config.h"
|
||||
CRGB leds[LED_COUNT];
|
||||
WiFiClient wifi;
|
||||
WiFiUDP ntpUDP;
|
||||
NTPClient ntpClient(ntpUDP, NTP_SERVER, NTP_OFFSET, NTP_INTERVAL);
|
||||
|
||||
#include "effect.h"
|
||||
#include "tools.h"
|
||||
#include "functions.h"
|
||||
#include "text.h"
|
||||
#include "sprites.h"
|
||||
#include "effect_sinematrix3.h"
|
||||
#include "effect_clock.h"
|
||||
#include "effect_bell.h"
|
||||
#include "effect_static.h"
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(74880);
|
||||
Serial.println("Core * Starting");
|
||||
wifi_setup();
|
||||
ota_setup();
|
||||
fastled_setup();
|
||||
ntp_setup();
|
||||
mqtt_setup();
|
||||
Serial.println("Core * Setup complete");
|
||||
}
|
||||
|
||||
Sinematrix3 effect_sinematrix3;
|
||||
Clock effect_clock;
|
||||
Bell effect_bell;
|
||||
Static effect_off(CRGB(0x000000));
|
||||
Effect* current_effect = &effect_clock;
|
||||
|
||||
#define NUM_EFFECTS 4
|
||||
EffectEntry effects[NUM_EFFECTS] = {
|
||||
{"bell", &effect_bell},
|
||||
{"sinematrix3", &effect_sinematrix3},
|
||||
{"clock", &effect_clock},
|
||||
{"off", &effect_off}
|
||||
};
|
||||
|
||||
#include "mqtt.h"
|
||||
|
||||
uint8_t starting_up = OTA_STARTUP_DELAY;
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
ota_loop();
|
||||
|
||||
if (starting_up > 0) {
|
||||
EVERY_N_SECONDS(1) {
|
||||
starting_up--;
|
||||
clear();
|
||||
for (int i=0; i<starting_up; i++) {
|
||||
leds[XYsafe(i, 0)] = CRGB(0xff0000);
|
||||
}
|
||||
FastLED.show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ntp_loop();
|
||||
mqtt_loop();
|
||||
|
||||
EVERY_N_MILLISECONDS(1000 / FPS) {
|
||||
current_effect->loop();
|
||||
FastLED.show();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user