FastLED 3.10.10
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 1044 of file channel.cpp.hpp.

1044 {
1045 // #2517: detect the silent-drop scenario before enqueuing — if the
1046 // resolved driver is registered with ChannelManager but currently
1047 // disabled (typically by `FastLED.setExclusiveDriver<OtherBus>()`),
1048 // `ChannelManager::onEndFrame()` will skip its `show()` call and the
1049 // frame is silently dropped on the floor. Emit an actionable
1050 // FL_ERROR so users can diagnose the missing output.
1051 //
1052 // One-shot via `mDisabledDriverWarned` to avoid per-frame spam.
1053 // Reset the latch whenever the driver returns to ENABLED so a later
1054 // disable re-emits the diagnostic.
1055 fl::string driverName = driver->getName();
1056 auto status = ChannelManager::instance().driverStatus(driverName);
1058#if FASTLED_LOG_RUNTIME_ENABLED
1059 if (!mDisabledDriverWarned) {
1060 emitDisabledDriverError(
1061 mName, driverName,
1062 ChannelManager::instance().exclusiveDriverName());
1063 mDisabledDriverWarned = true;
1064 }
1065#endif
1066 // Skip the enqueue — the data wouldn't be sent anyway, and dropping
1067 // it here matches the existing behaviour (rather than leaving stale
1068 // bytes in the driver's pending queue across an enable/disable flip).
1069 // The drop happens in both debug and release; only the diagnostic
1070 // and the one-shot latch are gated. In release, the empty
1071 // emitDisabledDriverError + the exclusiveDriverName() call + the
1072 // 3-arg fl::string chain dead-strip (see #2950).
1073 return;
1074 } else if (status == ChannelManager::DriverStatus::STATUS_ENABLED) {
1075#if FASTLED_LOG_RUNTIME_ENABLED
1076 // Reset the one-shot guard so a future disable re-emits the diagnostic.
1077 mDisabledDriverWarned = false;
1078#endif
1079 }
1080 // NOT_REGISTERED: driver is not managed by ChannelManager (e.g. a custom
1081 // test driver, or one that was removed). Fall through to enqueue and let
1082 // the driver decide what to do — this is the historic behaviour.
1083
1084 // Enqueue for transmission (will be sent when driver->show() is called)
1085 driver->enqueue(mChannelData);
1086 // Presented, per the driver contract: an accepted enqueue is the frame.
1087 ++mDitherPhase;
1088 auto& events = ChannelEvents::instance();
1089 // Reuse the name fetched for driverStatus() instead of a second getName().
1090 events.onChannelEnqueued(*this, driverName);
1091}
u8 mDitherPhase
This channel's temporal-dither phase.
Definition channel.h:445
ChannelDataPtr mChannelData
Definition channel.h:454
bool mDisabledDriverWarned
Definition channel.h:446
fl::string mName
Definition channel.h:453
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
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: