Lots of re-organizing code and stuff.

This commit is contained in:
2019-05-28 21:19:35 +02:00
parent 2cbb981eea
commit bb42770af7
13 changed files with 116 additions and 545 deletions

59
include/config.h Normal file
View File

@ -0,0 +1,59 @@
#ifndef my_config_H
#define my_config_H
#include <Arduino.h>
#include <FastLED.h>
#define DEBUG
#define WIFI_SSID "Schlenz"
#define WIFI_PASS "1410WischlingenPanda"
#define LED_WIDTH 16
#define LED_HEIGHT 16
#define LED_COUNT 256
#define LED_TYPE WS2812B
#define DATA_PIN 14
#define COLOR_ORDER GRB
#define BRIGHTNESS 20 // Can be overwritten via MQTT_TOPIC_BRIGHTNESS
#define NTP_SERVER "pool.ntp.org"
#define NTP_INTERVAL 300000
#define NTP_OFFSET 7200
#define MQTT_ENABLE
#define MQTT_SERVER "10.10.2.1"
#define MQTT_PORT 1883
#define MQTT_USER "pitrix"
#define MQTT_PASS "o385gbeoijkfndvlaukebi"
#define MQTT_TOPIC "pitrix/" // MQTT-Topic to listen to. Must not start with a slash, but must end with one."
#define HOSTNAME "pitrix-%08X"
#define OTA_STARTUP_DELAY 10 // How many seconds to wait at startup. 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
#define EFFECT_CYCLE_TIME 300 // Time in seconds between cycling effects.
#define EFFECT_MATRIX_LENGTH_MIN 4
#define EFFECT_MATRIX_LENGTH_MAX 20
#define EFFECT_MATRIX_SPEED_MIN 50
#define EFFECT_MATRIX_SPEED_MAX 135
#define EFFECT_SINGLE_DYNAMIC_LOOP_TIME 200
#define EFFECT_MULTI_DYNAMIC_LOOP_TIME 1400
#ifdef DEBUG
#define LOG(x) Serial.print(x);
#define LOGln(x) Serial.println(x);
#else
#define LOG(x) ""
#define LOGln(x) ""
#endif
#endif

44
include/config.sample.h Normal file
View File

@ -0,0 +1,44 @@
//#define DEBUG
#define WIFI_SSID "....."
#define WIFI_PASS "....."
#define LED_WIDTH 16
#define LED_HEIGHT 16
#define LED_COUNT 256
#define LED_TYPE WS2812B
#define DATA_PIN 14
#define COLOR_ORDER GRB
uint8_t config_brightness = 20; // Can be overwritten via MQTT_TOPIC_BRIGHTNESS
#define NTP_SERVER "pool.ntp.org"
#define NTP_INTERVAL 300000
#define NTP_OFFSET 7200
#define MQTT_ENABLE
#define MQTT_SERVER "....."
#define MQTT_PORT 1883
#define MQTT_USER "pitrix"
#define MQTT_PASS "....."
#define MQTT_TOPIC "pitrix/" // MQTT-Topic to listen to. Must not start with a slash, but must end with one."
#define HOSTNAME "pitrix-%08X"
#define OTA_STARTUP_DELAY 5 // How many seconds to wait at startup. 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
// Effect config
uint16_t config_effect_cycle_time = 300; // Time in seconds between cycling effects.
uint16_t config_effect_matrix_length_min = 4;
uint16_t config_effect_matrix_length_max = 20;
uint16_t config_effect_matrix_speed_min = 50;
uint16_t config_effect_matrix_speed_max = 135;
uint16_t config_effect_single_dynamic_loop_time = 200;
uint16_t config_effect_multi_dynamic_loop_time = 1400;

11
include/my_fastled.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef my_fastled_H
#define my_fastled_H
#include <FastLED.h>
#include "config.h"
extern CRGB leds[LED_COUNT];
void fastled_setup();
#endif

9
include/ota.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef ota_H
#define ota_H
#include <ArduinoOTA.h>
void ota_setup();
void ota_loop();
#endif

6
include/wifi.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef wifi_H
#define wifi_H
void wifi_setup();
#endif