diff --git a/teensy/LuaScreen.ino b/teensy/LuaScreen.ino index a18e94e..51e7900 100644 --- a/teensy/LuaScreen.ino +++ b/teensy/LuaScreen.ino @@ -15,12 +15,15 @@ void setup() { // Pin 13 has an LED connected on most Arduino boards: //pinMode(13, OUTPUT); LogOut.begin(9600); - delay(10000); // TODO remove this + debug_log("Setting up matrix"); setup_matrix(); + debug_log("Matrix initted, starting lua"); l_init(); + debug_log("Lua started"); } void loop() { + //debug_log("Lua frame"); l_frame(); } diff --git a/teensy/Makefile b/teensy/Makefile index 16442cc..d8f3de5 100644 --- a/teensy/Makefile +++ b/teensy/Makefile @@ -7,7 +7,7 @@ ARDUINO_DIR = /home/ryan/arduino/1.0.6/arduino-1.0.6/ CFLAGS += -Iinclude -Llib -llua -flto #-DSEND_NON_BLOCKING=1 CXXFLAGS += -Iinclude -Llib -llua -flto #-DSEND_NON_BLOCKING=1 # CPPFLAGS += -DSEND_NON_BLOCKING=1 -# LDFLAGS += -flto +LDFLAGS += -flto OTHER_OBJS += lib/liblua.a include ../extern/Arduino-Makefile/Teensy.mk diff --git a/teensy/logs.cpp b/teensy/logs.cpp index 9f78e87..7560843 100644 --- a/teensy/logs.cpp +++ b/teensy/logs.cpp @@ -98,7 +98,6 @@ void _output_log(const char *file, const char* function, const int line, int mes sprintf(buff, "%X", message); break; } - _write_ring(buff); } diff --git a/teensy/lua.cpp b/teensy/lua.cpp index da49256..5ee6958 100644 --- a/teensy/lua.cpp +++ b/teensy/lua.cpp @@ -21,9 +21,9 @@ ssize_t _write(int fd, const void *buf, size_t count) {return -1;} char l_prog_buff[MAX_PRGMSIZE] = "function main()\n" " local i = 0\n" " while true do\n" - " local c = ColorHSV(i % 360, 255, 255)\n" + " local c = matrixpanel.colorHSV(120, 255, 255)\n" " i = i + 1\n" - " drawFastVLine(i % 32, 0, 16, c)\n" + " matrixpanel.drawFastVLine(i % 32, 0, 16, c)\n" " end\n" "end\n"; /* "function main()\n" @@ -79,12 +79,12 @@ static void l_memstats() { // I want to replace this with an arena allocator so that i can get better memory performance in the future static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { - l_memstats(); +// l_memstats(); //"\t->alloc called: 12345678 12345678 12345 12345"; - char buff[64]; - sprintf(buff, "\t->alloc called: %08X %08X %05d %05d", (size_t) ud, (size_t) ptr, osize, nsize); - debug_log(buff); +// char buff[64]; +// sprintf(buff, "\t->alloc called: %08X %08X %05d %05d", (size_t) ud, (size_t) ptr, osize, nsize); +// debug_log(buff); (void)ud; (void)osize; /* not used */ if (nsize == 0) { diff --git a/teensy/luamatrix.cpp b/teensy/luamatrix.cpp index 3ac6576..d6bc616 100644 --- a/teensy/luamatrix.cpp +++ b/teensy/luamatrix.cpp @@ -326,5 +326,6 @@ static const struct luaL_Reg matrixpanel_methods[] = { int luaopen_matrixpanel (lua_State* L) { luaL_newlib(L, matrixpanel_methods); + lua_setglobal(L, "matrixpanel"); return 0; } diff --git a/teensy/matrix.cpp b/teensy/matrix.cpp index a55fdc4..e8ab1da 100644 --- a/teensy/matrix.cpp +++ b/teensy/matrix.cpp @@ -8,6 +8,8 @@ void setup_matrix() { // Some defaults matrixpanel.setTextWrap(false); matrixpanel.setFont(&TomThumb); + matrixpanel.fillScreen(0xFFFF); + matrixpanel.swapBuffers(true); } void loop_matrix() {