Why is it recommended to not use i2c with STARTUP?

I am trying to find a solution to display some information on an LCD during the startup process and avoid the several seconds of the screen being blank before the setup() method is executed. I have an LCD connected via i2c and was looking to use the Particle STARTUP() - Macros process, but the docs recommend against using i2c during this process and I was wondering why.

The only other solution I can find is to use some custom circuit to have a static message displayed once power is initiated and then switched over to the data from the photon once the startup() method is executed. I would like to avoid this…

Any other recommendations?

@alanquillin, welcome to the Community!

The reason for not including I2C in the STARTUP macro is that the order of initialization of class objects is not guaranteed prior to setup(), including the I2C class. Have you considered using SYSTEM_THREAD(ENABLED) to allow setup() to run as soon as initialization begins without waiting for the Cloud connection to be established? You could then put your display code at the start of setup() and it should run very quickly.

1 Like

Ah, ok, that makes sense. I have not considered SYSTEM_THREAD(ENABLED), I saw it menetioned but I guess it never registered what it was. I will take a look. Thanks!

1 Like

@peekay123 Yep, that worked and was exactly was I needed. Thanks!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.