FastLED 3.10.6
Loading...
Searching...
No Matches

◆ submitFrame()

void fl::Channel::submitFrame ( const fl::shared_ptr< IChannelDriver > & driver)
private

Submit the encoded frame to driver: disabled-driver drop + one-shot diagnostic, enqueue, dither advance, and onChannelEnqueued (#4566).

Definition at line 976 of file channel.cpp.hpp.

976 {
977 // #2517: detect the silent-drop scenario before enqueuing — if the
978 // resolved driver is registered with ChannelManager but currently
979 // disabled (typically by `FastLED.setExclusiveDriver<OtherBus>()`),
980 // `ChannelManager::onEndFrame()` will skip its `show()` call and the
981 // frame is silently dropped on the floor. Emit an actionable
982 // FL_ERROR so users can diagnose the missing output.
983 //
984 // One-shot via `mDisabledDriverWarned` to avoid per-frame spam.
985 // Reset the latch whenever the driver returns to ENABLED so a later
986 // disable re-emits the diagnostic.
987 fl::string driverName = driver->getName();
988 auto status = ChannelManager::instance().driverStatus(driverName);
990#if FASTLED_LOG_RUNTIME_ENABLED
993 mName, driverName,
994 ChannelManager::instance().exclusiveDriverName());
996 }
997#endif
998 // Skip the enqueue — the data wouldn't be sent anyway, and dropping
999 // it here matches the existing behaviour (rather than leaving stale
1000 // bytes in the driver's pending queue across an enable/disable flip).
1001 // The drop happens in both debug and release; only the diagnostic
1002 // and the one-shot latch are gated. In release, the empty
1003 // emitDisabledDriverError + the exclusiveDriverName() call + the
1004 // 3-arg fl::string chain dead-strip (see #2950).
1005 return;
1006 } else if (status == ChannelManager::DriverStatus::STATUS_ENABLED) {
1007#if FASTLED_LOG_RUNTIME_ENABLED
1008 // Reset the one-shot guard so a future disable re-emits the diagnostic.
1009 mDisabledDriverWarned = false;
1010#endif
1011 }
1012 // NOT_REGISTERED: driver is not managed by ChannelManager (e.g. a custom
1013 // test driver, or one that was removed). Fall through to enqueue and let
1014 // the driver decide what to do — this is the historic behaviour.
1015
1016 // Enqueue for transmission (will be sent when driver->show() is called)
1017 driver->enqueue(mChannelData);
1018 // Presented, per the driver contract: an accepted enqueue is the frame.
1019 ++mDitherPhase;
1020 auto& events = ChannelEvents::instance();
1021 // Reuse the name fetched for driverStatus() instead of a second getName().
1022 events.onChannelEnqueued(*this, driverName);
1023}
u8 mDitherPhase
This channel's temporal-dither phase.
Definition channel.h:426
ChannelDataPtr mChannelData
Definition channel.h:435
bool mDisabledDriverWarned
Definition channel.h:427
fl::string mName
Definition channel.h:434
static ChannelManager & instance() FL_NO_EXCEPT
Get the global singleton instance.
DriverStatus driverStatus(const fl::string &name) const FL_NO_EXCEPT
Look up a driver's registration status without logging on miss.
@ STATUS_ENABLED
Driver is registered and enabled.
Definition manager.h:193
@ STATUS_DISABLED
Driver is registered but disabled.
Definition manager.h:192
static FL_NO_INLINE void emitDisabledDriverError(const fl::string &channelName, const fl::string &driverName, const fl::string &exclusive) FL_NO_EXCEPT
Out-of-line cold-path emitter for the #2517 silent-drop DISABLED-driver diagnostic in Channel::showPi...
Status status() FL_NO_EXCEPT
Current connection state.
Definition wifi.cpp.hpp:43
static ChannelEvents & instance()

References fl::ChannelManager::driverStatus(), fl::FL_NO_EXCEPT, fl::ChannelEvents::instance(), fl::ChannelManager::instance(), mChannelData, mDisabledDriverWarned, mDitherPhase, mName, fl::ChannelManager::STATUS_DISABLED, and fl::ChannelManager::STATUS_ENABLED.

Referenced by showPixels().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: