From 7edea6ae7563f597bda473ce3a5865ba6d0cc47b Mon Sep 17 00:00:00 2001 From: repeat98 Date: Tue, 24 Nov 2026 18:06:23 +0100 Subject: [PATCH 1/2] Model:Cycles: a Status page over the link Your Model:Cycles (#model-cycles/unit, beta): the base the unit runs, its live modules and its audio load, read over the USB MIDI SysEx link every two seconds (readMcStatus: ident, mods and load over one line), in the Octatrack's console cells. A unit that does not answer the link reads as having no Modwerk base, with a link to build one. Co-Authored-By: Claude Opus 5.5 --- .../2026-11-24-model-cycles-status-page.md | 1 + docs/MACHINE_RECIPE.md | 2 +- sdk/machines/model-cycles/README.md | 2 +- sdk/machines/model-cycles/machine.json | 1 + src/App.tsx | 19 +-- src/components/ModelCyclesUnit.test.ts | 73 ++++++++++ src/components/ModelCyclesUnit.tsx | 130 ++++++++++++++++++ src/components/beta.ts | 1 + src/devices/MachinePages.tsx | 8 +- src/devices/machines.generated.json | 2 +- src/devices/registry.ts | 3 + src/engine/elektron/mc-link.ts | 14 ++ 12 files changed, 241 insertions(+), 15 deletions(-) create mode 100644 changelog/2026-11-24-model-cycles-status-page.md create mode 100644 src/components/ModelCyclesUnit.test.ts create mode 100644 src/components/ModelCyclesUnit.tsx diff --git a/changelog/2026-11-24-model-cycles-status-page.md b/changelog/2026-11-24-model-cycles-status-page.md new file mode 100644 index 0000000000..d3c04b2f2f --- /dev/null +++ b/changelog/2026-11-24-model-cycles-status-page.md @@ -0,0 +1 @@ +Beta members can open Your Model:Cycles from its machine page: with the unit connected over USB, it shows the Modwerk base it runs, the modules loaded on it and its audio load, read every two seconds. It needs a base with the USB link, today a development base. diff --git a/docs/MACHINE_RECIPE.md b/docs/MACHINE_RECIPE.md index 0292243daa..7639eba204 100644 --- a/docs/MACHINE_RECIPE.md +++ b/docs/MACHINE_RECIPE.md @@ -43,7 +43,7 @@ Read this before you plan a core, a base or the first modules for any machine ot | Digitakt II | preview | Modwerk base from core-dt2 1.1's source (elekloader#221 at `0df8409`), with sequencer and project hooks | started: the site builds the [pinned base](../sdk/machines/digitakt-ii/elekloader/README.md) `8650bb8a` (`e88273ed`, which passed on one unit on 17 November 2026, with kit data ended before the project archive); downloads off. The USB link is not started (SysEx over USB MIDI, from the Rytm's) | digikit (emulator only) | the exact build on a second unit, then the USB link ([goal](../sdk/machines/digitakt-ii/GOAL.md)) | | Syntakt | research | Modwerk boot probe | not started | digiemu's port (open upstream pull request; emulator only) | the core stage, planned as the base | | Digitone II | research | core-dn2 0.3, with the Digitakt II 1.1 additions, in toonst's elekloader fork: boots and its six UI events run on units (18 November 2026) | started: Modwerk's builder carries the device (`machine:base` and the site's kit, 19 November 2026) | digikit (the author's; emulator only) | the Modwerk base, reusing the Digitakt II's with its own recipe as the Rytm MKI does, then flashing from the site and the link ([goal](../sdk/machines/digitone-ii/GOAL.md)) | -| Model:Cycles | research | Modwerk base from core-mc 0.3's source (Elekloader v0.11.0) plus a key-LED hook ([events.json](../sdk/machines/model-cycles/events.json)) | started: built by `npm run machine:base`; runs on a unit with a test module on the LED hook; the USB link started: identity, memory reads, keys, encoder turns and a RAM boot over USB MIDI SysEx in development bases, on a unit ([LINK.md](../sdk/machines/model-cycles/LINK.md), 23 November 2026), the audio load and a diagnostics log in the Octatrack's layout (24 November 2026), and the Octatrack's runtime loader over the link: a test module on trial, kept, undone and refused while playing, on a unit (24 November 2026); the MCP's `device_status` reads its identity, `device_load` the audio load, `device_log` the log, and its trial tools load modules (24 November 2026); the site builds the pinned base from the owner's OS file as a local preview, downloads off (24 November 2026) | digiemu (emulator only) | the first module, Control All Config ([guide](../sdk/machines/model-cycles/README.md)) | +| Model:Cycles | research | Modwerk base from core-mc 0.3's source (Elekloader v0.11.0) plus a key-LED hook ([events.json](../sdk/machines/model-cycles/events.json)) | started: built by `npm run machine:base`; runs on a unit with a test module on the LED hook; the USB link started: identity, memory reads, keys, encoder turns and a RAM boot over USB MIDI SysEx in development bases, on a unit ([LINK.md](../sdk/machines/model-cycles/LINK.md), 23 November 2026), the audio load and a diagnostics log in the Octatrack's layout (24 November 2026), and the Octatrack's runtime loader over the link: a test module on trial, kept, undone and refused while playing, on a unit (24 November 2026); the MCP's `device_status` reads its identity, `device_load` the audio load, `device_log` the log, and its trial tools load modules (24 November 2026); the site builds the pinned base from the owner's OS file as a local preview, downloads off (24 November 2026); its Status page (`#model-cycles/unit`, beta) reads the base, the live modules and the load over the link (24 November 2026) | digiemu (emulator only) | the first module, Control All Config ([guide](../sdk/machines/model-cycles/README.md)) | | Analog Keys | research | none | not started | none known | the machine steps first ([add a machine](ADD_A_MACHINE.md)) | | Zoom MultiStomp | preview (MS-70CDR); research (MS-50G, MS-60B, G1on) | MIDISTOMP on the MS-70CDR; the MS-50G and MS-60B need builds from their own OS | browser base build and flash over Web MIDI. Shared MCP status and load tools use the same link. Load needs the MIDISTOMP SysEx load reply. | Ziddle (emulator only) | Prove a RAM-only effect trial and rollback on the MS-70CDR before wiring review, trial, Keep and Undo. See the [plan](ZOOM_MULTISTOMP.md#plan). | | Zoom G1 FOUR | research | none: effects load on the stock OS | not started: zoom-zt2's file commands work over USB, the pedal page does not speak ZD2 yet | none known | [next steps](ZOOM_ZD2.md#next-steps) | diff --git a/sdk/machines/model-cycles/README.md b/sdk/machines/model-cycles/README.md index 46ea1ca9bb..c4f940d28f 100644 --- a/sdk/machines/model-cycles/README.md +++ b/sdk/machines/model-cycles/README.md @@ -6,7 +6,7 @@ The Model:Cycles is in research for stock OS 1.13. Its Modwerk base is in develo The Model:Cycles follows the Octatrack's stack ([recipe](../../../docs/MACHINE_RECIPE.md)). Its [Modwerk base](elekloader/README.md) starts from drumkilla's core-mc 0.3 at Elekloader v0.11.0, imported unchanged. Modwerk adds one hook, `ev_key_leds`, as the Digitakt II has it. The base owns the six sites below; a module subscribes to them and never patches them. What several modules will share (pages behind a stock key, menu rows, per-kit state) goes into the base before the first module that needs it ([choose how a module hooks in](../../../docs/module-guides/README.md#choose-how-a-module-hooks-in)). A site only one module needs stays that module's own declared site (`platform.claims`). -The Model:Cycles gets the whole stack before its base is released (owner, 23 November 2026). The USB link is started: a development base answers identity and memory reads and takes panel keys and encoder turns over USB MIDI SysEx, and boots an uploaded image from RAM without flashing it ([LINK.md](LINK.md)), after the Rytm's. Diagnostics are started: a development base measures the audio's share of the CPU, the link's `load` reports it, and it keeps a diagnostics log in the Octatrack's layout that the link's `diag` and `mem` read ([LINK.md](LINK.md)). Loading a module without a restart is started: a development base carries the Octatrack's runtime loader, and `mc_link.py try` loads a module to RAM on trial, keeps it or undoes it ([LINK.md](LINK.md#loading-modules)). The MCP's `device_status` reads the link's identity and names the build the unit runs, `device_load` reads the audio load, `device_log` the diagnostics log, and `device_review`, `device_trial`, `device_keep` and `device_undo` load a module through the runtime loader (`--elektron-midi`, [FRONTEND_MCP.md](../../../docs/FRONTEND_MCP.md#a-modelcycles-over-its-development-link)). Flashing from the site is started: the machine page builds the pinned base from the owner's own OS file in the browser (a local build preview, `CORE_BUILD_PREVIEWS`), byte for byte the image `machine:base` and Elekloader's patcher build; downloads stay off until review. The page can also send a build over USB as a stock OS update (`usb-upgrade.ts`, the unit asks UPGRADE OS NOW?); that button waits for the same approval as downloads. The sender ran on a unit (24 November 2026). The first module, Control All Config, waits for the base. +The Model:Cycles gets the whole stack before its base is released (owner, 23 November 2026). The USB link is started: a development base answers identity and memory reads and takes panel keys and encoder turns over USB MIDI SysEx, and boots an uploaded image from RAM without flashing it ([LINK.md](LINK.md)), after the Rytm's. Diagnostics are started: a development base measures the audio's share of the CPU, the link's `load` reports it, and it keeps a diagnostics log in the Octatrack's layout that the link's `diag` and `mem` read ([LINK.md](LINK.md)). Loading a module without a restart is started: a development base carries the Octatrack's runtime loader, and `mc_link.py try` loads a module to RAM on trial, keeps it or undoes it ([LINK.md](LINK.md#loading-modules)). The MCP's `device_status` reads the link's identity and names the build the unit runs, `device_load` reads the audio load, `device_log` the diagnostics log, and `device_review`, `device_trial`, `device_keep` and `device_undo` load a module through the runtime loader (`--elektron-midi`, [FRONTEND_MCP.md](../../../docs/FRONTEND_MCP.md#a-modelcycles-over-its-development-link)). Flashing from the site is started: the machine page builds the pinned base from the owner's own OS file in the browser (a local build preview, `CORE_BUILD_PREVIEWS`), byte for byte the image `machine:base` and Elekloader's patcher build; downloads stay off until review. The page can also send a build over USB as a stock OS update (`usb-upgrade.ts`, the unit asks UPGRADE OS NOW?); that button waits for the same approval as downloads. The sender ran on a unit (24 November 2026). The Status page is started: Your Model:Cycles (`#model-cycles/unit`, beta, [ModelCyclesUnit.tsx](../../../src/components/ModelCyclesUnit.tsx)) reads the base, the live modules and the audio load over the link every two seconds; until the release base carries the link it needs a development base. The first module, Control All Config, waits for the base. ## Core hooks diff --git a/sdk/machines/model-cycles/machine.json b/sdk/machines/model-cycles/machine.json index ee74045c50..6c883ea862 100644 --- a/sdk/machines/model-cycles/machine.json +++ b/sdk/machines/model-cycles/machine.json @@ -32,6 +32,7 @@ "link": "started", "flash": "started", "loader": "started", + "status": "started", "diagnostics": "started", "tools": "started" }, diff --git a/src/App.tsx b/src/App.tsx index 515bb4ba97..29a371ea60 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -81,7 +81,7 @@ import { ZoomEffectDetail } from './devices/ZoomEffectDetail' import { ZOOM_EFFECTS, isZoomSetDevice } from './devices/zoom-effects' import { LibraryDock } from './components/LibraryDock' import { LibrarySelection } from './components/LibrarySelection' -import { ALL_MACHINES, DEVICES, DEVICES_BY_ID, deviceHref, lastMachine, parseDeviceRoute, rememberDevice, rememberedDevice, type DeviceProfile } from './devices/registry' +import { ALL_MACHINES, DEVICES, DEVICES_BY_ID, MC_UNIT_ROUTE, deviceHref, lastMachine, parseDeviceRoute, rememberDevice, rememberedDevice, type DeviceProfile } from './devices/registry' import { sidebarMachine } from './devices/sidebar-machine' import { parseZoomHubRoute, zoomHubHref } from './devices/zoom-hub-route' import type { ZoomLink } from './engine/zoom/zoom-link' @@ -111,6 +111,7 @@ const StateChip = lazy(() => beta().then(module => ({ default: module.StateChip const ModuleDialog = lazy(() => beta().then(module => ({ default: module.ModuleDialog }))) const OctatrackHub = lazy(() => beta().then(module => ({ default: module.OctatrackHub }))) const ZoomHub = lazy(() => beta().then(module => ({ default: module.ZoomHub }))) +const ModelCyclesUnit = lazy(() => beta().then(module => ({ default: module.ModelCyclesUnit }))) const ZoomSidebarStatus = lazy(() => beta().then(module => ({ default: module.ZoomSidebarStatus }))) const ZoomBaseDialog = lazy(() => beta().then(module => ({ default: module.ZoomBaseDialog }))) const LoadDialog = lazy(() => beta().then(module => ({ default: module.LoadDialog }))) @@ -269,9 +270,11 @@ export default function App() { // A Zoom pedal's page (ZoomHub.tsx): #/pedal, over its own Web MIDI link; who may open it is zoomHub's below. // A pedal page: open to everyone for a pedal whose effects the library lists (the MS-70CDR), beta for the others. const zoomRoute = parseZoomHubRoute(moduleRoute), zoomHub = zoomRoute && (betaUi || isZoomSetDevice(zoomRoute.device.id)) ? zoomRoute : undefined - const zoomHubName = zoomHub?.device.name + // The Model:Cycles' page (ModelCyclesUnit.tsx): Status over its link, beta only. + const mcUnit = betaUi && moduleRoute === MC_UNIT_ROUTE + const unitPageName = zoomHub?.device.name ?? (mcUnit ? DEVICES_BY_ID['model-cycles'].name : undefined) useEffect(() => { if (zoomHub && !mobileWorkspace) void beta().then(module => setZoomLink(link => link ?? module.createZoomLink())).catch(console.error) }, [!!zoomHub, mobileWorkspace]) // eslint-disable-line react-hooks/exhaustive-deps - const missingRoute=!zoomHub&&!faqRoute&&!projectsRoute&&!overviewRoute&&!allRoute&&!devicesRoute&&!machineView&&route!=='octatrack'&&!route.startsWith('octatrack/')&&!route.startsWith('device/')&&!forumRoute&&!accountRoute&&!developerRoute&&!adminRoute&&!['library',...LIBRARY_CATEGORIES,'module-sets','configuration','faq','credits','base','privacy','impressum','community-rules','modding-guidelines','report-content'].includes(route)&&!route.startsWith('submit')&&!detailModule&&!communityModule&&!route.startsWith('module-set/') + const missingRoute=!zoomHub&&!mcUnit&&!faqRoute&&!projectsRoute&&!overviewRoute&&!allRoute&&!devicesRoute&&!machineView&&route!=='octatrack'&&!route.startsWith('octatrack/')&&!route.startsWith('device/')&&!forumRoute&&!accountRoute&&!developerRoute&&!adminRoute&&!['library',...LIBRARY_CATEGORIES,'module-sets','configuration','faq','credits','base','privacy','impressum','community-rules','modding-guidelines','report-content'].includes(route)&&!route.startsWith('submit')&&!detailModule&&!communityModule&&!route.startsWith('module-set/') const filter = LIBRARY_CATEGORIES.find(category => category === route) ?? 'all' const hubRoute = octatrackUi && (route === 'octatrack' || route.startsWith('octatrack/') || route === 'configuration') // The Octatrack page's list: the unit's own pages (#octatrack is Status), and #configuration for the set you edit. @@ -286,7 +289,7 @@ export default function App() { const remembered = rememberedDevice() // All machines is a library view; machine-specific panels fall back to the last machine (or the Octatrack). const allMachines = allRoute || overviewRoute || (!machineView && !octatrackRoute && remembered === ALL_MACHINES) - const currentDevice = DEVICES_BY_ID[zoomHub ? zoomHub.device.id : machineView ? machineRoute!.device.id : octatrackRoute ? 'octatrack' : remembered && remembered !== ALL_MACHINES ? remembered : 'octatrack'] + const currentDevice = DEVICES_BY_ID[zoomHub ? zoomHub.device.id : mcUnit ? 'model-cycles' : machineView ? machineRoute!.device.id : octatrackRoute ? 'octatrack' : remembered && remembered !== ALL_MACHINES ? remembered : 'octatrack'] const machineHasMods = !allMachines && (currentDevice.status === 'available' || currentDevice.status === 'preview') const machineBuildPreview = !allMachines && isCoreBuildPreview(currentDevice.id) && currentDevice.status === 'research' && !!currentDevice.sdk const machineCanConfigure = machineHasMods || machineBuildPreview @@ -399,10 +402,10 @@ export default function App() { else if (route === 'submit') setPageMetadata({ title: pageTitle('Start developing'), description: SUBMIT_DESCRIPTION, url: new URL('submit/', appUrl).href, image: SUBMIT_PREVIEW_IMAGE, imageAlt: SUBMIT_PREVIEW_ALT }) // A public thread owns its title and description, supplied by its static page and refreshed after loading. else if (!route.startsWith('forum/thread/')) { - const title = overviewRoute || allRoute || route === 'library' ? HOME_TITLE : pageTitle(zoomHubName?'Your '+zoomHubName:hubRoute?'Your Octatrack':machineView==='configuration'?currentDevice.name+' '+w.set:machineView?currentDevice.name+' modules':forumRoute?'Forum':accountRoute?(betaInvitationRoute?'Join the beta':'Account'):developerRoute?(developer?.user&&!route.startsWith('developer/complete')?'Creator settings':'Account'):faqRoute?'FAQ':route==='credits'?'Credits':route==='base'?'Base firmware':route==='privacy'?'Privacy':route==='impressum'?'Impressum':route==='community-rules'?'Community rules':route==='modding-guidelines'?'Modding guidelines':route==='report-content'?'Report content':route==='configuration'?w.Set:route.startsWith('submit')?'Start developing':adminRoute?'Admin workspace':route.startsWith('module-set')?'Module sets':'Module library') + const title = overviewRoute || allRoute || route === 'library' ? HOME_TITLE : pageTitle(unitPageName?'Your '+unitPageName:hubRoute?'Your Octatrack':machineView==='configuration'?currentDevice.name+' '+w.set:machineView?currentDevice.name+' modules':forumRoute?'Forum':accountRoute?(betaInvitationRoute?'Join the beta':'Account'):developerRoute?(developer?.user&&!route.startsWith('developer/complete')?'Creator settings':'Account'):faqRoute?'FAQ':route==='credits'?'Credits':route==='base'?'Base firmware':route==='privacy'?'Privacy':route==='impressum'?'Impressum':route==='community-rules'?'Community rules':route==='modding-guidelines'?'Modding guidelines':route==='report-content'?'Report content':route==='configuration'?w.Set:route.startsWith('submit')?'Start developing':adminRoute?'Admin workspace':route.startsWith('module-set')?'Module sets':'Module library') setPageMetadata({ title, description: HOME_DESCRIPTION, url: appUrl.href }) } - }, [overviewRoute, projectsRoute, faqRoute, adminRoute, route,detailModule,digiMod,zoomEffect,forumRoute,accountRoute,betaInvitationRoute,developerRoute,developer?.user,allRoute,machineView,currentDevice.name,w,hubRoute,zoomHubName]) + }, [overviewRoute, projectsRoute, faqRoute, adminRoute, route,detailModule,digiMod,zoomEffect,forumRoute,accountRoute,betaInvitationRoute,developerRoute,developer?.user,allRoute,machineView,currentDevice.name,w,hubRoute,unitPageName]) const availabilityError = moduleAvailabilityError(selectedIds, betaAccess) const { blocks: addBlockMap } = withSetLimit<{ blocks: Record }>({ blocks: {} }, selectedIds) const showSelection = !mobileWorkspace && ( @@ -551,7 +554,7 @@ export default function App() { const libraryCurrent = onLibrary || !!(detailModule || digiMod || zoomEffect) const resourcesRef = useRef(null) const moduleTitle = detailModule?.name ?? digiMod?.title ?? zoomEffect?.name ?? communityModule?.title - const breadcrumbSection = hubRoute ? 'Your Octatrack' : zoomHubName ? 'Your ' + zoomHubName + const breadcrumbSection = hubRoute ? 'Your Octatrack' : unitPageName ? 'Your ' + unitPageName : projectsRoute ? PROJECT_TITLE : faqRoute ? 'Help & FAQ' : route === 'credits' ? 'Credits & acknowledgements' : route === 'base' ? 'Base firmware' : configuration || machineView === 'configuration' ? w.Set : route === 'privacy' ? 'Privacy' : route === 'impressum' ? 'Impressum' : route === 'community-rules' ? 'Community rules' @@ -695,7 +698,7 @@ export default function App() { {projectsRoute ? : faqRoute ? : route === 'credits' ? : route === 'base' ? : overviewRoute ? : !ready ?
Opening your workspace…
: <> {onLibrary ? setQuery('')} onBrowse={rememberBrowse} device={allMachines ? undefined : currentDevice} machinePicker={phoneLayout ? undefined : machinePicker} phone={phoneLayout} resultsSlot={resultsSlot} query={query} category={libraryCategory as ModuleCategory | undefined} octatrackModules={visibleModules} family={family} onFamilyChange={setFamily} sort={sort} onSortChange={setSort} statistics={statistics} octatrackBlocks={addBlockMap} onSwapOctatrack={swapModule} comparison={comparison} onCompare={toggleComparison} onOpenComparison={() => setCompareOpen(true)} viewedModuleVersions={viewedModuleVersions} moduleBaseline={moduleBaseline} octatrackSelected={selectedIds} onToggleOctatrack={toggleModule} digiSelected={digiSelected} onToggleDigi={(device, id) => workspace.toggleModule(id, device)} zoomSelected={zoomSelected} onToggleZoom={(device, id) => workspace.toggleModule(id, device)} onClearSearch={() => { setQuery(''); setFamily('all') }}> {!allMachines && currentDevice.id === 'octatrack' && !!catalog.filter((item,index,items)=>!MODULES.some(module=>module.id===item.module_id)&&items.findIndex(other=>other.module_id===item.module_id)===index).length &&

Community modules

{catalog.filter((item,index,items)=>!MODULES.some(module=>module.id===item.module_id)&&items.findIndex(other=>other.module_id===item.module_id)===index).sort((a,b)=>compareModules({id:a.module_id,name:a.title,authorName:a.author,addedAt:a.added_at??undefined,updatedAt:a.updated_at??undefined},{id:b.module_id,name:b.title,authorName:b.author,addedAt:b.added_at??undefined,updatedAt:b.updated_at??undefined},sort,statistics)).map(item=>)}
} -
: digiDevice && digiMod ? toggleMachineModule(digiMod.id)} /> : zoomEffect ? toggleMachineModule(zoomEffect.id)} /> : digiDevice && machineView === 'configuration' ? machineActive && setReportingConfiguration({ machine: digiDevice.id, id: machineActive.id })} device={digiDevice} configuration={machineActive} configurations={machineConfigurations} onSelect={id => { workspace.selectConfiguration(id) }} onDialog={setConfigDialog} onToggle={toggleMachineModule} onImport={item => workspace.importConfiguration(item.name,item.moduleIds,false,item.moduleVersions,digiDevice.id,undefined,undefined,undefined,item.storageLock)} onStorageLock={workspace.saveStorageLock} /> : missingRoute?

