The current implementation of RTClib provides no way, to check "on demand" if the i2c device has been connected and initialized. The only way is the return value of the "begin" function.
However, the protected variable "i2c_dev" in the class "RTC_I2C" does contain this information. If it is "NULL", the device has not been initialized.
Therefore, I added a function to "RTC_I2C" to check if this variable is NULL or not. Unfortunately, all classes derived from RTC_I2C must be derived "public". Otherwise, the variable is not visible to code outside the derived classes.
The current implementation of RTClib provides no way, to check "on demand" if the i2c device has been connected and initialized. The only way is the return value of the "begin" function.
However, the protected variable "i2c_dev" in the class "RTC_I2C" does contain this information. If it is "NULL", the device has not been initialized.
Therefore, I added a function to "RTC_I2C" to check if this variable is NULL or not. Unfortunately, all classes derived from RTC_I2C must be derived "public". Otherwise, the variable is not visible to code outside the derived classes.