Skip to content

Show the dialog before running update, switch to stock and shutdown commands - #286

Merged
pellcorp merged 1 commit into
pellcorp:mainfrom
kyleinoregon:fix/deferred-command-feedback
Sep 7, 2026
Merged

pellcorp merged 1 commit into
pellcorp:mainfrom
kyleinoregon:fix/deferred-command-feedback

Conversation

@kyleinoregon

Copy link
Copy Markdown

Problem

Pressing Update (and likewise Switch to Stock and Shutdown Host) and confirming the prompt gives no visible feedback at all: the button never shows its pressed colour and no dialog appears. The next thing you see is the printer rebooting. On COSMOS the update command downloads about 124 MB and flashes before it reboots, so the screen looks dead for several minutes and it is tempting to power-cycle in the middle of it.

The cause is in SettingPanel::handle_callback: the command runs through call_command() (sp::call, i.e. Popen().wait()) synchronously on the LVGL thread, inside the confirm dialog's click dispatch, and the "Initiated" dialog is only created after the command returns. A command that ends in reboot never returns, so lv_timer_handler() never gets to draw anything.

The factory reset button already avoids this: it creates the dialog first and defers the command to a one-shot lv_timer.

Change

  • Generalise that deferral into run_command_deferred(), taking the failure title and message so the callback is shared.
  • Use it for update, switch-to-stock and shutdown-host with a 500 ms delay, which is plenty for LVGL to render the dialog before the command blocks the thread.
  • Factory reset keeps its existing 5 s delay, so its behaviour is unchanged.
  • Failure handling is unchanged: a non-zero exit closes the "Initiated" dialog and shows the "Failed" one, exactly as factory reset does today.

Tested

  • Cross-built with GUPPY_SMALL_SCREEN and COSMOS's build variables and run on an Elegoo Centauri Carbon (480x272) on COSMOS 26.08.0. Confirming Update now shows "Update COSMOS Initiated" immediately; the update then ran to completion and rebooted.
  • Also built in the default configuration (no UPDATE_CMD, so the shutdown-host path) with no warnings.

@kyleinoregon

Copy link
Copy Markdown
Author

I'm no coder but I can work through basic understanding stuff. I have a Claude max plan and figured I would put it to use for the greater good. Happy to change/fix/remove if you give the word. I did install and test on my Centauri Carbon 1 w/canvas for a dry run,dry fail, and production. Appreciate everyone on this project!

@pellcorp

pellcorp commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Wonderful, I can take a look at these soon, thanks for taking the time, this sort of stuff is really great polish that helps everyone.

@pellcorp

pellcorp commented Sep 6, 2026 •

Copy link
Copy Markdown
Owner

please rebase on latest main, as I just merged the large MMU PR.
Then I can test this, if no issues will merge.

…ommands

The update, switch-to-stock and shutdown-host handlers ran their command
synchronously on the LVGL thread from inside the click dispatch and only
created the "Initiated" dialog after the command returned. Commands that
end in a reboot never return, so the screen showed nothing at all until
the printer restarted, not even the button's pressed state.

Factory reset already avoids this by creating the dialog first and
deferring the command to a one-shot lv_timer. Generalise that into
run_command_deferred() and use it for all four commands. Factory reset
keeps its 5 s delay; the others wait 500 ms, enough for LVGL to render
the dialog before the command blocks the thread. Failure handling is
unchanged: a non-zero exit replaces the dialog with the "Failed" one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@kyleinoregon
kyleinoregon force-pushed the fix/deferred-command-feedback branch from 08508fb to d05eb84 Compare September 6, 2026 21:04
@kyleinoregon

Copy link
Copy Markdown
Author

Rebased on current main (on top of #282), and #289 rebased on top of it. Both build clean with and without UPDATE_CMD.

@pellcorp

pellcorp commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Rebased on current main (on top of #282), and #289 rebased on top of it. Both build clean with and without UPDATE_CMD.

I hope to get a chance to verify this on my K1 and Nebula Pad, if all goes well I will be merging.

@pellcorp
pellcorp merged commit 1ec51c7 into pellcorp:main Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants