Skip to content

Commit

Permalink
930 bug fixes for garter carriage alignment and lace carriage start s…
Browse files Browse the repository at this point in the history
…election (#184)

* 930 bugs

* Make it pretty
  • Loading branch information
clholgat authored Feb 12, 2024
1 parent 77b7111 commit c6c1b2a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ayab/encoders.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ constexpr uint8_t START_OFFSET[NUM_MACHINES][NUM_DIRECTIONS][NUM_CARRIAGES] = {
// KH930
{
// K, L, G
{40U, 40U, 8U}, // Left
{16U, 16U, 32U} // Right
{40U, 40U, 32U}, // Left
{16U, 16U, 56U} // Right
},
// KH270
{
Expand Down
12 changes: 11 additions & 1 deletion src/ayab/knitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,23 @@ void Knitter::reqLine(uint8_t lineNumber) {
*/
bool Knitter::calculatePixelAndSolenoid() {
uint8_t startOffset = 0;
uint8_t laceOffset = 0;

switch (m_direction) {
// calculate the solenoid and pixel to be set
// implemented according to machine manual
// magic numbers from machine manual
case Direction_t::Right:
startOffset = getStartOffset(Direction_t::Left);
if (m_position >= startOffset) {

// We have to start setting pixels earlier when the lace carriage is selected because we shift
// the lace pixel selection up HALF_SOLENOIDS_NUM in this direction. Doesn't matter going back
// the other way.
if (Carriage_t::Lace == m_carriage) {
laceOffset = HALF_SOLENOIDS_NUM[static_cast<uint8_t>(m_machineType)];
}

if (m_position >= startOffset - laceOffset) {
m_pixelToSet = m_position - startOffset;

if ((BeltShift::Regular == m_beltShift) || (m_machineType == Machine_t::Kh270)) {
Expand Down Expand Up @@ -432,6 +441,7 @@ bool Knitter::calculatePixelAndSolenoid() {
default:
return false;
}

// The 270 has 12 solenoids but they get shifted over 3 bits
if (m_machineType == Machine_t::Kh270) {
m_solenoidToSet = m_solenoidToSet + 3;
Expand Down

0 comments on commit c6c1b2a

Please sign in to comment.