--ҪѣλöMODULE_TYPEPROJECTVERSION
--MODULE_TYPEģͺţĿǰ֧Air201Air202Air800
--PROJECTascii stringͣ㶨壬ֻҪʹ,
--VERSIONascii stringͣʹLuatƽ̨̼Ĺܣ밴"X.X.X"壬Xʾ1λ֣㶨
MODULE_TYPE = "Air202"
PROJECT = "USER_SERVER_UPDATE"
VERSION = "1.0.0"
require"sys"
--[[
ʹUARTtraceע͵Ĵ"--sys.opntrace(true,1)"ɣ21ʾUART1traceԼҪ޸
traceڵĵطдԱ֤UARTھܵͳֵĴϢ
дںλãп޷ϢӶӵѶ
]]
--sys.opntrace(true,1)
--ûʹԼhttpʱҲҪPRODUCT_KEYֵԼĿж
PRODUCT_KEY = "HJdJ7BGeQ3aUjMUetdYrUUuSMEDoAAZI"
--[[
ʹûԼʱ²
1updatehttpģ require"updatehttp"
2ûԼַ˿ںGETURL updatehttp.setup("TCP","www.userserver.com",80,"/api/site/firmware_upgrade")
ִ豸ÿο׼󣬾ͻԶִ
3Ҫʱִܣ--updatehttp.setperiod(3600)עͣԼҪöʱ
4Ҫʵʱִܣο--sys.timer_start(updatehttp.request,120000)ԼҪupdatehttp.request()
]]
require"updatehttp"
--[[
--Ҫѣ
--updatehttp.setupӿڴurlֻGETURLǰ벿֣updatehttp.luaлںϢ
"?project_key="..base.PRODUCT_KEY
"&imei="..misc.getimei()
"&device_key="..misc.getsn()
"&firmware_name="..base.PROJECT.."_"..rtos.get_version()
"&version="..base.VERSION
]]
updatehttp.setup("tcp","www.userserver.com",80,"/api/site/firmware_upgrade")
--updatehttp.setperiod(3600)
--sys.timer_start(updatehttp.request,120000)

--[[
Ҫѣ
һʹԶܣǿҽʹdbgܣοд
ΪͨԶ°汾Ľű°汾Ľűʱ﷨Զ˵һαдİ汾
˺һԶһԶ°汾->°汾г->Զ˵ɰ汾ѭ¹쳣˷
籾дİ汾1.0.01.0.1汾1.0.1汾ʱ﷨豸ѭԶ1.0.1->1.0.1г->Զ˵1.0.0
һdbgܺ󣬷﷨󣬻Ὣ﷨ϱdbgԱ鿴﷨־Լʱ﷨󣬳汾
dbg֧TCPUDPЭ飬յκϱҪظдOK
Լdbgʹúṩ"UDP","ota.airm2m.com",9072
iot.openluat.comе¼һƷ"ѯdebug"пԲѯ豸ϱĴϢ
]]
require"dbg"
sys.timer_start(dbg.setup,12000,"UDP","ota.airm2m.com",9072)

require"test"

--ӲŹģ
--ԼӲþ1Ƿش˹ģ飻2Luatģ鸴λƬźͻι
--ٷ۵Air201ӲŹʹùٷAir201ʱش˹ģ
--[[
require "wdt"
wdt.setup(pio.P0_30, pio.P0_31)
]]


sys.init(0,0)
sys.run()
