 
 void loop_wait(void)
 {
-  static uint32_t prev_time = 0;
+  static uint64_t prev_time = 0;
   while( prev_time == ms_time );
   prev_time = ms_time;
 }

  eeprom_write(ROM_OFFSET_START, 0xff);
}

void print_time(uint32_t time)
{
  uint32_t ms = time % 1000;
  uint32_t s = (time / 1000) % 60;
  uint32_t m = (time / 60000) % 60;
  uint32_t h = time / 3600000;

  if( h < 10 )
    Serial.write('0');
  Serial.print(h);
  Serial.write(':');
  if( m < 10 )
    Serial.write('0');
  Serial.print(m);
  Serial.write(':');
  if( s < 10 )
    Serial.write('0');
  Serial.print(s);
  Serial.write('.');
  if( ms < 100 )
    Serial.write('0');
  if( ms < 10 )
    Serial.write('0');
  Serial.print(ms);
}

void print_event(uint32_t index)

      Serial.print("R ");
      print_event(value % EVENT_MAX);
      Serial.write(' ');
      Serial.println((uint32_t)value);
      //Serial.println("R M1 123345 123");
    }
    else
    {
