 Adafruit_VCNL4010 proxim_sensor;
 
 #define NB_PROXIM_SAMPLES 20
-#define NB_ANOMALY_COUNTS 15
+#define NB_ANOMALY_COUNTS 9
 
 #define MAX_CLIENT_RETRIES 10
 
-uint16_t proxim_nominal = 1960;
-uint16_t proxim_anomaly = 160;
+uint16_t proxim_nominal = 2000;
+uint16_t proxim_anomaly = 240;
 uint16_t event_count = 0;
 
 uint16_t proxim_samples[NB_PROXIM_SAMPLES];

  } else {
    if ( event_count > 0 ) {
      event_count--;
    }
    if ( counter == 0 ) {
      proxim_samples[index] = proxim_value;

void update() {
  static uint16_t counter = 0;
  static uint16_t index = 0;
  static uint16_t printer_count = 0;

  uint16_t proxim_value = proxim_sensor.readProximity();

  if ( proxim_value > proxim_nominal + proxim_anomaly ) {
    printer_count = 2 * 1000 / 54;    // print 2 seconds of reading
    // integrate the anomaly
    if (event_count < NB_ANOMALY_COUNTS) {
      event_count++;
