Skip to content

Commit 829f0c9

Browse files
authored
Merge branch 'master' into m4eyes_arcadify
2 parents d04bde6 + 76388f6 commit 829f0c9

18 files changed

+197139
-5
lines changed
1.25 MB
Binary file not shown.
645 KB
Binary file not shown.
531 KB
Binary file not shown.
614 KB
Binary file not shown.

CPX_Snapfit_Mount/STLs/cpx-wheel.stl

619 KB
Binary file not shown.
3.12 MB
Binary file not shown.

CPX_Snapfit_Mount/source/Snapfit CPX Case.step

Lines changed: 84161 additions & 0 deletions
Large diffs are not rendered by default.
760 KB
Binary file not shown.
136 KB
Binary file not shown.
764 KB
Binary file not shown.
227 KB
Binary file not shown.

LEGO_Head_CPX_Lamp/STLs/LH-stud.stl

420 KB
Binary file not shown.
Binary file not shown.
4.31 MB
Binary file not shown.

LEGO_Head_CPX_Lamp/source/lego head cpx lamp.step

Lines changed: 112963 additions & 0 deletions
Large diffs are not rendered by default.
Binary file not shown.
Binary file not shown.

Stream_Deck_Message_Panel/MessagePanel/MessagePanel.ino

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ void handleMessage(AdafruitIO_Data *data) {
5555
uint16_t strpos = 0;
5656
byte lineLengths[] = {0, 0, 0, 0};
5757
byte lineNum = 0;
58+
byte messageHeight = 0;
59+
byte lineHeight = 0;
5860
// Calculate line lengths
5961
boolean paramRead = false;
6062
boolean newLine = false;
@@ -83,17 +85,25 @@ void handleMessage(AdafruitIO_Data *data) {
8385

8486
if (plainText.charAt(strpos) != '\n') {
8587
lineLengths[lineNum] += textSize * BASE_CHAR_WIDTH;
88+
if (textSize * BASE_CHAR_HEIGHT > lineHeight) {
89+
lineHeight = textSize * BASE_CHAR_HEIGHT;
90+
}
8691
}
8792

8893
// We want to keep adding up the characters * textSize until we hit a newline character
8994
// or we reach the width of the message panel. Then we go down to the next line
9095
if (plainText.charAt(strpos) == '\n' || lineLengths[lineNum] >= matrix.width()) {
96+
messageHeight += lineHeight;
97+
lineHeight = 0;
9198
lineNum++;
9299
}
93100

94101
strpos++;
95102
}
96103

104+
// Add the last line
105+
messageHeight += lineHeight;
106+
97107
textSize = 1;
98108
lineNum = 0;
99109
for(uint16_t i=0; i<message.length(); i++) {
@@ -103,7 +113,7 @@ void handleMessage(AdafruitIO_Data *data) {
103113
} else if (message.charAt(i) == '}') {
104114
paramRead = false;
105115
int wheelPos = atoi(message.substring(colorStartIndex, i).c_str());
106-
if (wheelPos < 25) {
116+
if (wheelPos < 24) {
107117
color = Wheel(wheelPos);
108118
} else {
109119
color = matrix.Color333(7, 7, 7);
@@ -118,7 +128,7 @@ void handleMessage(AdafruitIO_Data *data) {
118128
if (paramRead) continue;
119129

120130
if (matrix.getCursorX() == 0 && matrix.getCursorY() == 0) {
121-
matrix.setCursor(floor((matrix.width() / 2) - (lineLengths[lineNum] / 2)), 0);
131+
matrix.setCursor(floor((matrix.width() / 2) - (lineLengths[lineNum] / 2)), matrix.height() / 2 - messageHeight / 2);
122132
} else if (newLine) {
123133
matrix.setCursor(floor((matrix.width() / 2) - (lineLengths[++lineNum] / 2)), matrix.getCursorY());
124134
newLine = false;
@@ -159,16 +169,16 @@ void loop() {
159169
io.run();
160170
}
161171

162-
// Input a value 0 to 24 to get a color value.
172+
// Input a value 0 to 23 to get a color value.
163173
// The colours are a transition r - g - b - back to r.
164174
uint16_t Wheel(byte WheelPos) {
165175
if(WheelPos < 8) {
166176
return matrix.Color333(7 - WheelPos, WheelPos, 0);
167177
} else if(WheelPos < 16) {
168178
WheelPos -= 8;
169-
return matrix.Color333(0, 7-WheelPos, WheelPos);
179+
return matrix.Color333(0, 7 - WheelPos, WheelPos);
170180
} else {
171181
WheelPos -= 16;
172-
return matrix.Color333(0, WheelPos, 7 - WheelPos);
182+
return matrix.Color333(WheelPos, 0, 7 - WheelPos);
173183
}
174184
}

0 commit comments

Comments
 (0)