Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #206
Problem
During manual exit and OS shutdown/session termination, LEDs could remain lit because:
SettingsWindow::quit(),LightpackApplication::onSessionChange(SystemSession::Status::Ending), andcommitData()postedswitchOffLeds()asynchronously viaQt::QueuedConnectionand calledQApplication::processEvents(), which returns immediately on the main thread without waiting form_ledDeviceManagerThreadorm_ledDeviceThreadto finish writing the off frame.onSessionChange(Ending)andcommitData()did not stopGrabManager,MoodLampManager, andSoundManagerbefore shutting off LEDs, allowing color frames to keep racing into the queue.LightpackApplication::commitData(QSessionManager &)was still declared as a Qt 4virtualoverride rather than connected toQGuiApplication::commitDataRequest.LedDeviceAdalight::switchOffLeds()andLedDeviceArdulight::switchOffLeds()calledwriteBuffer(m_writeBuffer)withforce = false(which could skip the turn-off frame whenbytesToWrite() > 0) and returned before draining the serial port buffer viawaitForBytesWritten().Changes
LedDeviceManager: AddedQ_INVOKABLE void switchOffLedsSync(int timeoutMs = 1000)which setsBacklight::StatusOff, drops queuedSetColors, enqueues/sendsOffLeds, and runs a bounded localQEventLoopuntilOffLedscompletes or command state resets/times out.LedDeviceAdalight/LedDeviceArdulight: Forced writing the off frame inswitchOffLeds()(writeBuffer(m_writeBuffer, true)) and flushedbytesToWrite()viawaitForBytesWritten()within a 250 ms budget before acknowledging completion.LightpackApplication/SettingsWindow: AddedLightpackApplication::prepareForShutdown()to stop frame generators (GrabManager,MoodLampManager,SoundManagerBase) and invokeLedDeviceManager::switchOffLedsSync(1000)viaQt::BlockingQueuedConnectionwhenisKeepLightsOnAfterExit()is false; connectedQGuiApplication::commitDataRequesttocommitData(); routedonSessionChange(Ending),commitData(),SettingsWindow::quit(), traylesscloseEvent(), andquitForWizardthroughprepareForShutdown().LedDeviceManagerTest): AddedtestSwitchOffLedsSyncFlushesWithInFlightSetColorsandtestSwitchOffLedsSyncBoundedTimeoutWhenStalled, plus closed-portswitchOffLeds()ack checks onLedDeviceAdalightandLedDeviceArdulight.Verification
PrismatikandLightpackTestswithqmake6 -r && make -j2.QT_QPA_PLATFORM=offscreen ./bin/LightpackTests— all 8 test suites passed (0 failed).