Developing the software¶
For contributors who want to change the PC application or the firmware. Read Architecture first.
Get the code¶
git clone --recurse-submodules https://github.com/Open-BeatBox/Open-BeatBox_Software.git
cd Open-BeatBox_Software
Branches: main is the integration branch; mock_gui holds an early, hardware-free tkinter mock-up of the interface, deprecated, kept for reference.
Repository map¶
Path |
What it is |
|---|---|
|
Qt interface: main window ( |
|
One state machine per stage ( |
|
Serial communication with the main module ( |
|
|
|
Tests with a fake box (no hardware) |
|
One program per module role |
|
Shared libraries and the main module’s protocol layers |
|
The validation command-line client |
|
Host-side tests of the protocol layers |
|
Deployment script |
How a stage works (PC application)¶
Each stage is a state machine. A table maps every phase to what happens on entering it, the next phase, an optional timeout, which sensor edges matter and a function that decides the route. Adding a stage means subclassing the previous one, overriding the table entries that change, adding a configuration section and specification, and registering it in registry.py (stage classes and the stage order) and in the panel factory (stage_panels.py).
The GUI is a thin skin: it displays what the experiment manager emits through signals. Several design notes are in pc_app/beatbox/todo.md (moving more decoding from the GUI to the managers, removing duplicated pin-config objects, re-enabling the sequence-number check).
Running the tests¶
PC application (needs the dev extras; no hardware):
cd pc_app
pip install -e ".[dev]"
pytest
Firmware protocol layers (run on an ordinary Python):
cd micropython
python -m pytest tests/ -q
Tests that exercise real boards (timing_benchmarking/, parts of tests/) are not stable yet.
Conventions that matter¶
Keep everything under
main_module.pyfree ofmachineandcanioimports so it can be tested on a PC.Shared firmware code must run on both MicroPython and CPython: no 3.10+ typing syntax, no
typingimport.Compare ticks with
bb_ticks.ticks_diff.Interrupt handlers set a flag only.
One CAN encoding: add commands in
can_protocol.py, intents inbb_intents.py, events inbb_events.py, and mapping tables in the V2/CLI frontends. Update the specification (Inter-module CAN protocol) in the same change.The pin table in the PC application and the firmware’s V2 emulation must agree (a known duplication).
Roadmap (from the repository)¶
Roughly in order of priority:
Fix the application handshake that sometimes fails inadvertently.
Investigate dropped CAN messages in the main module when many arrive (for example the replies to
SCAN).Evaluate and improve MicroPython performance under load (Viper and native code for hot paths; interrupt-driven CAN; debounce).
Graph plotting in the PC application.
Log storage in the main module and more consistent logging.
Clean up the repository structure.
Retire previous-generation names (“V2”, “bbv2”) where appropriate.
See Status and open points for the full list of open points.
Contributing¶
Open an issue first for larger changes. See Contributing for the repositories, licensing and the review process.