Renamed main files to main

This commit is contained in:
Rohan Sircar 2020-08-02 13:02:52 +05:30
parent 2df921c435
commit 458673ac86
2 changed files with 32 additions and 28 deletions

View File

@ -4,44 +4,17 @@
#include <ArduinoJson.h>
#include <SoftwareSerial.h>
#include <Streaming.h>
#define RELAY_ON 0
#define RELAY_OFF 1
#define BALLAST_SIZE 3
#include "main.h"
SoftwareSerial s(5, 6); //RX,TX
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 *ballasts[BALLAST_SIZE] = {
&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 loopMillis;
const unsigned long loopPeriod = 1000;
unsigned long data_send_millis;
const unsigned long data_send_period = 2000;
static bool manualFlag;
void setup()

31
src/main.h Normal file
View 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;