Timing issues with DS18B20 sensor and 4dig7segment display (multiplex+ shiftreg)

Changed the code with everything you said but I stil get a flicker every 750ms (the display goes dark very briefly). Did I do the main loop correctly? Also one thing that I changed was the multiplex time. 4ms was too much, could see a sort of scanning happening.

byte writeDisplay() {
  static byte j;
  static unsigned long lastUpdate;

  if (millis() - lastUpdate >= 1) {
    digitalWrite(digitPins[j], HIGH); //unselect previous digit
    if (++j >= 4) j = 0;
    digitalWrite(latch_pin, LOW);// opens register and locks outputs
    shiftOut(DS_pin, shift_pin, LSBFIRST, registers[digits[j]]);
    digitalWrite(latch_pin, HIGH);//latches from register to outputs
    digitalWrite(digitPins[j], LOW); //selects new digit
    lastUpdate = millis();
    return 1;
  }
  else return 0;
}

void loop() {
  if (writeDisplay() == 1) {
    if ( (millis() - lastReadingTime) > processingTime) {
      reading = sensors.getTempC(tempSensor);
      sensors.requestTemperaturesByAddress(tempSensor); //read temps
      lastReadingTime = millis();
      setDigits();
    }
  }
}