 
 #include <Adafruit_BME280.h>
 Adafruit_BME280 bme(0);
-bool bme_ok = false;
-
-bool determineLocalTemperature = true;
-bool startedWithPattern = false;
-bool displayUpdated = false;
-unsigned long systemStart = 0;
-
-uint8_t cyclesWithoutUpdateThreshold = 5;
 
 #include "CrcableData.h"
 

    display.initFullMode();
    display.fillScreen(0x36); // a line pattern
    display.update();
    display.initPartialMode();
    startedWithPattern = true;
  } else {
    display.initPartialMode();
    display.fillScreen(EPD_WHITE);
  }

  server.begin();
  
  if (!bme.begin()) {
    Serial.println("No BME!");
  } else {
    bme_ok = true;
    delay(100); // Allow things to settle after begin()
  }
}

void loop()
{
  unsigned long loopStart = millis();
  
  if (determineLocalTemperature) {
    determineLocalTemperature = false;

    localData.dataValid = false;
    
    if (bme_ok) {
      float t = bme.readTemperature() - 1;
      float h = bme.readHumidity();

      if (isnan(t) || isnan(h)) {
        Serial.println("First local temp read was invalid");
        delay(100);
        t = bme.readTemperature() - 1;
        h = bme.readHumidity();
      }
   
      if (!isnan(t) && !isnan(h) && t > -100 && t < 100) {
        localData.dataValid = true;
        localData.temperature = round(t * 5) / 5.0f;
        localData.humidity = round(h * 5) / 5.0f;

        updateVaporPressure(&localData);

        if (startedWithPattern) {
          // Show something at the very first start
          TH invalidData;
          updateDisplay(&localData, &invalidData);
        }
      } else {
        localData.dataValid = false;
      }
    }
  }

  // TODO blank values if not up to date (> 5 minutes?)

  unsigned long systemActive = millis() - systemStart;
  unsigned int secondsUntilOff = 0;

  bool shouldSleepNow = millis() - systemStart > systemAwakeSeconds * 1000;

  if (shouldSleepNow && !displayUpdated) {
    boolean internalIsToBeShown = true;
    /*
    boolean internalIsToBeShown = systemState.displayedInternalTemperature == -100;

    if (!internalIsToBeShown) {
