Skip to content

Commit

Permalink
Merge branch 'main' into rc
Browse files Browse the repository at this point in the history
  • Loading branch information
pjdotson committed Nov 6, 2024
2 parents fd74a90 + 9694cb5 commit 2cd161c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion console/release-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"url": "https://github.com/synnaxlabs/synnax/releases/download/console-v0.34.0-rc/Synnax_0.34.0_x64_en-US.msi"
}
}
}
}
2 changes: 1 addition & 1 deletion console/src/hardware/labjack/task/Write.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ const Wrapped = ({
commandsToCreate.map((c, i) => ({
name: `${dev.properties.identifier}_${c.type}_${c.port}_cmd`,
index: commandIndexes[i].key,
dataType: "uint8",
dataType: c.type === "AO" ? "float32" : "uint8",
})),
);
commands.forEach((s, i) => {
Expand Down
15 changes: 12 additions & 3 deletions driver/labjack/writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ struct WriterConfig {

WriterConfig() = default;

explicit WriterConfig(config::Parser &parser)
explicit WriterConfig(
config::Parser &parser,
const std::shared_ptr<task::Context> &ctx
)
: device_type(parser.optional<std::string>("type", "")),
device_key(parser.required<std::string>("device")),
state_rate(synnax::Rate(parser.optional<int>("state_rate", 1))),
Expand All @@ -122,10 +125,16 @@ struct WriterConfig {
if (!parser.ok())
LOG(ERROR) << "Failed to parse writer config: " << parser.error_json().dump(4);

parser.iter("channels", [this](config::Parser &channel_parser) {
parser.iter("channels", [this, ctx](config::Parser &channel_parser) {
auto channel = WriterChannelConfig(channel_parser);
channels.emplace_back(channel);

auto [channel_info, err] = ctx->client->channels.retrieve(channel.cmd_key);
if (err) {
LOG(ERROR) << "Failed to retrieve channel info for key " << channel.cmd_key;
return;
}
channel.data_type = channel_info.data_type;
channels.emplace_back(channel);

/// digital outputs start active high
double initial_val = 0.0;
Expand Down
2 changes: 1 addition & 1 deletion driver/labjack/writer_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ std::unique_ptr<task::Task> labjack::WriterTask::configure(
};

auto parser = config::Parser(task.config);
WriterConfig writer_config(parser);
WriterConfig writer_config(parser, ctx);

auto sink = std::make_shared<labjack::WriteSink>(
ctx,
Expand Down

0 comments on commit 2cd161c

Please sign in to comment.