How ermi77/revovfirmware works
RevoV is vending-machine firmware split between an ESP32 order/planning brain and an Arduino Mega motion controller, coordinated through a shared pin protocol. The principal path is backend order intake, queueing and per-drink planning on the ESP32, command dispatch and READY synchronization, then physical motion on the Mega. The README also documents a browser simulation/trace console and conveyor advancement. Some implementation links rely on the source index or README rather than complete excerpts, so uncertain internal wiring is omitted or marked dashed.
Main entry points: src/main.cpp Mega runtime · Core/StateMachine.cpp Order state machine · Core/StateMachine.cpp Command state machine · src/main.cpp ESP runtime
Components 25
ESP32 brain
- ESP runtime
esp/src/main.cpp - WebSocket client
esp/src/Net/WebSocket.cpp - Order queue
esp/src/Order/OrderQueue.cpp - Slot inventory
esp/src/Order/Inventory.cpp - Trajectory planner
esp/src/Trajectory/Planner.cpp - Order state machine
esp/src/Core/StateMachine.cpp - Web console
esp/src/Web/Ui.cpp - Trace event bus
esp/src/Core/EventBus.cpp - Machine state tracker
esp/src/Core/StateTracker.cpp
Board protocol
- Command pin driver
esp/src/Protocol/PinDriver.cpp - READY handler
esp/src/Protocol/ReadyHandler.cpp
Mega motion
- Mega runtime
mega/src/main.cpp - Command state machine
mega/src/Core/StateMachine.cpp - Pin command reader
mega/src/Protocol/PinReader.cpp - Motion scheduler
mega/src/Core/Scheduler.cpp - Motion axes
mega/src/Motion/Axes.cpp - Stepper control
mega/src/Motion/StepperAxis.cpp - Gripper assembly
mega/src/EndEffector/Gripper.cpp - Dispense door
mega/src/EndEffector/Door.cpp - Shelf conveyor
mega/src/Shelf/Conveyor.cpp - Homing routine
mega/src/Homing/Home.cpp
Shared contract
- Wire protocol
shared/RevoVProtocol.h
Other components
- Order backend
- Operator
- Machine actuators
Connections 33
- Order backend → WebSocket client: sends orders
README.md - WebSocket client → ESP runtime: polls orders
esp/src/main.cpp - ESP runtime → Order state machine: updates control
esp/src/main.cpp - Order state machine → Order queue: enqueues orders
esp/src/Core/StateMachine.cpp - Order state machine → WebSocket client: publishes outcomes
esp/src/Core/StateMachine.cpp - Order state machine → Trajectory planner: plans commands
esp/src/Core/StateMachine.cpp - Order state machine → Slot inventory: updates slots
esp/src/Core/StateMachine.cpp - Order state machine → Command pin driver: dispatches commands
esp/src/Core/StateMachine.cpp - Order state machine → Trace event bus: publishes trace
esp/src/Core/StateMachine.cpp - ESP runtime → Trace event bus: initializes bus
esp/src/main.cpp - ESP runtime → Web console: initializes console
esp/src/main.cpp - Operator → Web console: uses console
README.md - Web console → Trace event bus: subscribes to trace
README.md - Command pin driver → Mega runtime: sends commands
README.md - Mega runtime → READY handler: waits for READY
README.md - READY handler → Order state machine: signals settled
README.md - Mega runtime → Pin command reader: initializes reader
mega/src/main.cpp - Mega runtime → Motion axes: initializes axes
mega/src/main.cpp - Mega runtime → Shelf conveyor: initializes conveyor
mega/src/main.cpp - Mega runtime → Dispense door: initializes door
mega/src/main.cpp - Mega runtime → Gripper assembly: initializes gripper
mega/src/main.cpp - Mega runtime → Command state machine: initializes control
mega/src/main.cpp - Mega runtime → Motion scheduler: updates scheduler
mega/src/main.cpp - Command state machine → Motion axes: dispatches motion
- Command state machine → Gripper assembly: dispatches handling
- Command state machine → Dispense door: controls door
- Command state machine → Shelf conveyor: advances shelf
- Command state machine → Homing routine: requests homing
- Motion scheduler → Stepper control: services motion
- Motion axes → Stepper control: uses axes
- Mega runtime → Machine actuators: drives
README.md - Wire protocol → Command pin driver: defines commands
- Wire protocol → Shelf conveyor: defines actions
mega/src/Shelf/Conveyor.cpp