Commit 6926c66b authored by galjonsfigur's avatar galjonsfigur Committed by Marcel Stör
Browse files

Polish Lua examples (#2846)

* Add missing globals from luacheck config

* Fix luacheck warnings in all lua files

* Re-enable luacheck in Travis

* Speed up Travis by using preinstalled LuaRocks

* Fix more luacheck warnings in httpserver lua module

* Fix DCC module and add appropriate definitions to luacheck config.

* Change inline comments from ignoring block to only ignore specific line

* Add Luacheck for Windows and enable it for both Windows and Linux

* Change luacheck exceptions and fix errors from 1st round of polishing

* Add retry and timeout params to wget
parent 36df8d00
......@@ -6,7 +6,7 @@
-- ****************************************************************************
function cb_drained(d)
local function cb_drained()
print("drained "..node.heap())
file.seek("set", 0)
......@@ -14,27 +14,29 @@ function cb_drained(d)
--d:play(pcm.RATE_8K)
end
function cb_stopped(d)
local function cb_stopped()
print("playback stopped")
file.seek("set", 0)
end
function cb_paused(d)
local function cb_paused()
print("playback paused")
end
file.open("jump_8k.u8", "r")
do
file.open("jump_8k.u8", "r")
drv = pcm.new(pcm.SD, 1)
local drv = pcm.new(pcm.SD, 1)
-- fetch data in chunks of FILE_READ_CHUNK (1024) from file
drv:on("data", function(drv) return file.read() end)
-- fetch data in chunks of FILE_READ_CHUNK (1024) from file
drv:on("data", function(driver) return file.read() end) -- luacheck: no unused
-- get called back when all samples were read from the file
drv:on("drained", cb_drained)
-- get called back when all samples were read from the file
drv:on("drained", cb_drained)
drv:on("stopped", cb_stopped)
drv:on("paused", cb_paused)
drv:on("stopped", cb_stopped)
drv:on("paused", cb_paused)
-- start playback
drv:play(pcm.RATE_8K)
-- start playback
drv:play(pcm.RATE_8K)
end
......@@ -29,10 +29,12 @@ local TWILIO_ACCOUNT_SID = "xxxxxx"
local TWILIO_TOKEN = "xxxxxx"
local HOST = "iot-https-relay.appspot.com" -- visit http://iot-https-relay.appspot.com/ to learn more about this service
-- Please be sure to understand the security issues of using this relay app and use at your own risk.
-- Please be sure to understand the security issues of using this relay app and use at your own risk.
local URI = "/twilio/Messages.json"
function build_post_request(host, uri, data_table)
local wifiTimer = tmr.create()
local function build_post_request(host, uri, data_table)
local data = ""
......@@ -40,7 +42,7 @@ function build_post_request(host, uri, data_table)
data = data .. param.."="..value.."&"
end
request = "POST "..uri.." HTTP/1.1\r\n"..
local request = "POST "..uri.." HTTP/1.1\r\n"..
"Host: "..host.."\r\n"..
"Connection: close\r\n"..
"Content-Type: application/x-www-form-urlencoded\r\n"..
......@@ -53,7 +55,7 @@ function build_post_request(host, uri, data_table)
return request
end
local function display(sck,response)
local function display(socket, response) -- luacheck: no unused
print(response)
end
......@@ -69,7 +71,7 @@ local function send_sms(from,to,body)
To = to
}
socket = net.createConnection(net.TCP,0)
local socket = net.createConnection(net.TCP,0)
socket:on("receive",display)
socket:connect(80,HOST)
......@@ -80,13 +82,13 @@ local function send_sms(from,to,body)
end)
end
function check_wifi()
local function check_wifi()
local ip = wifi.sta.getip()
if(ip==nil) then
print("Connecting...")
else
tmr.stop(0)
wifiTimer.stop()
print("Connected to AP!")
print(ip)
-- send a text message with the text "Hello from your esp8266"
......@@ -95,4 +97,4 @@ function check_wifi()
end
tmr.alarm(0,7000,1,check_wifi)
wifiTimer.alarm(7000, tmr.ALARM_AUTO, check_wifi)
-- Test sjson and GitHub API
local s = tls.createConnection()
s:on("connection", function(sck, c)
sck:send("GET /repos/nodemcu/nodemcu-firmware/git/trees/master HTTP/1.0\r\nUser-agent: nodemcu/0.1\r\nHost: api.github.com\r\nConnection: close\r\nAccept: application/json\r\n\r\n")
s:on("connection", function(sck)
sck:send(
[[GET /repos/nodemcu/nodemcu-firmware/git/trees/master HTTP/1.0
User-agent: nodemcu/0.1
Host: api.github.com
Connection: close
Accept: application/json
]])
end)
function startswith(String, Start)
local function startswith(String, Start)
return string.sub(String, 1, string.len(Start)) == Start
end
......@@ -23,13 +30,13 @@ local decoder = sjson.decoder({
end
}
})
local function handledata(s)
decoder:write(s)
local function handledata(sck)
decoder:write(sck)
end
-- The receive callback is somewhat gnarly as it has to deal with find the end of the header
-- and having the newline sequence split across packets
s:on("receive", function(sck, c)
s:on("receive", function(socket, c) -- luacheck: no unused
if partial then
c = partial .. c
partial = nil
......@@ -45,8 +52,8 @@ s:on("receive", function(sck, c)
handledata(c)
return
end
local s, e = c:find("\r\n")
if s then
local str, e = c:find("\r\n")
if str then
-- Throw away line
c = c:sub(e + 1)
else
......
-- Somfy module example (beside somfy module requires also SJSON module)
-- The rolling code number is stored in the file somfy.cfg. A cached write of the somfy.cfg file is implemented in order to reduce the number of write to the EEPROM memory. Together with the logic of the file module it should allow long lasting operation.
-- The rolling code number is stored in the file somfy.cfg.
-- A cached write of the somfy.cfg file is implemented in order to reduce
-- the number of write to the EEPROM memory. Together with the logic of the
-- file module it should allow long lasting operation.
config_file = "somfy."
local config_file = "somfy."
local config, config_saved
-- somfy.cfg looks like
-- {"window1":{"rc":1,"address":123},"window2":{"rc":1,"address":124}}
local tmr_cache = tmr.create()
local tmr_delay = tmr.create()
pin = 4
gpio.mode(pin, gpio.OUTPUT, gpio.PULLUP)
local pin = 4
function deepcopy(orig)
local function deepcopy(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then
......@@ -26,8 +29,8 @@ function deepcopy(orig)
return copy
end
function readconfig()
local cfg, ok, ln
local function readconfig()
local ln
if file.exists(config_file.."cfg") then
print("Reading config from "..config_file.."cfg")
file.open(config_file.."cfg", "r+")
......@@ -47,7 +50,7 @@ function readconfig()
config_saved = deepcopy(config)
end
function writeconfighard()
local function writeconfighard()
print("Saving config")
file.remove(config_file.."bak")
file.rename(config_file.."cfg", config_file.."bak")
......@@ -63,8 +66,8 @@ function writeconfighard()
config_saved = deepcopy(config)
end
function writeconfig()
tmr.stop(tmr_cache)
local function writeconfig()
tmr_cache:stop()
local savenow = false
local savelater = false
......@@ -87,12 +90,18 @@ function writeconfig()
end
if savelater then
print("Saving config later")
tmr.alarm(tmr_cache, 65000, tmr.ALARM_SINGLE, writeconfighard)
tmr_cache:alarm(65000, tmr.ALARM_SINGLE, writeconfighard)
end
end
--======================================================================================================--
function down(remote, cb, par)
local function wait(ms, cb, par)
par = par or {}
print("wait: ".. ms)
if cb then tmr_delay:alarm(ms, tmr.ALARM_SINGLE, function () cb(unpack(par)) end) end
end
local function down(remote, cb, par)
par = par or {}
print("down: ".. remote)
config[remote].rc=config[remote].rc+1
......@@ -100,7 +109,7 @@ function down(remote, cb, par)
writeconfig()
end
function up(remote, cb, par)
local function up(remote, cb, par)
par = par or {}
print("up: ".. remote)
config[remote].rc=config[remote].rc+1
......@@ -108,7 +117,7 @@ function up(remote, cb, par)
writeconfig()
end
function downStep(remote, cb, par)
local function downStep(remote, cb, par)
par = par or {}
print("downStep: ".. remote)
config[remote].rc=config[remote].rc+1
......@@ -116,7 +125,7 @@ function downStep(remote, cb, par)
writeconfig()
end
function upStep(remote, cb, par)
local function upStep(remote, cb, par) -- luacheck: ignore
par = par or {}
print("upStep: ".. remote)
config[remote].rc=config[remote].rc+1
......@@ -124,14 +133,9 @@ function upStep(remote, cb, par)
writeconfig()
end
function wait(ms, cb, par)
par = par or {}
print("wait: ".. ms)
if cb then tmr.alarm(tmr_delay, ms, tmr.ALARM_SINGLE, function () cb(unpack(par)) end) end
end
--======================================================================================================--
gpio.mode(pin, gpio.OUTPUT, gpio.PULLUP)
if not config then readconfig() end
if #config == 0 then -- somfy.cfg does not exist
config = sjson.decode([[{"window1":{"rc":1,"address":123},"window2":{"rc":1,"address":124}}]])
......@@ -141,5 +145,11 @@ down('window1',
wait, {60000,
up, {'window1',
wait, {9000,
downStep, {'window1', downStep, {'window1', downStep, {'window1', downStep, {'window1', downStep, {'window1', downStep, {'window1', downStep, {'window1'
downStep, {'window1',
downStep, {'window1',
downStep, {'window1',
downStep, {'window1',
downStep, {'window1',
downStep, {'window1',
downStep, {'window1'
}}}}}}}}}})
uart.setup(0,9600,8,0,1,0)
sv=net.createServer(net.TCP, 60)
global_c = nil
sv:listen(9999, function(c)
if global_c~=nil then
global_c:close()
end
global_c=c
c:on("receive",function(sck,pl) uart.write(0,pl) end)
end)
do
uart.setup(0, 9600, 8, 0, 1, 0)
local sv = net.createServer(net.TCP, 60)
local global_c = nil
sv:listen(9999, function(c)
if global_c~=nil then
global_c:close()
end
global_c = c
c:on("receive",function(_, pl) uart.write(0, pl) end)
end)
uart.on("data",4, function(data)
if global_c~=nil then
global_c:send(data)
end
end, 0)
uart.on("data", 4, function(data)
if global_c ~= nil then
global_c:send(data)
end
end, 0)
end
......@@ -27,7 +27,7 @@ function M.getzones()
return result
end
function load(t)
local function load(t)
local z = file.open(thezone .. ".zone", "r")
local hdr = z:read(20)
......@@ -35,7 +35,8 @@ function load(t)
if magic == "TZif" then
local lens = z:read(24)
local ttisgmt_count, ttisdstcnt, leapcnt, timecnt, typecnt, charcnt = struct.unpack("> LLLLLL", lens)
local ttisgmt_count, ttisdstcnt, leapcnt, timecnt, typecnt, charcnt -- luacheck: no unused
= struct.unpack("> LLLLLL", lens)
local times = z:read(4 * timecnt)
local typeindex = z:read(timecnt)
......
......@@ -9,8 +9,13 @@
--
-- ***************************************************************************
-- display object
local disp
local draw_state, loop_tmr = 0, tmr.create()
-- setup I2c and connect display
function init_i2c_display()
local function init_i2c_display()
-- SDA and SCL can be assigned freely to available GPIOs
local sda = 5 -- GPIO14
local scl = 6 -- GPIO12
......@@ -18,9 +23,8 @@ function init_i2c_display()
i2c.setup(0, sda, scl, i2c.SLOW)
disp = u8g2.ssd1306_i2c_128x64_noname(0, sla)
end
-- setup SPI and connect display
function init_spi_display()
local function init_spi_display() -- luacheck: no unused
-- Hardware SPI CLK = GPIO14
-- Hardware SPI MOSI = GPIO13
-- Hardware SPI MISO = GPIO12 (not used)
......@@ -37,8 +41,7 @@ function init_spi_display()
disp = u8g2.ssd1306_128x64_noname(1, cs, dc, res)
end
function u8g2_prepare()
local function u8g2_prepare()
disp:setFont(u8g2.font_6x10_tf)
disp:setFontRefHeightExtendedText()
disp:setDrawColor(1)
......@@ -47,7 +50,7 @@ function u8g2_prepare()
end
function u8g2_box_frame(a)
local function u8g2_box_frame(a)
disp:drawStr( 0, 0, "drawBox")
disp:drawBox(5,10,20,10)
disp:drawBox(10+a,15,30,7)
......@@ -56,7 +59,7 @@ function u8g2_box_frame(a)
disp:drawFrame(10+a,15+30,30,7)
end
function u8g2_disc_circle(a)
local function u8g2_disc_circle(a)
disp:drawStr( 0, 0, "drawDisc")
disp:drawDisc(10,18,9)
disp:drawDisc(24+a,16,7)
......@@ -65,13 +68,13 @@ function u8g2_disc_circle(a)
disp:drawCircle(24+a,16+30,7)
end
function u8g2_r_frame(a)
local function u8g2_r_frame(a)
disp:drawStr( 0, 0, "drawRFrame/Box")
disp:drawRFrame(5, 10,40,30, a+1)
disp:drawRBox(50, 10,25,40, a+1)
end
function u8g2_string(a)
local function u8g2_string(a)
disp:setFontDirection(0)
disp:drawStr(30+a,31, " 0")
disp:setFontDirection(1)
......@@ -82,7 +85,7 @@ function u8g2_string(a)
disp:drawStr(30,31-a, " 270")
end
function u8g2_line(a)
local function u8g2_line(a)
disp:drawStr( 0, 0, "drawLine")
disp:drawLine(7+a, 10, 40, 55)
disp:drawLine(7+a*2, 10, 60, 55)
......@@ -90,7 +93,7 @@ function u8g2_line(a)
disp:drawLine(7+a*4, 10, 100, 55)
end
function u8g2_triangle(a)
local function u8g2_triangle(a)
local offset = a
disp:drawStr( 0, 0, "drawTriangle")
disp:drawTriangle(14,7, 45,30, 10,40)
......@@ -99,7 +102,7 @@ function u8g2_triangle(a)
disp:drawTriangle(10+offset,40+offset, 45+offset,30+offset, 86+offset,53+offset)
end
function u8g2_ascii_1()
local function u8g2_ascii_1()
disp:drawStr( 0, 0, "ASCII page 1")
for y = 0, 5 do
for x = 0, 15 do
......@@ -108,7 +111,7 @@ function u8g2_ascii_1()
end
end
function u8g2_ascii_2()
local function u8g2_ascii_2()
disp:drawStr( 0, 0, "ASCII page 2")
for y = 0, 5 do
for x = 0, 15 do
......@@ -117,7 +120,7 @@ function u8g2_ascii_2()
end
end
function u8g2_extra_page(a)
local function u8g2_extra_page(a)
disp:drawStr( 0, 0, "Unicode")
disp:setFont(u8g2.font_unifont_t_symbols)
disp:setFontPosTop()
......@@ -129,9 +132,9 @@ function u8g2_extra_page(a)
end
end
cross_width = 24
cross_height = 24
cross_bits = string.char(
local cross_width = 24
local cross_height = 24
local cross_bits = string.char(
0x00, 0x18, 0x00, 0x00, 0x24, 0x00, 0x00, 0x24, 0x00, 0x00, 0x42, 0x00,
0x00, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x81, 0x00, 0x00, 0x81, 0x00,
0xC0, 0x00, 0x03, 0x38, 0x3C, 0x1C, 0x06, 0x42, 0x60, 0x01, 0x42, 0x80,
......@@ -139,24 +142,25 @@ cross_bits = string.char(
0x00, 0x81, 0x00, 0x00, 0x81, 0x00, 0x00, 0x42, 0x00, 0x00, 0x42, 0x00,
0x00, 0x42, 0x00, 0x00, 0x24, 0x00, 0x00, 0x24, 0x00, 0x00, 0x18, 0x00)
cross_fill_width = 24
cross_fill_height = 24
cross_fill_bits = string.char(
-- luacheck: push no unused
local cross_fill_width = 24
local cross_fill_height = 24
local cross_fill_bits = string.char(
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x64, 0x00, 0x26,
0x84, 0x00, 0x21, 0x08, 0x81, 0x10, 0x08, 0x42, 0x10, 0x10, 0x3C, 0x08,
0x20, 0x00, 0x04, 0x40, 0x00, 0x02, 0x80, 0x00, 0x01, 0x80, 0x18, 0x01,
0x80, 0x18, 0x01, 0x80, 0x00, 0x01, 0x40, 0x00, 0x02, 0x20, 0x00, 0x04,
0x10, 0x3C, 0x08, 0x08, 0x42, 0x10, 0x08, 0x81, 0x10, 0x84, 0x00, 0x21,
0x64, 0x00, 0x26, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
cross_block_width = 14
cross_block_height = 14
cross_block_bits = string.char(
-- luacheck: pop
local cross_block_width = 14
local cross_block_height = 14
local cross_block_bits = string.char(
0xFF, 0x3F, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20,
0xC1, 0x20, 0xC1, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20,
0x01, 0x20, 0xFF, 0x3F)
function u8g2_bitmap_overlay(a)
local function u8g2_bitmap_overlay(a)
local frame_size = 28
disp:drawStr(0, 0, "Bitmap overlay")
......@@ -177,7 +181,7 @@ function u8g2_bitmap_overlay(a)
end
end
function u8g2_bitmap_modes(transparent)
local function u8g2_bitmap_modes(transparent)
local frame_size = 24
disp:drawBox(0, frame_size * 0.5, frame_size * 5, frame_size)
......@@ -201,7 +205,7 @@ function u8g2_bitmap_modes(transparent)
end
function draw()
local function draw()
u8g2_prepare()
local d3 = bit.rshift(draw_state, 3)
......@@ -235,7 +239,7 @@ function draw()
end
function loop()
local function loop()
-- picture loop
disp:clearBuffer()
draw()
......@@ -251,13 +255,12 @@ function loop()
loop_tmr:start()
end
do
loop_tmr:register(100, tmr.ALARM_SEMI, loop)
draw_state = 0
loop_tmr = tmr.create()
loop_tmr:register(100, tmr.ALARM_SEMI, loop)
init_i2c_display()
--init_spi_display()
init_i2c_display()
--init_spi_display()
print("--- Starting Graphics Test ---")
loop_tmr:start()
print("--- Starting Graphics Test ---")
loop_tmr:start()
end
-- luacheck: globals T r disp millis lcg_rnd
local M, module = {}, ...
_G[module] = M
......
-- luacheck: globals T r disp millis lcg_rnd
local M, module = {}, ...
_G[module] = M
......
-- luacheck: globals T r disp millis lcg_rnd
local M, module = {}, ...
_G[module] = M
......@@ -7,10 +8,7 @@ function M.run()
print("Running component color_test...")
local mx
local c, x
mx = disp:getWidth() / 2
--my = disp:getHeight() / 2
disp:setColor(0, 0, 0, 0)
disp:drawBox(0, 0, disp:getWidth(), disp:getHeight())
......
-- luacheck: globals T r disp millis lcg_rnd
local M, module = {}, ...
_G[module] = M
......
-- luacheck: globals T r disp millis lcg_rnd
local M, module = {}, ...
_G[module] = M
......
-- luacheck: globals T r disp millis lcg_rnd
local M, module = {}, ...
_G[module] = M
......
-- luacheck: globals T r disp millis lcg_rnd
local M, module = {}, ...
_G[module] = M
......
-- luacheck: globals T r disp millis lcg_rnd
local M, module = {}, ...
_G[module] = M
......
-- luacheck: globals T r disp millis lcg_rnd
local M, module = {}, ...
_G[module] = M
......
-- luacheck: globals T r disp millis lcg_rnd
local M, module = {}, ...
_G[module] = M
......
-- luacheck: new globals z T r disp lcg_rnd millis
z = 127 -- start value
T = 1000
r = 0
disp = nil
local loop_idx = 0
function lcg_rnd()
z = bit.band(65 * z + 17, 255)
return z
end
function millis()
local usec = tmr.now()
return usec/1000
end
-- setup SPI and connect display
function init_spi_display()
local function init_spi_display()
-- Hardware SPI CLK = GPIO14
-- Hardware SPI MOSI = GPIO13
-- Hardware SPI MISO = GPIO12 (not used)
......@@ -20,11 +38,8 @@ function init_spi_display()
disp = ucg.st7735_18x128x160_hw_spi(bus, cs, dc, res)
end
-- switch statement http://lua-users.org/wiki/SwitchStatement
function switch(c)
local function switch(c)
local swtbl = {
casevar = c,
caseof = function (self, code)
......@@ -46,20 +61,7 @@ function switch(c)
return swtbl
end
z = 127 -- start value
function lcg_rnd()
z = bit.band(65 * z + 17, 255)
return z
end
function millis()
local usec = tmr.now()
return usec/1000
end
function set_clip_range()
local function set_clip_range()
local x, y, w, h
w = bit.band(lcg_rnd(), 31)
h = bit.band(lcg_rnd(), 31)
......@@ -71,7 +73,7 @@ function set_clip_range()
disp:setClipRange(x, y, w, h)
end
function loop()
local function loop()
if (loop_idx == 0) then
switch(bit.band(r, 3)) : caseof {
......@@ -112,18 +114,12 @@ function loop()
print("Heap: " .. node.heap())
end
do
init_spi_display()
T = 1000
r = 0
loop_idx = 0
disp:begin(ucg.FONT_MODE_TRANSPARENT)
disp:setFont(ucg.font_ncenR14_hr)
disp:clearScreen()
init_spi_display()
disp:begin(ucg.FONT_MODE_TRANSPARENT)
disp:setFont(ucg.font_ncenR14_hr)
disp:clearScreen()
tmr.register(0, 3000, tmr.ALARM_AUTO, function() loop() end)
tmr.start(0)
tmr.create():alarm(3000, tmr.ALARM_AUTO, function() loop() end)
end
local disp
-- setup SPI and connect display
function init_spi_display()
local function init_spi_display()
-- Hardware SPI CLK = GPIO14
-- Hardware SPI MOSI = GPIO13
-- Hardware SPI MISO = GPIO12 (not used)
......@@ -20,17 +22,17 @@ function init_spi_display()
disp = ucg.st7735_18x128x160_hw_spi(bus, cs, dc, res)
end
do
init_spi_display()
disp:begin(ucg.FONT_MODE_TRANSPARENT)
disp:clearScreen()
init_spi_display()
disp:begin(ucg.FONT_MODE_TRANSPARENT)
disp:clearScreen()
disp:setFont(ucg.font_ncenR12_tr);
disp:setColor(255, 255, 255);
disp:setColor(1, 255, 0,0);
disp:setFont(ucg.font_ncenR12_tr);
disp:setColor(255, 255, 255);
disp:setColor(1, 255, 0,0);
disp:setPrintPos(0, 25)
disp:print("Hello World!")
disp:setPrintPos(0, 25)
disp:print("Hello World!")
end
local disp
-- setup SPI and connect display
function init_spi_display()
local function init_spi_display()
-- Hardware SPI CLK = GPIO14
-- Hardware SPI MOSI = GPIO13
-- Hardware SPI MISO = GPIO12 (not used)
......@@ -21,7 +23,7 @@ function init_spi_display()
end
function upper_pin(x, y)
local function upper_pin(x, y)
local w = 7
local h = 6
disp:setColor(0, 212, 212, 212)
......@@ -36,7 +38,7 @@ function upper_pin(x, y)
disp:drawGradientLine(x+w, y, h, 1)
end
function lower_pin(x, y)
local function lower_pin(x, y)
local w = 7
local h = 5
disp:setColor(0, 212, 212, 212)
......@@ -56,7 +58,7 @@ function lower_pin(x, y)
disp:drawPixel(x+w, y+h)
end
function ic_body(x, y)
local function ic_body(x, y)
local w = 4*14+4
local h = 31
disp:setColor(0, 60, 60, 60)
......@@ -77,7 +79,7 @@ function ic_body(x, y)
disp:drawDisc(x+w-1, y+h/2+1, 7, bit.bor(ucg.DRAW_UPPER_LEFT, ucg.DRAW_LOWER_LEFT))
end
function draw_ucg_logo()
local function draw_ucg_logo()
local a, b
--ucg_Init(ucg, ucg_sdl_dev_cb, ucg_ext_none, (ucg_com_fnptr)0)
......@@ -156,12 +158,12 @@ function draw_ucg_logo()
--disp:drawString(1, 61, 0, "code.google.com/p/ucglib/")
end
do
init_spi_display()
init_spi_display()
disp:begin(ucg.FONT_MODE_TRANSPARENT)
disp:clearScreen()
disp:begin(ucg.FONT_MODE_TRANSPARENT)
disp:clearScreen()
disp:setRotate180()
draw_ucg_logo()
disp:setRotate180()
draw_ucg_logo()
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment