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

Improve serial protocol for firmware #17

Closed
niccokunzmann opened this issue May 31, 2016 · 14 comments
Closed

Improve serial protocol for firmware #17

niccokunzmann opened this issue May 31, 2016 · 14 comments

Comments

@niccokunzmann
Copy link
Member

@niccokunzmann niccokunzmann commented May 31, 2016

find a way to specify how knitting instructions can be converted to instructions for the machine

@kirstin

This comment has been minimized.

Copy link

@kirstin kirstin commented May 31, 2016

@chris007de

This comment has been minimized.

Copy link
Contributor

@chris007de chris007de commented May 31, 2016

Check also this wiki entry and its implementation in ayab_communication.py

@niccokunzmann niccokunzmann modified the milestone: Milestone 2 May 31, 2016
@niccokunzmann

This comment has been minimized.

Copy link
Member Author

@niccokunzmann niccokunzmann commented Jun 7, 2016

  • machine asks: give me line [uint8_t]
  • serial answer: line number, 200bit as bit mask
  • small and fast to be placed between interrupt
  • checksum crc? unused
  • needle position:
    • 1 = d
    • 0 = b
      laut andz
@niccokunzmann

This comment has been minimized.

Copy link
Member Author

@niccokunzmann niccokunzmann commented Jul 24, 2016

@niccokunzmann

This comment has been minimized.

Copy link
Member Author

@niccokunzmann niccokunzmann commented Jul 24, 2016

@chris007de @andz82

waffle deleted my last post.

  1. The debug message starts with "#" but in the specification with "0xFF" how to go about this? AllYarnsAreBeautiful/ayab-firmware#1
  2. cnfInfo Chris' source code does not match the specification
  3. indState is not listed
  4. in indState what is the byte order of uint16?
  5. indInit does not occur in the source code and in the sequence diagram - what does it do?
@niccokunzmann

This comment has been minimized.

Copy link
Member Author

@niccokunzmann niccokunzmann commented Jul 24, 2016

@niccokunzmann

This comment has been minimized.

Copy link
Member Author

@niccokunzmann niccokunzmann commented Jul 24, 2016

Resolved (4)
In the implementation, the higher order byte comes first.

Resolved (5) and (3)
indInit does not appear in the source code. I assume that indInit means indState. Documentation needs to be adjusted. Done

@niccokunzmann

This comment has been minimized.

Copy link
Member Author

@niccokunzmann niccokunzmann commented Jul 24, 2016

(1) and (2) Resolved
I assume I can update the specification according to what is used in the Arduino file.

I also linked the documentation to the Python implementation and the Arduino source code. #123 could improve linking.

@niccokunzmann

This comment has been minimized.

Copy link
Member Author

@niccokunzmann niccokunzmann commented Jul 24, 2016

@chris007de @andz82 You can review my assumptions.

@niccokunzmann

This comment has been minimized.

Copy link
Member Author

@niccokunzmann niccokunzmann commented Jul 24, 2016

New questions:

  • (6) What is initState in indState( bool initState = false) ?
  • (7) Do success messages use 0 == false and success != 0 ? I am not sure what casting a bool to a byte does. I would like to assume that success == 1 and all values >1 are invalid values. Before I decide on this, I would like to hear your thoughts. @chris007de
  • (8) What is cnfTest ?

(6) Resolved
I assume that it means "success" != "0", failure == "0".

(7) Resolved
Update1 I think, based on this answer that it is safe to assume 0 == false and success == 1 all other values are invalid.
[Old text: I assume - because it is safe to assume - that 0 == false and success != 0 for all booleans in true/false messages in the specification. The specification needs to be rewritten then, but the Arduino program can be left untouched.]

(8) Resolved
I assume:: cnfTest the message that should be answered to a reqTest. Both are not in the specification and should be put in the specification. @chris007de If you could write down what the test mode should do, this can be put in the specification.

@chris007de

This comment has been minimized.

Copy link
Contributor

@chris007de chris007de commented Jul 25, 2016

Your assumptions are mostly correct.
Just some remarks to further clarify things:

  • The host waits for a indState(true) message before requesting to start the knitting. On startup, the Arduino continuously checks for the initialization of the machine (carriage passed left hall sensor). When this happens, it sends an indState(true) to tell the host that the machine is ready to knit. After receiving this message, the host sends a reqStart message, which is immediately confirmed with a cnfStart message. When reqStart was successful, the Arduino begins to poll the host for line data with reqLine, the host answers with cnfLine. This reqLine/cnfLine happens each time the carriage moves passed the borders given by the Start/StopNeedle parameters in reqStart. When the host does not have any more lines to send, it marks the last line with the lastLine flag in its last cnfLine message.
  • reqTest (immediately confirmed by cnfTest) puts the Arduino in a Testmode, instead of a knitting mode (see https://github.com/AllYarnsAreBeautiful/ayab-desktop/blob/master/software/python/ayab/plugins/ayab_plugin/ayab_control.py#L605).
    Instead, it sends indState messages periodically, containing the sensor and position values.

I will clarify this in the specification today evening

@niccokunzmann

This comment has been minimized.

Copy link
Member Author

@niccokunzmann niccokunzmann commented Jul 25, 2016

@chris007de thanks.

  • (9) Resolved The sequence diagram does not contain the indState message.
  • (10) What does indState(false) mean?

(9) Resolved
I assume the indState(true) message should be added to the diagram.

(10) Resolved
indState(initState) is called with true/false. Thus, I assume that

  • true means the controller has waited for this message and this is the first indState sent
  • false means the controller can send this message from time to time to notify the host about changes.
@niccokunzmann

This comment has been minimized.

Copy link
Member Author

@niccokunzmann niccokunzmann commented Jul 31, 2016

  • (11) Is it possible to send a reqStart again to reset the start and stop needle in case the knitwork is not a rectangle? Will his require to reset the line count?
  • (12) is it possible to know when the knitting process is over?

@chris007de @andz82

@chris007de chris007de changed the title understand serial protocol for firmware Improve serial protocol for firmware Nov 26, 2016
@chris007de

This comment has been minimized.

Copy link
Contributor

@chris007de chris007de commented Nov 26, 2016

This issue was moved to AllYarnsAreBeautiful/ayab-firmware#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.