{pausedModule ? 'Module temporarily unavailable' : 'Page not found'}

{pausedModule ? pausedModule.name + ' is temporarily unavailable.' : 'This module or page is not in the current catalog.'}

Open module library
:zoomHub? setZoomInstall(true)} {...isZoomSetDevice(zoomHub.device.id) ? { sets: configurationsFor(zoomHub.device.id), selectedId: activeFor(zoomHub.device.id)?.id, onSelect: (id: string) => { workspace.selectConfiguration(id); window.location.assign(zoomHubHref(zoomHub.device.id, 'set')) }, onNew: () => newConfiguration(zoomHub.device.id), onSetAction: setAction, onToggle: (effect: string) => workspace.toggleModule(effect, zoomHub.device.id) } : {}} />:hubRoute?hubPage:route==='module-sets'||route.startsWith('module-set/')?(octatrackUi ? {workspace.importConfiguration(name,ids);window.location.assign('#configuration')}}/> : {workspace.importConfiguration(name,ids);window.location.assign('#configuration')}}/>):forumRoute ? {const device=config.device??'octatrack';workspace.importConfiguration(config.name,config.moduleIds,config.keepStockFx2,config.moduleVersions,device,config.usbAudio);openEditedSet(device)}}/> : developerRoute ? : accountRoute ? betaInvitationRoute ? : : route === 'privacy' ? : ['impressum','community-rules','modding-guidelines','report-content'].includes(route) ? : route.startsWith('submit') ? : adminRoute ? : communityModule ? : detailModule ? swapModule(detailModule.id, removeIds)} usbAudio={active?.usbAudio} configurationName={active?.name} configurationId={active?.id} onConfigureUsbAudio={configureUsbAudio} onToggle={() => toggleModule(detailModule.id)} /> : null} + : digiDevice && digiMod ? toggleMachineModule(digiMod.id)} /> : zoomEffect ? toggleMachineModule(zoomEffect.id)} /> : digiDevice && machineView === 'configuration' ? machineActive && setReportingConfiguration({ machine: digiDevice.id, id: machineActive.id })} device={digiDevice} configuration={machineActive} configurations={machineConfigurations} onSelect={id => { workspace.selectConfiguration(id) }} onDialog={setConfigDialog} onToggle={toggleMachineModule} onImport={item => workspace.importConfiguration(item.name,item.moduleIds,false,item.moduleVersions,digiDevice.id,undefined,undefined,undefined,item.storageLock)} onStorageLock={workspace.saveStorageLock} /> : missingRoute?

