 float get_consumption_from_time_since_last_pulse(long timeSinceLastPulse) {
   long time = millis();
   long dsecs = (time - timeSinceLastPulse) / 100;
-  if(dsecs < 5) { //5 dsecs = 0.5 sec: the highest supported interval for this sketch.
+  if(dsecs < 4) { //4 dsecs = 0.4 sec: the highest supported interval for this sketch.
     time_since_last_pulse = time;
     return 0.0F;
   }

#include "roboto_thin_20.h"
#include "images.h"


#include "eepromanything.h"

#define PULSES_PER_KWH 375
#define WH_PER_PULSE (1000.0F / PULSES_PER_KWH)

struct config_t
{
  int state;
  float consumption_total;
  int pulse_count_current_kwh;
} storage;

#define BTN_1 9
#define BTN_2 8

          EEPROM_writeAnything(EEPROM_READ_ADDR, storage);
        }
        yield();
        particle_consumption_current = get_consumption_from_time_since_last_pulse(time_since_last_pulse);
        particle_total_kwh = storage.consumption_total + ((((float)storage.pulse_count_current_kwh) * WH_PER_PULSE) / 1000.0F);
        dtostrf(particle_total_kwh, 6, 2, consumption_total_str);
        dtostrf(particle_consumption_current, 4, 0, consumption_current_str);
        time_since_last_pulse = millis();
        pulse_triggered = false;
        yield();
