Browse Source

Renamed main files to main

staging
Rohan Sircar 4 years ago
parent
commit
458673ac86
  1. 29
      src/main.cpp
  2. 31
      src/main.h

29
src/sketch_oct28a2.cpp → src/main.cpp

@ -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

@ -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…
Cancel
Save