Skip to content

Commit

Permalink
tester: don't send empty message for empty version suffix
Browse files Browse the repository at this point in the history
The desktop app currently crashes when handling a testRes message with an
empty string.

That bug should be fixed over there, but it turns out there's a bug in the
firmware as well, in that the suffix is not prefixed by a "-" as it should be.

Adding this prefix, and making sure we don't send anything if there is
no suffix, fixes that and "accidentally" works around the desktop bug.
  • Loading branch information
jonathanperret committed Aug 30, 2024
1 parent 8206764 commit 7c26098
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ayab/tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ void Tester::setUp() {
GlobalCom::sendMsg(AYAB_API::testRes, "AYAB Hardware Test, ");
snprintf(buf, BUFFER_LEN, "Firmware v%hhu.%hhu.%hhu", FW_VERSION_MAJ, FW_VERSION_MIN, FW_VERSION_PATCH);
GlobalCom::sendMsg(AYAB_API::testRes, buf);
GlobalCom::sendMsg(AYAB_API::testRes, FW_VERSION_SUFFIX);
if (*FW_VERSION_SUFFIX != '\0') {
snprintf(buf, BUFFER_LEN, "-%s", FW_VERSION_SUFFIX);
GlobalCom::sendMsg(AYAB_API::testRes, buf);
}
snprintf(buf, BUFFER_LEN, " API v%hhu\n\n", API_VERSION);
GlobalCom::sendMsg(AYAB_API::testRes, buf);
helpCmd();
Expand Down

0 comments on commit 7c26098

Please sign in to comment.