Skip to content

Organize multiACE macros in Fluidd and Mainsail - #178

Merged
decay71 merged 3 commits into
mainfrom
tareku99/issue-175-macro-layout
Oct 21, 2026
Merged

decay71 merged 3 commits into
mainfrom
tareku99/issue-175-macro-layout

Conversation

@Tareku99

@Tareku99 Tareku99 commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #175.

Organizes active multiACE controls into purpose-based groups in Fluidd and Mainsail. The provider-owned Klipper module starts after Klipper is ready, waits for active macros and frontend database readiness, stops startup retries for a frontend after five unavailable namespace checks, and exits on Klipper disconnect. It preserves user-created groups and categories, keeps existing group/category names and settings, hides INNER_RESUME in both frontends, and offers a repeatable manual apply command. Automatic grouping can be disabled with macro_layout_enabled: false under [ace].

The standalone installer/uninstaller and managed-package manifest include ace_macro_layout.py. Platforms that mount Klipper extras individually must expose that provider file at Klipper's extras path. They can add an optional settings action for manual retries after adopting a release. Existing ACE G-code macro names remain unchanged for console and G-code compatibility.

Validation: Decay tested the previous iteration on hardware with Fluidd and ran mocked Moonraker checks, including repeated apply and settings preservation. The follow-up fixes in this commit have not been retested yet.

@Tareku99
Tareku99 requested a review from decay71 as a code owner October 18, 2026 05:28
@Tareku99

Tareku99 commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

Hey @decay71, could you run a smoke test of the macro layout in Fluidd and Mainsail, if you have a suitable printer available? The main checks are that groups appear after each frontend initializes its database, repeated apply/reboot does not create duplicates, and existing custom groups or categories remain intact.
I am testing the other multiACE PAXX implementation right now, so my printer is tied up; I can test this later if you are not available. The layout helper only updates frontend settings and does not run printer macros.

@decay71

decay71 commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Hi, @Tareku99 ,

Sorry, i am out of town this weekend, back on monday.

@Tareku99

Copy link
Copy Markdown
Collaborator Author

@decay71 no worries, I won't get to it till next week since I want to make sure paxx implementation works well..
I will leave a comment when I get to it if you don't first. Safe travels

@decay71

decay71 commented Oct 18, 2026

Copy link
Copy Markdown
Owner

All right, thanks. I will test it on monday.

@decay71 decay71 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I tested it today and it works well: the macros are neatly grouped in Fluidd right after the restart, and it is a real improvement over the long flat list.

Tested on my printer (dev build, Fluidd only, no Mainsail installed), plus a desk run against a mocked Moonraker with the real macro names from ace.cfg:

  • The groups appear in Fluidd after the restart, with all multiACE macros sorted in.
  • A repeated apply reports "current" and writes nothing; no duplicate categories after a reboot either.
  • In the desk run, user groups/categories (also one holding an ACE macro), Mainsail groups, hiddenMacros and dashboard panels stayed intact, without duplicates.

A few things to look at:

  1. Naming: every other multiACE Klipper module is ace*.py / _ace.py and the config sections are [ace], [ace_bg_swap], [ace_tipform]. Could you rename it to ace_macro_layout.py / [ace_macro_layout]? Then it also matches the existing ace.py globs (our PAXX bake script, the installer's chown, the uninstaller's pycache cleanup) without extra lines.
  2. No lasting opt-out: our config merge copies every section outside [ace]/[ace N]/[ace_bg_swap]/[ace_tipform] verbatim from the new default, so a user who deletes the section gets it back with the next update. An enable switch would need to live in [ace], or I add the section to the merge.
  3. Without Mainsail the worker polls every 30 s for the full 30 minutes and ends with a warning. Maybe stop asking for a frontend whose namespace does not exist after the first few polls.
  4. After a FIRMWARE_RESTART the previous worker thread keeps running next to the new one (the lock is per instance). Harmless since apply is idempotent, but it doubles the polling.
  5. Fluidd: INNER_RESUME stays visible on real hardware (it is only hidden when Fluidd already has an entry for it). Since all the other stock INNER_* macros are listed there anyway, hiding just this one does not buy much; either drop the hiding or add the entry so it works on a fresh Fluidd.
  6. Fluidd: renaming a multiACE category is reset on every apply (the name is forced), while Mainsail keeps a renamed group (setdefault). Same behaviour on both would be nice.

