Skip to content

Commit 6038307

Browse files
HHHartmannmarcelstoer
authored andcommitted
add ws2812 4 channels for RGBW strips + diagnostic output (#3637)
1 parent d086480 commit 6038307

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

app/lua/luac_cross/lflashimg.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ uint dumpToFlashImage (lua_State* L, const Proto *main, lua_Writer w,
399399

400400
fh->flash_sig = FLASH_SIG + (address ? FLASH_SIG_ABSOLUTE : 0);
401401
fh->flash_size = curOffset*WORDSIZE;
402+
printf("Image size: %d\n", fh->flash_size);
402403
if (fh->flash_size>maxSize) {
403404
fatal ("The image is too large for specfied LFS size");
404405
}

app/modules/ws2812.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static int ws2812_write(lua_State* L) {
138138
else if (type == LUA_TUSERDATA)
139139
{
140140
pixbuf *buffer = pixbuf_from_lua_arg(L, 1);
141-
luaL_argcheck(L, pixbuf_channels(buffer) == 3, 1, "Bad pixbuf format");
141+
luaL_argcheck(L, pixbuf_channels(buffer) == 3 || pixbuf_channels(buffer) == 4, 1, "Bad pixbuf format");
142142
buffer1 = buffer->values;
143143
length1 = pixbuf_size(buffer);
144144
}
@@ -163,7 +163,7 @@ static int ws2812_write(lua_State* L) {
163163
else if (type == LUA_TUSERDATA)
164164
{
165165
pixbuf *buffer = pixbuf_from_lua_arg(L, 2);
166-
luaL_argcheck(L, pixbuf_channels(buffer) == 3, 2, "Bad pixbuf format");
166+
luaL_argcheck(L, pixbuf_channels(buffer) == 3 || pixbuf_channels(buffer) == 4, 2, "Bad pixbuf format");
167167
buffer2 = buffer->values;
168168
length2 = pixbuf_size(buffer);
169169
}

0 commit comments

Comments
 (0)