Skip to content

Commit 51fffc1

Browse files
Changed EFFECTS_ defines
Remapped the EFFECTS_ character codes to higher values to allow fonts with more characters to be used without effecting their use.
1 parent 4e426e6 commit 51fffc1

File tree

2 files changed

+81
-86
lines changed

2 files changed

+81
-86
lines changed

LEDText.cpp

Lines changed: 51 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
LEDText V5 class by Aaron Liddiment (c) 2015
2+
LEDText V6 class by Aaron Liddiment (c) 2015
33
44
Uses my LEDMatrix class and especially the
55
@@ -18,36 +18,36 @@ Even the basic examples need 12k rom & 4k ram
1818
#define SCROLL_MASK (SCROLL_LEFT | SCROLL_RIGHT | SCROLL_UP | SCROLL_DOWN)
1919
#define COLR_MASK (COLR_RGB | COLR_HSV | COLR_SINGLE | COLR_GRAD | COLR_CHAR | COLR_AREA | COLR_VERT | COLR_HORI | COLR_EMPTY | COLR_DIMMING)
2020

21-
#define UC_BACKGND_ERASE 0x80
22-
#define UC_BACKGND_LEAVE 0x81
23-
#define UC_BACKGND_DIMMING 0x82
24-
#define UC_FRAME_RATE 0x84
25-
#define UC_DELAY_FRAMES 0x85
26-
27-
#define UC_CUSTOM_RC 0x88
28-
29-
#define UC_SCROLL_LEFT 0x90
30-
#define UC_SCROLL_RIGHT 0x91
31-
#define UC_SCROLL_UP 0x92
32-
#define UC_SCROLL_DOWN 0x93
33-
34-
#define UC_CHAR_UP 0xa0
35-
#define UC_CHAR_DOWN 0xa1
36-
#define UC_CHAR_LEFT 0xa2
37-
#define UC_CHAR_RIGHT 0xa3
38-
39-
#define UC_RGB 0xc0
40-
#define UC_HSV 0xc1
41-
#define UC_RGB_CV 0xc2
42-
#define UC_HSV_CV 0xc3
43-
#define UC_RGB_AV 0xc6
44-
#define UC_HSV_AV 0xc7
45-
#define UC_RGB_CH 0xca
46-
#define UC_HSV_CH 0xcb
47-
#define UC_RGB_AH 0xce
48-
#define UC_HSV_AH 0xcf
49-
#define UC_COLR_EMPTY 0xd0
50-
#define UC_COLR_DIMMING 0xe0
21+
#define UC_CHAR_UP 0xd8
22+
#define UC_CHAR_DOWN 0xd9
23+
#define UC_CHAR_LEFT 0xda
24+
#define UC_CHAR_RIGHT 0xdb
25+
26+
#define UC_SCROLL_LEFT 0xdc
27+
#define UC_SCROLL_RIGHT 0xdd
28+
#define UC_SCROLL_UP 0xde
29+
#define UC_SCROLL_DOWN 0xdf
30+
31+
#define UC_RGB 0xe0
32+
#define UC_HSV 0xe1
33+
#define UC_RGB_CV 0xe2
34+
#define UC_HSV_CV 0xe3
35+
#define UC_RGB_AV 0xe6
36+
#define UC_HSV_AV 0xe7
37+
#define UC_RGB_CH 0xea
38+
#define UC_HSV_CH 0xeb
39+
#define UC_RGB_AH 0xee
40+
#define UC_HSV_AH 0xef
41+
#define UC_COLR_EMPTY 0xf0
42+
#define UC_COLR_DIMMING 0xf1
43+
44+
#define UC_BACKGND_ERASE 0xf4
45+
#define UC_BACKGND_LEAVE 0xf5
46+
#define UC_BACKGND_DIMMING 0xf6
47+
48+
#define UC_FRAME_RATE 0xf8
49+
#define UC_DELAY_FRAMES 0xf9
50+
#define UC_CUSTOM_RC 0xfa
5151

5252

