From 90d63738e84f27808ce383c162d6014620319cf8 Mon Sep 17 00:00:00 2001 From: bsongis Date: Thu, 22 May 2014 16:47:35 +0200 Subject: [PATCH] New Lua functions added (needed for the wizard) --- radio/src/lua.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/radio/src/lua.cpp b/radio/src/lua.cpp index 1c4e7d42e..780dde6f6 100644 --- a/radio/src/lua.cpp +++ b/radio/src/lua.cpp @@ -220,7 +220,9 @@ static int luaLcdDrawLine(lua_State *L) int y1 = luaL_checkinteger(L, 2); int x2 = luaL_checkinteger(L, 3); int y2 = luaL_checkinteger(L, 4); - lcd_line(x1, y1, x2, y2); + int pat = luaL_checkinteger(L, 5); + int flags = luaL_checkinteger(L, 6); + lcd_line(x1, y1, x2, y2, pat, flags); return 0; } @@ -269,6 +271,17 @@ static int luaLcdDrawPixmap(lua_State *L) return 0; } +static int luaLcdDrawRect(lua_State *L) +{ + int x = luaL_checkinteger(L, 1); + int y = luaL_checkinteger(L, 2); + int w = luaL_checkinteger(L, 3); + int h = luaL_checkinteger(L, 4); + int flags = luaL_checkinteger(L, 5); + lcd_filled_rect(x, y, w, h, SOLID, flags); + return 0; +} + static int luaLcdDrawScreenTitle(lua_State *L) { const char * str = luaL_checkstring(L, 1); @@ -282,6 +295,53 @@ static int luaLcdDrawScreenTitle(lua_State *L) return 0; } +static int luaLcdDrawCombobox(lua_State *L) +{ + int x = luaL_checkinteger(L, 1); + int y = luaL_checkinteger(L, 2); + int w = luaL_checkinteger(L, 3); + luaL_checktype(L, 4, LUA_TTABLE); + int count = luaL_len(L, 4); /* get size of table */ + int idx = luaL_checkinteger(L, 5); + int flags = luaL_checkinteger(L, 6); + if (idx >= count) { + // TODO error + } + if (flags & BLINK) { + lcd_filled_rect(x, y, w-9, count*9+2, SOLID, ERASE); + lcd_rect(x, y, w-9, count*9+2); + for (int i=0; i