FastLED 3.10.8
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 1007 of file channel.cpp.hpp.

1007 {
1008 // #2517: detect the silent-drop scenario before enqueuing — if the
1009 // resolved driver is registered with ChannelManager but currently
1010 // disabled (typically by `FastLED.setExclusiveDriver<OtherBus>()`),
1011 // `ChannelManager::onEndFrame()` will skip its `show()` call and the
1012 // frame is silently dropped on the floor. Emit an actionable
1013 // FL_ERROR so users can diagnose the missing output.
1014 //
1015 // One-shot via `mDisabledDriverWarned` to avoid per-frame spam.
1016 // Reset the latch whenever the driver returns to ENABLED so a later
1017 // disable re-emits the diagnostic.
1018 fl::string driverName = driver->getName();
1019 auto status = ChannelManager::instance().driverStatus(driverName);
1021#if FASTLED_LOG_RUNTIME_ENABLED
1022 if (!mDisabledDriverWarned) {
1024 mName, driverName,
1025 ChannelManager::instance().exclusiveDriverName());
1026 mDisabledDriverWarned = true;
1027 }
1028#endif
1029 // Skip the enqueue — the data wouldn't be sent anyway, and dropping
1030 // it here matches the existing behaviour (rather than leaving stale
1031 // bytes in the driver's pending queue across an enable/disable flip).
1032 // The drop happens in both debug and release; only the diagnostic
1033 // and the one-shot latch are gated. In release, the empty
1034 // emitDisabledDriverError + the exclusiveDriverName() call + the
1035 // 3-arg fl::string chain dead-strip (see #2950).
1036 return;
1037 } else if (status == ChannelManager::DriverStatus::STATUS_ENABLED) {
1038#if FASTLED_LOG_RUNTIME_ENABLED
1039 // Reset the one-shot guard so a future disable re-emits the diagnostic.
1040 mDisabledDriverWarned = false;
1041#endif
1042 }
1043 // NOT_REGISTERED: driver is not managed by ChannelManager (e.g. a custom
1044 // test driver, or one that was removed). Fall through to enqueue and let
1045 // the driver decide what to do — this is the historic behaviour.
1046
1047 // Enqueue for transmission (will be sent when driver->show() is called)
1048 driver->enqueue(mChannelData);
1049 // Presented, per the driver contract: an accepted enqueue is the frame.
1050 ++mDitherPhase;
1051 auto& events = ChannelEvents::instance();
1052 // Reuse the name fetched for driverStatus() instead of a second getName().
1053 events.onChannelEnqueued(*this, driverName);
1054}
u8 mDitherPhase
This channel's temporal-dither phase.
Definition channel.h:448
ChannelDataPtr mChannelData
Definition channel.h:457
bool mDisabledDriverWarned
Definition channel.h:449
fl::string mName
Definition channel.h:456
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:199
@ STATUS_DISABLED
Driver is registered but disabled.
Definition manager.h:198
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() FL_NO_EXCEPT

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: