mirror of
https://github.com/ruppert/fmini-1.git
synced 2026-12-06 21:04:26 +01:00
Backup: the web editor reads all 200 presets (cmd 85, the whole record) and saves them in one .bkp file (JSON, records in hex). Restore: cmd 87 asks the device first. The device shows OVERWRITE ALL 200 PRESETS? with NO selected: ALGORITHM turns it to YES, SAVE accepts; SAVE on NO or any page button refuses; no answer for 60 s refuses. Only then does cmd 86 write each record (rc 2 before the YES and after the end). The restore question sits above the other pop-ups; the preset and tempo pop-ups stay hidden under it. Protocol 4: the web editor needs it. tests/editor_test.c walks the handshake and the record round trip; tests/fmini_app_test.c drives the question on the panel and renders it; web/test_editor_fmini.py backs up, restores a changed file and puts the original back (the bridge answers the question: FM_RESTORE_ANSWER). Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUF6pQ1NkTwmBC8SR8AK94
38 lines
1.5 KiB
C
38 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-3.0-only
|
|
* The firmware's real editor handler behind stdin / stdout, for web/test_editor_fmini.py: each input line is the hex of a
|
|
* SysEx request (F0 .. F7); the answer is the hex of the reply frame (or an empty line when there is none).
|
|
* Track 1 is an FMINI track on its first factory patch, as on an FMini-1. */
|
|
#define EDITOR_TEST_NO_MAIN 1
|
|
#include "editor_test.c"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
int main(void)
|
|
{
|
|
char line[2048];
|
|
fb_names_init(); /* the RAM presets (main.c: fmini_init, fb_boot) */
|
|
reset();
|
|
set_engine_of(&trk[0], ENGI_FMINI);
|
|
apply_preset_to(&trk[0], 0);
|
|
trk[0].engine = trk[0].eng_req;
|
|
fmini_track_loaded(&trk[0]);
|
|
song.sel = 0;
|
|
setvbuf(stdout, 0, _IOLBF, 0);
|
|
while (fgets(line, sizeof line, stdin)) {
|
|
uint8_t a[1024];
|
|
uint32_t n = 0, i, got;
|
|
char *p = line;
|
|
unsigned v;
|
|
int k;
|
|
while (sscanf(p, "%2x%n", &v, &k) == 1 && n < sizeof a) { a[n++] = (uint8_t)v; p += k; }
|
|
if (n < 6u) { puts(""); continue; }
|
|
got = request(a[4], a + 5, n - 6u); /* (F0 7D 46 4C cmd args F7) */
|
|
if (getenv("FM_RESTORE_ANSWER") && fb_rs == FB_RS_ASK) /* test only: the device's answer to the restore question */
|
|
fb_rs = strcmp(getenv("FM_RESTORE_ANSWER"), "yes") == 0 ? FB_RS_OK : FB_RS_NO;
|
|
for (i = 0; i < got; i++)
|
|
printf("%02x", host_wire[i]);
|
|
puts("");
|
|
}
|
|
return 0;
|
|
}
|