<commit_before>/* Copyright (c) 2017 timothyjager
   JBC-Soldering-Controller
   MIT License. See LICENSE file for details.
*/

//----------------OLED Display------------------------


//This updates the OLED display
void updateDisplay(bool update_now)
{
#define DISPLAY_UPDATE_PERIOD 250;
  static bool in_cradle;
  static long next_millis = millis() + DISPLAY_UPDATE_PERIOD;  //determine the next time this function should activate

  //Time to update the display?
  if (millis() > next_millis || update_now)
  {
    //block interrupts while retreiving the temperature values.
    noInterrupts();
    //int16_t adc_copy = status.adc_counts;
    int16_t tip_temperature_copy = status.tip_temperature_c;
    int16_t adc_ic_temp_counts_copy = status.adc_ic_temp_counts;
    interrupts();

    display.clearDisplay();
    display.setTextColor(WHITE);
    
    display.setTextSize(1);
    display.setCursor(0, 0);
    display.print("Set");
    display.setCursor(64, 0);
    display.print("Deg C");
    
    display.setTextSize(2);
    display.setCursor(0, 12);
    display.print((int16_t)params.setpoint);
    
    display.setCursor(64, 12);
    display.print(tip_temperature_copy);
     uint16_t pwm_bar = status.pid_output/7.5;  //scale max PWM value (961) down to 128 pixels. TODO: dont leave this hard coded. 
     display.fillRect(0, 29, pwm_bar, 3, WHITE);
    //display.print(" ");
    //display.print(ADS1118_INT_TEMP_C(adc_ic_temp_counts_copy));
    //display.setCursor(0, 20);

    //display.print(status.encoder_pos);

    
    display.display();

    next_millis += DISPLAY_UPDATE_PERIOD;  //set up our loop to run again in x ms
  }
}



/*
  if (dell.read_data() == true)
  {
    display.print(" ");
    display.print("DELL PWR ");
  }
  else
  {
    display.print("     ");
  }
  if (fastDigitalRead(CRADLE_SENSOR) == false)
  {
    display.print(" ");
    display.print("CRDL ");
    in_cradle = true;
  }
  else
  {
    in_cradle = false;
    display.print("      ");
  }
*/



<commit_msg>fixed bug in display refresh logic.<commit_after>/* Copyright (c) 2017 timothyjager
   JBC-Soldering-Controller
   MIT License. See LICENSE file for details.
*/

//----------------OLED Display------------------------


//This updates the OLED display
void updateDisplay(bool update_now)
{
#define DISPLAY_UPDATE_PERIOD 250;
  static bool in_cradle;
  static long next_millis = millis() + DISPLAY_UPDATE_PERIOD;  //determine the next time this function should activate

  //Time to update the display?
  if (millis() > next_millis || update_now)
  {
    //block interrupts while retreiving the temperature values.
    noInterrupts();
    //int16_t adc_copy = status.adc_counts;
    int16_t tip_temperature_copy = status.tip_temperature_c;
    int16_t adc_ic_temp_counts_copy = status.adc_ic_temp_counts;
    interrupts();

    display.clearDisplay();
    display.setTextColor(WHITE);

    display.setTextSize(1);
    display.setCursor(0, 0);
    display.print("Set");
    display.setCursor(64, 0);
    display.print("Deg C");

    display.setTextSize(2);
    display.setCursor(0, 12);
    display.print((int16_t)params.setpoint);

    display.setCursor(64, 12);
    display.print(tip_temperature_copy);
    uint16_t pwm_bar = status.pid_output / 7.5; //scale max PWM value (961) down to 128 pixels. TODO: dont leave this hard coded.
    display.fillRect(0, 29, pwm_bar, 3, WHITE);
    //display.print(" ");
    //display.print(ADS1118_INT_TEMP_C(adc_ic_temp_counts_copy));
    //display.setCursor(0, 20);

    //display.print(status.encoder_pos);


    display.display();
    if (!update_now)
    {
      next_millis += DISPLAY_UPDATE_PERIOD;  //set up our loop to run again in x ms
    }
  }
}



/*
  if (dell.read_data() == true)
  {
    display.print(" ");
    display.print("DELL PWR ");
  }
  else
  {
    display.print("     ");
  }
  if (fastDigitalRead(CRADLE_SENSOR) == false)
  {
    display.print(" ");
    display.print("CRDL ");
    in_cradle = true;
  }
  else
  {
    in_cradle = false;
    display.print("      ");
  }
*/




{'fraction_non_alphanumeric': 0.14292779426310584, 'fraction_numerical': 0.024727992087042534, 'mean_word_length': 2.896917148362235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4434247', 'n_tokens_mistral': 1492, 'n_tokens_neox': 1391, 'n_words': 300}