Left here for archival purposes.

User avatar
By jumjum123
#15346 After compiling this module, UART is disconnected.
Happens only with this code, others are compiled without problems.
Code: Select alllocal Serv = {
  srv = nil,
  script = function(path,params) return "Empty" end,
  response = function(self,path,params)
    return "<html><body>"..self.script(path,params).."</body></html>"
  end,
  startServer = function(self,port)
    self.srv=net.createServer(net.TCP)
    self.srv:listen(port,function(conn)
      conn:on("receive",function(conn,request)
        local params = {}
        local _, _, method, path, vars = string.find(request, "([A-Z]+) /(.+)?(.+) HTTP");
        if (vars ~= nil)then for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do params[k] = v end end
        conn:send(self:response(path,params))
        conn:on("sent",function(conn) conn:close() conn=nil collectgarbage() end)
      end)
    end)
  end,
  stopServer = function(self) self.srv:close() end,
}
return Serv
User avatar
By cal
#15351 Moin,

You didn't tell which firmware you used.
I have no problem compiling that on

1. current dev version + my cal_dex module
2. some customized nodemcu

If you use one of the march builds: Use either a february build or a build from the dev branch.

Cal

P.S.
Die Küste ist hier nur im Geiste. Tief im Wee~eesteeen triffts eher. ;-)