add ws2812 4 channels for RGBW strips + diagnostic output (#3637)

This commit is contained in:
Gregor Hartmann 2024-02-18 10:58:41 +01:00 committed by Marcel Stör
parent d0864808d3
commit 6038307bbf
2 changed files with 3 additions and 2 deletions

View File

@ -399,6 +399,7 @@ uint dumpToFlashImage (lua_State* L, const Proto *main, lua_Writer w,
fh->flash_sig = FLASH_SIG + (address ? FLASH_SIG_ABSOLUTE : 0); fh->flash_sig = FLASH_SIG + (address ? FLASH_SIG_ABSOLUTE : 0);
fh->flash_size = curOffset*WORDSIZE; fh->flash_size = curOffset*WORDSIZE;
printf("Image size: %d\n", fh->flash_size);
if (fh->flash_size>maxSize) { if (fh->flash_size>maxSize) {
fatal ("The image is too large for specfied LFS size"); fatal ("The image is too large for specfied LFS size");
} }

View File

@ -138,7 +138,7 @@ static int ws2812_write(lua_State* L) {
else if (type == LUA_TUSERDATA) else if (type == LUA_TUSERDATA)
{ {
pixbuf *buffer = pixbuf_from_lua_arg(L, 1); pixbuf *buffer = pixbuf_from_lua_arg(L, 1);
luaL_argcheck(L, pixbuf_channels(buffer) == 3, 1, "Bad pixbuf format"); luaL_argcheck(L, pixbuf_channels(buffer) == 3 || pixbuf_channels(buffer) == 4, 1, "Bad pixbuf format");
buffer1 = buffer->values; buffer1 = buffer->values;
length1 = pixbuf_size(buffer); length1 = pixbuf_size(buffer);
} }
@ -163,7 +163,7 @@ static int ws2812_write(lua_State* L) {
else if (type == LUA_TUSERDATA) else if (type == LUA_TUSERDATA)
{ {
pixbuf *buffer = pixbuf_from_lua_arg(L, 2); pixbuf *buffer = pixbuf_from_lua_arg(L, 2);
luaL_argcheck(L, pixbuf_channels(buffer) == 3, 2, "Bad pixbuf format"); luaL_argcheck(L, pixbuf_channels(buffer) == 3 || pixbuf_channels(buffer) == 4, 2, "Bad pixbuf format");
buffer2 = buffer->values; buffer2 = buffer->values;
length2 = pixbuf_size(buffer); length2 = pixbuf_size(buffer);
} }