Skip to content

set cannot write any enum parameter: sends F32 where the device expects Int #7

Description

@AC6y86

set cannot write any enum parameter: every one is refused with error -3.
Affects the GUI too, so on my machine there is currently no way to change one
except on the pedal itself.

Found on v0.6.0 (ec7b02d), HX Effects, firmware 3.80.

Symptom

Both accepted input forms fail identically — the rendered label and the raw
menu index:

$ tonepush set 2 Ratio -- "4:1"
Error: the device refused: error -3
$ tonepush set 2 Ratio -- "2"
Error: the device refused: error -3

Same for every enum I tried: Stages (Deluxe Phaser), Gain Mod (Heir
Apparent), Attack (Horizon Drive), Wave Shape (Chorus), Drip (Hot
Springs). Continuous parameters and Kind::Switch parameters both write fine,
which is what narrows it down.

Cause

set_param, crates/tonepush-cli/src/main.rs:1470:

let wire = match described.kind {
    hx_catalog::Kind::Switch => Value::Bool(native >= 0.5),
    _ => Value::F32(native),
};

hx_catalog::Kind::Enum (crates/hx-catalog/src/lib.rs:117) is never matched,
so a menu index goes out as a float. The device stores enums as integers —
crates/hx-proto/src/preset.rs:869 reads them back through
Value::Int(i) => Some(*i as f32) — and rejects the float outright.

That also explains why the label and index forms fail the same way:
Catalog::parse resolves both to the same 2.0, so the value was never
wrong, only its wire type.

Fix

One arm:

let wire = match described.kind {
    hx_catalog::Kind::Switch => Value::Bool(native >= 0.5),
    hx_catalog::Kind::Enum => Value::Int(native as i64),
    _ => Value::F32(native),
};

Verified on hardware:

$ tonepush set 2 Ratio -- "4:1"
block 2: Ratio = 4:1

and it reads back as 4:1 in chain.

The GUI has the same defect

crates/tonepush-gui/src/session.rs:606 picks the wire type from a
switch: bool:

let wire = if switch { Value::Bool(value >= 0.5) } else { Value::F32(value) };

and crates/tonepush-gui/src/lib.rs:9659 sets that flag as
param.kind == Kind::Switch. Two booleans cannot carry three wire types, so
enums take the F32 path there as well — both the ComboBox and the knob route
converge on that line.

I fixed it locally by replacing the flag with a three-way
WireKind { Switch, Enum, Number }. Happy to open a PR for both if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions