Skip to content

Commit

Permalink
controllers: support doubles in write_general and write_channel.
Browse files Browse the repository at this point in the history
Since these functions are proxies for the RegisterDecoder ones, they
should have had the same type for their value arguments.

This required some fixes to decode-reg where implicit conversion to the
variant wasn't available.

Fixes: d859702
  • Loading branch information
ericonr committed May 20, 2024
1 parent 9fe4b85 commit 4ab1e6d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions app/decode-reg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -285,17 +285,17 @@ int main(int argc, char *argv[])
auto channel = args.get<unsigned>("-c");

ctl.write_channel("AMP_EN", channel, args.is_used("-e"));
ctl.write_channel("MODE", channel, get_index(args.get<std::string>("-m"), lamp::mode_list));
ctl.write_channel("PI_KP", channel, args.get<unsigned>("-k"));
ctl.write_channel("PI_TI", channel, args.get<unsigned>("-t"));
ctl.write_channel("MODE", channel, (int32_t)get_index(args.get<std::string>("-m"), lamp::mode_list));
ctl.write_channel("PI_KP", channel, (int32_t)args.get<unsigned>("-k"));
ctl.write_channel("PI_TI", channel, (int32_t)args.get<unsigned>("-t"));
ctl.write_channel("PI_SP", channel, args.get<int>("-s"));

ctl.write_channel("DAC", channel, args.get<int>("-d"));
ctl.write_channel("LIMIT_A", channel, args.get<int>("-l"));
ctl.write_channel("LIMIT_B", channel, args.get<int>("-L"));
ctl.write_channel("CNT", channel, args.get<int>("-C"));

ctl.write_channel("TRIG_EN", channel, args.get<unsigned>("-T"));
ctl.write_channel("TRIG_EN", channel, (int32_t)args.get<unsigned>("-T"));

ctl.write_params();
}
Expand Down
4 changes: 2 additions & 2 deletions util/controllers.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ class RegisterDecoderController: public RegisterController {

virtual void encode_params() override { }

void write_general(const char *name, int32_t value)
void write_general(const char *name, decoders::data_type value)
{
pdec->write_general(name, value, read_dest);
}
void write_channel(const char *name, unsigned pos, int32_t value)
void write_channel(const char *name, unsigned pos, decoders::data_type value)
{
pdec->write_channel(name, pos, value, read_dest);
}
Expand Down
2 changes: 1 addition & 1 deletion util/tests/controllers-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST_CASE("RegisterDecoderController write_general", "[controllers-test]")
CHECK(dec.get_general_data<int32_t>("RF_INT") == -0x11);
}

TEST_CASE("RegisterDecoderController write_general fixed-point", "[controllers-test][!shouldfail]")
TEST_CASE("RegisterDecoderController write_general fixed-point", "[controllers-test]")
{
TestRegisterDecoderController ctl{};
TestRegisterDecoder dec{};
Expand Down

0 comments on commit 4ab1e6d

Please sign in to comment.