Skip to content

Commit

Permalink
Merge branch 'master' of https://gitee.com/openLuat/LuatOS
Browse files Browse the repository at this point in the history
  • Loading branch information
allewalker committed May 24, 2023
2 parents e25cb5e + 3e671cb commit 7c626b7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion components/lcd/luat_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ int luat_lcd_clear(luat_lcd_conf_t* conf, luat_color_t color){

int luat_lcd_draw_fill(luat_lcd_conf_t* conf,uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2, luat_color_t color) {
uint16_t i;
for(i=y1;i<y2;i++)
for(i=y1;i<=y2;i++)
{
luat_lcd_draw_line(conf, x1, i, x2, i, color);
}
Expand Down
3 changes: 1 addition & 2 deletions components/lua-cjson/lua_cjson.c
Original file line number Diff line number Diff line change
Expand Up @@ -1404,8 +1404,7 @@ json.encode(obj,"12f")-->浮点数用%.12f的方式转换为字符串
static int l_json_encode_safe(lua_State *L) {
// int top = lua_gettop(L);
if (lua_isnil(L, 1)) {
lua_pushnil(L);
lua_pushliteral(L, "obj is nil");
lua_pushliteral(L, "");
return 1;
}
memcpy(float_fmt, "%.7g", strlen("%.7g") + 1);
Expand Down
19 changes: 19 additions & 0 deletions demo/wtd9527/main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
PROJECT = 'wtd9527'
VERSION = '2.0.0'
LOG_LEVEL = log.LOG_INFO
log.setLevel(LOG_LEVEL )
require 'wtd9527'
local sys = require "sys"
_G.sysplus = require("sysplus")


sys.taskInit(function ()
wtd9527.init(28)
wtd9527.feed_dog(28)--28为看门狗控制引脚
--wtd9527.set_time(1)--开启定时模式再打开此代码,否则无效
while 1 do
sys.wait(100)
end
end)

sys.run()
8 changes: 4 additions & 4 deletions script/libs/lbsLoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ local function enCellInfo(s)
if not handle then
table.insert(t,{mcc=mcc,mnc=mnc,lac=lac,rssici={{rssi=rssi,ci=ci}}})
end
log.debug("rssimccmnclacci", rssi,mcc,mnc,lac,ci)
log.debug("rssi,mcc,mnc,lac,ci", rssi,mcc,mnc,lac,ci)
end
for k,v in pairs(t) do
ret = ret .. pack.pack(">HHb",v.lac,v.mcc,v.mnc)
Expand Down Expand Up @@ -193,7 +193,7 @@ local function taskClient(cbFnc, reqAddr, timeout, productKey, host, port,reqTim
if retryCnt>=3 then return cbFnc(4) end
break
end
succ, param, _, _ = socket.rx(netc, rx_buff) -- 接收数据
succ, param = socket.rx(netc, rx_buff) -- 接收数据
-- log.info("是否接收和数据长度", succ, param)
if param ~= 0 then -- 如果接收成功
socket.close(netc) -- 关闭连接
Expand All @@ -206,7 +206,7 @@ local function taskClient(cbFnc, reqAddr, timeout, productKey, host, port,reqTim
cbFnc(0, trans(bcdNumToNum(read_buff:sub(2, 6))),
trans(bcdNumToNum(read_buff:sub(7, 11))), reqAddr and
read_buff:sub(13, 12 + read_buff:byte(12)) or nil,
read_buff:sub(reqAddr and (13 + read_buff:byte(12)) or 12, -1),
reqTime and read_buff:sub(reqAddr and (13 + read_buff:byte(12)) or 12, -1) or "",
locType)
else
log.warn("lbsLoc.query", "根据基站查询经纬度失败")
Expand Down Expand Up @@ -260,7 +260,7 @@ end
-- 提醒: 返回的坐标值, 是WGS84坐标系
]]
function lbsLoc.request(cbFnc,reqAddr,timeout,productKey,host,port,reqTime,reqWifi)
sysplus.taskInitEx(taskClient, d1Name, netCB, cbFnc, reqAddr,timeout or 20000,productKey or _G.PRODUCT_KEY,host or "bs.openluat.com",port or "12411")
sysplus.taskInitEx(taskClient, d1Name, netCB, cbFnc, reqAddr,timeout or 20000,productKey or _G.PRODUCT_KEY,host or "bs.openluat.com",port or "12411", reqTime == nil and true or reqTime)
end

return lbsLoc

0 comments on commit 7c626b7

Please sign in to comment.