{pausedModule ? 'Module temporarily unavailable' : 'Page not found'}

{pausedModule ? pausedModule.name + ' is temporarily unavailable.' : 'This module or page is not in the current catalog.'}

Open module library
:mcUnit?:zoomHub? setZoomInstall(true)} {...isZoomSetDevice(zoomHub.device.id) ? { sets: configurationsFor(zoomHub.device.id), selectedId: activeFor(zoomHub.device.id)?.id, onSelect: (id: string) => { workspace.selectConfiguration(id); window.location.assign(zoomHubHref(zoomHub.device.id, 'set')) }, onNew: () => newConfiguration(zoomHub.device.id), onSetAction: setAction, onToggle: (effect: string) => workspace.toggleModule(effect, zoomHub.device.id) } : {}} />:hubRoute?hubPage:route==='module-sets'||route.startsWith('module-set/')?(octatrackUi ? {workspace.importConfiguration(name,ids);window.location.assign('#configuration')}}/> : {workspace.importConfiguration(name,ids);window.location.assign('#configuration')}}/>):forumRoute ? {const device=config.device??'octatrack';workspace.importConfiguration(config.name,config.moduleIds,config.keepStockFx2,config.moduleVersions,device,config.usbAudio);openEditedSet(device)}}/> : developerRoute ? : accountRoute ? betaInvitationRoute ? : : route === 'privacy' ? : ['impressum','community-rules','modding-guidelines','report-content'].includes(route) ? : route.startsWith('submit') ? : adminRoute ? : communityModule ? : detailModule ? swapModule(detailModule.id, removeIds)} usbAudio={active?.usbAudio} configurationName={active?.name} configurationId={active?.id} onConfigureUsbAudio={configureUsbAudio} onToggle={() => toggleModule(detailModule.id)} /> : null} } diff --git a/src/components/ModelCyclesUnit.test.ts b/src/components/ModelCyclesUnit.test.ts new file mode 100644 index 0000000000..a8aab08ed9 --- /dev/null +++ b/src/components/ModelCyclesUnit.test.ts @@ -0,0 +1,73 @@ +// @vitest-environment jsdom +import { act, createElement } from 'react' +import { createRoot } from 'react-dom/client' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' +import { DEVICES_BY_ID } from '../devices/registry' +import { pack7 } from '../engine/elektron/dn2-link' +import type { MidiAccessLike, MidiIn, MidiOut } from '../engine/elektron/os-upgrade-midi' +import { ModelCyclesUnit } from './ModelCyclesUnit' + +let container: HTMLDivElement, root: ReturnType +beforeEach(() => { + vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true) + container = document.createElement('div'); document.body.append(container); root = createRoot(container) +}) +afterEach(async () => { await act(() => root.unmount()); container.remove(); vi.unstubAllGlobals() }) + +const put32 = (v: number) => [0, 1, 2, 3, 4].map(i => v >>> 7 * i & 0x7f) +// link.c's ident: version … boot status (0: none), boot image CRC, set CRC, set bytes +const IDENT = [1, 3, 0, 395, 2, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0xf2fe7324, 5764].flatMap(put32) +const MODS = pack7(Uint8Array.from([0, 0, 0xfe, 0x60, 0, 0, 0xfe, 0x60, 0, 0, 0, 0, 0, 0, 0, 1, 0x4d, 0x57, 0x49, 1, + 0xff, 0, 0, 1, 0x59, 0x4c, 0xfd, 0x26, ...[...'frames'.padEnd(16, '\0')].map(c => c.charCodeAt(0))])) +/** A Model:Cycles on USB answering the link's ident (0x01), load (0x23) and mods (0x33) with `answers`; a command + * without an answer gets a bad-request refusal, as a base without it; `answers` null: no reply at all (stock). */ +function unit(answers: Record number[])> | null): MidiAccessLike { + const input: MidiIn = { id: 'i', name: 'Elektron Model:Cycles', onmidimessage: null } + const output: MidiOut = { id: 'o', name: 'Elektron Model:Cycles', send(data) { + if (!answers) return + const answer = answers[data[7]], body = typeof answer === 'function' ? answer() : answer + queueMicrotask(() => input.onmidimessage?.({ data: Uint8Array.from([0xf0, 0x7d, 0x4d, 0x57, 0x4c, 1, data[6], data[7] | 0x40, body ? 0 : 2, ...body ?? [], 0xf7]) })) + } } + return { inputs: new Map([['i', input]]), outputs: new Map([['o', output]]) } +} +const render = (access: MidiAccessLike | null) => act(() => root.render(createElement(ModelCyclesUnit, { device: DEVICES_BY_ID['model-cycles'], request: access && (async () => access) }))) +const connect = async () => { await act(() => { [...container.querySelectorAll('button')].find(b => b.textContent === 'Connect')!.click() }) } +const settle = (ms = 30) => act(() => new Promise(resolve => setTimeout(resolve, ms))) +const text = () => container.textContent ?? '' + +describe('the Model:Cycles page', () => { + it('shows the base, its live modules and its load from a development base', async () => { + let windows = 10 + await render(unit({ 0x01: IDENT, 0x33: [...MODS], 0x23: () => [738, 801, 849, windows++, 9000].flatMap(put32) })) + expect(text()).toContain('Not connected') + await connect(); await settle() + expect(text()).toContain('Connected · Modwerk base · 1 module') + expect(text()).toContain('Set f2fe7324 · 5764 bytes') + expect(text()).toContain('frames') + expect(text()).toContain('63.6 KB free') + expect(text()).toContain('73.8%') + expect(text()).toContain('84.9%') + }) + it('says what a base without the loader or the load probe lacks', async () => { + await render(unit({ 0x01: IDENT })) + await connect(); await settle() + expect(text()).toContain('Connected · Modwerk base') + expect(text()).toContain('This base loads no modules over USB') + expect(text()).toContain('doesn’t measure its load') + }) + it('tells a unit without the link from no unit at all', async () => { + await render(unit(null)) + await connect(); await settle(2200) + expect(text()).toContain('Connected · no Modwerk base') + expect(container.querySelector('a[href="#model-cycles/configuration"]')).not.toBeNull() + await act(() => root.unmount()); root = createRoot(container) + await render({ inputs: new Map(), outputs: new Map() }) + await connect(); await settle() + expect(text()).toContain('No Model:Cycles over USB') + }, 10000) + it('needs a browser with MIDI', async () => { + await render(null) + expect(text()).toContain('can’t use MIDI') + expect([...container.querySelectorAll('button')].some(b => b.textContent === 'Connect')).toBe(false) + }) +}) diff --git a/src/components/ModelCyclesUnit.tsx b/src/components/ModelCyclesUnit.tsx new file mode 100644 index 0000000000..0e39cfabd6 --- /dev/null +++ b/src/components/ModelCyclesUnit.tsx @@ -0,0 +1,130 @@ +import { useEffect, useState, type ReactNode } from 'react' +import { DeviceImage } from '../devices/DeviceImage' +import { MC_UNIT_ROUTE, deviceHref, type DeviceProfile } from '../devices/registry' +import { findUnit, type MidiAccessLike } from '../engine/elektron/os-upgrade-midi' +import { readMcStatus, type McStatus } from '../engine/elektron/mc-link' +import { browserMidi } from '../engine/elektron/usb-upgrade' +import { useMobileWorkspace } from '../hooks/useMobileWorkspace' +import { Icon } from './Icon' +import { LoadChart, Meter } from './OctatrackLoad' +import './octatrack-link.css' +import './octatrack-load.css' + +const INTERVAL = 2000, HISTORY = 150 +const SERIES: { key: 'audio' | 'block'; title: string; className: string }[] = [{ key: 'audio', title: 'Audio', className: 'load-core1' }, { key: 'block', title: 'Busiest block', className: 'load-cpu' }] +type Point = { at: number; reading: { audio: number; block: number } | null } +/** none: no Model:Cycles port (or two); stock: a port, but no answer to the link. */ +type Status = 'unsupported' | 'idle' | 'connecting' | 'none' | 'stock' | 'ready' +const tenths = (percent: number | null | undefined) => percent == null ? null : Math.round(percent * 10) +const count = (n: number, one: string, many: string) => n + ' ' + (n === 1 ? one : many) +const kb = (bytes: number) => (bytes / 1024).toFixed(1) + ' KB' + +/** Reads the unit every two seconds once MIDI is allowed: identity, live modules and load over one line each time. + * A load window that hasn't moved is a gap. shortcut: kept while this page is open, not app-wide as the Octatrack's; + * record it across pages when someone needs that. */ +function useMcUnit(request: (() => Promise) | null) { + const [access, setAccess] = useState() + const [state, setState] = useState<{ status: Status; read?: McStatus; points: Point[]; now: number; error?: string }>({ status: request ? 'idle' : 'unsupported', points: [], now: 0 }) + useEffect(() => { + if (!access) return + let live = true, timer: ReturnType | undefined, windows: number | undefined + const tick = async () => { + try { + const read = findUnit(access, 'Model:Cycles') ? await readMcStatus(access) : undefined + if (!live) return + const load = read?.load, fresh = load && load.windowPercent !== null && load.windows !== windows ? load : null + windows = load?.windows + setState(s => ({ status: read ? 'ready' : read === null ? 'stock' : 'none', read: read ?? undefined, now: Date.now(), + points: [...s.points, { at: Date.now(), reading: fresh && { audio: tenths(fresh.windowPercent)!, block: tenths(fresh.windowPeakPercent) ?? 0 } }].slice(-HISTORY) })) + } catch (error) { if (live) setState(s => ({ ...s, error: (error as Error).message })) } + if (live) timer = setTimeout(() => void tick(), INTERVAL) + } + void tick() + return () => { live = false; clearTimeout(timer) } + }, [access]) + const connect = () => { + if (!request) return + setState(s => ({ ...s, status: 'connecting', error: undefined })) + request().then(setAccess, (error: Error) => setState(s => ({ ...s, status: 'idle', error: 'MIDI wasn’t allowed: ' + error.message }))) + } + return { ...state, connect, clear: () => setState(s => ({ ...s, points: [] })) } +} + +/** + * Your Model:Cycles: the Octatrack's Status (OctatrackHub.tsx, as ZoomHub.tsx has it) over the Model:Cycles' link, + * USB MIDI SysEx (mc-link.ts): the base it runs, its live modules and its audio load. Beta only (App.tsx). + * `request` asks the browser for MIDI with SysEx; null where it has none. + */ +export function ModelCyclesUnit({ device, header, request = browserMidi() }: { device: DeviceProfile; header?: ReactNode; request?: (() => Promise) | null }) { + const mobile = useMobileWorkspace() + const { status, read, points, now, error, connect, clear } = useMcUnit(request) + const identity = read?.identity, modules = read?.modules, load = read?.load, ready = status === 'ready' + const last = points.at(-1), latest = ready && last && now - last.at <= 6000 ? last.reading : null + const build = Build the base + const line: ReactNode = status === 'unsupported' ? 'This browser can’t use MIDI. Open this page in Chrome or Edge on a computer.' + : status === 'connecting' ? 'Looking for your Model:Cycles…' + : status === 'none' ? 'No Model:Cycles over USB. Plug one in and switch it on.' + : status === 'stock' ? 'Connected · no Modwerk base' + : ready ? <>Connected · Modwerk base{modules && <> · {count(modules.modules.length, 'module', 'modules')}} + : 'Not connected' + const off = !ready ? 'Connect your Model:Cycles to see its load.' : !load ? 'This base doesn’t measure its load. A newer one does.' : undefined + const offCell = status === 'stock' ?

