Use or instead of plus since the header bits can be set multiple times.
This commit is contained in:
parent
1151396912
commit
7ecc1fd19a
46
StenoFW.ino
46
StenoFW.ino
@ -262,63 +262,63 @@ void sendChordTxBolt() {
|
||||
|
||||
// byte 1
|
||||
// S-
|
||||
if (currentChord[0][0] || currentChord[1][0]) chordBytes[0] += B00000001;
|
||||
if (currentChord[0][0] || currentChord[1][0]) chordBytes[0] |= B00000001;
|
||||
// T-
|
||||
if (currentChord[0][1]) chordBytes[index] += B00000010;
|
||||
if (currentChord[0][1]) chordBytes[index] |= B00000010;
|
||||
// K-
|
||||
if (currentChord[1][1]) chordBytes[index] += B00000100;
|
||||
if (currentChord[1][1]) chordBytes[index] |= B00000100;
|
||||
// P-
|
||||
if (currentChord[0][2]) chordBytes[index] += B00001000;
|
||||
if (currentChord[0][2]) chordBytes[index] |= B00001000;
|
||||
// W-
|
||||
if (currentChord[1][2]) chordBytes[index] += B00010000;
|
||||
if (currentChord[1][2]) chordBytes[index] |= B00010000;
|
||||
// H-
|
||||
if (currentChord[0][3]) chordBytes[index] += B00100000;
|
||||
if (currentChord[0][3]) chordBytes[index] |= B00100000;
|
||||
// Increment the index if the current byte has any keys set.
|
||||
if (chordBytes[index]) index++;
|
||||
|
||||
// byte 2
|
||||
// R-
|
||||
if (currentChord[1][3]) chordBytes[index] += B01000001;
|
||||
if (currentChord[1][3]) chordBytes[index] |= B01000001;
|
||||
// A
|
||||
if (currentChord[2][0]) chordBytes[index] += B01000010;
|
||||
if (currentChord[2][0]) chordBytes[index] |= B01000010;
|
||||
// O
|
||||
if (currentChord[2][1]) chordBytes[index] += B01000100;
|
||||
if (currentChord[2][1]) chordBytes[index] |= B01000100;
|
||||
// *
|
||||
if (currentChord[0][4] || currentChord[1][4]) chordBytes[index] += B01001000;
|
||||
if (currentChord[0][4] || currentChord[1][4]) chordBytes[index] |= B01001000;
|
||||
// E
|
||||
if (currentChord[2][2]) chordBytes[index] += B01010000;
|
||||
if (currentChord[2][2]) chordBytes[index] |= B01010000;
|
||||
// U
|
||||
if (currentChord[2][3]) chordBytes[index] += B01100000;
|
||||
if (currentChord[2][3]) chordBytes[index] |= B01100000;
|
||||
// Increment the index if the current byte has any keys set.
|
||||
if (chordBytes[index]) index++;
|
||||
|
||||
// byte 3
|
||||
// -F
|
||||
if (currentChord[3][0]) chordBytes[index] += B10000001;
|
||||
if (currentChord[3][0]) chordBytes[index] |= B10000001;
|
||||
// -R
|
||||
if (currentChord[4][0]) chordBytes[index] += B10000010;
|
||||
if (currentChord[4][0]) chordBytes[index] |= B10000010;
|
||||
// -P
|
||||
if (currentChord[3][1]) chordBytes[index] += B10000100;
|
||||
if (currentChord[3][1]) chordBytes[index] |= B10000100;
|
||||
// -B
|
||||
if (currentChord[4][1]) chordBytes[index] += B10001000;
|
||||
if (currentChord[4][1]) chordBytes[index] |= B10001000;
|
||||
// -L
|
||||
if (currentChord[3][2]) chordBytes[index] += B10010000;
|
||||
if (currentChord[3][2]) chordBytes[index] |= B10010000;
|
||||
// -G
|
||||
if (currentChord[4][2]) chordBytes[index] += B10100000;
|
||||
if (currentChord[4][2]) chordBytes[index] |= B10100000;
|
||||
// Increment the index if the current byte has any keys set.
|
||||
if (chordBytes[index]) index++;
|
||||
|
||||
// byte 4
|
||||
// -T
|
||||
if (currentChord[3][3]) chordBytes[index] += B11000001;
|
||||
if (currentChord[3][3]) chordBytes[index] |= B11000001;
|
||||
// -S
|
||||
if (currentChord[4][3]) chordBytes[index] += B11000010;
|
||||
if (currentChord[4][3]) chordBytes[index] |= B11000010;
|
||||
// -D
|
||||
if (currentChord[3][4]) chordBytes[index] += B11000100;
|
||||
if (currentChord[3][4]) chordBytes[index] |= B11000100;
|
||||
// -Z
|
||||
if (currentChord[4][3]) chordBytes[index] += B11001000;
|
||||
if (currentChord[4][3]) chordBytes[index] |= B11001000;
|
||||
// #
|
||||
if (currentChord[2][4]) chordBytes[index] += B11010000;
|
||||
if (currentChord[2][4]) chordBytes[index] |= B11010000;
|
||||
// Increment the index if the current byte has any keys set.
|
||||
if (chordBytes[index]) index++;
|
||||
|
||||
|
Reference in New Issue
Block a user