Skip to content
New issue

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

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

Already on GitHub? # to your account

Needle selection is wrong on KH270, Beta builds. #204

Closed
Adrienne200 opened this issue Oct 9, 2024 · 7 comments
Closed

Needle selection is wrong on KH270, Beta builds. #204

Adrienne200 opened this issue Oct 9, 2024 · 7 comments
Labels
Milestone

Comments

@Adrienne200
Copy link

Adrienne200 commented Oct 9, 2024

AYAB software version: 1.0.0-beta2
Computer/OS: Mac. Intel, Big Sur 11.7.10
Knitting machine: KH270
AYAB hardware: Tried both a shield and an interface

The whole pattern is displaced 2 needles to the right, and alternate rows are displaced by 6 needles.

Steps:

  1. Make sure you have selected KH270 in prefs, and reflash the firmware.
  2. Open the Triangles 60x10 image.
  3. Leave all the settings at default.
  4. Air-knit, or knit in Fair Isle

Expected: it should select needles looking exactly like the pattern on the purl side, reversed on the knit side.

Actual: The whole pattern is displaced 2 needles to the right, and alternate rows are displaced by 6 needles. It's not entirely consistent, sometimes a sequence of a few rows will be correct (aside from being displaced) but usually it's wrong on alternate rows.

I tried with and without crossing the turn marks every row. No difference.

It was mostly working previous to the Beta builds, I went back to a build from Aug 16th (including flashing the firmware) which I think was one of Jonathan's test builds and it was still good there.
IMG_2731 copy

@jpcornil-git
Copy link
Contributor

jpcornil-git commented Oct 11, 2024

6 seems to point to HALF_SOLENOIDS_NUM

The only place where it plays a role is here

  m_pixelToSet = m_position - startOffset;

  if (!beltShift) {
    m_solenoidToSet = m_pixelToSet % SOLENOIDS_NUM[static_cast<uint8_t>(m_machineType)];
  } else {
    m_solenoidToSet = (m_pixelToSet + HALF_SOLENOIDS_NUM[static_cast<uint8_t>(m_machineType)]) % SOLENOIDS_NUM[static_cast<uint8_t>(m_machineType)];
  }

https://github.com/AllYarnsAreBeautiful/ayab-firmware/blob/main/src/ayab/knitter.cpp#L419

Direction doesn't play a role here a priori; starfOffset is 28/16 for left/right respectively but after modulo 12 operation, end results will be the same, i.e. starfOffset could be set to any multiple of 12.

... but beltshift is supposed to be "not connected" and therefore shouldn't be in such 'if" statement (even if a floating signal shouldn't lead to values dependent of the direction which seems to be the case here)

I can't find a reason to explain why the pattern is displaced by 2 needles to the right ... the solenoid to set is always the pixel to set modulo 12 -> either at the correct place or shifted by a multiple of 12.

Could you check/confirm that the solenoid connector is well in place, not shifted ?

@Adrienne200
Copy link
Author

My 270 patterns correctly using its native electronics - I checked that patterns are positioned where they should be, relative to the center of the machine. And yes, my number strip is positioned correctly.
I've used two different AYAB hardwares, a shield and an interface. The connectors only go in one position.

@jpcornil-git
Copy link
Contributor

jpcornil-git commented Oct 15, 2024

Could you check in your tests if:

  • none of the two magnets crosses the right sensor.
  • the first magnet crossing the left sensor is the one at the right of the carriage.

When I do otherwise with my simulator, I see shifted patterns or marginal needle selection (solenoid is set when the needle selection takes place).

I see in the current code that the carriage position is reset to 135 everytime a magnet crosses the right sensor in whatever direction (END_RIGHT_MINUS_OFFSET) at encoders.cpp#L285

On the left side, position is reset to 5 + 12 = 17 (END_LEFT_PLUS_OFFSET + MAGNET_DISTANCE_270 ) the first time a magnet is seen at encoders.cpp#L199 (detected_carriage is always "Knit" for KH270 and therefore "if" statement is always taken/could just be removed).

135 -17 = 118 = 112 + 6 => shifted by 6 when right magnet of the carriage is crossing the right sensor.

17 seems correct when carriage is engaged from the left and the first magnet crossing the left sensor is the one at the right of the carriage. If the other magnets crosses first (carriage coming from the center before init, not enough to the left at start, ...) , then position is also set to 17 but the carriage is effectively 6 needles (distance between magnets in needles) further => shifted by 6 as well.

@clholgat
Copy link
Contributor

I'm going to test this on my 270

@clholgat
Copy link
Contributor

Yup, I can repro, probably an issue with the offsets, working on a fix.

@jpcornil-git
Copy link
Contributor

jpcornil-git commented Oct 18, 2024

Simulation results;

  • ayab-desktop with continuous reporting, i.e. what the FW indicates
  • simavr, i.e. what the machine does (solenoid register bank, needle "painted" ('x'), carriage position ("^"), needle bed, ...)

Released version (NOK)

Proposed #207 fix (OK)

@dl1com
Copy link
Contributor

dl1com commented Oct 27, 2024

Solved by #207

@dl1com dl1com closed this as completed Oct 27, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in AYAB 1.0.0 Release Tracking Oct 27, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
Development

No branches or pull requests

4 participants