It runs Elektron’s OS, or a base without the link. {build}, then send it over USB.

+ :

{status === 'none' ? 'No Model:Cycles over USB.' : 'Connect your Model:Cycles to read it.'}

+ + if (mobile) return
+ {header} +

Your {device.name}

Connecting a Model:Cycles needs Chrome or Edge on a computer.

+ Open {device.name} page +
+ return
+ {header} +
+
+ +

{device.name}

+

+ {error &&

{error}

} +
+ {status === 'idle' && } +
+ +
+
+ + + + +
+

Base

+ {!ready || !identity ? offCell : <> +

+

{identity.set ? <>Set {identity.set.crc.toString(16).padStart(8, '0')} · {identity.set.bytes} bytes: the base and the modules flashed with it. : 'This base doesn’t report its set. A newer one does.'}

+ {identity.ramBoot.status === 'booted from RAM' &&

Running from RAM: a power cycle brings back the flashed OS.

} + } +
+
+

Module memory

+ {!ready ? offCell : !modules ?

This base loads no modules over USB. A newer one does.

: <> +

{kb(modules.free)} free

+

Largest free block {kb(modules.largest)}.{modules.refusal !== 'none' && <> Last refused: {modules.refusal}.}

+ } +
+
+

On your Model:Cycles{modules && <> · {modules.modules.length}}

