119 lines
4.4 KiB
C
119 lines
4.4 KiB
C
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#define FASTLED_INTERNAL
|
|
#include <FastLED.h>
|
|
#include "settings.h"
|
|
|
|
//#define DEBUG // Uncomment this to enable Debug messages via Serial and, if enabled, MQTT.
|
|
//#define CONFIG_USABLE // Uncomment this by removing the // at the beginning!
|
|
|
|
#define WIFI_SSID "..." // SSID of the wifi to connect to
|
|
#define WIFI_PASS "..." // Password of the wifi
|
|
|
|
#define LED_WIDTH 16 // Number of LEDs in horizontal direction
|
|
#define LED_HEIGHT 16 // Number of LEDs in vertical direction
|
|
#define LED_COUNT 256 // Total number of LEDs. WIDTH*HEIGHT.
|
|
#define LED_TYPE WS2812B // Type of LEDs
|
|
#define DATA_PIN 14 // PIN the LEDs are connected to on the microcontroller
|
|
#define COLOR_ORDER GRB // Order of the colors of the LEDs. If you get unexpected colors, you should change this.
|
|
#define BRIGHTNESS 20 // Default brightness of the LEDs. 1 (lowest)-255 (brightest)
|
|
#define TEMPORAL_DITHERING 0 // Use temporal dithering. Can lead to flickering.
|
|
#define LED_MAX_MILLIAMPS 0 // If your power supply is too small, you can set this to a maximum mA value. FastLED should then honor this. Setting it to 0 disables this limit.
|
|
|
|
#define NTP_SERVER "pool.ntp.org" // NTP server to use to fetch the current time
|
|
#define NTP_INTERVAL 300000 // Interval in ms to update the time from the NTP server. 300000 ms = 5 minutes
|
|
#define NTP_OFFSET 7200 // Offset of your local time from UTC in seconds. Germany, daylight savings time = 2 hours = 7200 seconds
|
|
|
|
#define HTTP_SERVER_ENABLE
|
|
#define HTTP_SERVER_PORT 80
|
|
|
|
#define MQTT_ENABLE // Use MQTT. Add slashes to the start of the line to disable MQTT completely.
|
|
#define MQTT_SERVER "..." // Data for connecting to the MQTT server
|
|
#define MQTT_PORT 1883
|
|
#define MQTT_USER "..."
|
|
#define MQTT_PASS "..."
|
|
#define MQTT_TOPIC "pitrix/" // MQTT topic to listen to. Must not start with a slash, but must end with one.
|
|
#define MQTT_REPORT_METRICS // Whether to report metrics via MQTT. Disable if unwanted.
|
|
#define MQTT_TOPIC_WEATHER "accuweather/pitrix/" // MQTT topic to listen for weather data. Must not start with a slash, but must end with one.
|
|
#define MQTT_TOPIC_TIMER "alexa/timer"
|
|
#define MQTT_TOPIC_HOMEASSISTANT "homeassistant"
|
|
|
|
#define HOSTNAME "pitrix-%08X" // Hostname of the ESP to use for OTA and MQTT client id. %08X will be replaced by the chip id.
|
|
#define OTA_STARTUP_DELAY 10 // How many seconds to wait at startup. This is useful to prevent being unable to flash OTA by a bug in the code. Set to 0 to disable.
|
|
|
|
#define FPS 50
|
|
#define SHOW_TEXT_DELAY 100
|
|
|
|
#define MONITOR_LOOP_TIMES false
|
|
#define MONITOR_LOOP_TIME_THRESHOLD 500
|
|
#define MONITOR_LOOP_TIME_COUNT_MAX 10
|
|
|
|
// settings.effects.cycle.time = 300; // Time in seconds between cycling effects.
|
|
// settings.effects.cycle.random = true;
|
|
|
|
// settings.effects.matrix.length_min = 4;
|
|
// settings.effects.matrix.length_max = 20;
|
|
// settings.effects.matrix.speed_min = 1;
|
|
// settings.effects.matrix.speed_max = 10;
|
|
|
|
// .dynamic.single_loop_time = 40;
|
|
// .dynamic.multi_loop_time = 1400;
|
|
// .dynamic.big_loop_time = 50;
|
|
// .dynamic.big_size = 3;
|
|
|
|
// .fire.cooldown = 192;
|
|
// .fire.spark_chance = 5;
|
|
|
|
// .firework.drag = 255;
|
|
// .firework.bounce = 200;
|
|
// .firework.gravity = 10;
|
|
// .firework.sparks = 12;
|
|
|
|
// .gol.start_percentage = 90;
|
|
// .gol.blend_speed = 10;
|
|
// .gol.restart_after_steps = 100;
|
|
|
|
// .sines.count = 5;
|
|
|
|
// .snake.direction_change = 5;
|
|
// .snake.slowdown = 2;
|
|
|
|
// Stop editing here
|
|
|
|
#ifdef DEBUG
|
|
#ifdef MQTT_ENABLE
|
|
#include "my_mqtt.h"
|
|
#define LOG(msg, ...) do { \
|
|
char buffer[128]; \
|
|
snprintf_P(buffer, 128, PSTR(msg), ##__VA_ARGS__);\
|
|
mqtt_log(buffer);\
|
|
Serial.print(buffer);\
|
|
} while (0);
|
|
#define LOGln(msg, ...) do {\
|
|
char buffer[128]; \
|
|
snprintf_P(buffer, 128, PSTR(msg), ##__VA_ARGS__);\
|
|
mqtt_log_ln(buffer);\
|
|
Serial.println(buffer);\
|
|
} while (0);
|
|
#else
|
|
#define LOG(x, ...) Serial.printf(x, ##__VA_ARGS__);
|
|
#define LOGln(x, ...) { Serial.printf(x, ##__VA_ARGS__); Serial.println(); }
|
|
#endif
|
|
#define DBG(msg, ...) { Serial.printf(msg, ##__VA_ARGS__); Serial.println(); }
|
|
#else
|
|
#define LOG(x) do {} while(0);
|
|
#define LOGln(x) do {} while(0);
|
|
#define DBG(msg, ...) do {} while(0);
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined( ESP8266 ) && !defined( ESP32 )
|
|
#error "Neither ESP8266 nor ESP32 are set. Maybe you are compiling this for another platform...?"
|
|
#endif
|
|
|
|
#ifndef CONFIG_USABLE
|
|
#error "CONFIG_USABLE isn't set!"
|
|
#endif
|