From dd8a633e9097092224b3f68cba8e24082ef35633 Mon Sep 17 00:00:00 2001 From: Carson Holgate Date: Mon, 2 Dec 2024 19:21:48 -0800 Subject: [PATCH 1/2] Get the correct value for the lastLineFlag from cnfLine --- src/ayab/com.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ayab/com.cpp b/src/ayab/com.cpp index 4ca12d37..8e6adfe1 100644 --- a/src/ayab/com.cpp +++ b/src/ayab/com.cpp @@ -297,7 +297,10 @@ void Com::h_cnfLine(const uint8_t *buffer, size_t size) { if (GlobalKnitter::setNextLine(lineNumber)) { // Line was accepted - bool flagLastLine = bitRead(flags, 0U); + + // A Python bool is represented as a byte + // so read the second bit to get the value + bool flagLastLine = bitRead(flags, 1U); if (flagLastLine) { GlobalKnitter::setLastLine(); } From 3b1a158c1db6e342945d99b73af371ab1c70586d Mon Sep 17 00:00:00 2001 From: Carson Holgate Date: Mon, 2 Dec 2024 19:29:48 -0800 Subject: [PATCH 2/2] Fix test --- test/test_com.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_com.cpp b/test/test_com.cpp index be611993..884c8a5f 100644 --- a/test/test_com.cpp +++ b/test/test_com.cpp @@ -276,7 +276,7 @@ TEST_F(ComTest, test_cnfline_kh910) { uint8_t buffer[30] = {static_cast(AYAB_API::cnfLine) /* 0x42 */, 0, 0, - 1, + 0x01, 0xDE, 0xAD, 0xBE,