Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the correct value for the lastLineFlag from cnfLine #217

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/ayab/com.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading bit 1 and assuming the lastLine flag there is violating the API.

Assuming the error is really caused by a faulty Bool->int conversion in the Python (ayab-desktop) part of AYAB, it should be fixed there to comply with the API (likely https://github.com/AllYarnsAreBeautiful/ayab-desktop/blob/5e781f109c8c86f6190152cfa6db0095c888b242/src/main/python/main/ayab/engine/control.py#L212).

if (flagLastLine) {
GlobalKnitter::setLastLine();
}
Expand Down
Loading