Zmiana intwrwału na zmienna = 5 min
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include "SD.h"
|
||||
#include "SPI.h"
|
||||
|
||||
#define Version "0.35"
|
||||
#define Version "0.36"
|
||||
#define WIRE Wire
|
||||
#define DHTTYPE DHT22
|
||||
#define DHTPIN 4
|
||||
@@ -42,6 +42,8 @@ int dayss;
|
||||
int months;
|
||||
int years;
|
||||
|
||||
int intervalTempWrite = 5;
|
||||
|
||||
int minsToSet = -1;
|
||||
int hoursToSet = -1;
|
||||
|
||||
@@ -457,8 +459,8 @@ void loop() {
|
||||
display.print("Discharge");
|
||||
chrgState = "DSG";
|
||||
} else {
|
||||
display.print("---");
|
||||
chrgState = "---";
|
||||
display.print("xxx");
|
||||
chrgState = "xxx";
|
||||
}
|
||||
if (chrgState == "CHR") {
|
||||
batteryPercent = chargeVoltageToPercentage(currentBatteryVoltage);
|
||||
@@ -481,15 +483,15 @@ void loop() {
|
||||
display.print("m");
|
||||
|
||||
|
||||
display.drawRect(0,16, 124, 6, SSD1306_WHITE);
|
||||
display.fillRect(124, 17, 5, 4, SSD1306_WHITE);
|
||||
display.drawRect(0,16, 124, 7, SSD1306_WHITE);
|
||||
display.fillRect(124, 17, 5, 5, SSD1306_WHITE);
|
||||
batteryBarWidth = int(((float(batteryPercent)/100)*122));
|
||||
if (batteryBarWidth >122){
|
||||
batteryBarWidth = 122;
|
||||
}
|
||||
display.fillRect(1, 17, batteryBarWidth, 5, SSD1306_WHITE);
|
||||
display.fillRect(1, 17, batteryBarWidth, 6, SSD1306_WHITE);
|
||||
if (batteryVoltage < 2 ){
|
||||
display.setCursor(60,8);
|
||||
display.setCursor(60,15 );
|
||||
display.print("xxx");
|
||||
}
|
||||
|
||||
@@ -572,10 +574,11 @@ void loop() {
|
||||
delay(500);
|
||||
|
||||
}
|
||||
//zapis na SD poziom baterii
|
||||
if (mins % 1 == 0 && secs == 0) {
|
||||
File file = SD.open("/GeneralLog.txt", FILE_APPEND);
|
||||
if (file) {
|
||||
display.fillRect(0, 0, 124, 64, SSD1306_WHITE);
|
||||
display.fillRect(0, 0, 128, 64, SSD1306_WHITE);
|
||||
file.print(dateString);
|
||||
file.print(" Battery %: ");
|
||||
file.print(batteryPercent);
|
||||
@@ -585,8 +588,8 @@ void loop() {
|
||||
}
|
||||
}
|
||||
|
||||
//zapis na SD:
|
||||
if (mins % 1 == 0 && secs == 0) {
|
||||
//zapis na SD temp i hum
|
||||
if (mins % intervalTempWrite == 0 && secs == 0) {
|
||||
File file = SD.open("/TempHumLog.txt", FILE_APPEND);
|
||||
if (file) {
|
||||
display.fillRect(0, 0, 124, 64, SSD1306_WHITE);
|
||||
|
||||
Reference in New Issue
Block a user