5353
void cLEDText::SetFont(const uint8_t *FontData)
@@ -192,13 +192,13 @@ void cLEDText::DecodeOptions(uint16_t *tp, uint16_t *opt, uint8_t *backDim, uint
192192
case UC_CHAR_DOWN:
193193
case UC_CHAR_LEFT:
194194
case UC_CHAR_RIGHT:
195-
*opt = (*opt & (~CHAR_MASK)) | (((uint16_t)m_pText[*tp] << 2) & CHAR_MASK);
195+
*opt = (*opt & (~CHAR_MASK)) | ((((uint16_t)m_pText[*tp] & 0x03) << 2) & CHAR_MASK);
196196
break;
197197
case UC_SCROLL_LEFT:
198198
case UC_SCROLL_RIGHT:
199199
case UC_SCROLL_UP:
200200
case UC_SCROLL_DOWN:
201-
*opt = (*opt & (~SCROLL_MASK)) | (((uint16_t)m_pText[*tp] << 4) & SCROLL_MASK);
201+
*opt = (*opt & (~SCROLL_MASK)) | ((((uint16_t)m_pText[*tp] & 0x03) << 4) & SCROLL_MASK);
202202
break;
203203
case UC_RGB:
204204
case UC_HSV:
@@ -210,32 +210,27 @@ void cLEDText::DecodeOptions(uint16_t *tp, uint16_t *opt, uint8_t *backDim, uint
210210
case UC_HSV_CH:
211211
case UC_RGB_AH:
212212
case UC_HSV_AH:
213-
case UC_COLR_EMPTY:
214-
case UC_COLR_DIMMING:
215-
*opt = (*opt & (~COLR_MASK)) | (((uint16_t)m_pText[*tp] << 6) & COLR_MASK);
216-
if ((*opt & COLR_EMPTY) != COLR_EMPTY)
213+
*opt = (*opt & (~COLR_MASK)) | ((((uint16_t)m_pText[*tp] & 0x0f) << 6) & COLR_MASK);
214+
col1[0] = m_pText[*tp + 1];
215+
col1[1] = m_pText[*tp + 2];
216+
col1[2] = m_pText[*tp + 3];
217+
*tp += 3;
218+
if ((*opt & COLR_GRAD) == COLR_GRAD)
217219
{
218-
if ((*opt & COLR_DIMMING) == COLR_DIMMING)
219-
{
220-
*colDim = (uint8_t)m_pText[*tp + 1];
221-
*tp += 1;
222-
}
223-
else
224-
{
225-
col1[0] = m_pText[*tp + 1];
226-
col1[1] = m_pText[*tp + 2];
227-
col1[2] = m_pText[*tp + 3];
228-
*tp += 3;
229-
if ((*opt & COLR_GRAD) == COLR_GRAD)
230-
{
231-
col2[0] = m_pText[*tp + 1];
232-
col2[1] = m_pText[*tp + 2];
233-
col2[2] = m_pText[*tp + 3];
234-
*tp += 3;
235-
}
236-
}
220+
col2[0] = m_pText[*tp + 1];
221+
col2[1] = m_pText[*tp + 2];
222+
col2[2] = m_pText[*tp + 3];
223+
*tp += 3;
237224
}
238225
break;
226+
case UC_COLR_EMPTY:
227+
*opt = (*opt & (~COLR_MASK)) | COLR_EMPTY;
228+
break;
229+
case UC_COLR_DIMMING:
230+
*opt = (*opt & (~COLR_MASK)) | COLR_DIMMING;
231+
*colDim = (uint8_t)m_pText[*tp + 1];
232+
*tp += 1;
233+
break;
239234
}
240235
}
241236

LEDText.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,36 @@
3737

3838
#define INSTANT_OPTIONS_MODE 0x1000
3939

40-
#define EFFECT_BACKGND_ERASE "\x80"
41-
#define EFFECT_BACKGND_LEAVE "\x81"
42-
#define EFFECT_BACKGND_DIMMING "\x82"
43-
#define EFFECT_FRAME_RATE "\x84"
44-
#define EFFECT_DELAY_FRAMES "\x85"
45-
46-
#define EFFECT_CUSTOM_RC "\x88"
47-
48-
#define EFFECT_SCROLL_LEFT "\x90"
49-
#define EFFECT_SCROLL_RIGHT "\x91"
50-
#define EFFECT_SCROLL_UP "\x92"
51-
#define EFFECT_SCROLL_DOWN "\x93"
52-
53-
#define EFFECT_CHAR_UP "\xa0"
54-
#define EFFECT_CHAR_DOWN "\xa1"
55-
#define EFFECT_CHAR_LEFT "\xa2"
56-
#define EFFECT_CHAR_RIGHT "\xa3"
57-
58-
#define EFFECT_RGB "\xc0"
59-
#define EFFECT_HSV "\xc1"
60-
#define EFFECT_RGB_CV "\xc2"
61-
#define EFFECT_HSV_CV "\xc3"
62-
#define EFFECT_RGB_AV "\xc6"
63-
#define EFFECT_HSV_AV "\xc7"
64-
#define EFFECT_RGB_CH "\xca"
65-
#define EFFECT_HSV_CH "\xcb"
66-
#define EFFECT_RGB_AH "\xce"
67-
#define EFFECT_HSV_AH "\xcf"
68-
#define EFFECT_COLR_EMPTY "\xd0"
69-
#define EFFECT_COLR_DIMMING "\xe0"
40+
#define EFFECT_CHAR_UP "\xd8"
41+
#define EFFECT_CHAR_DOWN "\xd9"
42+
#define EFFECT_CHAR_LEFT "\xda"
43+
#define EFFECT_CHAR_RIGHT "\xdb"
44+
45+
#define EFFECT_SCROLL_LEFT "\xdc"
46+
#define EFFECT_SCROLL_RIGHT "\xdd"
47+
#define EFFECT_SCROLL_UP "\xde"
48+
#define EFFECT_SCROLL_DOWN "\xdf"
49+
50+
#define EFFECT_RGB "\xe0"
51+
#define EFFECT_HSV "\xe1"
52+
#define EFFECT_RGB_CV "\xe2"
53+
#define EFFECT_HSV_CV "\xe3"
54+
#define EFFECT_RGB_AV "\xe6"
55+
#define EFFECT_HSV_AV "\xe7"
56+
#define EFFECT_RGB_CH "\xea"
57+
#define EFFECT_HSV_CH "\xeb"
58+
#define EFFECT_RGB_AH "\xee"
59+
#define EFFECT_HSV_AH "\xef"
60+
#define EFFECT_COLR_EMPTY "\xf0"
61+
#define EFFECT_COLR_DIMMING "\xf1"
62+
63+
#define EFFECT_BACKGND_ERASE "\xf4"
64+
#define EFFECT_BACKGND_LEAVE "\xf5"
65+
#define EFFECT_BACKGND_DIMMING "\xf6"
66+
67+
#define EFFECT_FRAME_RATE "\xf8"
68+
#define EFFECT_DELAY_FRAMES "\xf9"
69+
#define EFFECT_CUSTOM_RC "\xfa"
7070

7171

7272
/* Binary constant generator macro By Tom Torfs - donated to the public domain */

0 commit comments

Comments
 (0)