Skip to content

Commit

Permalink
fix decimal places issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jaminNZx committed Feb 9, 2017
1 parent b16a67a commit af5e6f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions ESP8266-Power-Monitor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ void sendINA219valuesENERGY() {
energyDifference = energy - energyPrevious;
// ENERGY CONSUMPTION
if (energy > 1000 && autoRange == 1) {
Blynk.virtualWrite(vPIN_ENERGY_USED, String((energy / 1000), 6) + String(" kWh"));
Blynk.virtualWrite(vPIN_ENERGY_USED, String((energy / 1000), 5) + String(" kWh"));
} else {
Blynk.virtualWrite(vPIN_ENERGY_USED, String(energy, 6) + String(" mWh"));
Blynk.virtualWrite(vPIN_ENERGY_USED, String(energy, 5) + String(" mWh"));
}
energyPrevious = energy;
// ENERGY COST
Expand All @@ -163,7 +163,7 @@ void sendINA219valuesENERGY() {

// this is feeding raw data to the graph
void sendINA219_GraphValues() {
Blynk.virtualWrite(vPIN_CURRENT_GRAPH, current_AVG_total);
Blynk.virtualWrite(vPIN_GRAPH, current_mA);
}

// HOLD BUTTON
Expand Down Expand Up @@ -230,7 +230,7 @@ BLYNK_WRITE(vPIN_BUTTON_RESET_AVG) {

}
void countdownResetConCallback() {
Blynk.virtualWrite(vPIN_ENERGY_USED, "0.000000 mWh");
Blynk.virtualWrite(vPIN_ENERGY_USED, "0.00000 mWh");
Blynk.virtualWrite(vPIN_ENERGY_COST, "0.00000000");
energy = 0;
energyCost = 0;
Expand Down
3 changes: 2 additions & 1 deletion settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
#define vPIN_CURRENT_REAL V4
#define vPIN_CURRENT_AVG V5
#define vPIN_CURRENT_PEAK V6
#define vPIN_CURRENT_GRAPH V7

#define vPIN_GRAPH V7

#define vPIN_POWER_REAL V8
#define vPIN_POWER_AVG V9
Expand Down

0 comments on commit af5e6f2

Please sign in to comment.