     {
       trigger->time = ms_time;
       trigger->deadtime_count = deadtime;
+      events[event_count % EVENT_MAX].time = ms_time;
+      events[event_count % EVENT_MAX].source = trigger->source;
+      event_count++;
     }
     return true;
   }

  if( strcasecmp(cmd, "ping") == 0 )
  {
    Serial.print("P ");
    Serial.println(value);
  }
  else if( strcasecmp(cmd, "recall") == 0 )
  {
    //Serial.println("R M1 01:23:45.678 123345 123");
    Serial.println("E not implemented");
  }
  else if( strcasecmp(cmd, "clear") == 0 )
  {
    //Serial.println("C");
    Serial.println("E not implemented");
  }
  else if( strcasecmp(cmd, "debounce") == 0 )
  {

  SOURCE_START = 0,
  SOURCE_FINISH,
  SOURCE_MANUAL_START,
  SOURCE_MANUAL_FINISH,
} source_t;

typedef struct 
{
