Compare commits
3 Commits
b56c1a143c
...
90d98bf848
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90d98bf848 | ||
|
|
536b203cb7 | ||
|
|
4e1c4ff2f1 |
@@ -11,7 +11,7 @@ TFT_eSPI tft = TFT_eSPI(); // domyślna konfiguracja z User_Setup.h
|
|||||||
// obsługa przycisków zmieniających menu i LED
|
// obsługa przycisków zmieniających menu i LED
|
||||||
//160x128
|
//160x128
|
||||||
|
|
||||||
#define Version "0.0.0"
|
#define Version "0.0.1"
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <Adafruit_GFX.h>
|
#include <Adafruit_GFX.h>
|
||||||
@@ -162,8 +162,6 @@ void loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (menu_number == 0 ) {//show menu
|
if (menu_number == 0 ) {//show menu
|
||||||
tft.setTextSize(2);
|
tft.setTextSize(2);
|
||||||
tft.drawString("GAIN:" + String(gainValue),0, 0);
|
tft.drawString("GAIN:" + String(gainValue),0, 0);
|
||||||
@@ -177,11 +175,9 @@ void loop() {
|
|||||||
|
|
||||||
delay(100);
|
delay(100);
|
||||||
}
|
}
|
||||||
|
// show calculated values
|
||||||
// //
|
|
||||||
if (menu_number == 1 || menu_number == 5 ) {//show calculated values
|
if (menu_number == 1 || menu_number == 5 ) {//show calculated values
|
||||||
drawControls();
|
drawControls();
|
||||||
//tft.setRotation(0);
|
|
||||||
tft.drawString("Calculated Values",0,0);
|
tft.drawString("Calculated Values",0,0);
|
||||||
tft.drawString("R:" + String(CalcRed),0, 20);
|
tft.drawString("R:" + String(CalcRed),0, 20);
|
||||||
tft.drawString("O:" + String(CalcOrange),0, 39);
|
tft.drawString("O:" + String(CalcOrange),0, 39);
|
||||||
@@ -202,163 +198,101 @@ void loop() {
|
|||||||
tft.drawString("V:" + String(RawViolet),0, 115);
|
tft.drawString("V:" + String(RawViolet),0, 115);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//show relative calculated values graph
|
||||||
|
if (menu_number == 3 || menu_number == 7 ){
|
||||||
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
|
|
||||||
|
maxValue = 0.0;
|
||||||
|
minValue = 0.0;
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
maxValue = max(maxValue, ReadValues[i]);
|
||||||
|
}
|
||||||
|
HeightRed = int((CalcRed / maxValue) * GraphHeight);
|
||||||
|
HeightOrange = int((CalcOrange / maxValue) * GraphHeight);
|
||||||
|
HeightYellow = int((CalcYellow / maxValue) * GraphHeight);
|
||||||
|
HeightGreen = int((CalcGreen / maxValue) * GraphHeight);
|
||||||
|
HeightBlue = int((CalcBlue / maxValue) * GraphHeight);
|
||||||
|
HeightViolet = int((CalcViolet / maxValue) * GraphHeight);
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
maxValue = min(maxValue, ReadValues[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
tft.fillRect(minValue, 0, 240, maxValue-minValue, TFT_BLACK);
|
||||||
|
drawControls();
|
||||||
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
|
tft.drawString("Relvative Calculated Values",0,0);
|
||||||
|
drawControls();
|
||||||
|
tft.fillRect(0 * GrapWidth, GraphHeight - HeightRed+8, GrapWidth, HeightRed, TFT_RED);
|
||||||
|
tft.fillRect(1 * GrapWidth + 1, GraphHeight - HeightOrange+8, GrapWidth, HeightOrange, TFT_ORANGE);
|
||||||
|
tft.fillRect(2 * GrapWidth + 2, GraphHeight - HeightYellow+8, GrapWidth, HeightYellow, TFT_YELLOW);
|
||||||
|
tft.fillRect(3 * GrapWidth + 3, GraphHeight - HeightGreen+8, GrapWidth, HeightGreen, TFT_GREEN);
|
||||||
|
tft.fillRect(4 * GrapWidth + 4, GraphHeight - HeightBlue+8, GrapWidth, HeightBlue, TFT_BLUE);
|
||||||
|
tft.fillRect(5 * GrapWidth + 5, GraphHeight - HeightViolet+8, GrapWidth, HeightViolet, TFT_MAGENTA);
|
||||||
|
tft.setCursor(1 * GrapWidth -10, 0);
|
||||||
|
|
||||||
|
|
||||||
////tft.setRotation(0);
|
|
||||||
|
|
||||||
// //show relative calculated values graph
|
tft.setTextColor(TFT_BLACK, TFT_RED);
|
||||||
// if (menu_number == 3 || menu_number == 7 ){
|
tft.drawString(" R:",1 * GrapWidth -20, 120);
|
||||||
// maxValue = 0;
|
tft.setTextColor(TFT_BLACK, TFT_ORANGE);
|
||||||
// drawControls();
|
tft.drawString(" O:",2 * GrapWidth -19, 120);
|
||||||
// ////tft.setRotation(0);
|
tft.setTextColor(TFT_BLACK, TFT_YELLOW);
|
||||||
|
tft.drawString(" Y:",3 * GrapWidth -18, 120);
|
||||||
// for (int i = 0; i < 5; i++) {
|
tft.setTextColor(TFT_BLACK, TFT_GREEN);
|
||||||
// maxValue = max(maxValue, ReadValues[i]);
|
tft.drawString(" G:",4 * GrapWidth -17, 120);
|
||||||
// }
|
tft.setTextColor(TFT_BLACK, TFT_BLUE);
|
||||||
// HeightRed = int((CalcRed / maxValue) * GraphHeight);
|
tft.drawString(" B:",5 * GrapWidth -16, 120);
|
||||||
// HeightOrange = int((CalcOrange / maxValue) * GraphHeight);
|
tft.setTextColor(TFT_BLACK, TFT_MAGENTA);
|
||||||
// HeightYellow = int((CalcYellow / maxValue) * GraphHeight);
|
tft.drawString(" V:",6 * GrapWidth -15, 120);
|
||||||
// HeightGreen = int((CalcGreen / maxValue) * GraphHeight);
|
maxValue = 0.0;
|
||||||
// HeightBlue = int((CalcBlue / maxValue) * GraphHeight);
|
minValue = 0.0;
|
||||||
// HeightViolet = int((CalcViolet / maxValue) * GraphHeight);
|
}
|
||||||
|
|
||||||
|
|
||||||
// tft.setCursor(1 * GrapWidth -10, 10);
|
|
||||||
// if (HeightRed >25){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// tft.fillRect(0 * GrapWidth, GraphHeight - HeightRed, GrapWidth, HeightRed, RED);
|
|
||||||
// tft.fillRect(1 * GrapWidth + 1, GraphHeight - HeightOrange, GrapWidth, HeightOrange, ORANGE);
|
|
||||||
// tft.fillRect(2 * GrapWidth + 2, GraphHeight - HeightYellow, GrapWidth, HeightYellow, YELLOW);
|
|
||||||
// tft.fillRect(3 * GrapWidth + 3, GraphHeight - HeightGreen, GrapWidth, HeightGreen, GREEN);
|
|
||||||
// tft.fillRect(4 * GrapWidth + 4, GraphHeight - HeightBlue, GrapWidth, HeightBlue, BLUE);
|
|
||||||
// tft.fillRect(5 * GrapWidth + 5, GraphHeight - HeightViolet, GrapWidth, HeightViolet, MAGENTA);
|
|
||||||
// tft.setCursor(1 * GrapWidth -10, 0);
|
|
||||||
// if (HeightRed > 28){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }else {
|
|
||||||
// tft.setTextColor(WHITE);
|
|
||||||
// }
|
|
||||||
// tft.println("R:");
|
|
||||||
// tft.setCursor(2 * GrapWidth -10, 0);
|
|
||||||
// if (HeightOrange > 28){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }else {
|
|
||||||
// tft.setTextColor(WHITE);
|
|
||||||
// }
|
|
||||||
// tft.println("O:");
|
|
||||||
// tft.setCursor(3 * GrapWidth -10, 0);
|
|
||||||
// if (HeightYellow > 28){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }else {
|
|
||||||
// tft.setTextColor(WHITE);
|
|
||||||
// }
|
|
||||||
// tft.println("Y:");
|
|
||||||
// tft.setCursor(4 * GrapWidth -10, 0);
|
|
||||||
// if (HeightGreen > 28){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }else {
|
|
||||||
// tft.setTextColor(WHITE);
|
|
||||||
// }
|
|
||||||
// tft.println("G:");
|
|
||||||
// tft.setCursor(5 * GrapWidth -10, 0);
|
|
||||||
// if (HeightBlue > 28){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }else {
|
|
||||||
// tft.setTextColor(WHITE);
|
|
||||||
// }
|
|
||||||
// tft.println("B:");
|
|
||||||
// tft.setCursor(6 * GrapWidth -10, 0);
|
|
||||||
// if (HeightViolet > 28){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }else {
|
|
||||||
// tft.setTextColor(WHITE);
|
|
||||||
// }
|
|
||||||
// tft.println("V:");
|
|
||||||
|
|
||||||
// maxValue = 0.0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// //show relative raw data graph
|
// //show relative raw data graph
|
||||||
// if (menu_number == 4 || menu_number == 8 ){
|
if (menu_number == 4 || menu_number == 8 ){
|
||||||
// maxValue = 0;
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
// drawControls();
|
maxValue = 0.0;
|
||||||
// ////tft.setRotation(0);
|
minValue = 0.0;
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
maxValue = max(maxValue, ReadValues[i]);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
minValue = min(minValue, ReadValues[i]);
|
||||||
|
}
|
||||||
|
HeightRed = int(((RawRed + abs(minValue)) / (maxValue + abs(minValue))) * GraphHeight);
|
||||||
|
HeightOrange = int(((RawOrange + abs(minValue)) / (maxValue + abs(minValue))) * GraphHeight);
|
||||||
|
HeightYellow = int(((RawYellow + abs(minValue)) / (maxValue + abs(minValue))) * GraphHeight);
|
||||||
|
HeightGreen = int(((RawGreen + abs(minValue)) / (maxValue + abs(minValue))) * GraphHeight);
|
||||||
|
HeightBlue = int(((RawBlue + abs(minValue)) / (maxValue + abs(minValue))) * GraphHeight);
|
||||||
|
HeightViolet = int(((RawViolet + abs(minValue)) / (maxValue + abs(minValue))) * GraphHeight);
|
||||||
|
tft.fillRect(minValue, 0, 240, maxValue-minValue, TFT_BLACK);
|
||||||
|
drawControls();
|
||||||
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
|
tft.drawString("Relvative Raw Values",0,0);
|
||||||
|
|
||||||
// for (int i = 0; i < 5; i++) {
|
tft.fillRect(0 * GrapWidth, GraphHeight - HeightRed+8, GrapWidth, HeightRed, TFT_RED);
|
||||||
// maxValue = max(maxValue, ReadValues[i]);
|
tft.fillRect(1 * GrapWidth + 1, GraphHeight - HeightOrange+8, GrapWidth, HeightOrange, TFT_ORANGE);
|
||||||
// }
|
tft.fillRect(2 * GrapWidth + 2, GraphHeight - HeightYellow+8, GrapWidth, HeightYellow, TFT_YELLOW);
|
||||||
// for (int i = 0; i < 5; i++) {
|
tft.fillRect(3 * GrapWidth + 3, GraphHeight - HeightGreen+8, GrapWidth, HeightGreen, TFT_GREEN);
|
||||||
// minValue = min(minValue, ReadValues[i]);
|
tft.fillRect(4 * GrapWidth + 4, GraphHeight - HeightBlue+8, GrapWidth, HeightBlue, TFT_BLUE);
|
||||||
// }
|
tft.fillRect(5 * GrapWidth + 5, GraphHeight - HeightViolet+8, GrapWidth, HeightViolet, TFT_MAGENTA);
|
||||||
// HeightRed = int(((RawRed + abs(minValue)) / (maxValue + abs(minValue))) * GraphHeight);
|
tft.setTextColor(TFT_BLACK, TFT_RED);
|
||||||
// HeightOrange = int(((RawOrange + abs(minValue)) / (maxValue + abs(minValue))) * GraphHeight);
|
tft.drawString(" R:",1 * GrapWidth -20, 120);
|
||||||
// HeightYellow = int(((RawYellow + abs(minValue)) / (maxValue + abs(minValue))) * GraphHeight);
|
tft.setTextColor(TFT_BLACK, TFT_ORANGE);
|
||||||
// HeightGreen = int(((RawGreen + abs(minValue)) / (maxValue + abs(minValue))) * GraphHeight);
|
tft.drawString(" O:",2 * GrapWidth -19, 120);
|
||||||
// HeightBlue = int(((RawBlue + abs(minValue)) / (maxValue + abs(minValue))) * GraphHeight);
|
tft.setTextColor(TFT_BLACK, TFT_YELLOW);
|
||||||
// HeightViolet = int(((RawViolet + abs(minValue)) / (maxValue + abs(minValue))) * GraphHeight);
|
tft.drawString(" Y:",3 * GrapWidth -18, 120);
|
||||||
|
tft.setTextColor(TFT_BLACK, TFT_GREEN);
|
||||||
|
tft.drawString(" G:",4 * GrapWidth -17, 120);
|
||||||
// tft.setCursor(1 * GrapWidth -10, 10);
|
tft.setTextColor(TFT_BLACK, TFT_BLUE);
|
||||||
// if (HeightRed >25){
|
tft.drawString(" B:",5 * GrapWidth -16, 120);
|
||||||
// tft.setTextColor(BLACK);
|
tft.setTextColor(TFT_BLACK, TFT_MAGENTA);
|
||||||
// }
|
tft.drawString(" V:",6 * GrapWidth -15, 120);
|
||||||
|
maxValue = 0.0;
|
||||||
// tft.fillRect(0 * GrapWidth, GraphHeight - HeightRed, GrapWidth, HeightRed, RED);
|
minValue = 0.0;
|
||||||
// tft.fillRect(1 * GrapWidth + 1, GraphHeight - HeightOrange, GrapWidth, HeightOrange, ORANGE);
|
}
|
||||||
// tft.fillRect(2 * GrapWidth + 2, GraphHeight - HeightYellow, GrapWidth, HeightYellow, YELLOW);
|
|
||||||
// tft.fillRect(3 * GrapWidth + 3, GraphHeight - HeightGreen, GrapWidth, HeightGreen, GREEN);
|
|
||||||
// tft.fillRect(4 * GrapWidth + 4, GraphHeight - HeightBlue, GrapWidth, HeightBlue, BLUE);
|
|
||||||
// tft.fillRect(5 * GrapWidth + 5, GraphHeight - HeightViolet, GrapWidth, HeightViolet, MAGENTA);
|
|
||||||
// tft.setCursor(1 * GrapWidth -10, 0);
|
|
||||||
// if (HeightRed > 28){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }else {
|
|
||||||
// tft.setTextColor(WHITE);
|
|
||||||
// }
|
|
||||||
// tft.println("R");
|
|
||||||
// tft.setCursor(2 * GrapWidth -10, 0);
|
|
||||||
// if (HeightOrange > 28){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }else {
|
|
||||||
// tft.setTextColor(WHITE);
|
|
||||||
// }
|
|
||||||
// tft.println("O");
|
|
||||||
// tft.setCursor(3 * GrapWidth -10, 0);
|
|
||||||
// if (HeightYellow > 28){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }else {
|
|
||||||
// tft.setTextColor(WHITE);
|
|
||||||
// }
|
|
||||||
// tft.println("Y");
|
|
||||||
// tft.setCursor(4 * GrapWidth -10, 0);
|
|
||||||
// if (HeightGreen > 28){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }else {
|
|
||||||
// tft.setTextColor(WHITE);
|
|
||||||
// }
|
|
||||||
// tft.println("G");
|
|
||||||
// tft.setCursor(5 * GrapWidth -10, 0);
|
|
||||||
// if (HeightBlue > 28){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }else {
|
|
||||||
// tft.setTextColor(WHITE);
|
|
||||||
// }
|
|
||||||
// tft.println("B");
|
|
||||||
|
|
||||||
// tft.setCursor(6 * GrapWidth -10, 0);
|
|
||||||
// if (HeightViolet > 28){
|
|
||||||
// tft.setTextColor(BLACK);
|
|
||||||
// }else {
|
|
||||||
// tft.setTextColor(WHITE);
|
|
||||||
// }
|
|
||||||
// tft.println("V");
|
|
||||||
|
|
||||||
// maxValue = 0.0;
|
|
||||||
// }
|
|
||||||
delay(100);
|
delay(100);
|
||||||
|
|
||||||
if (menu_number > 4 ) {
|
if (menu_number > 4 ) {
|
||||||
@@ -399,25 +333,25 @@ void loop() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// //data haverest
|
//data haverest
|
||||||
// RawRed = sensor.getRed();
|
RawRed = sensor.getRed();
|
||||||
// RawOrange = sensor.getOrange();
|
RawOrange = sensor.getOrange();
|
||||||
// RawYellow = sensor.getYellow();
|
RawYellow = sensor.getYellow();
|
||||||
// RawGreen = sensor.getGreen();
|
RawGreen = sensor.getGreen();
|
||||||
// RawBlue = sensor.getBlue();
|
RawBlue = sensor.getBlue();
|
||||||
// RawViolet = sensor.getViolet();
|
RawViolet = sensor.getViolet();
|
||||||
|
|
||||||
// CalcRed = sensor.getCalibratedRed();
|
CalcRed = sensor.getCalibratedRed();
|
||||||
// CalcOrange = sensor.getCalibratedOrange();
|
CalcOrange = sensor.getCalibratedOrange();
|
||||||
// CalcYellow = sensor.getCalibratedYellow();
|
CalcYellow = sensor.getCalibratedYellow();
|
||||||
// CalcGreen = sensor.getCalibratedGreen();
|
CalcGreen = sensor.getCalibratedGreen();
|
||||||
// CalcBlue = sensor.getCalibratedBlue();
|
CalcBlue = sensor.getCalibratedBlue();
|
||||||
// CalcViolet = sensor.getCalibratedViolet();
|
CalcViolet = sensor.getCalibratedViolet();
|
||||||
|
|
||||||
// ReadValues[0] = CalcRed;
|
ReadValues[0] = CalcRed;
|
||||||
// ReadValues[1] = CalcOrange;
|
ReadValues[1] = CalcOrange;
|
||||||
// ReadValues[2] = CalcYellow;
|
ReadValues[2] = CalcYellow;
|
||||||
// ReadValues[3] = CalcGreen;
|
ReadValues[3] = CalcGreen;
|
||||||
// ReadValues[4] = CalcBlue;
|
ReadValues[4] = CalcBlue;
|
||||||
// ReadValues[5] = CalcViolet;
|
ReadValues[5] = CalcViolet;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
//Płytka: "FireBeetle-ESP32"
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <Adafruit_GFX.h>
|
#include <Adafruit_GFX.h>
|
||||||
@@ -9,7 +10,7 @@
|
|||||||
#include "SD.h"
|
#include "SD.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
|
|
||||||
#define Version "0.46"
|
#define Version "0.47"
|
||||||
#define WIRE Wire
|
#define WIRE Wire
|
||||||
#define DHTTYPE DHT22
|
#define DHTTYPE DHT22
|
||||||
#define DHTPIN 4 //GPIO04 D4
|
#define DHTPIN 4 //GPIO04 D4
|
||||||
@@ -80,7 +81,9 @@ int dayss;
|
|||||||
int months;
|
int months;
|
||||||
int years;
|
int years;
|
||||||
|
|
||||||
int intervalTempWrite = 1;
|
//##########################################################################################################################
|
||||||
|
int intervalTempIdx = 3;
|
||||||
|
int intervalTempWrite = 0;
|
||||||
|
|
||||||
int minsToSet = -1;
|
int minsToSet = -1;
|
||||||
int hoursToSet = -1;
|
int hoursToSet = -1;
|
||||||
@@ -215,7 +218,8 @@ void setup() {
|
|||||||
|
|
||||||
if (!rtc.begin()) {
|
if (!rtc.begin()) {
|
||||||
Serial.println("Nie znaleziono DS3231 RTC!");
|
Serial.println("Nie znaleziono DS3231 RTC!");
|
||||||
while (1); // Zatrzymaj program, jeśli RTC nie jest dostępny
|
while (1)
|
||||||
|
; // Zatrzymaj program, jeśli RTC nie jest dostępny
|
||||||
}
|
}
|
||||||
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Address 0x3C for 128x32
|
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Address 0x3C for 128x32
|
||||||
display.setTextSize(1);
|
display.setTextSize(1);
|
||||||
@@ -226,10 +230,21 @@ void setup() {
|
|||||||
display.setCursor(60, 0);
|
display.setCursor(60, 0);
|
||||||
display.println(Version);
|
display.println(Version);
|
||||||
display.setCursor(0, 8);
|
display.setCursor(0, 8);
|
||||||
|
if (intervalTempIdx = 1) {
|
||||||
|
intervalTempWrite = 1;
|
||||||
|
} else if (intervalTempIdx = 2) {
|
||||||
|
intervalTempWrite = 5;
|
||||||
|
} else if (intervalTempIdx = 3) {
|
||||||
|
intervalTempWrite = 15;
|
||||||
|
} else if (intervalTempIdx = 4) {
|
||||||
|
intervalTempWrite = 60;
|
||||||
|
} else {
|
||||||
|
intervalTempWrite = 360;
|
||||||
|
}
|
||||||
display.println("Interval:");
|
display.println("Interval:");
|
||||||
display.setCursor(60, 8);
|
display.setCursor(80, 8);
|
||||||
display.println(intervalTempWrite);
|
display.println(intervalTempWrite);
|
||||||
display.setCursor(70, 8);
|
display.setCursor(90, 8);
|
||||||
display.println("min");
|
display.println("min");
|
||||||
display.setCursor(0, 16);
|
display.setCursor(0, 16);
|
||||||
|
|
||||||
@@ -277,7 +292,6 @@ void setup() {
|
|||||||
File file = SD.open("/TempHumLog.txt", FILE_APPEND);
|
File file = SD.open("/TempHumLog.txt", FILE_APPEND);
|
||||||
file.println("Data; Godzina; Temp; Humi; Feel,TempH,HumH, TempM, HumM, TempL, HumL");
|
file.println("Data; Godzina; Temp; Humi; Feel,TempH,HumH, TempM, HumM, TempL, HumL");
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
sprintf(dateString, "%02d/%02d/%4d %02d:%02d:%02d", now.day(), now.month(), now.year(), now.hour(), now.minute(), now.second());
|
sprintf(dateString, "%02d/%02d/%4d %02d:%02d:%02d", now.day(), now.month(), now.year(), now.hour(), now.minute(), now.second());
|
||||||
if (SD.exists("/GeneralLog.txt")) {
|
if (SD.exists("/GeneralLog.txt")) {
|
||||||
@@ -325,22 +339,28 @@ void setup() {
|
|||||||
|
|
||||||
if (isnan(tempH)) {
|
if (isnan(tempH)) {
|
||||||
lastTempH = 0.0;
|
lastTempH = 0.0;
|
||||||
tempH = lastTempH; }
|
tempH = lastTempH;
|
||||||
|
}
|
||||||
if (isnan(tempM)) {
|
if (isnan(tempM)) {
|
||||||
lastTempM = 0.0;
|
lastTempM = 0.0;
|
||||||
tempM = lastTempM;}
|
tempM = lastTempM;
|
||||||
|
}
|
||||||
if (isnan(tempL)) {
|
if (isnan(tempL)) {
|
||||||
lastTempL = 0.0;
|
lastTempL = 0.0;
|
||||||
tempL = lastTempL;}
|
tempL = lastTempL;
|
||||||
|
}
|
||||||
if (isnan(humH)) {
|
if (isnan(humH)) {
|
||||||
lastHumH = 0.0;
|
lastHumH = 0.0;
|
||||||
humH = lastHumH;}
|
humH = lastHumH;
|
||||||
|
}
|
||||||
if (isnan(humM)) {
|
if (isnan(humM)) {
|
||||||
lastHumM = 0.0;
|
lastHumM = 0.0;
|
||||||
humM = lastHumM;}
|
humM = lastHumM;
|
||||||
|
}
|
||||||
if (isnan(humL)) {
|
if (isnan(humL)) {
|
||||||
lastHumL = 0.0;
|
lastHumL = 0.0;
|
||||||
humL = lastHumL;}
|
humL = lastHumL;
|
||||||
|
}
|
||||||
//setup END
|
//setup END
|
||||||
//######################
|
//######################
|
||||||
}
|
}
|
||||||
@@ -371,7 +391,18 @@ void loop() {
|
|||||||
humL = (dhtL.readHumidity() + 1.7); //kalibracja
|
humL = (dhtL.readHumidity() + 1.7); //kalibracja
|
||||||
if (isnan(humL)) { humL = lastHumL; }
|
if (isnan(humL)) { humL = lastHumL; }
|
||||||
|
|
||||||
|
//##########################################################################################################################
|
||||||
|
if (intervalTempIdx = 1) {
|
||||||
|
intervalTempWrite = 1;
|
||||||
|
} else if (intervalTempIdx = 2) {
|
||||||
|
intervalTempWrite = 5;
|
||||||
|
} else if (intervalTempIdx = 3) {
|
||||||
|
intervalTempWrite = 15;
|
||||||
|
} else if (intervalTempIdx = 4) {
|
||||||
|
intervalTempWrite = 60;
|
||||||
|
} else {
|
||||||
|
intervalTempWrite = 360;
|
||||||
|
}
|
||||||
// Compute heat index in Celsius (isFahreheit = false)
|
// Compute heat index in Celsius (isFahreheit = false)
|
||||||
heat_idx = dht.computeHeatIndex(temp, hum, false);
|
heat_idx = dht.computeHeatIndex(temp, hum, false);
|
||||||
|
|
||||||
@@ -438,18 +469,48 @@ void loop() {
|
|||||||
if (menuL1 == 10) {
|
if (menuL1 == 10) {
|
||||||
display.setCursor(0, 8);
|
display.setCursor(0, 8);
|
||||||
display.print("Enter edycja czasu");
|
display.print("Enter edycja czasu");
|
||||||
|
display.setCursor(0, 16);
|
||||||
|
display.print("Intwerwal: ");
|
||||||
|
|
||||||
|
|
||||||
|
//##########################################################################################################################
|
||||||
|
display.print(intervalTempIdx);
|
||||||
|
if (intervalTempWrite >= 60) {
|
||||||
|
display.setCursor(60, 16);
|
||||||
|
display.print((intervalTempIdx / 60));
|
||||||
|
display.setCursor(80, 16);
|
||||||
|
display.print("godz");
|
||||||
|
} else {
|
||||||
|
display.setCursor(60, 16);
|
||||||
|
display.print((intervalTempIdx));
|
||||||
|
display.setCursor(80, 16);
|
||||||
|
display.print("godz");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (menuL1 == 9) {
|
if (menuL1 == 9) {
|
||||||
display.setCursor(0, 8);
|
display.setCursor(0, 8);
|
||||||
delay(100);
|
delay(100);
|
||||||
display.print("Ustaw godziny");
|
display.print("Interwal:");
|
||||||
delay(150);
|
delay(100);
|
||||||
if (digitalRead(BTN_ENTER) == HIGH and menuL2 == 10) {
|
if (digitalRead(BTN_ENTER) == HIGH and menuL2 == 10) {
|
||||||
menuL2 = 9;
|
menuL2 = 9;
|
||||||
}
|
}
|
||||||
|
//##########################################################################################################################
|
||||||
if (menuL2 == 9) {
|
if (menuL2 == 9) {
|
||||||
|
display.setCursor(0, 16);
|
||||||
|
display.print("Ustaw godziny");
|
||||||
|
display.setCursor(45, 16);
|
||||||
|
display.print(hoursToSet);
|
||||||
|
delay(100);
|
||||||
|
|
||||||
|
if (digitalRead(BTN_ENTER) == HIGH) {
|
||||||
|
intervalTempWrite++;
|
||||||
|
if (intervalTempWrite >= 6) {
|
||||||
|
intervalTempWrite = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (menuL2 == 8) {
|
||||||
display.setCursor(0, 16);
|
display.setCursor(0, 16);
|
||||||
display.print("Godzina:");
|
display.print("Godzina:");
|
||||||
display.setCursor(45, 16);
|
display.setCursor(45, 16);
|
||||||
@@ -467,7 +528,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (menuL1 == 8) {
|
if (menuL1 == 7) {
|
||||||
display.setCursor(0, 8);
|
display.setCursor(0, 8);
|
||||||
display.print("Ustaw minuty");
|
display.print("Ustaw minuty");
|
||||||
|
|
||||||
@@ -501,7 +562,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (menuL1 == 7 ) {
|
if (menuL1 == 36) {
|
||||||
display.setCursor(0, 8);
|
display.setCursor(0, 8);
|
||||||
display.print("Ustaw sekundy na 0");
|
display.print("Ustaw sekundy na 0");
|
||||||
|
|
||||||
@@ -647,7 +708,6 @@ void loop() {
|
|||||||
display.println(humL, 1);
|
display.println(humL, 1);
|
||||||
display.setCursor(120, 24);
|
display.setCursor(120, 24);
|
||||||
display.println("%");
|
display.println("%");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (digitalRead(BTN_UP) == HIGH and menuL0 < 10) {
|
if (digitalRead(BTN_UP) == HIGH and menuL0 < 10) {
|
||||||
@@ -660,12 +720,10 @@ void loop() {
|
|||||||
if (menuL2 < 9 and menuL0 != 10 and menuL1 != 10) {
|
if (menuL2 < 9 and menuL0 != 10 and menuL1 != 10) {
|
||||||
menuL2 = menuL2 + 1;
|
menuL2 = menuL2 + 1;
|
||||||
}
|
}
|
||||||
if (menuL2 == 9 and minsToSet <59)
|
if (menuL2 == 9 and minsToSet < 59) {
|
||||||
{
|
|
||||||
minsToSet = minsToSet + 1;
|
minsToSet = minsToSet + 1;
|
||||||
}
|
}
|
||||||
if (menuL2 == 9 and hoursToSet < 23)
|
if (menuL2 == 9 and hoursToSet < 23) {
|
||||||
{
|
|
||||||
hoursToSet = hoursToSet + 1;
|
hoursToSet = hoursToSet + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -680,12 +738,10 @@ void loop() {
|
|||||||
if (menuL2 > 6 and menuL2 < 9 and menuL0 != 10 and menuL1 != 10) {
|
if (menuL2 > 6 and menuL2 < 9 and menuL0 != 10 and menuL1 != 10) {
|
||||||
menuL2 = menuL2 - 1;
|
menuL2 = menuL2 - 1;
|
||||||
}
|
}
|
||||||
if (menuL2 == 9 and minsToSet > 1)
|
if (menuL2 == 9 and minsToSet > 1) {
|
||||||
{
|
|
||||||
minsToSet = minsToSet - 1;
|
minsToSet = minsToSet - 1;
|
||||||
}
|
}
|
||||||
if (menuL2 == 9 and hoursToSet > 1)
|
if (menuL2 == 9 and hoursToSet > 1) {
|
||||||
{
|
|
||||||
hoursToSet = hoursToSet - 1;
|
hoursToSet = hoursToSet - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -713,7 +769,6 @@ void loop() {
|
|||||||
lastBatteryVoltage = currentBatteryVoltage;
|
lastBatteryVoltage = currentBatteryVoltage;
|
||||||
currentBatteryVoltage = batteryVoltage;
|
currentBatteryVoltage = batteryVoltage;
|
||||||
delay(500);
|
delay(500);
|
||||||
|
|
||||||
}
|
}
|
||||||
//zapis na SD poziom baterii
|
//zapis na SD poziom baterii
|
||||||
if (mins % 1 == 0 && secs == 0) {
|
if (mins % 1 == 0 && secs == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user