+ {!ready ? offCell : !modules?.modules.length ?

{modules ? 'No modules loaded. Modules kept over USB show here until the next power cycle.' : 'This base loads no modules over USB.'}

+ :
    {modules.modules.map(module =>
  • )}
} +
+
+
+
+
+} diff --git a/src/components/beta.ts b/src/components/beta.ts index 921e41f1a3..9c57f63d2c 100644 --- a/src/components/beta.ts +++ b/src/components/beta.ts @@ -5,6 +5,7 @@ import { moduleSetKit } from '../engine/elekloader/module-set' import { ZoomLink } from '../engine/zoom/zoom-link' export { OctatrackHub } from './OctatrackHub' export { ZoomHub, ZoomSidebarStatus } from './ZoomHub' +export { ModelCyclesUnit } from './ModelCyclesUnit' export { ZoomBaseDialog } from './ZoomBaseDialog' export { LoadDialog } from './LoadDialog' export { InstrumentItem } from './InstrumentItem' diff --git a/src/devices/MachinePages.tsx b/src/devices/MachinePages.tsx index adc3a587e3..bcde2e2709 100644 --- a/src/devices/MachinePages.tsx +++ b/src/devices/MachinePages.tsx @@ -23,7 +23,7 @@ import { LibraryResultsBar } from '../components/LibraryResultsBar' import { compareModules, downloadCoverage, downloadPeriod, periodCoverage, type ModuleStatistics } from '../community/module-statistics' import { DownloadPeriodContext } from '../community/download-period' import { DeviceImage, PhotoCredit } from './DeviceImage' -import { ALL_MACHINES, DEVICES, DEVICES_BY_ID, STATUS_LABELS, deviceHref, deviceSteps, deviceTitle, readyForMods, stepsDone, type DeviceProfile } from './registry' +import { ALL_MACHINES, DEVICES, DEVICES_BY_ID, MC_UNIT_ROUTE, STATUS_LABELS, deviceHref, deviceSteps, deviceTitle, readyForMods, stepsDone, type DeviceProfile } from './registry' import { MACHINE_STACK } from './machine-contract' import { isCoreBuildPreview } from '../engine/elekloader/protocol' import { DIGI_CORES, DIGI_DEVICES, DIGI_MODS, estimateCombination, type DigiMod } from './digi-mods' @@ -40,7 +40,7 @@ import { ModuleAuthors } from '../components/ModuleAuthors' import { digiMatchesQuery, octatrackMatchesQuery } from '../catalog/module-search' import { useModuleAudioPreviews } from '../components/audio-preview-context' import { ModuleAudioCardCover } from '../components/ModuleAudioPreview' -import { useSetWords } from '../community/beta-ui' +import { useBetaUi, useSetWords } from '../community/beta-ui' import { DEVELOP_PITCH, UNLOCK_NOTE, developHref } from '../overview/overview' type DigiDevice = DeviceProfile & { id: DigiMod['device'] } @@ -300,12 +300,12 @@ function StackLadder({ device }: { device: DeviceProfile }) { // Machines without mods: the library page becomes an invitation to open the first one. export function EmptyMachine({ device, machinePicker, embedded = false }: { device: DeviceProfile; machinePicker?: ReactNode; embedded?: boolean }) { - const repository = issueRepository(), mobile = useMobileWorkspace() + const repository = issueRepository(), mobile = useMobileWorkspace(), betaUi = useBetaUi() const page = FAMILY_PAGE[device.family], ready = readyForMods(device), steps = deviceSteps(device) return (
{machinePicker &&
{machinePicker}
} - +

Be the first to mod the {device.name}

{page.invite} {ready ? DEVELOP_PITCH : page.unlock}

Road to the first mod

{stepsDone(device)} of {steps.length} done
diff --git a/src/devices/machines.generated.json b/src/devices/machines.generated.json index 05dc132ccf..583a97daa0 100644 --- a/src/devices/machines.generated.json +++ b/src/devices/machines.generated.json @@ -1065,7 +1065,7 @@ "link": "started", "flash": "started", "loader": "started", - "status": "open", + "status": "started", "diagnostics": "started", "tools": "started" }, diff --git a/src/devices/registry.ts b/src/devices/registry.ts index 498f9204b8..722403240e 100644 --- a/src/devices/registry.ts +++ b/src/devices/registry.ts @@ -154,6 +154,9 @@ export function parseDeviceRoute(route: string): DeviceRoute | undefined { return undefined } +/** The Model:Cycles' own page (ModelCyclesUnit.tsx), beside its machine page. */ +export const MC_UNIT_ROUTE = 'model-cycles/unit' + export function deviceHref(id: string, path = '') { if (id === 'octatrack') return '#' + (path || 'library') if (id === ALL_MACHINES) return '#all' diff --git a/src/engine/elektron/mc-link.ts b/src/engine/elektron/mc-link.ts index 43fa297867..68bafa4882 100644 --- a/src/engine/elektron/mc-link.ts +++ b/src/engine/elektron/mc-link.ts @@ -221,6 +221,20 @@ export async function mcModules(call: McCall): Promise { } } +export type McStatus = { identity: McIdentity; modules: McModules | null; load: McLoad | null } +/** What the machine page's Status shows, over one line: the identity, then the live modules and the load, each null + * from a base without them (it refuses the command as a bad request). Null when no unit answers the identity. */ +export async function readMcStatus(access: MidiAccessLike, timeoutMs = 2000): Promise { + return withMc(access, timeoutMs, async call => { + const ident = await call(IDENT) + if (!ident) return null + const optional = async (read: () => Promise) => { + try { return await read() } catch (error) { if (error instanceof McRefused && error.status === BAD_REQUEST) return null; throw error } + } + return { identity: parseMcIdent(ident), modules: await optional(() => mcModules(call)), load: await optional(async () => { const p = await call(LOAD); return p && parseMcLoad(p) }) } + }) +} + /** The upload controller's session with the connected unit: identity first, so BEGIN names the running base. */ export async function mcUploadSession(call: McCall, timeoutMs = 20000): Promise { const payload = await call(IDENT) From 34f7abd3131f16bac0ed7915c078a8a172ca8c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannik=20A=C3=9Ffalg?= <67785539+repeat98@users.noreply.github.com> Date: Thu, 26 Nov 2026 10:32:46 +0100 Subject: [PATCH 2/2] Model:Cycles: the Status page button for beta testers only The machine page asked useBetaUi, the Octatrack base path's context, which is open to everyone since that base's release, so every visitor saw a button to a page only beta testers can open. It asks hasBetaUi now, as the build preview beside it does. Co-Authored-By: Claude Opus 5.5 --- src/devices/MachinePages.tsx | 7 ++++--- src/devices/core-build-preview-gate.test.ts | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/devices/MachinePages.tsx b/src/devices/MachinePages.tsx index 5f897c5caf..0091585e1f 100644 --- a/src/devices/MachinePages.tsx +++ b/src/devices/MachinePages.tsx @@ -42,7 +42,7 @@ import { ModuleAuthors } from '../components/ModuleAuthors' import { digiMatchesQuery, octatrackMatchesQuery } from '../catalog/module-search' import { useModuleAudioPreviews } from '../components/audio-preview-context' import { ModuleAudioCardCover } from '../components/ModuleAudioPreview' -import { useBetaUi, useSetWords } from '../community/beta-ui' +import { useSetWords } from '../community/beta-ui' import { DEVELOP_PITCH, UNLOCK_NOTE, developHref } from '../overview/overview' type DigiDevice = DeviceProfile & { id: DigiMod['device'] } @@ -302,9 +302,10 @@ function StackLadder({ device }: { device: DeviceProfile }) { // Machines without mods: the library page becomes an invitation to open the first one. export function EmptyMachine({ device, machinePicker, embedded = false }: { device: DeviceProfile; machinePicker?: ReactNode; embedded?: boolean }) { - const repository = issueRepository(), mobile = useMobileWorkspace(), betaUi = useBetaUi() + // hasBetaUi, not useBetaUi: that context is the Octatrack base path's, open to everyone since its release. + const repository = issueRepository(), mobile = useMobileWorkspace(), betaUi = hasBetaUi(useCommunity().session) const page = FAMILY_PAGE[device.family], ready = readyForMods(device), steps = deviceSteps(device) - const preview = coreBuildPreviewOpen(device.id, hasBetaUi(useCommunity().session)) && !!device.sdk + const preview = coreBuildPreviewOpen(device.id, betaUi) && !!device.sdk return (
{machinePicker &&
{machinePicker}
} diff --git a/src/devices/core-build-preview-gate.test.ts b/src/devices/core-build-preview-gate.test.ts index 55324ab91b..c8bdc42bea 100644 --- a/src/devices/core-build-preview-gate.test.ts +++ b/src/devices/core-build-preview-gate.test.ts @@ -29,4 +29,8 @@ describe('the Model:Cycles core build preview', () => { expect(page(emptySession)).not.toContain('#model-cycles/configuration') expect(page(tester)).toContain('#model-cycles/configuration') }) + it('shows the Status page button to a beta tester, not to a visitor', () => { + expect(page(emptySession)).not.toContain('#model-cycles/unit') + expect(page(tester)).toContain('#model-cycles/unit') + }) })