Command Byte CRC Random Ranges. - meerk40t/moshi GitHub Wiki

Within A7 commands.

The a7xx values used before the AC01 commands are:

  • A2 A6 B2 B6 C5 C7 CD CF E2 E5 E6 E7 ED EF F2 F6

Before a jump / program / turned on:

  • 45 47 4D 4F 65 67 6D 6F 82 86 92 96 C2 C6 D2 D6

After a jump / program:

  • 05 07 0D 0F 25 27 2D 2F 80 84 90 94 C0 C4 D0 D4

Freemotor command:

  • 08 0C 13 19 1B 1C 31 3B 48 58 5C ?? ?? ?? ?? ?? -- Low sample size.

Stop command (likely same as freemotor):

  • 19 58 C2 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? -- Low Sample size.

Within A6 commands.

Header start byte. (0x00 position), followed by 1 int16le (1)

  • 0A 0E 1A 1E 4A 4E 51 53 59 5A 5B 5E 71 74 79 7B

2nd Command For Jump. (0x03 position), followed by 3 int16le (2)

  • 00 01 03 04 09 0C 10 14 21 23 29 2B 40 44 50 54

Laser Off, X and Y values. 3rd Command for Jump. (0x0A position), followed by 2 int16le (3)

  • 55 57 5D 5F 75 77 7D 7F 8A 8E 9A 9E CA CE DA DE

Terminal Commands for Jump/Program. (last 6 bytes). (4)

  • 05 07 0D 0F 25 27 2D 2F 80 84 90 94 C0 C4 D0 D4

Laser On, X and Y values. (5)

  • AA AE BA BE D5 D7 DD DF EA EE F5 F7 FA FD FE FF

Laser UNK(likely off), Y value only. (6)

  • 15 17 1D 1F 35 37 3D 3F 88 8C 98 9C C8 CC D8 DC

Laser Off, X value only. (7)

  • 45 47 4D 4F 65 67 6D 6F 82 86 92 96 C2 C6 D2 D6

Laser On, X value only. (8)

  • A2 A6 B2 B6 C5 C7 CD CF E2 E5 E6 E7 ED EF F2 F6

1. 0A 0E 1A 1E 4A 4E 51 53 59 5A 5B 5E 71 74 79 7B
2. 00 01 03 04 09 0C 10 14 21 23 29 2B 40 44 50 54
3. 55 57 5D 5F 75 77 7D 7F 8A 8E 9A 9E CA CE DA DE
4. 05 07 0D 0F 25 27 2D 2F 80 84 90 94 C0 C4 D0 D4
5. AA AE BA BE D5 D7 DD DF EA EE F5 F7 FA FD FE FF
6. 15 17 1D 1F 35 37 3D 3F 88 8C 98 9C C8 CC D8 DC
7. 45 47 4D 4F 65 67 6D 6F 82 86 92 96 C2 C6 D2 D6
8. A2 A6 B2 B6 C5 C7 CD CF E2 E5 E6 E7 ED EF F2 F6

If we perform:

def swizzle(b, b0, b1, b2, b3, b4, b5, b6, b7):
    return ((b >> 0) & 1) << b7 | ((b >> 1) & 1) << b6 | \
           ((b >> 2) & 1) << b5 | ((b >> 3) & 1) << b4 | \
           ((b >> 4) & 1) << b3 | ((b >> 5) & 1) << b2 | \
           ((b >> 6) & 1) << b1 | ((b >> 7) & 1) << b0

def convert(q):
    if q & 1:
        return swizzle(q, 7, 6, 2, 4, 3, 5, 1, 0)
    else:
        return swizzle(q, 5, 1, 7, 2, 4, 3, 6, 0)

The rows are converted into:

1: ['50', '51', '52', '53', '54', '55', '56', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '8e']
2: ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0c', '0d', '0e', '0f', '18']
3: ['70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f']
4: ['20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f']
5: ['f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff']
6: ['30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f']
7: ['60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f']
8: ['e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef']
9: ['10', '12', '13', '15', '16', '18', '19', '1b', '1c', '1e', '1f']

We know that 3 (Off, X, Y) and 5 (On, X, Y) differ by a laser on state. And that 7 (Off, X) and 8 (On, X) should differ by the laser. In both of these the laser bit is could be judged as 0x80 or bit #7. Since the on section of both is the same code with the highest bit set.

Taking another stab that the difference between 3 (0x7?) and 7 (0x6?) is the flag for Y value given. This would be lowest bit in the upper nibble 0x10. The same difference should exist between 5 (0xF?) and 8 (0xE?). Lines 3 (off, x,y) and 6 (off, y) should differ by the existence of X. this is 0x7? and 0x3? which differs by the 0x4? place.

This would imply that that flags are: (Laser)(X Value)(Unknown)(Yvalue)

Testing still need to be done as to whether the remaining bits are random or crc and have a required order or something.

Inverting the Swizzle:

['00', '01', '40', '03', '10', '21', '50', '23', '04', '09', '44', '0b', '14', '29', '54', '2b']
['08', '11', '48', '13', '18', '31', '58', '33', '0c', '19', '4c', '1b', '1c', '39', '5c', '3b']
['80', '05', 'c0', '07', '90', '25', 'd0', '27', '84', '0d', 'c4', '0f', '94', '2d', 'd4', '2f']
['88', '15', 'c8', '17', '98', '35', 'd8', '37', '8c', '1d', 'cc', '1f', '9c', '3d', 'dc', '3f']
['02', '41', '42', '43', '12', '61', '52', '63', '06', '49', '46', '4b', '16', '69', '56', '6b']
['0a', '51', '4a', '53', '1a', '71', '5a', '73', '0e', '59', '4e', '5b', '1e', '79', '5e', '7b']
['82', '45', 'c2', '47', '92', '65', 'd2', '67', '86', '4d', 'c6', '4f', '96', '6d', 'd6', '6f']
['8a', '55', 'ca', '57', '9a', '75', 'da', '77', '8e', '5d', 'ce', '5f', '9e', '7d', 'de', '7f']
['20', '81', '60', '83', '30', 'a1', '70', 'a3', '24', '89', '64', '8b', '34', 'a9', '74', 'ab']
['28', '91', '68', '93', '38', 'b1', '78', 'b3', '2c', '99', '6c', '9b', '3c', 'b9', '7c', 'bb']
['a0', '85', 'e0', '87', 'b0', 'a5', 'f0', 'a7', 'a4', '8d', 'e4', '8f', 'b4', 'ad', 'f4', 'af']
['a8', '95', 'e8', '97', 'b8', 'b5', 'f8', 'b7', 'ac', '9d', 'ec', '9f', 'bc', 'bd', 'fc', 'bf']
['22', 'c1', '62', 'c3', '32', 'e1', '72', 'e3', '26', 'c9', '66', 'cb', '36', 'e9', '76', 'eb']
['2a', 'd1', '6a', 'd3', '3a', 'f1', '7a', 'f3', '2e', 'd9', '6e', 'db', '3e', 'f9', '7e', 'fb']
['a2', 'c5', 'e2', 'c7', 'b2', 'e5', 'f2', 'e7', 'a6', 'cd', 'e6', 'cf', 'b6', 'ed', 'f6', 'ef']
['aa', 'd5', 'ea', 'd7', 'ba', 'f5', 'fa', 'f7', 'ae', 'dd', 'ee', 'df', 'be', 'fd', 'fe', 'ff']
⚠️ **GitHub.com Fallback** ⚠️