Ejemplo n.º 1
0
void lifetime_stats_tick()
{
    unsigned long m = millis();
    
    //Every minute, increase the minute counters that are active.
    if (minute_counter_millis < m)
    {
        minute_counter_millis += MILLIS_MINUTE;
        
        lifetime_minutes++;
        triptime_minutes++;
        if (is_printing)
        {
            lifetime_print_minutes++;
            triptime_print_minutes++;
        }
    }
    
    //Every hour, save the data to EEPROM. 
    if (hour_save_millis < m)
    {
        hour_save_millis = m + MILLIS_HOUR;
        save_lifetime_stats();
    }
}
Ejemplo n.º 2
0
void lifetime_stats_tick()
{
  unsigned long m = millis();

  //Every minute, increase the minute counters that are active.
  if (minute_counter_millis < m)
  {
    minute_counter_millis += MILLIS_MINUTE;

    lifetime_minutes++;
    triptime_minutes++;
    if (is_printing)
    {
      lifetime_print_minutes++;
      triptime_print_minutes++;

      float diff = current_position[E_AXIS] - last_e_pos;
      if (diff > 0 && diff < 60 * 30)
      {
        accumulated_e_diff += diff * volume_to_filament_length[active_extruder];
        while(accumulated_e_diff > 10.0)
        {
          lifetime_print_centimeters++;
          triptime_print_centimeters++;
          accumulated_e_diff -= 10.0;
        }
      }
      last_e_pos = current_position[E_AXIS];
    }
  }

  //Every hour, save the data to EEPROM.
  if (hour_save_millis < m)
  {
    hour_save_millis = m + MILLIS_HOUR;
    save_lifetime_stats();
  }
}
Ejemplo n.º 3
0
void lifetime_stats_print_end()
{
  is_printing = false;
  save_lifetime_stats();
}