       calc_time_ms = millis();
     }
    }
+
+   if (calc_time_ms > millis()) calc_time_ms = millis(); // to Reset the timer variable once millis() timer overflows.
   
     if (solenoid_valve_open == true && water_level_cm <= close_valve_at_cm_level){
     digitalWrite(solenoidValvePin,LOW);

      data_read(data_buf);
      delay(1);
      if ((millis() - time_check) >= 2000){//Haha, let's NOT get stuck if the thing is unplugged
        Serial.println("checksum_error");
        break;
        }



    rpm_calculation();
    flow_rate();
    shaft_temp();
    one_wire_temps();
    Irms = emon1.calcIrms(1480);  // Calculate Irms only
    if (Irms < 2) Irms = 0;//Until library is fixed
