Hi, please find both ino files below as loaded onto the nano's.
Code:
//--------------------------------------------------------------------------------------
// WeatherDuino Pro2 RF Transmiter
// Compatible with Cumulus Weather Software
// Boards compatibility : WeatherDuino TX v2.xx, Board Series
// Software compatibility : WeatherDuino RX v013 series only
//
// Version: 0.13-b005
// Version Released date: 13/01/2015
// Last revision date : 10/01/2015
// Licence: GNU GPL
// Author : Werk_AG (Portugal)
//
// I wish to thanks to kevinkessler from http://kesslerarduino.wordpress.com/
// for the base code to read wind and rain sensors.
//--------------------------------------------------------------------------------------
#include <VirtualWire.h> // library for RF RX/TX
#include <Wire.h>
#include <SHT1x.h>
#include <SHT2x.h>
#include "HTU21D.h" // library for HTU21 Temp/Hum Sensor
#include <DHTxx.h> // library for DHTxx
#include <Timer.h>
#include "RunningAverage.h"
#include <EEPROM.h> // Library to eeprom read and write
// --------------------------------------------------------------------------------------
// User configurable options start here.
// --------------------------------------------------------------------------------------
byte StationID = 0xA1; // Must be equal to your RX Unit (Value from 0x00 to 0xFF)
byte UnitID = 0; // If you use only one TX unit define it as UnitID = 0
// For a second TX unit, define it as UnitID = 1
// ------- Let's define the data we want to send --------------
//#define ID0 0 // Temp / Hum sensors - 0 for SHT2x sensor, 1 for HTU21 sensor
#define ID1 0 // Temp / Hum sensors - 0 for SHT1x sensor, 1 for DHT22 sensor
#define ID2 // Wind data
#define ID3 // Rain data
//#define ID4 // UV / SolRad data
#define ID5 // Hardware Status - System Temp, Battery Voltage etc
byte fanOn_HiTemp = 32; // RS Fan turn on when outside temperature is >= than this value (ºC)
byte fanOn_LowTemp = 3; // RS Fan turn on when outside temperature is <= than this value (ºC)
byte fanOn_LowWind = 2; // RS Fan turn on when Wind Average is <= than this value (m/s)
// ---------------------------------------------------------------------------------------------------
// There is nothing to edit below this line !!!
// ---------------------------------------------------------------------------------------------------
//#define DebugID0
//#define DebugID1
//#define DebugID2
//#define DebugID3
//#define DebugID4
//#define DebugID5
//#define Local_TestMode
#if ID0 == 1
HTU21D myHTU21;
#endif
#if ID1 == 0
// Specify data and clock connections and instantiate SHT1x object
#define dataPin 6
#define clockPin 9
SHT1x sht1x(dataPin, clockPin);
#endif
#if ID1 == 1
// DTH22 Data wire is plugged into port 6 on the Arduino
// Connect a 10K resistor between VCC and the data pin (strong pullup)
#define DHT22_PIN 6
DHTxx dht (DHT22_PIN);
#endif
// --- Analog Pins ---
#define SolarRad_PIN A0
#define IndiceUV_PIN A1
#define BatVolt_PIN A2
#define VANE_PIN A3
#define SysTemp_PIN A7
// --- Digital Pins ---
#define RAIN_GAUGE_INT 0
#define ANEMOMETER_INT 1
#define RAIN_GAUGE_PIN 2
#define ANEMOMETER_PIN 3
#define VANE_PWR 4
#define Fan_PIN 5
#define TXPower_PIN 7
#define TX_PIN 8 // Transmitter connected to pin 8
// --- Wind ------------
#define WIND_FACTOR 0.666667 // Factor 2.4 Km/h = 0,66666666666667 M/s
#define TEST_PAUSE 30 // Value for WindAverage - 30 secs
volatile unsigned long anem_count = 0;
volatile unsigned long anem_last = 0;
volatile unsigned long anem_min = 0xffffffff;
unsigned int WindAvg, WindGust;
unsigned int last_WindGust = 50000;
RunningAverage raWindAvg(10);
// --- Vane -----------
const int vaneValues[] PROGMEM={66,84,92,127,184,244,287,406,461,600,631,702,786,827,889,946};
const int vaneDirections[] PROGMEM={1125,675,900,1575,1350,2025,1800,225,450,2475,2250,3375,0,2925,3150,2700};
#ifdef Local_TestMode
const char vaneDirectionsText[16] [4] = {"N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"};
String winddr;
#endif
unsigned int WindDir;
// --- Rain -----------
//#define RAIN_FACTOR 0.3 // Datasheet value = 0.2794
const float RAIN_FACTOR = 0.3; // Datasheet value = 0.2794
volatile unsigned long rain_count = 0;
volatile unsigned long rain_last = 0;
volatile unsigned long RainFall_rate;
unsigned int TotalRainTips;
unsigned int LastHourRainTips;
unsigned int lasthour_TotalRainTips = 0;
unsigned int last_TotalRainTips = 0;
//float TotalRain;
byte Pool_Rain_Interval = 31; //Pool Rain tick counter every 31 seconds
byte TotalRainTips_Eeprom_adr = 10;
// ---------------------
RunningAverage raSolarRad(4);
RunningAverage raIndiceUV(4);
char DataPacket[32];
byte PacketID;
byte RSfan;
unsigned int avg_SolarRad, SolarRad, avg_IndiceUV;
float IndiceUV;
float TotalRain; // Used only in Debug Mode
unsigned int BatVolt, SysTempADC;
int ID0_TemperaturaExt, ID1_TemperaturaExt;
int ID0_HumidadeExt, ID1_HumidadeExt;
#ifdef Local_TestMode
// ---------- Temp Var for debug ---------------------
int DHT_HumidadeInt = 500;
int DHT_TemperaturaInt = 200;
int DHT_TemperaturaInt_offset = 0.0;
float pressure = 100000;
float pressure_offset = 0.0;
//------------------------------------------------
#endif
Timer t;
// --------- Soft Reset -------------------------------------------
void(*softReset)(void) = 0; //SoftwareReset vector (goto address 0)
// SETUP
//--------------------------------------------------------------------------------------
void setup()
{
// erase_eeprom();
//------------------------------------------------------------
// Setup the transmitter
//------------------------------------------------------------
vw_set_ptt_pin(TXPower_PIN);
vw_set_tx_pin(TX_PIN); // Transmitter connected to pin 8
vw_setup(1000); // Bits per second
//------------------------------------------------------------
pinMode(13,OUTPUT);
digitalWrite(13, LOW);
pinMode(Fan_PIN,OUTPUT);
pinMode(TXPower_PIN,OUTPUT);
Wire.begin();
#if ID0 == 1
myHTU21.begin();
#endif
#ifdef Local_TestMode
Serial.begin(19200);
t.every(3050, Cumulus_Output);
#endif
#ifdef ID0
t.every(19000, send_SensorID0);
#endif
#ifdef ID1
t.every(53000, send_SensorID1);
#endif
#ifdef ID2
setupWindInts();
t.every(5000, send_SensorID2); // Send PacketID2. Before sending, call getGust() function
t.every(TEST_PAUSE * 1000, getUnitWind); // Calls Wind Average function +- every TEST_PAUSE seconds
#endif
#ifdef ID3
setupRainInts();
TotalRainTips = eepromReadInt(TotalRainTips_Eeprom_adr);
t.every(Pool_Rain_Interval * 1000, send_SensorID3);
t.every(3600000, TotalRainTips_toEeprom); // Every 1 hours call routine to save Rain Totals to eeprom (Routine only save if value is different from last call)
#endif
#ifdef ID4
t.every(37000, send_SensorID4);
//t.every(5000, send_SensorID4); // For testing...
#endif
#ifdef ID5
t.every(97000, send_SensorID5);
#endif
}
// MAIN LOOP
//--------------------------------------------------------------------------------------
void loop()
{
// Reboot if millis is close to rollover. RTC_Millis won't work properly if millis rolls over. Takes 49 days to rollover
if( millis() > 4294000000UL ) softReset();
t.update();
}
// End MAIN LOOP ------------------------------------------------------------------------
Code:
/***************************************************************************
WeatherDuino Pro2 RF Receiver
Compatible with Cumulus Weather Software
RX Boards compatibility: WeatherDuino RX Boards Series v2.xx, 3.xx and v4.xx
Software compatibility : WeatherDuino TX v013 series only
Version: 0.13-b014 : NEEDS Arduino 1.5.7 or newer to compilie
Version Release date : xx/xx/2015
Last revision date : 14/01/2015
Ver start dev date : 03/10/2014
Licence : GNU GPL
Author : Werk_AG (Portugal)
Weather Station Website: http://www.meteocercal.info
Support Forum : http://www.meteocercal.info/forum/Forum-WeatherDuino-Pro2
There is no manual. Look at the code, almost anything important is commented.
User configurable options are on first lines of code, just after include statements.
**************************************************************************************/
/*
// BOF preprocessor bug prevent - insert me on top of your arduino-code
#if 1
__asm volatile ("nop");
#endif
*/
#include <SPI.h>
#include <VirtualWire.h> // library for RF RX/TX
#include <Wire.h> // needed for BMP085, RTC, LCD
#include <RTC_DS3231.h> // From https://github.com/mizraith/RTClib
#include <DHTxx.h> // library for DHTxx
#include <BMP085.h>
#include <LiquidCrystal_I2C.h> // Library for LCD
#include <EEPROM.h> // Library to eeprom read and write
#include <ClickButton.h> // Button Library
#include <AC_GFX.h>
#include <AC_ST7735.h> // TFT Hardware-specific library
#include <SerialCommand.h>
#include "VP2crc.h"
#include "data_structs.h"
#include "Davisdef.h"
// --------------------------------------------------------------------------------------
// User configurable options start here.
// --------------------------------------------------------------------------------------
// --- Station ID, use the same value in your TX unit
const byte StationID = 0xA1;
// --- Define Software Operation Mode
#define Work_Mode 0 // Mode 0= Davis VP2 Emulation Mode, Mode 1= EasyWeather Mode
// --- Define your Display type
#define DisplayType 0 // 0= TFT, 1= LCD 20x4, 2= LCD 16x2
// --- Define Backlight timeOut
// --- With RX boards version <= 3.01 without the TFT backlight control mod, always set this value to 0
byte BackLight_Timeout = 0; // Timeout for TFT backlight in minutes (1 to 255). 0 = Always ON
// --- Define Temperature and Wind Display units
byte Temp_Display_Unit = 0; // 0 for ºC, 1 for ºF
byte Wind_Display_Unit = 1; // 0 for Km/h, 1 for mph, 2 for m/s
// --- Fine adjusts for Inside Temperature and Barometer
const int TemperaturaInt_offset = 0; // Inside Temperature Fine Adjust in Tenths of Degree (-4 = -0,4ºC)
const float pressure_offset = -1.0; // Pressure Fine Adjust in mB
// --- Some Data from your Weather Station location
#define LATITUDE 518 // Put here your Station latitude in tenths of degrees North
#define LONGITUDE -33 // Put here your Station longitude in tenths of degrees East
#define ELEVATION 62 // Put here your Station height above sea level in Meters
// --- Define Starting Hour of your Meteorological Day
#define MeteoDay_HStart 1 // Use values from 0 to 23
// --- Define Wind Speed and Wind Gust resolution
#define VP2_WindRes 2 // If set to 2, set Cumulus Wind Speed and Wind Gust multipliers to 0.448. Wind Resolution 0.72 Km/h
// If set to 1, set Cumulus Wind Speed and Wind Gust multipliers to 0.224. Wind Resolution 0.36 Km/h
// WARNING !!! Setting this variable to 1 allows a better wind speed and gust resolution,
// but also limits both of them, to a maximum reading of just 91.8 Km/h
// This setting only have effect when the software is used in Davis VP2 emulation mode
// --- Define type of outside temperature / humidity sensor
#define TH_OutSensor 1 // 0 for SHT21 or HTU21D sensor, 1 for SHT1x or DHT22 sensor,
// ---- Let's define the source of the sensors we want to receive
// ---- If you have all the sensors connected to only one TX board, always select Unit 0
#define TH_OutUnit 0 // 0 for Temp/Hum sensor connected to TX_Unit 0, 1 for Temp/Hum sensor connected to TX_Unit 1
#define WIND_OutUnit 0 // 0 for Wind instruments connected to TX_Unit 0, 1 for TX_Unit 1, 2 for Auriol RF Odometer
#define RAIN_OutUnit 0 // 0 for Rain Gauge connected to TX_Unit 0, 1 for TX_Unit 1, 2 for Auriol RF Rain Gauge
#define SRUV_OutUnit 0 // 0 for Solar Rad / UV sensors connected to TX_Unit 0, 1 for TX_Unit1
// ---------------------------------------------------------------------------------------------------
// There is nothing to edit below this line !!!
// ---------------------------------------------------------------------------------------------------
String Software_Ver = "v0.13-b014";
// ------ Define hardware PINS ----------------------------------------------------------
#define Led1_PIN 2
#define BackLight_PIN 3
#define RX_PIN 8
#define DHT22_PIN 9
#define Button1_PIN 5
#define TX_PIN 14 // A0
#define TX_Power_PIN 15 // A1
// -------------------------------------------------------------------------------------
#define BMP085_ADDRESS 0x77 // I2C address of BMP085
#if Work_Mode == 0
//#define TIME_ZONE_INDEX
#define DST_MANAUTO 1
#define DST_OFFON 0
//#define GMT_OFFSET_LSB
//#define GMT_OFFSET_MSB
#define GMT_OR_ZONE 0
#define UNIT_BITS 0x3E // BAROMETER_UNITS_HPA | TEMP_UNITS_TENTHS_C | ELEVATION_UNITS_M | RAIN_UNITS_MM | WIND_UNITS_MPH
#define SETUP_BITS 0x51 // LONGITUDE_WEST | LATITUDE_NORTH | RAIN_COLLECTOR_02MM | WIND_CUP_LARGE | MONTH_DAY_MONTHDAY | AMPM_TIME_MODE_24H
#define RAIN_YEAR_START 1 // 1 = Jan
#define ARCHIVE_PERIOD 15
#define DAVIS_PACKET_LEN 8 // ISS has fixed packet lengths of eight bytes, including CRC
#define LOOP_PACKET_LENGTH 97
#define LOOP_INTERVAL 2500
unsigned long lastLoopTime = 0;
unsigned int loopCount = 0;
#endif
#if DisplayType == 0
//#define TFT_SCLK 13
//#define TFT_MOSI 11
//#define TFT_CS 10 // Chip select line for TFT display
//#define TFT_DC 6 // Data/command line for TFT
//#define TFT_RST 7 // Reset line for TFT (or connect to +5V)
//AC_ST7735 tft = AC_ST7735(TFT_CS, TFT_DC, TFT_RST); // Hardware SPI Mode
AC_ST7735 tft = AC_ST7735(10, 6, 7); // Hardware SPI Mode
byte TFT_mode = 1;
#endif
#if DisplayType >= 1
// set the LCD address to 0x27 for a 20 chars 4 line display
// Set the pins on the I2C chip used for LCD connections:
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
byte lcd_L_info = 1;
//boolean LCD_flip = true;
// make one custom character:
byte heart[8] = {
0b00000,
0b01010,
0b11111,
0b11111,
0b11111,
0b01110,
0b00100,
0b00000
};
#endif
// Important for Auriol data receiving - NEVER TOUCH THIS ---------
#if (WIND_OutUnit == 2 || RAIN_OutUnit == 2)
#define nobits 36
#define smin 7500
#define smax 9900
#define semin 250
#define semax 750
#define lmin 1700
#define lmax 2300
#define hmin 3700
#define hmax 4300
#endif
// ---------------------------------------------------------------
// the Button
ClickButton button1(Button1_PIN, LOW, CLICKBTN_PULLUP);
const char vaneDirectionsText[16] [4] = {"N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"};
char RX_DataPacket[32];
char TX_DataPacket[32];
const float UnitTip_value[3] = {0.3, 0.3, 0.25};
float pressure;
float rainf;
//float RainToday;
float averagew_ms, gust_ms;
float Output_WSpeed, Output_WGust, Output_RToday;
float Output_UV;
unsigned long last_millis_0;
unsigned long StartTime, BackLight_Timer;
int ButtonFunction = 0; // Arbitrary Button function
int TemperaturaInt;
int Output_T_Int, Output_T_Out;
unsigned int Output_H_Int, Output_H_Out;
unsigned int Output_SRad;
unsigned int windd;
unsigned int last10min_TotalRain_tips;
unsigned int RainToday_tips;
unsigned int DaysWithoutRain;
unsigned int YearNow_Eeprom;
const byte Display_Units = (Temp_Display_Unit << 4) | Wind_Display_Unit;
const byte TotalRain_tips_Eeprom_adr = 50 + (RAIN_OutUnit * 10);
const byte RainDayBegin_tips_Eeprom_adr = 80 + (RAIN_OutUnit * 10);
const byte RainYearBegin_tips_Eeprom_adr = 110 + (RAIN_OutUnit * 10);
const byte thisYearRain_tips_Eeprom_adr = 140 + (RAIN_OutUnit * 10);
const byte DayNow_Eeprom_adr = 170;
const byte YearNow_Eeprom_adr = 180;
const byte DaysWithoutRain_Eeprom_adr = 190;
const byte FirstRunCheck_Eeprom_adr = 200;
byte FirstRunCheck;
byte DayNow_Eeprom;
byte RSfan;
byte last_min = 99;
byte last_min1 = 99;
byte last_second0 = 99;
byte last_second1 = 99;
boolean StartUp = true;
boolean sysinfo = false;
boolean init_SysInfoTFT = true;
boolean BackLight_State = true;
boolean validPacket;
String code;
// ------ Create objects ---------------
RTC_DS3231 RTC;
DHTxx dht (DHT22_PIN);
BMP085 bmp;
DavisCRC davis;
SerialCommand sCmd;
LoopPacket loopData;
// ------ Setup ----------------
void setup()
{
Serial.begin(19200);
// --- If Auriol Wind is selected in VP2 mode, auto-disable data relay (because short memory) -------
#if (Work_Mode == 0 && WIND_OutUnit == 2)
#define TX_relay 0
#else
#define TX_relay 1
#endif
//---------------------------------------------------------
// Receiver setup
//---------------------------------------------------------
vw_set_rx_pin(RX_PIN);
vw_setup(1000); // Bits per sec
vw_rx_start(); // Start
pinMode(RX_PIN, INPUT);
//#ifdef RainAuriol
// digitalWrite(receiver_PIN, HIGH); // Activa internal pull up resistor
//#endif
//------------------------------------------------------------
// Transmiter Setup
//------------------------------------------------------------
#if TX_relay == 1
pinMode(TX_Power_PIN, OUTPUT);
pinMode(TX_PIN, OUTPUT);
vw_set_ptt_pin(TX_Power_PIN);
vw_set_tx_pin(TX_PIN); // Transmitter connected to pin A0
#endif
//------------------------------------------------------------
pinMode(Led1_PIN, OUTPUT);
//pinMode(Button1_PIN,INPUT);
//digitalWrite(Button1_PIN, HIGH); // Activa internal pull up resistor - Also done in Button library
pinMode(BackLight_PIN, OUTPUT);
digitalWrite(BackLight_PIN, HIGH); // Turns ON TFT/LCD backlight
Wire.begin();
bmp.begin();
RTC.begin();
// Set RTC to compile time
/*
DateTime now = RTC.now();
DateTime compiled = DateTime(__DATE__, __TIME__);
if (now.unixtime() != compiled.unixtime()) {
//Serial.println("RTC is older than compile time! Updating");
RTC.adjust(DateTime(__DATE__, __TIME__));
}
*/
#if DisplayType == 0
#define ST7735_DARKGRAY 0x5ACB // Box Backgound
#define ST7735_LIGHTGRAY 0xB5B6 // Box Contour
#define ST7735_SKYBLUE 0x7D5F
#define ST7735_NICEGREEN 0x0551
#define ST7735_LORANGE 0xFCA0
#define ST7735_VIOLET 0xB01C
tft.initR(INITR_BLACKTAB); // initialize a ST7735R chip, Black Tab
// tft.setRotation(0); // 0 (0 degrees), 1 (90 degrees), 2 (180 degrees) and 3 (270 degrees)
// tft.invertDisplay(false);
tft.setTextWrap(false);
init_TFT_M1();
#endif
#if DisplayType == 1
init_LCD20x4();
#endif
#if DisplayType == 2
init_LCD16x2();
#endif
#if Work_Mode == 0
// Initialize the loop data array
memcpy(&loopData, &loopInit, sizeof(loopInit));
//Setup callbacks for SerialCommand commands
sCmd.addCommand("LOOP", cmdLoop); // Send the loop data
sCmd.addCommand("NVER", cmdNver); // Send the version string
sCmd.addCommand("TEST", cmdTest); // Echo's "TEST"
sCmd.addCommand("VER", cmdVer); // Send the associated date for this version
sCmd.addCommand("WRD\x12M", cmdWRD); // Support the Davis legacy "WRD" command
//sCmd.addCommand("GETTIME", cmdGettime); // Send back current RTC date/time
sCmd.addCommand("SETTIME", cmdSettime); // Update current RTC date/time from PC
sCmd.addCommand("EEBRD", cmdEebrd); // EEPROM Read
sCmd.setDefaultHandler(cmdUnrecognized); // Handler for command that isn't matched
sCmd.setNullHandler(cmdWake); // Handler for an empty line to wake the simulated console
//sCmd.addCommand("BARDATA", cmdBardata); // Barometer calibration data
//sCmd.addCommand("DMPAFT", cmdDmpaft); // Download archive records after date:time specified
//erase_eeprom();
EEPROM.write(EEPROM_LATITUDE_LSB, LATITUDE & 0xFF);
EEPROM.write(EEPROM_LATITUDE_MSB, LATITUDE >> 8);
EEPROM.write(EEPROM_LONGITUDE_LSB, LONGITUDE & 0xFF);
EEPROM.write(EEPROM_LONGITUDE_MSB, LONGITUDE >> 8);
EEPROM.write(EEPROM_ELEVATION_LSB, ELEVATION & 0xFF);
EEPROM.write(EEPROM_ELEVATION_MSB, ELEVATION >> 8);
//EEPROM.write(EEPROM_TIME_ZONE_INDEX, TIME_ZONE_INDEX);
EEPROM.write(EEPROM_DST_MANAUTO, DST_MANAUTO);
EEPROM.write(EEPROM_DST_OFFON, DST_OFFON);
//EEPROM.write(EEPROM_GMT_OFFSET_LSB, GMT_OFFSET_LSB);
//EEPROM.write(EEPROM_GMT_OFFSET_MSB, GMT_OFFSET_MSB);
EEPROM.write(EEPROM_GMT_OR_ZONE, GMT_OR_ZONE);
EEPROM.write(EEPROM_UNIT_BITS, UNIT_BITS);
EEPROM.write(EEPROM_SETUP_BITS, SETUP_BITS);
EEPROM.write(EEPROM_RAIN_YEAR_START, RAIN_YEAR_START);
//EEPROM.write(EEPROM_ARCHIVE_PERIOD, ARCHIVE_PERIOD);
#endif
//EEPROM.write(DayNow_Eeprom_adr,0);
//eepromWriteInt(YearNow_Eeprom_adr, 0);
//eepromWriteInt(RainDayBegin_tips_Eeprom_adr, 0);
//eepromWriteInt(RainYearBegin_tips_Eeprom_adr, 0);
//eepromWriteInt(thisYearRain_tips_Eeprom_adr, 0);
//eepromWriteInt(TotalRain_tips_Eeprom_adr, 0);
//eepromWriteInt(DaysWithoutRain_Eeprom_adr, 1);
//EEPROM.write(FirstRunCheck_Eeprom_adr, 0);
Unit[RAIN_OutUnit].RainDayBegin_tips = eepromReadInt(RainDayBegin_tips_Eeprom_adr);
Unit[RAIN_OutUnit].RainYearBegin_tips = eepromReadInt(RainYearBegin_tips_Eeprom_adr);
Unit[RAIN_OutUnit].TotalRain_tips = eepromReadInt(TotalRain_tips_Eeprom_adr);
DaysWithoutRain = eepromReadInt(DaysWithoutRain_Eeprom_adr);
YearNow_Eeprom = eepromReadInt(YearNow_Eeprom_adr);
DayNow_Eeprom = EEPROM.read(DayNow_Eeprom_adr);
FirstRunCheck = EEPROM.read(FirstRunCheck_Eeprom_adr);
StartTime = millis();
BackLight_Timer = StartTime;
/*
Serial.println(EEPROM.read(FirstRunCheck_Eeprom_adr));
Serial.println(EEPROM.read(DayNow_Eeprom_adr));
Serial.println(eepromReadInt(YearNow_Eeprom_adr));
Serial.println(eepromReadInt(RainDayBegin_tips_Eeprom_adr));
Serial.println(eepromReadInt(RainYearBegin_tips_Eeprom_adr));
Serial.println(eepromReadInt(thisYearRain_tips_Eeprom_adr));
Serial.println(eepromReadInt(TotalRain_tips_Eeprom_adr));
Serial.println(eepromReadInt(DaysWithoutRain_Eeprom_adr));
*/
}
// --------- End Setup ----------------
void loop()
{
DateTime now = RTC.now();
if (millis() - StartTime > 120000)
{
Rain_updates(now.year(), now.month(), now.day(), now.hour(), now.minute());
StartUp = false;
}
if (vw_have_message()) ReceiveDataRF();
#if RAIN_OutUnit == 2
Auriol_Rain();
#endif
#if WIND_OutUnit == 2
Auriol_Wind();
#endif
// -- Davis VP2 Mode
#if Work_Mode == 0
if (!StartUp) // Prevents Cumulus connection before 2 minutes after a restart.
{
if (Serial.available() > 0) loopCount = 0; // if we receive anything while sending LOOP packets, stop the stream
sendLoopPacket(); // send out a LOOP packet if needed
sCmd.readSerial(); // Process serial commands
}
#endif
// -- EasyWeather Mode - Output every 10 Sec
#if Work_Mode == 1
if (now.second() % 10 == 0 && now.second() != last_second0)
{
easyweather_Output();
last_second0 = now.second();
}
#endif
#if TX_relay == 1
// ---------------------- Broadcast Time every 15 Minutes -------------------------
if (now.minute() % 15 == 0 && now.second() == 0)
{
int Master_Time = now.hour() << 8 | now.minute();
sendData(StationID, 80, now.year() - 1900, now.month() , now.day(), Master_Time);
}
#endif
// --- Read local sensors every minute
if (now.minute() % 1 == 0 && now.minute() != last_min1)
{
read_BMP();
read_DHT();
last_min1 = now.minute();
//Update_Display(); // HERE JUST FOR TESTING
}
if (BackLight_Timeout != 0 && (millis() - BackLight_Timer) > BackLight_Timeout * 60000)
{
BackLight_State = false;
digitalWrite(BackLight_PIN, BackLight_State);
}
// -- Update seconds on TFT Clock
#if DisplayType == 0
if ((BackLight_State == true) && (sysinfo == false) && (now.second() != last_second1)) // Clock update interval - 1s
{
DisplayClock_TFT(now.year(), now.month(), now.day(), now.hour(), now.minute(), now.second());
last_second1 = now.second();
}
#endif
// Update button state
button1.Update();
// Save click codes in ButtonFunction, as click codes are reset at next Update()
if (button1.clicks != 0) ButtonFunction = button1.clicks;
if(button1.clicks == 1) B_click();
if(ButtonFunction == 2) B_doubleclick();
#if DisplayType == 0
if(ButtonFunction == -1) B_LongPress();
#endif
} // End void loop
Hi.
all the sensors were connected to the TX unit.