Skip to content

Commit

Permalink
Ensure that explicit queries work even if default_query is false
Browse files Browse the repository at this point in the history
jpieper committed Aug 16, 2023
1 parent 3a7f28b commit d1a678a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Moteus.h
Original file line number Diff line number Diff line change
@@ -101,7 +101,9 @@ class Moteus {
// Query

CanFdFrame MakeQuery(const mm::Query::Format* format_override = nullptr) {
return MakeFrame(mm::EmptyMode(), {}, {}, format_override);
return MakeFrame(mm::EmptyMode(), {}, {},
format_override == nullptr ?
&options_.query_format : format_override);
}

bool SetQuery(const mm::Query::Format* query_override = nullptr) {
@@ -576,6 +578,7 @@ class Moteus {
const typename CommandType::Format& fmt,
const mm::Query::Format* query_override = nullptr) {
auto result = DefaultFrame(
query_override != nullptr ? kReplyRequired :
options_.default_query ? kReplyRequired : kNoReply);

mm::WriteCanData write_frame(result.data, &result.size);

0 comments on commit d1a678a

Please sign in to comment.