An idea for a follow-up PR, not for this one: with the groups in place, the ACEA__..ACEH__ letters that only force the alphabetical order are no longer needed. Readable names with one common prefix (e.g. MULTIACE_STATUS, MULTIACE_LOAD_SLOT_1, MULTIACE_DRY_STOP) would still keep them together in frontends without groups (Mainsail simple mode, KlipperScreen). The names are referenced in a few more places that would have to move along: your group list, the web UI macro buttons (_MACRO_BUCKETS in web/backend/main.py), the managed manifest's remove_sections and its tests, and the recovery hints in ace.py and the i18n files. Users would lose their per-macro Fluidd/Mainsail settings once. Would you like to take that on after this one is merged, or should I handle it?

@Tareku99

Copy link
Copy Markdown
Collaborator Author

Thanks for testing it for me and leaving feedback. I addressed the layout follow-ups in the updated commit: the helper and config section now use ace_macro_layout; the opt-out is under [ace] so it survives config updates; startup retries stop for a frontend after five unavailable namespace checks; and the worker stops on klippy:disconnect so it does not keep polling across a firmware restart. Fluidd now creates a hidden INNER_RESUME entry when that macro is active and preserves renamed categories. The installer, uninstaller, managed manifest, and documentation use the new helper name.

I am not too sure if I agree with changing the macro names. They can still be used from console and invoked from other processes so renaming it just because we grouped them could cause more issues than it is worth for visual effects. I think we should keep them named what they are and deal with the redundant naming when grouped together. Let me know what you think.

I have not retested these follow-up changes yet, so your hardware test covered the earlier commit. When convenient, could you test this again, if not I can take a stab at it, just not too sure when since my printer is busy.

@decay71

decay71 commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Thanks for the update. Agreed on the macro names, let's keep them. Nothing in multiACE calls them by name, but users may have them in their own macros, start G-code or dashboard buttons, and renaming would break those just for a cleaner look. The duplicated prefix inside the groups is a bit redundant, but that is fine for now.

I will test the new commit on my printer today and report back.

@decay71 decay71 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the updated commit on my printer (Fluidd only, Mainsail is not installed here), on top of the groups from the first test:

  • Install and restart: still 6 categories, no duplicates, and INNER_RESUME is now hidden in Fluidd.
  • Renamed a multiACE category, ran apply: the new name stays, no second category was created.
  • Restart: nothing duplicated.
  • macro_layout_enabled: false, deleted a multiACE category, restart: it stays deleted. Back to true and restart: it is recreated, no duplicates.
  • klippy.log shows the expected layout lines and no errors.

One thing before merging: macro_layout_enabled sits in [ace] but is only read by ace_macro_layout. If someone deletes the [ace_macro_layout] section to turn the feature off, nothing reads the option anymore and Klipper stops with "Option 'macro_layout_enabled' is not valid in section 'ace'". Could you add a read of the option in ace.py as well (config.getboolean('macro_layout_enabled', True), unconditionally), so both ways of turning it off are safe? After that I am happy to merge.

@Tareku99

Copy link
Copy Markdown
Collaborator Author

Thanks for testing this for me! I wish I had space for more printers so I could do it myself

@decay71
decay71 merged commit d951f33 into main Oct 21, 2026
7 checks passed
@decay71
decay71 deleted the tareku99/issue-175-macro-layout branch October 21, 2026 05:12
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.

Organize multiACE macros into frontend groups

2 participants