Rebased against current dev, tweaks for clean compile

This commit is contained in:
Terry Ellison 2019-07-23 21:22:59 +01:00 committed by Marcel Stör
parent 6d81dd6c0a
commit 08426e48f1
5 changed files with 9 additions and 8 deletions

View File

@ -162,8 +162,6 @@ end:
return coap_make_response(scratch, outpkt, NULL, 0, id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_NOT_FOUND, COAP_CONTENTTYPE_NONE);
}
extern int lua_put_line(const char *s, size_t l);
static const coap_endpoint_path_t path_command = {2, {"v1", "c"}};
static int handle_post_command(const coap_endpoint_t *ep, coap_rw_buffer_t *scratch, const coap_packet_t *inpkt, coap_packet_t *outpkt, uint8_t id_hi, uint8_t id_lo)
{
@ -171,11 +169,11 @@ static int handle_post_command(const coap_endpoint_t *ep, coap_rw_buffer_t *scra
return coap_make_response(scratch, outpkt, NULL, 0, id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_BAD_REQUEST, COAP_CONTENTTYPE_TEXT_PLAIN);
if (inpkt->payload.len > 0)
{
char line[LUA_MAXINPUT];
if (!coap_buffer_to_string(line, LUA_MAXINPUT, &inpkt->payload) &&
lua_put_line(line, strlen(line))) {
NODE_DBG("\nResult(if any):\n");
system_os_post (LUA_TASK_PRIO, LUA_PROCESS_LINE_SIG, 0);
char line[LUA_MAXINPUT+1];
if (!coap_buffer_to_string(line, LUA_MAXINPUT, &inpkt->payload)) {
int l = strlen(line);
line[l] = '\n';
lua_input_string(line, l+1);
}
return coap_make_response(scratch, outpkt, NULL, 0, id_hi, id_lo, &inpkt->tok, COAP_RSPCODE_CONTENT, COAP_CONTENTTYPE_TEXT_PLAIN);
}

View File

@ -277,7 +277,7 @@ LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE)
#define lua_isrotable(L,n) (lua_type(L, (n)) == LUA_TROTABLE)
#define lua_isanytable(L,n) (lua_istable(L,n) || lua_isrotable(L,n))
#define lua_islightuserdata(L,n) (lua_type(L, (n) == LUA_TLIGHTUSERDATA)
#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL)
#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)
#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)

View File

@ -3,6 +3,7 @@
* vowstar@gmail.com
* 2015-12-29
*******************************************************************************/
#include <string.h>
#include <stdlib.h>
#include "module.h"
#include "lauxlib.h"

View File

@ -9,6 +9,7 @@
#include <stdlib.h>
#include "platform.h"
#include "user_interface.h"
#define U8X8_USE_PINS
#define U8X8_WITH_USER_PTR

View File

@ -8,6 +8,7 @@
#include <stdlib.h>
#include "platform.h"
#include "user_interface.h"
#define USE_PIN_LIST
#include "ucg_nodemcu_hal.h"