KOrakta wyliczania %
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
#include "SD.h"
|
#include "SD.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
|
|
||||||
#define Version "0.33"
|
#define Version "0.35"
|
||||||
#define WIRE Wire
|
#define WIRE Wire
|
||||||
#define DHTTYPE DHT22
|
#define DHTTYPE DHT22
|
||||||
#define DHTPIN 4
|
#define DHTPIN 4
|
||||||
@@ -444,7 +444,7 @@ void loop() {
|
|||||||
display.setCursor(80,8);
|
display.setCursor(80,8);
|
||||||
display.print("V:");
|
display.print("V:");
|
||||||
display.setCursor(95, 8);
|
display.setCursor(95, 8);
|
||||||
display.print(formatNumber(batteryVoltage,2));
|
display.print(batteryVoltage);
|
||||||
|
|
||||||
display.setCursor(0, 24);
|
display.setCursor(0, 24);
|
||||||
if (currentBatteryVoltage >= 4.20 ){
|
if (currentBatteryVoltage >= 4.20 ){
|
||||||
@@ -453,19 +453,17 @@ void loop() {
|
|||||||
} else if ((lastBatteryVoltage < currentBatteryVoltage && currentBatteryVoltage >= 2.0&& currentBatteryVoltage >= 4.0 ) || currentBatteryVoltage >= 4.10 ){
|
} else if ((lastBatteryVoltage < currentBatteryVoltage && currentBatteryVoltage >= 2.0&& currentBatteryVoltage >= 4.0 ) || currentBatteryVoltage >= 4.10 ){
|
||||||
display.print("Charging");
|
display.print("Charging");
|
||||||
chrgState = "CHR";
|
chrgState = "CHR";
|
||||||
} else if (lastBatteryVoltage > currentBatteryVoltage && currentBatteryVoltage >= 2.0 ) {
|
} else if (lastBatteryVoltage >=currentBatteryVoltage && currentBatteryVoltage >= 2.0 ) {
|
||||||
display.print("Discharge");
|
display.print("Discharge");
|
||||||
chrgState = "DSG";
|
chrgState = "DSG";
|
||||||
} else {
|
} else {
|
||||||
display.print("---");
|
display.print("---");
|
||||||
chrgState = "---";
|
chrgState = "---";
|
||||||
}
|
}
|
||||||
if (chrgState == "DSG"){
|
if (chrgState == "CHR") {
|
||||||
batteryPercent = voltageToPercentage(currentBatteryVoltage);
|
batteryPercent = chargeVoltageToPercentage(currentBatteryVoltage);
|
||||||
} else if (chrgState == "CHR") {
|
|
||||||
batteryPercent = chargeVoltageToPercentage(currentBatteryVoltage);
|
|
||||||
} else {
|
} else {
|
||||||
batteryPercent = 100;
|
batteryPercent = voltageToPercentage(currentBatteryVoltage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -582,7 +580,7 @@ void loop() {
|
|||||||
file.print(" Battery %: ");
|
file.print(" Battery %: ");
|
||||||
file.print(batteryPercent);
|
file.print(batteryPercent);
|
||||||
file.print(" V: ");
|
file.print(" V: ");
|
||||||
file.println(currentBatteryVoltage);
|
file.println(formatNumber(currentBatteryVoltage,2));
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user