 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];


void loop() {
  static bool raised = false;
  static uint8_t counter = 0;
  static unsigned long last_millis = millis();

  // publish heartbeat
  unsigned long now_millis = millis();
  if ( now_millis - last_millis > 50 ) {
    update();
    counter++;
    if ( counter == 200 ) {
      heartbeat();
      counter = 0;
    }

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