FMini-1: DET 2 / 3 dial centre drawn at 5.0

In the fine detune law the zero is code 90 of 0..180, but the dial
position was byte * 1000 / 127, so code 90 was drawn at 7.0 and the
old coarse centre (byte 64, drawn at 5.0) jumped there on the first
turn. The fine code now scales over DET_MAX, so zero sits at 5.0.

fmini_app_test checks the dial position of the fine centre (500).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QUF6pQ1NkTwmBC8SR8AK94
This commit is contained in:
Claude committed 2026-10-28 16:01:40 -03:00
1 parent 0006fd81ce
commit 99e12156b8
2 files changed
+9

No files matched your search

+1
View File
@@ -369,6 +369,7 @@ static void fmg_card_at(uint32_t pg, uint32_t i, int32_t vo, const char **label,
v = vo >= 0 ? vo : (int32_t)fmg_byte(f->a);
*ratio = v * 1000 / 127;
if ((f->a == FG_F2 || f->a == FG_F3) && (fmg_byte(FG_SW2) & FT_DETFINE)) {
*ratio = v * 1000 / DET_MAX; /* the fine code's centre (90) sits at the dial's middle, like the CC */
fmg_cents(val, fmini_det_fine((uint32_t)v));
*unit = "ST";
} else if (f->a == FG_F2 || f->a == FG_F3) {
+8
View File
@@ -450,6 +450,14 @@ int main(int argc, char **argv)
fmg_turn(pg, f2, 1, EN_K1);
if (!(fmini_patch[0][FG_SW2] & FT_DETFINE) || fmini_det(fmini_patch[0], FG_F2) != 10) { printf("DET first turn %d\n", (int)fmini_det(fmini_patch[0], FG_F2)); return 1; }
fmini_patch[0][FG_F2] = 90;
{ /* the dial: the fine centre (0 cents, code 90) is drawn at the middle, 5.0, as the coarse centre byte 64 was */
const char *lb = 0, *un = 0;
char val[16];
int32_t ratio = -1;
uint32_t ic = 0;
fmg_card_at(pg, f2, -1, &lb, val, &un, &ratio, &ic);
if (ratio != 500 || val[0] != '+' || val[1] != '0' || val[3] != '0') { printf("DET dial centre %d '%s'\n", (int)ratio, val); return 1; }
}
fmg_turn(pg, f2, 40, EN_K1); /* +40 detents: a fast turn is still 40 */
if (fmini_patch[0][FG_F2] != 130 || fmini_det(fmini_patch[0], FG_F2) != 400) { printf("DET 4 st %d\n", (int)fmini_patch[0][FG_F2]); return 1; }
fmg_turn(pg, f2, 1, EN_K1);