@@ -181,7 +181,7 @@ BLYNK_WRITE(vPIN_BUTTON_HOLD) {
181
181
}
182
182
}
183
183
184
- // this function only runs when in HOLD mode and select AUTO-RANGE
184
+ // this function only runs when in HOLD mode and select AUTO-RANGE. just shows latest values on demand
185
185
void updateINA219eXtraValues () {
186
186
Blynk.virtualWrite (vPIN_VOLTAGE_PEAK, String (loadvoltageMax, 3 ) + String (" V" ) );
187
187
if (current_AVG_total > 1000 && autoRange == 1 ) {
@@ -206,19 +206,19 @@ BLYNK_WRITE(vPIN_BUTTON_AUTORANGE) {
206
206
updateINA219eXtraValues ();
207
207
}
208
208
209
- // RESET AVERAGES
209
+ // RESET AVERAGES (short) & RESET STOPWATCH (long)
210
210
BLYNK_WRITE (vPIN_BUTTON_RESET_AVG) {
211
211
if (param.asInt ()) {
212
212
Blynk.virtualWrite (vPIN_VOLTAGE_AVG, " --- V" );
213
213
Blynk.virtualWrite (vPIN_CURRENT_AVG, " --- mA" );
214
214
Blynk.virtualWrite (vPIN_POWER_AVG, " --- mW" );
215
- for (int i = 0 ; i < AVG_DEPTH_VOLTAGE; i++) {
215
+ for (int i = 0 ; i < ( AVG_DEPTH_VOLTAGE - 1 ) ; i++) {
216
216
loadvoltage_AVG[i] = loadvoltage;
217
217
}
218
- for (int i = 0 ; i < AVG_DEPTH_CURRENT; i++) {
218
+ for (int i = 0 ; i < ( AVG_DEPTH_CURRENT - 1 ) ; i++) {
219
219
current_AVG[i] = current_mA;
220
220
}
221
- for (int i = 0 ; i < AVG_DEPTH_POWER; i++) {
221
+ for (int i = 0 ; i < ( AVG_DEPTH_POWER - 1 ) ; i++) {
222
222
power_AVG[i] = power;
223
223
}
224
224
delay (50 );
@@ -237,7 +237,7 @@ void countdownResetConCallback() {
237
237
energyPrevious = 0 ;
238
238
}
239
239
240
- // RESET PEAKS
240
+ // RESET PEAKS (short) & RESET CONSUMTION (long)
241
241
BLYNK_WRITE (vPIN_BUTTON_RESET_MAX) {
242
242
if (param.asInt ()) {
243
243
Blynk.virtualWrite (vPIN_VOLTAGE_PEAK, " --- V" );
@@ -289,7 +289,7 @@ void stopwatchCounter() {
289
289
290
290
// This section is for setting the kWh price from your electric company.
291
291
// I use a SPOT rate which means I need to update it all the time.
292
- // If you know your set price per kWh (in cents), then enter the price at the top of the sketch : FIXED_ENERGY_PRICE
292
+ // If you know your set price per kWh (in cents), then enter the price in settings : FIXED_ENERGY_PRICE
293
293
void getPrice () {
294
294
Blynk.virtualWrite (vPIN_ENERGY_API, ENERGY_API); // local API Server to get current power price per mWh
295
295
}
0 commit comments