Renamed main files to main
This commit is contained in:
parent
2df921c435
commit
458673ac86
@ -4,44 +4,17 @@
|
|||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <SoftwareSerial.h>
|
#include <SoftwareSerial.h>
|
||||||
#include <Streaming.h>
|
#include <Streaming.h>
|
||||||
#define RELAY_ON 0
|
#include "main.h"
|
||||||
#define RELAY_OFF 1
|
|
||||||
#define BALLAST_SIZE 3
|
|
||||||
|
|
||||||
SoftwareSerial s(5, 6); //RX,TX
|
SoftwareSerial s(5, 6); //RX,TX
|
||||||
RTC_DS1307 rtc;
|
RTC_DS1307 rtc;
|
||||||
|
|
||||||
struct ballast
|
|
||||||
{
|
|
||||||
int id;
|
|
||||||
int shour;
|
|
||||||
int smin;
|
|
||||||
uint32_t fadePeriod;
|
|
||||||
int ehour;
|
|
||||||
int emin;
|
|
||||||
int stage;
|
|
||||||
int brightness;
|
|
||||||
int pin;
|
|
||||||
unsigned long fadeStartMillis;
|
|
||||||
int relayPin;
|
|
||||||
};
|
|
||||||
struct ballast ballast1, ballast2, ballast3;
|
struct ballast ballast1, ballast2, ballast3;
|
||||||
struct ballast *ballasts[BALLAST_SIZE] = {
|
struct ballast *ballasts[BALLAST_SIZE] = {
|
||||||
&ballast1, &ballast2, &ballast3};
|
&ballast1, &ballast2, &ballast3};
|
||||||
|
|
||||||
void setupBallast(ballast *b);
|
|
||||||
int setupBallasts(ballast *b_arr[], size_t arr_size, JsonObject &root);
|
|
||||||
void doBallast(ballast *b, int hr, int mn);
|
|
||||||
void updateBallast(ballast *b, JsonObject &root);
|
|
||||||
void manualMode(ballast *b);
|
|
||||||
int getFreeRam();
|
|
||||||
const size_t bufferSize = JSON_ARRAY_SIZE(3) + JSON_OBJECT_SIZE(2) + 3 * JSON_OBJECT_SIZE(5) + 180;
|
|
||||||
|
|
||||||
unsigned long currentMillis;
|
unsigned long currentMillis;
|
||||||
unsigned long loopMillis;
|
unsigned long loopMillis;
|
||||||
const unsigned long loopPeriod = 1000;
|
|
||||||
unsigned long data_send_millis;
|
unsigned long data_send_millis;
|
||||||
const unsigned long data_send_period = 2000;
|
|
||||||
static bool manualFlag;
|
static bool manualFlag;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
31
src/main.h
Normal file
31
src/main.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#include <ArduinoJson.h>
|
||||||
|
#define RELAY_ON 0
|
||||||
|
#define RELAY_OFF 1
|
||||||
|
#define BALLAST_SIZE 3
|
||||||
|
|
||||||
|
struct ballast
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
int shour;
|
||||||
|
int smin;
|
||||||
|
uint32_t fadePeriod;
|
||||||
|
int ehour;
|
||||||
|
int emin;
|
||||||
|
int stage;
|
||||||
|
int brightness;
|
||||||
|
int pin;
|
||||||
|
unsigned long fadeStartMillis;
|
||||||
|
int relayPin;
|
||||||
|
};
|
||||||
|
|
||||||
|
void setupBallast(ballast *b);
|
||||||
|
int setupBallasts(ballast *b_arr[], size_t arr_size, JsonObject &root);
|
||||||
|
void doBallast(ballast *b, int hr, int mn);
|
||||||
|
void updateBallast(ballast *b, JsonObject &root);
|
||||||
|
void manualMode(ballast *b);
|
||||||
|
int getFreeRam();
|
||||||
|
const size_t bufferSize = JSON_ARRAY_SIZE(3) + JSON_OBJECT_SIZE(2) + 3 * JSON_OBJECT_SIZE(5) + 180;
|
||||||
|
|
||||||
|
const unsigned long loopPeriod = 1000;
|
||||||
|
|
||||||
|
const unsigned long data_send_period = 2000;
|
Loading…
Reference in New Issue
Block a user