ComandiCommands
cd sparky-amoled/emulator
make
./robot_emu.exe --script "2:expr=Happy; 4:shot=cap.png"
Un binario Windows che compila l'albero src/ reale del firmware contro stub Arduino/ESP32 e lo disegna con raylib. Non è una ricostruzione del viso: esegue lo stesso codice che gira sulla board.
A Windows binary that compiles the real firmware src/ tree against Arduino/ESP32 stubs and draws it with raylib. It is not a re-implementation of the face: it runs the same code that runs on the board.
L'emulatore è utile perché ricompila gli stessi sorgenti: un cambiamento al Brain o al FaceEngine si verifica subito, senza flashare.The emulator is useful because it recompiles the same sources: a change to Brain or FaceEngine is verified immediately, without flashing.
Il progetto sparky-amoled/emulator/ include un EmuStubs.cpp che sostituisce le parti impossibili da replicare su PC — rete, server web, BLE, streaming video, metriche, schermi News e Stream — con implementazioni vuote o minime. Tutto il resto è il codice di produzione: motore del viso, Brain, macchina a stati degli atti, gestione dello schermo, pipeline audio e APU del Game Boy.The sparky-amoled/emulator/ project includes an EmuStubs.cpp that replaces the parts impossible to replicate on a PC — network, web server, BLE, video streaming, metrics, News and Stream screens — with empty or minimal implementations. Everything else is production code: face engine, Brain, act state machine, screen handling, audio pipeline, and the Game Boy APU.
Il risultato è un banco di prova per il comportamento: reazioni agli eventi, espressioni, transizioni, script e catture. Non è un sostituto del dispositivo per la rete, la BLE, lo streaming o le prestazioni reali: l'hardware, la memoria contigua e i tempi della board restano il riferimento.The result is a test bench for behaviour: event reactions, expressions, transitions, scripts, and captures. It is not a replacement for the device when it comes to networking, BLE, streaming, or real performance: the hardware, contiguous memory, and board timings remain the reference.
tools/emu_build.ps1 e tools/mock-model.js per il modello di risposta.tools/emu_build.ps1 and tools/mock-model.js for the reply model.La build host richiede un compilatore C++ e raylib disponibili nel percorso previsto dal Makefile.The host build requires a C++ compiler and raylib available at the path expected by the Makefile.
cd sparky-amoled/emulator
make
./robot_emu.exe --script "2:expr=Happy; 4:shot=cap.png"
robot_emu.exe.Windows for the robot_emu.exe binary.tools/emu_build.ps1 automatizza i passaggi ripetibili.tools/emu_build.ps1 automates the repeatable steps.Il protocollo testuale accetta i comandi da 0 a 9 e i comandi nominativi; l'output è JSON con reply, emotion, gesture, display e session.The text protocol accepts commands from 0 to 9 and named commands; the output is JSON with reply, emotion, gesture, display, and session.
| ComandoCommand | EffettoEffect |
|---|---|
| face | Mostra il catalogo delle espressioni disponibili.Shows the catalogue of available expressions. |
| act | Mostra il catalogo degli atti animati.Shows the catalogue of animated acts. |
| set | Imposta espressione, atto, volume, luminosità o altra proprietà.Sets expression, act, volume, brightness, or another property. |
| say | Mostra un testo nel fumetto del viso.Shows text in the face balloon. |
| stop | Interrompe animazione, audio e fumetto in corso.Stops the running animation, audio, and balloon. |
| reset | Riporta l'emulatore allo stato iniziale.Returns the emulator to its initial state. |
| mood | Legge o imposta il mood corrente del Brain.Reads or sets the Brain's current mood. |
| ping | Verifica che il processo risponda.Checks that the process responds. |
| tts | Richiede la sintesi vocale del testo indicato.Requests speech synthesis of the given text. |
| 0 – 9 | Scorciatoie per le nove espressioni preferite, dalla normale alla risata.Shortcuts for the nine favourite expressions, from neutral to laugh. |
Nella finestra raylib i tasti agiscono direttamente sul Brain, senza passare dalla rete.In the raylib window, keys act directly on the Brain, without going through the network.
1…9 — le nove espressioni preferite.the nine favourite expressions.Tab / Shift+Tab — espressione successiva o precedente.next or previous expression.0 — atto selezionato; [ e ] cambiano atto.selected act; [ and ] change act.Y / U — atti “Yes” e “No”.“Yes” and “No” acts.H — scrive un messaggio nel fumetto.writes a message in the balloon.S — rumore improvviso.sudden noise.W — parola di attivazione.wake word.V, ←, → — voce e direzione del suono.voice and sound direction.I — richiesta di informazioni.information request.C — stato di ricarica.charging state.B / N + Shift — pulsanti laterali BOOT e PWR, pressione breve o lunga.BOOT and PWR side buttons, short or long press.A — attiva o disattiva il comportamento autonomo.toggles autonomous behaviour.Q — mostra la macchina a stati.shows the state machine.P — salva uno screenshot PNG.saves a PNG screenshot.F — raddoppia la velocità di simulazione fino a 8×.doubles simulation speed up to 8×.Invio — pausa e riprende.pauses and resumes.Gli script rendono riproducibili le scene: espressione, atto, testo, tocco, rumore, voce e cattura in una timeline ordinata.Scripts make scenes reproducible: expression, act, text, tap, noise, voice, and capture in one ordered timeline.
La sintassi è tempo:comando=valore, con i passi separati da punto e virgola. Il tempo è in secondi dall'avvio. Quando tutti i passi sono stati eseguiti e non ci sono catture in coda, l'emulatore termina da solo: è il modo più semplice per generare una sequenza di immagini per la documentazione.The syntax is tempo:comando=valore, with steps separated by semicolons. Time is in seconds from start-up. Once every step has run and no captures remain, the emulator exits by itself: this is the simplest way to produce an image sequence for documentation.
robot_emu.exe --script "2:expr=Happy; 4:shot=captures/smile.png; 5:act=Yes; 7:say=Ciao; 9:quit"
I comandi disponibili nello script includono expr, act, say, tap, hold, stroke, noise, voice, wake, hour, battery, charging, auto, states, info, shot e quit.The commands available in a script include expr, act, say, tap, hold, stroke, noise, voice, wake, hour, battery, charging, auto, states, info, shot, and quit.
| Comando scriptScript command | EsempioExample |
|---|---|
| expr | 3:expr=Curious |
| act | 5:act=Yes |
| say | 7:say=Ciao |
| tap | 1:tap=184,224 |
| hold | 2:hold=120,120 |
| noise | 2:noise |
| voice | 4:voice=-45 |
| shot | 6:shot=captures/a.png |
L'emulatore riproduce la logica, non l'hardware. Le differenze sono intenzionali e documentate.The emulator reproduces logic, not hardware. The differences are intentional and documented.
Wi-Fi e scansione delle reti, server web, stack BLE, streaming MJPEG, metriche di produzione, feed RSS e schermate Stream.Wi-Fi and network scanning, web server, BLE stack, MJPEG streaming, production metrics, RSS feeds, and Stream screens.
Tempi reali della board, consumo energetico, dimensione della memoria contigua, PSRAM reale e qualità del display AMOLED.Real board timings, power consumption, contiguous-memory size, actual PSRAM, and AMOLED display quality.
Usa l'emulatore per il comportamento e la logica, poi la board per integrazione, rete, memoria e resa sul vetro.Use the emulator for behaviour and logic, then the board for integration, networking, memory, and on-glass rendering.