[2/2] Improve led availability checking and caching.

First part frameworks/base.