Unverified Commit 310faf7f authored by Terry Ellison's avatar Terry Ellison Committed by GitHub
Browse files

Merge pull request #2886 from nodemcu/dev

Next master drop
parents 68c425c0 a08e74d9
......@@ -3,7 +3,7 @@
#include "module.h"
#include "lauxlib.h"
#include "lmem.h"
#include "c_string.h"
#include <string.h>
#define BASE64_INVALID '\xff'
#define BASE64_PADDING '='
#define ISBASE64(c) (unbytes64[c] != BASE64_INVALID)
......@@ -19,7 +19,7 @@ static uint8 *toBase64 ( lua_State* L, const uint8 *msg, size_t *len){
int buf_size = (n + 2) / 3 * 4; // estimated encoded size
uint8 * q, *out = (uint8 *)luaM_malloc(L, buf_size);
uint8 bytes64[sizeof(b64)];
c_memcpy(bytes64, b64, sizeof(b64)); //Avoid lots of flash unaligned fetches
memcpy(bytes64, b64, sizeof(b64)); //Avoid lots of flash unaligned fetches
for (i = 0, q = out; i < n; i += 3) {
int a = msg[i];
......@@ -46,7 +46,7 @@ static uint8 *fromBase64 ( lua_State* L, const uint8 *enc_msg, size_t *len){
if (n & 3)
luaL_error (L, "Invalid base64 string");
c_memset(unbytes64, BASE64_INVALID, sizeof(unbytes64));
memset(unbytes64, BASE64_INVALID, sizeof(unbytes64));
for (i = 0; i < sizeof(b64)-1; i++) unbytes64[b64[i]] = i; // sequential so no exceptions
if (enc_msg[n-1] == BASE64_PADDING) {
......@@ -153,12 +153,12 @@ static int do_func (lua_State *L, uint8 * (*conv_func)(lua_State *, const uint8
DECLARE_FUNCTION(toHex);
// Module function map
static const LUA_REG_TYPE encoder_map[] = {
{ LSTRKEY("fromBase64"), LFUNCVAL(encoder_fromBase64) },
{ LSTRKEY("toBase64"), LFUNCVAL(encoder_toBase64) },
{ LSTRKEY("fromHex"), LFUNCVAL(encoder_fromHex) },
{ LSTRKEY("toHex"), LFUNCVAL(encoder_toHex) },
{ LNILKEY, LNILVAL }
};
NODEMCU_MODULE(ENCODER, "encoder", encoder_map, NULL);
LROT_BEGIN(encoder)
LROT_FUNCENTRY( fromBase64, encoder_fromBase64 )
LROT_FUNCENTRY( toBase64, encoder_toBase64 )
LROT_FUNCENTRY( fromHex, encoder_fromHex )
LROT_FUNCENTRY( toHex, encoder_toHex )
LROT_END( encoder, NULL, 0 )
NODEMCU_MODULE(ENCODER, "encoder", encoder, NULL);
......@@ -38,9 +38,9 @@
#include "lauxlib.h"
#include "lmem.h"
#include "platform.h"
#include "c_stdlib.h"
#include "c_stdio.h"
#include "c_string.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "ctype.h"
#include "user_interface.h"
#include "espconn.h"
......@@ -93,6 +93,7 @@ static const char http_html_filename[] = "enduser_setup.html";
static const char http_header_200[] = "HTTP/1.1 200 OK\r\nCache-control:no-cache\r\nConnection:close\r\nContent-Type:text/html\r\n"; /* Note single \r\n here! */
static const char http_header_204[] = "HTTP/1.1 204 No Content\r\nContent-Length:0\r\nConnection:close\r\n\r\n";
static const char http_header_302[] = "HTTP/1.1 302 Moved\r\nLocation: /\r\nContent-Length:0\r\nConnection:close\r\n\r\n";
static const char http_header_302_trying[] = "HTTP/1.1 302 Moved\r\nLocation: /?trying=true\r\nContent-Length:0\r\nConnection:close\r\n\r\n";
static const char http_header_400[] = "HTTP/1.1 400 Bad request\r\nContent-Length:0\r\nConnection:close\r\n\r\n";
static const char http_header_404[] = "HTTP/1.1 404 Not found\r\nContent-Length:0\r\nConnection:close\r\n\r\n";
static const char http_header_405[] = "HTTP/1.1 405 Method Not Allowed\r\nContent-Length:0\r\nConnection:close\r\n\r\n";
......@@ -101,8 +102,8 @@ static const char http_header_500[] = "HTTP/1.1 500 Internal Error\r\nContent-Le
static const char http_header_content_len_fmt[] = "Content-length:%5d\r\n\r\n";
static const char http_html_gzip_contentencoding[] = "Content-Encoding: gzip\r\n";
/* Externally defined: static const char http_html_backup[] = ... */
#include "eus/http_html_backup.def"
/* Externally defined: static const char enduser_setup_html_default[] = ... */
#include "enduser_setup/enduser_setup.html.gz.def.h"
typedef struct scan_listener
{
......@@ -247,7 +248,7 @@ static void enduser_setup_check_station(void *p)
(void)p;
struct ip_info ip;
c_memset(&ip, 0, sizeof(struct ip_info));
memset(&ip, 0, sizeof(struct ip_info));
wifi_get_ip_info(STATION_IF, &ip);
......@@ -265,7 +266,7 @@ static void enduser_setup_check_station(void *p)
/* No IP Address yet, so check the reported status */
uint8_t curr_status = wifi_station_get_connect_status();
char buf[20];
c_sprintf(buf, "status=%d,chan=%d", curr_status, currChan);
sprintf(buf, "status=%d,chan=%d", curr_status, currChan);
ENDUSER_SETUP_DEBUG(buf);
if (curr_status == 2 || curr_status == 3 || curr_status == 4)
......@@ -289,7 +290,7 @@ static void enduser_setup_check_station(void *p)
return;
}
c_sprintf (ipaddr, "%d.%d.%d.%d", IP2STR(&ip.ip.addr));
sprintf (ipaddr, "%d.%d.%d.%d", IP2STR(&ip.ip.addr));
state->success = 1;
state->lastStationStatus = 5; /* We have an IP Address, so the status is 5 (as of SDK 1.5.1) */
......@@ -297,7 +298,7 @@ static void enduser_setup_check_station(void *p)
#if ENDUSER_SETUP_DEBUG_ENABLE
char debuginfo[100];
c_sprintf(debuginfo, "AP_CHAN: %d, STA_CHAN: %d", state->softAPchannel, currChan);
sprintf(debuginfo, "AP_CHAN: %d, STA_CHAN: %d", state->softAPchannel, currChan);
ENDUSER_SETUP_DEBUG(debuginfo);
#endif
......@@ -396,18 +397,25 @@ static err_t close_once_sent (void *arg, struct tcp_pcb *pcb, u16_t len)
/* ------------------------------------------------------------------------- */
/**
* Search String
* Get length of param value
*
* This is being called with a fragment of the parameters passed in the
* URL for GET requests or part of the body of a POST request.
* The string will look like one of these
* "SecretPassword HTTP/1.1"
* "SecretPassword&wifi_ssid=..."
* "SecretPassword"
* The string is searched for the first occurence of deliemiter '&' or ' '.
* If found return the length up to that position.
* If not found return the length of the string.
*
* Search string for first occurance of any char in srch_str.
*
* @return -1 iff no occurance of char was found.
*/
static int enduser_setup_srch_str(const char *str, const char *srch_str)
static int enduser_setup_get_lenth_of_param_value(const char *str)
{
char *found = strpbrk (str, srch_str);
char *found = strpbrk (str, "& ");
if (!found)
{
return -1;
return strlen(str);
}
else
{
......@@ -418,9 +426,9 @@ static int enduser_setup_srch_str(const char *str, const char *srch_str)
/**
* Load HTTP Payload
*
* @return - 0 iff payload loaded successfully
* 1 iff backup html was loaded
* 2 iff out of memory
* @return - 0 if payload loaded successfully
* 1 if default html was loaded
* 2 if out of memory
*/
static int enduser_setup_http_load_payload(void)
{
......@@ -461,27 +469,32 @@ static int enduser_setup_http_load_payload(void)
char cl_hdr[30];
size_t ce_len = 0;
c_sprintf(cl_hdr, http_header_content_len_fmt, file_len);
size_t cl_len = c_strlen(cl_hdr);
sprintf(cl_hdr, http_header_content_len_fmt, file_len);
size_t cl_len = strlen(cl_hdr);
if (!f || err == VFS_RES_ERR || err2 == VFS_RES_ERR)
{
ENDUSER_SETUP_DEBUG("Unable to load file enduser_setup.html, loading backup HTML...");
ENDUSER_SETUP_DEBUG("Unable to load file enduser_setup.html, loading default HTML...");
if (f)
{
vfs_close(f);
}
c_sprintf(cl_hdr, http_header_content_len_fmt, sizeof(http_html_backup));
cl_len = c_strlen(cl_hdr);
int html_len = LITLEN(http_html_backup);
sprintf(cl_hdr, http_header_content_len_fmt, sizeof(enduser_setup_html_default));
cl_len = strlen(cl_hdr);
int html_len = LITLEN(enduser_setup_html_default);
if (http_html_backup[0] == 0x1f && http_html_backup[1] == 0x8b)
if (enduser_setup_html_default[0] == 0x1f && enduser_setup_html_default[1] == 0x8b)
{
ce_len = c_strlen(http_html_gzip_contentencoding);
html_len = http_html_backup_len; /* Defined in eus/http_html_backup.def by xxd -i */
ce_len = strlen(http_html_gzip_contentencoding);
html_len = enduser_setup_html_default_len; /* Defined in enduser_setup/enduser_setup.html.gz.def.h by xxd -i */
ENDUSER_SETUP_DEBUG("Content is gzipped");
}
int payload_len = LITLEN(http_header_200) + cl_len + ce_len + html_len;
state->http_payload_len = payload_len;
state->http_payload_data = (char *) c_malloc(payload_len);
state->http_payload_data = (char *) malloc(payload_len);
if (state->http_payload_data == NULL)
{
......@@ -489,17 +502,17 @@ static int enduser_setup_http_load_payload(void)
}
int offset = 0;
c_memcpy(&(state->http_payload_data[offset]), &(http_header_200), LITLEN(http_header_200));
memcpy(&(state->http_payload_data[offset]), &(http_header_200), LITLEN(http_header_200));
offset += LITLEN(http_header_200);
if (ce_len > 0)
{
offset += c_sprintf(state->http_payload_data + offset, http_html_gzip_contentencoding, ce_len);
offset += sprintf(state->http_payload_data + offset, http_html_gzip_contentencoding, ce_len);
}
c_memcpy(&(state->http_payload_data[offset]), &(cl_hdr), cl_len);
memcpy(&(state->http_payload_data[offset]), &(cl_hdr), cl_len);
offset += cl_len;
c_memcpy(&(state->http_payload_data[offset]), &(http_html_backup), sizeof(http_html_backup));
memcpy(&(state->http_payload_data[offset]), &(enduser_setup_html_default), sizeof(enduser_setup_html_default));
return 1;
}
......@@ -509,13 +522,13 @@ static int enduser_setup_http_load_payload(void)
if (magic[0] == 0x1f && magic[1] == 0x8b)
{
ce_len = c_strlen(http_html_gzip_contentencoding);
ce_len = strlen(http_html_gzip_contentencoding);
ENDUSER_SETUP_DEBUG("Content is gzipped");
}
int payload_len = LITLEN(http_header_200) + cl_len + ce_len + file_len;
state->http_payload_len = payload_len;
state->http_payload_data = (char *) c_malloc(payload_len);
state->http_payload_data = (char *) malloc(payload_len);
if (state->http_payload_data == NULL)
{
......@@ -526,15 +539,15 @@ static int enduser_setup_http_load_payload(void)
int offset = 0;
c_memcpy(&(state->http_payload_data[offset]), &(http_header_200), LITLEN(http_header_200));
memcpy(&(state->http_payload_data[offset]), &(http_header_200), LITLEN(http_header_200));
offset += LITLEN(http_header_200);
if (ce_len > 0)
{
offset += c_sprintf(state->http_payload_data + offset, http_html_gzip_contentencoding, ce_len);
offset += sprintf(state->http_payload_data + offset, http_html_gzip_contentencoding, ce_len);
}
c_memcpy(&(state->http_payload_data[offset]), &(cl_hdr), cl_len);
memcpy(&(state->http_payload_data[offset]), &(cl_hdr), cl_len);
offset += cl_len;
vfs_read(f, &(state->http_payload_data[offset]), file_len);
vfs_close(f);
......@@ -548,7 +561,7 @@ static int enduser_setup_http_load_payload(void)
*
* Parse escaped and form encoded data of request.
*
* @return - return 0 iff the HTTP parameter is decoded into a valid string.
* @return - return 0 if the HTTP parameter is decoded into a valid string.
*/
static int enduser_setup_http_urldecode(char *dst, const char *src, int src_len, int dst_len)
{
......@@ -631,13 +644,167 @@ static void do_station_cfg (task_param_t param, uint8_t prio)
luaM_free(lua_getstate(), cnf);
}
/**
* Count the number of occurences of a character in a string
*
* return the number of times the character was encountered in the string
*/
static int count_char_occurence(const char *input, const char char_to_count) {
const char *current = input;
int occur = 0;
while (*current != 0) {
if (*current == char_to_count) occur++;
current++;
}
return occur;
}
/* structure used to store the key/value pairs that we find in a HTTP POST body */
struct keypairs_t {
char **keypairs;
int keypairs_nb;
};
static void enduser_setup_free_keypairs(struct keypairs_t *kp) {
if (kp == NULL) return;
if (kp->keypairs != NULL) {
for (int i = 0; i < kp->keypairs_nb * 2; i++) {
free(kp->keypairs[i]);
}
}
free(kp->keypairs);
free(kp);
}
static struct keypairs_t * enduser_setup_alloc_keypairs(int kp_number ){
struct keypairs_t *kp = malloc(sizeof(struct keypairs_t));
os_memset(kp, 0, sizeof(struct keypairs_t));
kp->keypairs = malloc(kp_number * 2 * sizeof(char *));
kp->keypairs_nb = kp_number;
return kp;
}
/**
* Parses a form-urlencoded body into a struct keypairs_t, which contains an array of key,values strings and the size of the array.
*/
static struct keypairs_t *enduser_setup_get_keypairs_from_form(char *form_body, int form_length) {
int keypair_nb = count_char_occurence(form_body, '&') + 1;
int equal_nb = count_char_occurence(form_body, '=');
if (keypair_nb == 1 && equal_nb == 0) {
ENDUSER_SETUP_DEBUG("No keypair in form body");
return NULL;
}
struct keypairs_t *kp = enduser_setup_alloc_keypairs(keypair_nb);
int current_idx = 0;
int err;
char *body_copy = malloc(form_length+1);
os_bzero(body_copy, form_length+1);
os_memcpy(body_copy, form_body, form_length);
char *tok = strtok(body_copy, "=");
char last_tok = '=';
while (tok) {
size_t len = strlen(tok);
kp->keypairs[current_idx] = malloc(len + 1);
err = enduser_setup_http_urldecode(kp->keypairs[current_idx], tok, len, len + 1);
if (err) {
ENDUSER_SETUP_DEBUG("Unable to decode parameter");
enduser_setup_free_keypairs(kp);
free(body_copy);
return NULL;
}
current_idx++;
if (current_idx > keypair_nb*2) {
ENDUSER_SETUP_DEBUG("Too many keypairs!");
enduser_setup_free_keypairs(kp);
free(body_copy);
return NULL;
}
if (last_tok == '=') {
tok = strtok(NULL, "&"); // now search for the '&'
last_tok='&';
} else {
tok = strtok(NULL, "="); // search for the next '='
last_tok='=';
}
}
free(body_copy);
return kp;
}
/**
* This function saves the form data received when the configuration is sent to the ESP into a eus_params.lua file
*/
static int enduser_setup_write_file_with_extra_configuration_data(char *form_body, int form_length) {
ENDUSER_SETUP_DEBUG("enduser: write data from posted form");
ENDUSER_SETUP_DEBUG(form_body);
// We will save the form data into a file in the LUA format: KEY="VALUE", so that configuration data is available for load in the lua code.
// As input, we have a string as such: "key1=value1&key2=value2&key3=value%203" (urlencoded), the number of '&' tells us how many keypairs there are (the count + 1)
struct keypairs_t *kp = enduser_setup_get_keypairs_from_form(form_body, form_length);
if (kp == NULL || kp->keypairs_nb == 0) {
ENDUSER_SETUP_DEBUG("enduser: No extra configuration.");
if (kp != NULL) enduser_setup_free_keypairs(kp);
return 1;
}
// Now that we have the keys and the values, let's save them in a lua file
int p_file = vfs_open("eus_params.lua", "w");
if (p_file == 0)
{
ENDUSER_SETUP_DEBUG("Can't open file in write mode!");
enduser_setup_free_keypairs(kp);
return 1;
}
// write all key pairs as KEY="VALUE"\n into a Lua table, example:
// local p = {}
// p.wifi_ssid="ssid"
// p.wifi_password="password"
// p.device_name="foo-node"
// return p
vfs_write(p_file, "local p={}\n", 11);
int idx = 0;
for( idx = 0; idx < kp->keypairs_nb*2; idx=idx+2){
char* to_write = kp->keypairs[idx];
size_t length = strlen(to_write);
vfs_write(p_file, "p.", 2);
vfs_write(p_file, to_write, length);
vfs_write(p_file, "=\"", 2);
to_write = kp->keypairs[idx+1];
length = strlen(to_write);
vfs_write(p_file, to_write, length);
vfs_write(p_file, "\"\n", 2);
}
vfs_write(p_file, "return p\n", 9);
vfs_close(p_file);
enduser_setup_free_keypairs(kp);
// TODO: we could call back in the LUA with an associative table setup, but this is MVP2...
return 0;
}
/**
* Handle HTTP Credentials
*
* @return - return 0 iff credentials are found and handled successfully
* return 1 iff credentials aren't found
* return 2 iff an error occured
* @return - return 0 if credentials are found and handled successfully
* return 1 if credentials aren't found
* return 2 if an error occured
*/
static int enduser_setup_http_handle_credentials(char *data, unsigned short data_len)
{
......@@ -646,8 +813,8 @@ static int enduser_setup_http_handle_credentials(char *data, unsigned short data
state->success = 0;
state->lastStationStatus = 0;
char *name_str = (char *) ((uint32_t)strstr(&(data[6]), "wifi_ssid="));
char *pwd_str = (char *) ((uint32_t)strstr(&(data[6]), "wifi_password="));
char *name_str = strstr(data, "wifi_ssid=");
char *pwd_str = strstr(data, "wifi_password=");
if (name_str == NULL || pwd_str == NULL)
{
ENDUSER_SETUP_DEBUG("Password or SSID string not found");
......@@ -659,30 +826,24 @@ static int enduser_setup_http_handle_credentials(char *data, unsigned short data
char *name_str_start = name_str + name_field_len;
char *pwd_str_start = pwd_str + pwd_field_len;
int name_str_len = enduser_setup_srch_str(name_str_start, "& ");
int pwd_str_len = enduser_setup_srch_str(pwd_str_start, "& ");
if (name_str_len == -1 || pwd_str_len == -1)
{
ENDUSER_SETUP_DEBUG("Password or SSID HTTP paramter divider not found");
return 1;
}
int name_str_len = enduser_setup_get_lenth_of_param_value(name_str_start);
int pwd_str_len = enduser_setup_get_lenth_of_param_value(pwd_str_start);
struct station_config *cnf = luaM_malloc(lua_getstate(), sizeof(struct station_config));
c_memset(cnf, 0, sizeof(struct station_config));
memset(cnf, 0, sizeof(struct station_config));
cnf->threshold.rssi = -127;
cnf->threshold.authmode = AUTH_OPEN;
int err;
err = enduser_setup_http_urldecode(cnf->ssid, name_str_start, name_str_len, sizeof(cnf->ssid));
err |= enduser_setup_http_urldecode(cnf->password, pwd_str_start, pwd_str_len, sizeof(cnf->password));
if (err != 0 || c_strlen(cnf->ssid) == 0)
if (err != 0 || strlen(cnf->ssid) == 0)
{
ENDUSER_SETUP_DEBUG("Unable to decode HTTP parameter to valid password or SSID");
return 1;
}
ENDUSER_SETUP_DEBUG("");
ENDUSER_SETUP_DEBUG("WiFi Credentials Stored");
ENDUSER_SETUP_DEBUG("-----------------------");
......@@ -702,7 +863,7 @@ static int enduser_setup_http_handle_credentials(char *data, unsigned short data
/**
* Serve HTML
*
* @return - return 0 iff html was served successfully
* @return - return 0 if html was served successfully
*/
static int enduser_setup_http_serve_header(struct tcp_pcb *http_client, const char *header, uint32_t header_len)
{
......@@ -763,7 +924,7 @@ static err_t streamout_sent (void *arg, struct tcp_pcb *pcb, u16_t len)
/**
* Serve HTML
*
* @return - return 0 iff html was served successfully
* @return - return 0 if html was served successfully
*/
static int enduser_setup_http_serve_html(struct tcp_pcb *http_client)
{
......@@ -836,21 +997,21 @@ static void enduser_setup_serve_status(struct tcp_pcb *conn)
ip_addr[0] = '\0';
if (curr_state == STATION_GOT_IP)
{
c_sprintf (ip_addr, "%d.%d.%d.%d", IP2STR(&ip_info.ip.addr));
sprintf (ip_addr, "%d.%d.%d.%d", IP2STR(&ip_info.ip.addr));
}
int state_len = c_strlen(s);
int ip_len = c_strlen(ip_addr);
int ssid_len = c_strlen(config.ssid);
int state_len = strlen(s);
int ip_len = strlen(ip_addr);
int ssid_len = strlen(config.ssid);
int status_len = state_len + ssid_len + ip_len + 1;
char status_buf[status_len];
memset(status_buf, 0, status_len);
status_len = c_sprintf(status_buf, s, config.ssid, ip_addr);
status_len = sprintf(status_buf, s, config.ssid, ip_addr);
int buf_len = sizeof(fmt) + status_len + 10; /* 10 = (9+1), 1 byte is '\0' and 9 are reserved for length field */
char buf[buf_len];
memset(buf, 0, buf_len);
int output_len = c_sprintf(buf, fmt, status_len, status_buf);
int output_len = sprintf(buf, fmt, status_len, status_buf);
enduser_setup_http_serve_header(conn, buf, output_len);
}
......@@ -860,11 +1021,11 @@ static void enduser_setup_serve_status(struct tcp_pcb *conn)
default:
{
const char *s = states[curr_state];
int status_len = c_strlen(s);
int status_len = strlen(s);
int buf_len = sizeof(fmt) + status_len + 10; /* 10 = (9+1), 1 byte is '\0' and 9 are reserved for length field */
char buf[buf_len];
memset(buf, 0, buf_len);
int output_len = c_sprintf(buf, fmt, status_len, s);
int output_len = sprintf(buf, fmt, status_len, s);
enduser_setup_http_serve_header(conn, buf, output_len);
}
......@@ -894,13 +1055,13 @@ static void enduser_setup_serve_status_as_json (struct tcp_pcb *http_client)
/* If IP address not yet available, get now */
if (strlen(ipaddr) == 0)
{
c_sprintf(ipaddr, "%d.%d.%d.%d", IP2STR(&ip_info.ip.addr));
sprintf(ipaddr, "%d.%d.%d.%d", IP2STR(&ip_info.ip.addr));
}
c_sprintf(json_payload, "{\"deviceid\":\"%s\", \"status\":%d}", ipaddr, curr_status);
sprintf(json_payload, "{\"deviceid\":\"%s\", \"status\":%d}", ipaddr, curr_status);
}
else
{
c_sprintf(json_payload, "{\"deviceid\":\"%06X\", \"status\":%d}", system_get_chip_id(), curr_status);
sprintf(json_payload, "{\"deviceid\":\"%06X\", \"status\":%d}", system_get_chip_id(), curr_status);
}
const char fmt[] =
......@@ -913,9 +1074,9 @@ static void enduser_setup_serve_status_as_json (struct tcp_pcb *http_client)
"\r\n"
"%s";
int len = c_strlen(json_payload);
char buf[c_strlen(fmt) + NUMLEN(len) + len - 4];
len = c_sprintf (buf, fmt, len, json_payload);
int len = strlen(json_payload);
char buf[strlen(fmt) + NUMLEN(len) + len - 4];
len = sprintf (buf, fmt, len, json_payload);
enduser_setup_http_serve_header (http_client, buf, len);
}
......@@ -944,19 +1105,53 @@ static void enduser_setup_handle_OPTIONS (struct tcp_pcb *http_client, char *dat
int type = 0;
if (c_strncmp(data, "GET ", 4) == 0)
if (strncmp(data, "GET ", 4) == 0)
{
if (c_strncmp(data + 4, "/aplist", 7) == 0 || c_strncmp(data + 4, "/setwifi?", 9) == 0 || c_strncmp(data + 4, "/status.json", 12) == 0)
if (strncmp(data + 4, "/aplist", 7) == 0 || strncmp(data + 4, "/setwifi?", 9) == 0 || strncmp(data + 4, "/status.json", 12) == 0)
{
enduser_setup_http_serve_header (http_client, json, c_strlen(json));
enduser_setup_http_serve_header (http_client, json, strlen(json));
return;
}
}
enduser_setup_http_serve_header (http_client, others, c_strlen(others));
enduser_setup_http_serve_header (http_client, others, strlen(others));
return;
}
static void enduser_setup_handle_POST(struct tcp_pcb *http_client, char* data, size_t data_len)
{
ENDUSER_SETUP_DEBUG("Handling POST");
if (strncmp(data + 5, "/setwifi ", 9) == 0) // User clicked the submit button
{
char* body=strstr(data, "\r\n\r\n");
char *content_length_str = strstr(data, "Content-Length: ");
if( body == NULL || content_length_str == NULL)
{
enduser_setup_http_serve_header(http_client, http_header_400, LITLEN(http_header_400));
return;
}
int bodylength = atoi(content_length_str + 16);
body += 4; // length of the double CRLF found above
switch (enduser_setup_http_handle_credentials(body, bodylength))
{
case 0: {
// all went fine, extract all the form data into a file
enduser_setup_write_file_with_extra_configuration_data(body, bodylength);
// redirect user to the base page with the trying flag
enduser_setup_http_serve_header(http_client, http_header_302_trying, LITLEN(http_header_302_trying));
break;
}
case 1:
enduser_setup_http_serve_header(http_client, http_header_400, LITLEN(http_header_400));
break;
default:
ENDUSER_SETUP_ERROR_VOID("http_recvcb failed. Failed to handle wifi credentials.", ENDUSER_SETUP_ERR_UNKOWN_ERROR, ENDUSER_SETUP_ERR_NONFATAL);
break;
}
}
}
/* --- WiFi AP scanning support -------------------------------------------- */
static void free_scan_listeners (void)
......@@ -972,7 +1167,7 @@ static void free_scan_listeners (void)
while (l)
{
next = l->next;
c_free (l);
free (l);
l = next;
}
state->scan_listeners = 0;
......@@ -992,7 +1187,7 @@ static void remove_scan_listener (scan_listener_t *l)
if (*sl == l)
{
*sl = l->next;
c_free (l);
free (l);
/* No early exit to guard against multi-entry on list */
}
else
......@@ -1071,7 +1266,7 @@ static void on_scan_done (void *arg, STATUS status)
/* To be able to safely escape a pathological SSID, we need 2*32 bytes */
const size_t max_entry_sz = 27 + 2*32 + 6; /* {"ssid":"","rssi":,"chan":} */
const size_t alloc_sz = hdr_sz + num_nets * max_entry_sz + 3;
char *http = os_zalloc (alloc_sz);
char *http = calloc (1, alloc_sz);
if (!http)
{
goto serve_500;
......@@ -1097,26 +1292,26 @@ static void on_scan_done (void *arg, STATUS status)
strcpy (p, entry_mid);
p += sizeof (entry_mid) -1;
p += c_sprintf (p, "%d", wn->rssi);
p += sprintf (p, "%d", wn->rssi);
const char entry_chan[] = ",\"chan\":";
strcpy (p, entry_chan);
p += sizeof (entry_chan) -1;
p += c_sprintf (p, "%d", wn->channel);
p += sprintf (p, "%d", wn->channel);
*p++ = '}';
}
*p++ = ']';
size_t body_sz = (p - http) - hdr_sz;
c_sprintf (http, header_fmt, body_sz);
sprintf (http, header_fmt, body_sz);
http[hdr_sz] = '['; /* Rewrite the \0 with the correct start of body */
notify_scan_listeners (http, hdr_sz + body_sz);
ENDUSER_SETUP_DEBUG(http + hdr_sz);
c_free (http);
free (http);
return;
}
......@@ -1149,7 +1344,7 @@ static err_t enduser_setup_http_recvcb(void *arg, struct tcp_pcb *http_client, s
return ERR_OK;
}
char *data = os_zalloc (p->tot_len + 1);
char *data = calloc (1, p->tot_len + 1);
if (!data)
return ERR_MEM;
......@@ -1163,9 +1358,9 @@ static err_t enduser_setup_http_recvcb(void *arg, struct tcp_pcb *http_client, s
ENDUSER_SETUP_DEBUG(data);
#endif
if (c_strncmp(data, "GET ", 4) == 0)
if (strncmp(data, "GET ", 4) == 0)
{
if (c_strncmp(data + 4, "/ ", 2) == 0)
if (strncmp(data + 4, "/ ", 2) == 0 || strncmp(data + 4, "/?", 2) == 0)
{
if (enduser_setup_http_serve_html(http_client) != 0)
{
......@@ -1176,12 +1371,12 @@ static err_t enduser_setup_http_recvcb(void *arg, struct tcp_pcb *http_client, s
goto free_out; /* streaming now in progress */
}
}
else if (c_strncmp(data + 4, "/aplist", 7) == 0)
else if (strncmp(data + 4, "/aplist", 7) == 0)
{
/* Don't do an AP Scan while station is trying to connect to Wi-Fi */
if (state->connecting == 0)
{
scan_listener_t *l = os_malloc (sizeof (scan_listener_t));
scan_listener_t *l = malloc (sizeof (scan_listener_t));
if (!l)
{
ENDUSER_SETUP_ERROR("out of memory", ENDUSER_SETUP_ERR_OUT_OF_MEMORY, ENDUSER_SETUP_ERR_NONFATAL);
......@@ -1213,16 +1408,16 @@ static err_t enduser_setup_http_recvcb(void *arg, struct tcp_pcb *http_client, s
enduser_setup_http_serve_header(http_client, http_header_204, LITLEN(http_header_204));
}
}
else if (c_strncmp(data + 4, "/status.json", 12) == 0)
else if (strncmp(data + 4, "/status.json", 12) == 0)
{
enduser_setup_serve_status_as_json(http_client);
}
else if (c_strncmp(data + 4, "/status", 7) == 0)
else if (strncmp(data + 4, "/status", 7) == 0)
{
enduser_setup_serve_status(http_client);
}
else if (c_strncmp(data + 4, "/update?", 8) == 0)
else if (strncmp(data + 4, "/update?", 8) == 0)
{
switch (enduser_setup_http_handle_credentials(data, data_len))
{
......@@ -1237,22 +1432,7 @@ static err_t enduser_setup_http_recvcb(void *arg, struct tcp_pcb *http_client, s
break;
}
}
else if (c_strncmp(data + 4, "/setwifi?", 9) == 0)
{
switch (enduser_setup_http_handle_credentials(data, data_len))
{
case 0:
enduser_setup_serve_status_as_json(http_client);
break;
case 1:
enduser_setup_http_serve_header(http_client, http_header_400, LITLEN(http_header_400));
break;
default:
ENDUSER_SETUP_ERROR("http_recvcb failed. Failed to handle wifi credentials.", ENDUSER_SETUP_ERR_UNKOWN_ERROR, ENDUSER_SETUP_ERR_NONFATAL);
break;
}
}
else if (c_strncmp(data + 4, "/generate_204", 13) == 0)
else if (strncmp(data + 4, "/generate_204", 13) == 0)
{
/* Convince Android devices that they have internet access to avoid pesky dialogues. */
enduser_setup_http_serve_header(http_client, http_header_204, LITLEN(http_header_204));
......@@ -1263,10 +1443,14 @@ static err_t enduser_setup_http_recvcb(void *arg, struct tcp_pcb *http_client, s
enduser_setup_http_serve_header(http_client, http_header_404, LITLEN(http_header_404));
}
}
else if (c_strncmp(data, "OPTIONS ", 8) == 0)
else if (strncmp(data, "OPTIONS ", 8) == 0)
{
enduser_setup_handle_OPTIONS(http_client, data, data_len);
}
else if (strncmp(data, "POST ", 5) == 0)
{
enduser_setup_handle_POST(http_client, data, data_len);
}
else /* not GET or OPTIONS */
{
enduser_setup_http_serve_header(http_client, http_header_405, LITLEN(http_header_405));
......@@ -1275,10 +1459,11 @@ static err_t enduser_setup_http_recvcb(void *arg, struct tcp_pcb *http_client, s
deferred_close (http_client);
free_out:
os_free (data);
free (data);
return ret;
}
static err_t enduser_setup_http_connectcb(void *arg, struct tcp_pcb *pcb, err_t err)
{
ENDUSER_SETUP_DEBUG("enduser_setup_http_connectcb");
......@@ -1332,7 +1517,7 @@ static int enduser_setup_http_start(void)
int err = enduser_setup_http_load_payload();
if (err == 1)
{
ENDUSER_SETUP_DEBUG("enduser_setup_http_start info. Loaded backup HTML.");
ENDUSER_SETUP_DEBUG("enduser_setup_http_start info. Loaded default HTML.");
}
else if (err == 2)
{
......@@ -1367,20 +1552,20 @@ static void enduser_setup_ap_start(void)
ENDUSER_SETUP_DEBUG("enduser_setup_ap_start");
struct softap_config cnf;
c_memset(&(cnf), 0, sizeof(struct softap_config));
memset(&(cnf), 0, sizeof(struct softap_config));
#ifndef ENDUSER_SETUP_AP_SSID
#define ENDUSER_SETUP_AP_SSID "SetupGadget"
#endif
char ssid[] = ENDUSER_SETUP_AP_SSID;
int ssid_name_len = c_strlen(ssid);
c_memcpy(&(cnf.ssid), ssid, ssid_name_len);
int ssid_name_len = strlen(ssid);
memcpy(&(cnf.ssid), ssid, ssid_name_len);
uint8_t mac[6];
wifi_get_macaddr(SOFTAP_IF, mac);
cnf.ssid[ssid_name_len] = '_';
c_sprintf(cnf.ssid + ssid_name_len + 1, "%02X%02X%02X", mac[3], mac[4], mac[5]);
sprintf(cnf.ssid + ssid_name_len + 1, "%02X%02X%02X", mac[3], mac[4], mac[5]);
cnf.ssid_len = ssid_name_len + 7;
cnf.channel = state == NULL? 1 : state->softAPchannel;
cnf.authmode = AUTH_OPEN;
......@@ -1392,7 +1577,7 @@ static void enduser_setup_ap_start(void)
#if ENDUSER_SETUP_DEBUG_ENABLE
char debuginfo[100];
c_sprintf(debuginfo, "SSID: %s, CHAN: %d", cnf.ssid, cnf.channel);
sprintf(debuginfo, "SSID: %s, CHAN: %d", cnf.ssid, cnf.channel);
ENDUSER_SETUP_DEBUG(debuginfo);
#endif
}
......@@ -1439,15 +1624,15 @@ static void enduser_setup_dns_recv_callback(void *arg, char *recv_data, unsigned
struct espconn *callback_espconn = arg;
struct ip_info ip_info;
uint32_t qname_len = c_strlen(&(recv_data[12])) + 1; /* \0=1byte */
uint32_t qname_len = strlen(&(recv_data[12])) + 1; /* \0=1byte */
uint32_t dns_reply_static_len = (uint32_t) sizeof(dns_header) + (uint32_t) sizeof(dns_body) + 2 + 4; /* dns_id=2bytes, ip=4bytes */
uint32_t dns_reply_len = dns_reply_static_len + qname_len;
#if ENDUSER_SETUP_DEBUG_ENABLE
char *qname = c_malloc(qname_len + 12);
char *qname = malloc(qname_len + 12);
if (qname != NULL)
{
c_sprintf(qname, "DNS QUERY = %s", &(recv_data[12]));
sprintf(qname, "DNS QUERY = %s", &(recv_data[12]));
uint32_t p;
int i, j;
......@@ -1464,7 +1649,7 @@ static void enduser_setup_dns_recv_callback(void *arg, char *recv_data, unsigned
}
qname[i-1]='\0';
ENDUSER_SETUP_DEBUG(qname);
c_free(qname);
free(qname);
}
#endif
......@@ -1481,22 +1666,22 @@ static void enduser_setup_dns_recv_callback(void *arg, char *recv_data, unsigned
}
char *dns_reply = (char *) c_malloc(dns_reply_len);
char *dns_reply = (char *) malloc(dns_reply_len);
if (dns_reply == NULL)
{
ENDUSER_SETUP_ERROR_VOID("dns_recv_callback failed. Failed to allocate memory.", ENDUSER_SETUP_ERR_OUT_OF_MEMORY, ENDUSER_SETUP_ERR_NONFATAL);
}
uint32_t insert_byte = 0;
c_memcpy(&(dns_reply[insert_byte]), recv_data, 2);
memcpy(&(dns_reply[insert_byte]), recv_data, 2);
insert_byte += 2;
c_memcpy(&(dns_reply[insert_byte]), dns_header, sizeof(dns_header));
memcpy(&(dns_reply[insert_byte]), dns_header, sizeof(dns_header));
insert_byte += (uint32_t) sizeof(dns_header);
c_memcpy(&(dns_reply[insert_byte]), &(recv_data[12]), qname_len);
memcpy(&(dns_reply[insert_byte]), &(recv_data[12]), qname_len);
insert_byte += qname_len;
c_memcpy(&(dns_reply[insert_byte]), dns_body, sizeof(dns_body));
memcpy(&(dns_reply[insert_byte]), dns_body, sizeof(dns_body));
insert_byte += (uint32_t) sizeof(dns_body);
c_memcpy(&(dns_reply[insert_byte]), &(ip_info.ip), 4);
memcpy(&(dns_reply[insert_byte]), &(ip_info.ip), 4);
/* SDK 1.4.0 changed behaviour, for UDP server need to look up remote ip/port */
remot_info *pr = 0;
......@@ -1509,7 +1694,7 @@ static void enduser_setup_dns_recv_callback(void *arg, char *recv_data, unsigned
int8_t err;
err = espconn_send(callback_espconn, dns_reply, dns_reply_len);
c_free(dns_reply);
free(dns_reply);
if (err == ESPCONN_MEM)
{
ENDUSER_SETUP_ERROR_VOID("dns_recv_callback failed. Failed to allocate memory for send.", ENDUSER_SETUP_ERR_OUT_OF_MEMORY, ENDUSER_SETUP_ERR_FATAL);
......@@ -1550,16 +1735,16 @@ static void enduser_setup_free(void)
{
if (state->espconn_dns_udp->proto.udp != NULL)
{
c_free(state->espconn_dns_udp->proto.udp);
free(state->espconn_dns_udp->proto.udp);
}
c_free(state->espconn_dns_udp);
free(state->espconn_dns_udp);
}
c_free(state->http_payload_data);
free(state->http_payload_data);
free_scan_listeners ();
c_free(state);
free(state);
state = NULL;
}
......@@ -1572,20 +1757,20 @@ static int enduser_setup_dns_start(void)
{
ENDUSER_SETUP_ERROR("dns_start failed. Appears to already be started (espconn_dns_udp != NULL).", ENDUSER_SETUP_ERR_ALREADY_INITIALIZED, ENDUSER_SETUP_ERR_FATAL);
}
state->espconn_dns_udp = (struct espconn *) c_malloc(sizeof(struct espconn));
state->espconn_dns_udp = (struct espconn *) malloc(sizeof(struct espconn));
if (state->espconn_dns_udp == NULL)
{
ENDUSER_SETUP_ERROR("dns_start failed. Memory allocation failed (espconn_dns_udp == NULL).", ENDUSER_SETUP_ERR_OUT_OF_MEMORY, ENDUSER_SETUP_ERR_FATAL);
}
esp_udp *esp_udp_data = (esp_udp *) c_malloc(sizeof(esp_udp));
esp_udp *esp_udp_data = (esp_udp *) malloc(sizeof(esp_udp));
if (esp_udp_data == NULL)
{
ENDUSER_SETUP_ERROR("dns_start failed. Memory allocation failed (esp_udp == NULL).", ENDUSER_SETUP_ERR_OUT_OF_MEMORY, ENDUSER_SETUP_ERR_FATAL);
}
c_memset(state->espconn_dns_udp, 0, sizeof(struct espconn));
c_memset(esp_udp_data, 0, sizeof(esp_udp));
memset(state->espconn_dns_udp, 0, sizeof(struct espconn));
memset(esp_udp_data, 0, sizeof(esp_udp));
state->espconn_dns_udp->proto.udp = esp_udp_data;
state->espconn_dns_udp->type = ESPCONN_UDP;
state->espconn_dns_udp->state = ESPCONN_NONE;
......@@ -1641,7 +1826,7 @@ static int enduser_setup_init(lua_State *L)
}
else
{
state = (enduser_setup_state_t *) os_zalloc(sizeof(enduser_setup_state_t));
state = (enduser_setup_state_t *) calloc(1, sizeof(enduser_setup_state_t));
if (state == NULL)
{
......@@ -1649,7 +1834,7 @@ static int enduser_setup_init(lua_State *L)
}
else
{
c_memset(state, 0, sizeof(enduser_setup_state_t));
memset(state, 0, sizeof(enduser_setup_state_t));
state->lua_connected_cb_ref = LUA_NOREF;
state->lua_err_cb_ref = LUA_NOREF;
......@@ -1784,11 +1969,11 @@ static int enduser_setup_stop(lua_State* L)
}
static const LUA_REG_TYPE enduser_setup_map[] = {
{ LSTRKEY( "manual" ), LFUNCVAL( enduser_setup_manual )},
{ LSTRKEY( "start" ), LFUNCVAL( enduser_setup_start )},
{ LSTRKEY( "stop" ), LFUNCVAL( enduser_setup_stop )},
{ LNILKEY, LNILVAL}
};
LROT_BEGIN(enduser_setup)
LROT_FUNCENTRY( manual, enduser_setup_manual )
LROT_FUNCENTRY( start, enduser_setup_start )
LROT_FUNCENTRY( stop, enduser_setup_stop )
LROT_END( enduser_setup, NULL, 0 )
NODEMCU_MODULE(ENDUSER_SETUP, "enduser_setup", enduser_setup_map, NULL);
NODEMCU_MODULE(ENDUSER_SETUP, "enduser_setup", enduser_setup, NULL);
......@@ -153,14 +153,17 @@
<div id=deviceId></div>
<div id=f1>
<h3>Connect device to your Wi-Fi</h3>
<button id=networks type=button class=utility></button>
<div id=dropdown>
<span id=arrow>&#x25bc;</span>
<select id=aplist name=aplist></select>
</div>
<input id=ssid type=text autocorrect=off autocapitalize=none placeholder='Wi-Fi Name' />
<input id=wifi_password type=text autocorrect=off autocapitalize=none autocomplete=off placeholder=Password />
<button id=submit type=button>Save</button>
<form action="/setwifi" method="POST">
<button id=networks type=button class=utility></button>
<div id=dropdown>
<span id=arrow>&#x25bc;</span>
<select id=aplist name=aplist></select>
</div>
<input id=ssid name=wifi_ssid type=text autocorrect=off autocapitalize=none placeholder='Wi-Fi Name' />
<input name=wifi_password type=password autocorrect=off autocapitalize=none autocomplete=off placeholder=Password />
<!-- You can add inputs here and have them pop up in your lua code through the file eus_params.lua -->
<input type="submit" value="Save"/>
</form>
</div>
<div id=f2>
<h1>Success!</h1>
......@@ -180,6 +183,11 @@
var ab = $('#networks'), ap = $('#aplist');
var stopAll = false, ra, rs, submitted = false;
$.urlParam = function (name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results == null) { return null;}
else { return decodeURI(results[1]) || 0;}
}
function show(f, y) {
if (y == null) y = f;
$(f).style.display = y == f ? 'block' : 'none';
......@@ -240,13 +248,6 @@
}
}
}
function submit() {
submitted = true;
var url = '/setwifi?wifi_ssid=' + encodeURIComponent($('#ssid').value) + '&wifi_password=' + encodeURIComponent($('#wifi_password').value);
clearTimeout(rs);
fetch(url, 'GET', newSt, 2);
cur('#f3');
}
function fetch(url, method, callback, time_out) {
var xhr = new XMLHttpRequest();
xhr.onloadend = function () {
......@@ -305,18 +306,19 @@
fetch('/aplist?n=' + Math.random(), 'GET', gotAp, 10);
}
window.onload = function() {
ab.innerText = 'Scan for Networks';
ab.onclick = refrAp;
$('#aplist').onchange = function () {
$('#ssid').value = $('#aplist').value;
};
$('#submit').onclick = submit;
$('#bk2').onclick = function () {
cur('#f1')
}
rs = to(refr, 0.5);
let trying = $.urlParam('trying');
ab.innerText = 'Scan for Networks';
ab.onclick = refrAp;
$('#aplist').onchange = function () {
$('#ssid').value = $('#aplist').value;
};
$('#bk2').onclick = function () {
cur('#f1')
}
rs = to(refr, 0.5);
if( trying ) cur("#f3");
}
</script>
</body>
</html>
\ No newline at end of file
</html>
static const char enduser_setup_html_default[] = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x95, 0x59,
0x7d, 0x73, 0xdc, 0xb6, 0xd1, 0xff, 0x5b, 0xcf, 0xcc, 0xf3, 0x1d, 0x56,
0x92, 0x6b, 0x52, 0xf6, 0x1d, 0x4f, 0xa7, 0x17, 0xc7, 0x23, 0xdd, 0x29,
0xe3, 0x26, 0xce, 0x4b, 0x27, 0x76, 0x3c, 0x91, 0x33, 0x69, 0xc6, 0x75,
0x33, 0x38, 0x12, 0x14, 0x11, 0xf3, 0x08, 0x16, 0x00, 0x25, 0x5d, 0x13,
0x7f, 0xf7, 0xee, 0x12, 0x8b, 0xe3, 0xd1, 0x64, 0xd4, 0x74, 0x12, 0x89,
0x04, 0xb0, 0xef, 0xfb, 0xc3, 0xee, 0x52, 0x5e, 0xec, 0x7f, 0xf9, 0xfd,
0x17, 0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f5,
0x78, 0xeb, 0x76, 0x29, 0x1d, 0xb8, 0xf6, 0xc3, 0x0c, 0x4f, 0xbb, 0x2f,
0x87, 0x38, 0xf2, 0x9b, 0x1c, 0xe3, 0x3f, 0x97, 0xde, 0x87, 0xb2, 0xbb,
0xfb, 0x69, 0x43, 0x24, 0x85, 0xa8, 0x6e, 0xe4, 0x78, 0x83, 0x78, 0xb4,
0xcd, 0x6f, 0xd2, 0x7e, 0x37, 0xf7, 0x3f, 0x8c, 0x78, 0x93, 0xd3, 0xda,
0x09, 0xc7, 0xcf, 0x47, 0x3c, 0x63, 0xe5, 0x43, 0xc1, 0xfd, 0x66, 0xeb,
0x99, 0x47, 0x46, 0xcf, 0xe3, 0x24, 0x5c, 0x2c, 0x95, 0xc7, 0x21, 0x30,
0x47, 0x40, 0x9c, 0x07, 0x38, 0xe7, 0x1e, 0x6c, 0x43, 0x0b, 0xb0, 0x98,
0x6d, 0x3f, 0x12, 0x17, 0x33, 0xfe, 0x9b, 0x15, 0xbd, 0xf2, 0x3f, 0xef,
0xfd, 0x07, 0xb4, 0xda, 0xa2, 0xb2, 0xf8, 0x1b, 0x00, 0x00
};
unsigned int enduser_setup_html_default_len = 2590;
......@@ -3,5 +3,5 @@
# Uses zopfli for better gzip compression
# sudo apt-get install zopfli
zopfli --gzip ./enduser_setup.html
xxd -i ./enduser_setup.html.gz | sed 's/unsigned char/static const char/; s/__enduser_setup_html_gz/http_html_backup/' > http_html_backup.def
xxd -i ./enduser_setup.html.gz | sed 's/unsigned char/static const char/; s/__enduser_setup_html_gz/enduser_setup_html_default/' > enduser_setup.html.gz.def.h
static const char http_html_backup[] = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x95, 0x59,
0x7b, 0x73, 0xdb, 0x36, 0x12, 0xff, 0xdb, 0xf9, 0x14, 0xeb, 0xba, 0x17,
0xca, 0x8d, 0xde, 0xb2, 0xd3, 0x8c, 0xf5, 0xe8, 0xe4, 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 +5,9 @@
#include "lmem.h"
#include "platform.h"
#include "c_types.h"
#include <stdint.h>
#include "vfs.h"
#include "c_string.h"
#include <string.h>
#include <alloca.h>
......@@ -126,15 +126,16 @@ static int file_close( lua_State* L )
ud = (file_fd_ud *)luaL_checkudata(L, 1, "file.obj");
}
// unref default file descriptor
luaL_unref( L, LUA_REGISTRYINDEX, file_fd_ref );
file_fd_ref = LUA_NOREF;
if(ud->fd){
vfs_close(ud->fd);
// mark as closed
ud->fd = 0;
}
// unref default file descriptor
luaL_unref( L, LUA_REGISTRYINDEX, file_fd_ref );
file_fd_ref = LUA_NOREF;
return 0;
}
......@@ -189,7 +190,7 @@ static int file_open( lua_State* L )
const char *fname = luaL_checklstring( L, 1, &len );
const char *basename = vfs_basename( fname );
luaL_argcheck(L, c_strlen(basename) <= FS_OBJ_NAME_LEN && c_strlen(fname) == len, 1, "filename invalid");
luaL_argcheck(L, strlen(basename) <= FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid");
const char *mode = luaL_optstring(L, 2, "r");
......@@ -302,7 +303,7 @@ static int file_exists( lua_State* L )
size_t len;
const char *fname = luaL_checklstring( L, 1, &len );
const char *basename = vfs_basename( fname );
luaL_argcheck(L, c_strlen(basename) <= FS_OBJ_NAME_LEN && c_strlen(fname) == len, 1, "filename invalid");
luaL_argcheck(L, strlen(basename) <= FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid");
struct vfs_stat stat;
lua_pushboolean(L, vfs_stat((char *)fname, &stat) == VFS_RES_OK ? 1 : 0);
......@@ -316,7 +317,7 @@ static int file_remove( lua_State* L )
size_t len;
const char *fname = luaL_checklstring( L, 1, &len );
const char *basename = vfs_basename( fname );
luaL_argcheck(L, c_strlen(basename) <= FS_OBJ_NAME_LEN && c_strlen(fname) == len, 1, "filename invalid");
luaL_argcheck(L, strlen(basename) <= FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid");
vfs_remove((char *)fname);
return 0;
}
......@@ -342,11 +343,11 @@ static int file_rename( lua_State* L )
const char *oldname = luaL_checklstring( L, 1, &len );
const char *basename = vfs_basename( oldname );
luaL_argcheck(L, c_strlen(basename) <= FS_OBJ_NAME_LEN && c_strlen(oldname) == len, 1, "filename invalid");
luaL_argcheck(L, strlen(basename) <= FS_OBJ_NAME_LEN && strlen(oldname) == len, 1, "filename invalid");
const char *newname = luaL_checklstring( L, 2, &len );
basename = vfs_basename( newname );
luaL_argcheck(L, c_strlen(basename) <= FS_OBJ_NAME_LEN && c_strlen(newname) == len, 2, "filename invalid");
luaL_argcheck(L, strlen(basename) <= FS_OBJ_NAME_LEN && strlen(newname) == len, 2, "filename invalid");
if(0 <= vfs_rename( oldname, newname )){
lua_pushboolean(L, 1);
......@@ -361,7 +362,7 @@ static int file_stat( lua_State* L )
{
size_t len;
const char *fname = luaL_checklstring( L, 1, &len );
luaL_argcheck( L, c_strlen(fname) <= FS_OBJ_NAME_LEN && c_strlen(fname) == len, 1, "filename invalid" );
luaL_argcheck( L, strlen(fname) <= FS_OBJ_NAME_LEN && strlen(fname) == len, 1, "filename invalid" );
struct vfs_stat stat;
if (vfs_stat( (char *)fname, &stat ) != VFS_RES_OK) {
......@@ -421,67 +422,42 @@ static int file_stat( lua_State* L )
// g_read()
static int file_g_read( lua_State* L, int n, int16_t end_char, int fd )
{
static char *heap_mem = NULL;
// free leftover memory
if (heap_mem) {
luaM_free(L, heap_mem);
heap_mem = NULL;
}
if(n <= 0)
n = FILE_READ_CHUNK;
if(end_char < 0 || end_char >255)
end_char = EOF;
int i, j;
luaL_Buffer b;
char p[LUAL_BUFFERSIZE/2];
if(!fd)
return luaL_error(L, "open a file first");
char *p;
int i;
luaL_buffinit(L, &b);
if (n > LUAL_BUFFERSIZE) {
// get buffer from heap
p = heap_mem = luaM_malloc(L, n);
} else {
// small chunks go onto the stack
p = alloca(n);
}
for (j = 0; j < n; j += sizeof(p)) {
int nwanted = (n - j >= sizeof(p)) ? sizeof(p) : n - j;
int nread = vfs_read(fd, p, nwanted);
n = vfs_read(fd, p, n);
// bypass search if no end character provided
if (n > 0 && end_char != EOF) {
for (i = 0; i < n; ++i)
if (p[i] == end_char)
{
++i;
if (nread == VFS_RES_ERR || nread == 0) {
lua_pushnil(L);
return 1;
}
for (i = 0; i < nread; ++i) {
luaL_addchar(&b, p[i]);
if (p[i] == end_char) {
vfs_lseek(fd, -nread + j + i + 1, VFS_SEEK_CUR); //reposition after end char found
nread = 0; // force break on outer loop
break;
}
} else {
i = n;
}
if (i == 0 || n == VFS_RES_ERR) {
if (heap_mem) {
luaM_free(L, heap_mem);
heap_mem = NULL;
}
lua_pushnil(L);
return 1;
}
vfs_lseek(fd, -(n - i), VFS_SEEK_CUR);
lua_pushlstring(L, p, i);
if (heap_mem) {
luaM_free(L, heap_mem);
heap_mem = NULL;
if (nread < nwanted)
break;
}
luaL_pushresult(&b);
return 1;
}
// Lua: read()
// file.read() will read all byte in file
// file.read() will read FILE _CHUNK bytes, or EOF is reached.
// file.read(10) will read 10 byte from file, or EOF is reached.
// file.read('q') will read until 'q' or EOF is reached.
static int file_read( lua_State* L )
......@@ -516,6 +492,28 @@ static int file_readline( lua_State* L )
return file_g_read(L, FILE_READ_CHUNK, '\n', fd);
}
// Lua: getfile(filename)
static int file_getfile( lua_State* L )
{
// Warning this code C calls other file_* routines to avoid duplication code. These
// use Lua stack addressing of arguments, so this does Lua stack maniplation to
// align these
int ret_cnt = 0;
lua_settop(L ,1);
// Stack [1] = FD
file_open(L);
// Stack [1] = filename; [2] = FD or nil
if (!lua_isnil(L, -1)) {
lua_remove(L, 1); // dump filename, so [1] = FD
file_fd_ud *ud = (file_fd_ud *)luaL_checkudata(L, 1, "file.obj");
ret_cnt = file_g_read(L, LUAI_MAXINT32, EOF, ud->fd);
// Stack [1] = FD; [2] = contents if ret_cnt = 1;
file_close(L); // leaves Stack unchanged if [1] = FD
lua_remove(L, 1); // Dump FD leaving contents as [1] / ToS
}
return ret_cnt;
}
// Lua: write("string")
static int file_write( lua_State* L )
{
......@@ -556,6 +554,34 @@ static int file_writeline( lua_State* L )
return 1;
}
// Lua: getfile(filename)
static int file_putfile( lua_State* L )
{
// Warning this code C calls other file_* routines to avoid duplication code. These
// use Lua stack addressing of arguments, so this does Lua stack maniplation to
// align these
int ret_cnt = 0;
lua_settop(L, 2);
lua_pushvalue(L, 2); //dup contents onto the ToS [3]
lua_pushliteral(L, "w+");
lua_replace(L, 2);
// Stack [1] = filename; [2] "w+" [3] contents;
file_open(L);
// Stack [1] = filename; [2] "w+" [3] contents; [4] FD or nil
if (!lua_isnil(L, -1)) {
lua_remove(L, 2); //dump "w+" attribute literal
lua_replace(L, 1);
// Stack [1] = FD; [2] contents
file_write(L);
// Stack [1] = FD; [2] contents; [3] result status
lua_remove(L, 2); //dump contents
file_close(L);
lua_remove(L, 1); // Dump FD leaving status as ToS
}
return 1;
}
// Lua: fsinfo()
static int file_fsinfo( lua_State* L )
{
......@@ -619,62 +645,76 @@ static int file_vol_umount( lua_State *L )
}
static const LUA_REG_TYPE file_obj_map[] =
{
{ LSTRKEY( "close" ), LFUNCVAL( file_close ) },
{ LSTRKEY( "read" ), LFUNCVAL( file_read ) },
{ LSTRKEY( "readline" ), LFUNCVAL( file_readline ) },
{ LSTRKEY( "write" ), LFUNCVAL( file_write ) },
{ LSTRKEY( "writeline" ), LFUNCVAL( file_writeline ) },
{ LSTRKEY( "seek" ), LFUNCVAL( file_seek ) },
{ LSTRKEY( "flush" ), LFUNCVAL( file_flush ) },
{ LSTRKEY( "__gc" ), LFUNCVAL( file_obj_free ) },
{ LSTRKEY( "__index" ), LROVAL( file_obj_map ) },
{ LNILKEY, LNILVAL }
};
static const LUA_REG_TYPE file_vol_map[] =
{
{ LSTRKEY( "umount" ), LFUNCVAL( file_vol_umount )},
//{ LSTRKEY( "getfree" ), LFUNCVAL( file_vol_getfree )},
//{ LSTRKEY( "getlabel" ), LFUNCVAL( file_vol_getlabel )},
//{ LSTRKEY( "__gc" ), LFUNCVAL( file_vol_free ) },
{ LSTRKEY( "__index" ), LROVAL( file_vol_map ) },
{ LNILKEY, LNILVAL }
};
LROT_BEGIN(file_obj)
LROT_FUNCENTRY( close, file_close )
LROT_FUNCENTRY( read, file_read )
LROT_FUNCENTRY( readline, file_readline )
LROT_FUNCENTRY( write, file_write )
LROT_FUNCENTRY( writeline, file_writeline )
LROT_FUNCENTRY( seek, file_seek )
LROT_FUNCENTRY( flush, file_flush )
LROT_FUNCENTRY( __gc, file_obj_free )
LROT_TABENTRY( __index, file_obj )
LROT_END( file_obj, file_obj, LROT_MASK_GC_INDEX )
LROT_BEGIN(file_vol)
LROT_FUNCENTRY( umount, file_vol_umount )
// LROT_FUNCENTRY( getfree, file_vol_getfree )
// LROT_FUNCENTRY( getlabel, file_vol_getlabel )
// LROT_FUNCENTRY( __gc, file_vol_free )
LROT_TABENTRY( __index, file_vol )
LROT_END( file_vol, file_vol, LROT_MASK_GC_INDEX )
// Module function map
static const LUA_REG_TYPE file_map[] = {
{ LSTRKEY( "list" ), LFUNCVAL( file_list ) },
{ LSTRKEY( "open" ), LFUNCVAL( file_open ) },
{ LSTRKEY( "close" ), LFUNCVAL( file_close ) },
{ LSTRKEY( "write" ), LFUNCVAL( file_write ) },
{ LSTRKEY( "writeline" ), LFUNCVAL( file_writeline ) },
{ LSTRKEY( "read" ), LFUNCVAL( file_read ) },
{ LSTRKEY( "readline" ), LFUNCVAL( file_readline ) },
#ifdef BUILD_SPIFFS
{ LSTRKEY( "format" ), LFUNCVAL( file_format ) },
{ LSTRKEY( "fscfg" ), LFUNCVAL( file_fscfg ) },
#define LROT_FUNCENTRY_S(n,f) LROT_FUNCENTRY(n,f)
#else
#define LROT_FUNCENTRY_S(n,f)
#endif
{ LSTRKEY( "remove" ), LFUNCVAL( file_remove ) },
{ LSTRKEY( "seek" ), LFUNCVAL( file_seek ) },
{ LSTRKEY( "flush" ), LFUNCVAL( file_flush ) },
{ LSTRKEY( "rename" ), LFUNCVAL( file_rename ) },
{ LSTRKEY( "exists" ), LFUNCVAL( file_exists ) },
{ LSTRKEY( "fsinfo" ), LFUNCVAL( file_fsinfo ) },
{ LSTRKEY( "on" ), LFUNCVAL( file_on ) },
{ LSTRKEY( "stat" ), LFUNCVAL( file_stat ) },
#ifdef BUILD_FATFS
{ LSTRKEY( "mount" ), LFUNCVAL( file_mount ) },
{ LSTRKEY( "chdir" ), LFUNCVAL( file_chdir ) },
#define LROT_FUNCENTRY_F(n,f) LROT_FUNCENTRY(n,f)
#else
#define LROT_FUNCENTRY_F(n,f)
#endif
{ LNILKEY, LNILVAL }
};
// Module function map
LROT_BEGIN(file)
LROT_FUNCENTRY( list, file_list )
LROT_FUNCENTRY( open, file_open )
LROT_FUNCENTRY( close, file_close )
LROT_FUNCENTRY( write, file_write )
LROT_FUNCENTRY( writeline, file_writeline )
LROT_FUNCENTRY( read, file_read )
LROT_FUNCENTRY( readline, file_readline )
LROT_FUNCENTRY_S( format, file_format )
LROT_FUNCENTRY_S( fscfg, file_fscfg )
LROT_FUNCENTRY( remove, file_remove )
LROT_FUNCENTRY( seek, file_seek )
LROT_FUNCENTRY( flush, file_flush )
LROT_FUNCENTRY( rename, file_rename )
LROT_FUNCENTRY( exists, file_exists )
LROT_FUNCENTRY( getcontents, file_getfile )
LROT_FUNCENTRY( putcontents, file_putfile )
LROT_FUNCENTRY( fsinfo, file_fsinfo )
LROT_FUNCENTRY( on, file_on )
LROT_FUNCENTRY( stat, file_stat )
LROT_FUNCENTRY_F( mount, file_mount )
LROT_FUNCENTRY_F( chdir, file_chdir )
LROT_END( file, NULL, 0 )
int luaopen_file( lua_State *L ) {
luaL_rometatable( L, "file.vol", (void *)file_vol_map );
luaL_rometatable( L, "file.obj", (void *)file_obj_map );
if (!vfs_mount("/FLASH", 0)) {
// Failed to mount -- try reformat
dbg_printf("Formatting file system. Please wait...\n");
if (!vfs_format()) {
NODE_ERR( "\n*** ERROR ***: unable to format. FS might be compromised.\n" );
NODE_ERR( "It is advised to re-flash the NodeMCU image.\n" );
}
}
luaL_rometatable( L, "file.vol", LROT_TABLEREF(file_vol));
luaL_rometatable( L, "file.obj", LROT_TABLEREF(file_obj));
return 0;
}
NODEMCU_MODULE(FILE, "file", file_map, luaopen_file);
NODEMCU_MODULE(FILE, "file", file, luaopen_file);
......@@ -17,7 +17,7 @@
#include "module.h"
#include "lauxlib.h"
#include "platform.h"
#include "c_types.h"
#include <stdint.h>
#include "user_interface.h"
#include "../esp-gdbstub/gdbstub.h"
......@@ -39,11 +39,11 @@ static int lgdbstub_open(lua_State *L) {
}
// Module function map
static const LUA_REG_TYPE gdbstub_map[] = {
{ LSTRKEY( "brk" ), LFUNCVAL( lgdbstub_break ) },
{ LSTRKEY( "gdboutput" ), LFUNCVAL( lgdbstub_gdboutput) },
{ LSTRKEY( "open" ), LFUNCVAL( lgdbstub_open) },
{ LNILKEY, LNILVAL }
};
LROT_BEGIN(gdbstub)
LROT_FUNCENTRY( brk, lgdbstub_break )
LROT_FUNCENTRY( gdboutput, lgdbstub_gdboutput )
LROT_FUNCENTRY( open, lgdbstub_open )
LROT_END( gdbstub, NULL, 0 )
NODEMCU_MODULE(GDBSTUB, "gdbstub", gdbstub_map, NULL);
NODEMCU_MODULE(GDBSTUB, "gdbstub", gdbstub, NULL);
......@@ -6,8 +6,8 @@
#include "lmem.h"
#include "platform.h"
#include "user_interface.h"
#include "c_types.h"
#include "c_string.h"
#include <stdint.h>
#include <string.h>
#include "gpio.h"
#include "hw_timer.h"
......@@ -319,32 +319,32 @@ static int lgpio_serout( lua_State* L )
#undef DELAY_TABLE_MAX_LEN
#ifdef LUA_USE_MODULES_GPIO_PULSE
extern const LUA_REG_TYPE gpio_pulse_map[];
LROT_EXTERN(gpio_pulse);
extern int gpio_pulse_init(lua_State *);
#endif
// Module function map
static const LUA_REG_TYPE gpio_map[] = {
{ LSTRKEY( "mode" ), LFUNCVAL( lgpio_mode ) },
{ LSTRKEY( "read" ), LFUNCVAL( lgpio_read ) },
{ LSTRKEY( "write" ), LFUNCVAL( lgpio_write ) },
{ LSTRKEY( "serout" ), LFUNCVAL( lgpio_serout ) },
LROT_BEGIN(gpio)
LROT_FUNCENTRY( mode, lgpio_mode )
LROT_FUNCENTRY( read, lgpio_read )
LROT_FUNCENTRY( write, lgpio_write )
LROT_FUNCENTRY( serout, lgpio_serout )
#ifdef LUA_USE_MODULES_GPIO_PULSE
{ LSTRKEY( "pulse" ), LROVAL( gpio_pulse_map ) }, //declared in gpio_pulse.c
LROT_TABENTRY( pulse, gpio_pulse )
#endif
#ifdef GPIO_INTERRUPT_ENABLE
{ LSTRKEY( "trig" ), LFUNCVAL( lgpio_trig ) },
{ LSTRKEY( "INT" ), LNUMVAL( INTERRUPT ) },
LROT_FUNCENTRY( trig, lgpio_trig )
LROT_NUMENTRY( INT, INTERRUPT )
#endif
{ LSTRKEY( "OUTPUT" ), LNUMVAL( OUTPUT ) },
{ LSTRKEY( "OPENDRAIN" ), LNUMVAL( OPENDRAIN ) },
{ LSTRKEY( "INPUT" ), LNUMVAL( INPUT ) },
{ LSTRKEY( "HIGH" ), LNUMVAL( HIGH ) },
{ LSTRKEY( "LOW" ), LNUMVAL( LOW ) },
{ LSTRKEY( "FLOAT" ), LNUMVAL( FLOAT ) },
{ LSTRKEY( "PULLUP" ), LNUMVAL( PULLUP ) },
{ LNILKEY, LNILVAL }
};
LROT_NUMENTRY( OUTPUT, OUTPUT )
LROT_NUMENTRY( OPENDRAIN, OPENDRAIN )
LROT_NUMENTRY( INPUT, INPUT )
LROT_NUMENTRY( HIGH, HIGH )
LROT_NUMENTRY( LOW, LOW )
LROT_NUMENTRY( FLOAT, FLOAT )
LROT_NUMENTRY( PULLUP, PULLUP )
LROT_END( gpio, NULL, 0 )
int luaopen_gpio( lua_State *L ) {
#ifdef LUA_USE_MODULES_GPIO_PULSE
......@@ -362,4 +362,4 @@ int luaopen_gpio( lua_State *L ) {
return 0;
}
NODEMCU_MODULE(GPIO, "gpio", gpio_map, luaopen_gpio);
NODEMCU_MODULE(GPIO, "gpio", gpio, luaopen_gpio);
......@@ -3,8 +3,8 @@
#include "lmem.h"
#include "platform.h"
#include "user_interface.h"
#include "c_types.h"
#include "c_string.h"
#include <stdint.h>
#include <string.h>
#include "gpio.h"
#include "hw_timer.h"
#include "pin_map.h"
......@@ -467,31 +467,30 @@ static void gpio_pulse_task(os_param_t param, uint8_t prio)
}
}
static const LUA_REG_TYPE pulse_map[] = {
{ LSTRKEY( "getstate" ), LFUNCVAL( gpio_pulse_getstate ) },
{ LSTRKEY( "stop" ), LFUNCVAL( gpio_pulse_stop ) },
{ LSTRKEY( "cancel" ), LFUNCVAL( gpio_pulse_cancel ) },
{ LSTRKEY( "start" ), LFUNCVAL( gpio_pulse_start ) },
{ LSTRKEY( "adjust" ), LFUNCVAL( gpio_pulse_adjust ) },
{ LSTRKEY( "update" ), LFUNCVAL( gpio_pulse_update ) },
{ LSTRKEY( "__gc" ), LFUNCVAL( gpio_pulse_delete ) },
{ LSTRKEY( "__index" ), LROVAL( pulse_map ) },
{ LNILKEY, LNILVAL }
};
const LUA_REG_TYPE gpio_pulse_map[] =
{
{ LSTRKEY( "build" ), LFUNCVAL( gpio_pulse_build ) },
{ LSTRKEY( "__index" ), LROVAL( gpio_pulse_map ) },
{ LNILKEY, LNILVAL }
};
LROT_BEGIN(pulse)
LROT_FUNCENTRY( getstate, gpio_pulse_getstate )
LROT_FUNCENTRY( stop, gpio_pulse_stop )
LROT_FUNCENTRY( cancel, gpio_pulse_cancel )
LROT_FUNCENTRY( start, gpio_pulse_start )
LROT_FUNCENTRY( adjust, gpio_pulse_adjust )
LROT_FUNCENTRY( update, gpio_pulse_update )
LROT_FUNCENTRY( __gc, gpio_pulse_delete )
LROT_TABENTRY( __index, pulse )
LROT_END( pulse, pulse, LROT_MASK_GC_INDEX )
LROT_PUBLIC_BEGIN(gpio_pulse)
LROT_FUNCENTRY( build, gpio_pulse_build )
LROT_TABENTRY( __index, gpio_pulse )
LROT_END( gpio_pulse, gpio_pulse, LROT_MASK_INDEX )
int gpio_pulse_init(lua_State *L)
{
luaL_rometatable(L, "gpio.pulse", (void *)pulse_map);
luaL_rometatable(L, "gpio.pulse", LROT_TABLEREF(pulse));
tasknumber = task_get_id(gpio_pulse_task);
return 0;
}
//NODEMCU_MODULE(GPIOPULSE, "gpiopulse", gpio_pulse_map, gpio_pulse_init);
NODEMCU_MODULE(GPIOPULSE, "gpiopulse", gpio_pulse, gpio_pulse_init);
......@@ -7,9 +7,9 @@
#include "module.h"
#include "lauxlib.h"
#include "platform.h"
#include "c_stdlib.h"
#include "c_string.h"
#include "c_math.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
static const uint32_t hdc1080_i2c_id = 0;
static const uint8_t hdc1080_i2c_addr = 0x40;
......@@ -99,10 +99,10 @@ static int hdc1080_read(lua_State* L) {
return 2;
}
static const LUA_REG_TYPE hdc1080_map[] = {
{ LSTRKEY( "read" ), LFUNCVAL( hdc1080_read )},
{ LSTRKEY( "setup" ), LFUNCVAL( hdc1080_setup )},
{ LNILKEY, LNILVAL}
};
LROT_BEGIN(hdc1080)
LROT_FUNCENTRY( read, hdc1080_read )
LROT_FUNCENTRY( setup, hdc1080_setup )
LROT_END( hdc1080, NULL, 0 )
NODEMCU_MODULE(HDC1080, "hdc1080", hdc1080_map, NULL);
NODEMCU_MODULE(HDC1080, "hdc1080", hdc1080, NULL);
......@@ -6,8 +6,8 @@
#include "module.h"
#include "lauxlib.h"
#include "platform.h"
#include "c_stdlib.h"
#include "c_string.h"
#include <stdlib.h>
#include <string.h>
static const uint32_t hmc5883_i2c_id = 0;
static const uint8_t hmc5883_i2c_addr = 0x1E;
......@@ -89,10 +89,10 @@ static int hmc5883_read(lua_State* L) {
return 3;
}
static const LUA_REG_TYPE hmc5883_map[] = {
{ LSTRKEY( "read" ), LFUNCVAL( hmc5883_read )},
{ LSTRKEY( "setup" ), LFUNCVAL( hmc5883_setup )},
{ LNILKEY, LNILVAL}
};
LROT_BEGIN(hmc5883)
LROT_FUNCENTRY( read, hmc5883_read )
LROT_FUNCENTRY( setup, hmc5883_setup )
LROT_END( hmc5883, NULL, 0 )
NODEMCU_MODULE(HMC5883L, "hmc5883l", hmc5883_map, NULL);
NODEMCU_MODULE(HMC5883L, "hmc5883l", hmc5883, NULL);
......@@ -3,12 +3,12 @@
* vowstar@gmail.com
* 2015-12-29
*******************************************************************************/
#include <c_stdlib.h>
#include <stdlib.h>
#include "module.h"
#include "lauxlib.h"
#include "platform.h"
#include "cpu_esp8266.h"
#include "httpclient.h"
#include "http/httpclient.h"
static int http_callback_registry = LUA_NOREF;
......@@ -92,7 +92,7 @@ static void http_callback( char * response, int http_status, char ** full_respon
}
if (full_response_p && *full_response_p) {
c_free(*full_response_p);
free(*full_response_p);
*full_response_p = NULL;
}
......@@ -269,17 +269,17 @@ static int http_lapi_get( lua_State *L )
}
// Module function map
static const LUA_REG_TYPE http_map[] = {
{ LSTRKEY( "request" ), LFUNCVAL( http_lapi_request ) },
{ LSTRKEY( "post" ), LFUNCVAL( http_lapi_post ) },
{ LSTRKEY( "put" ), LFUNCVAL( http_lapi_put ) },
{ LSTRKEY( "delete" ), LFUNCVAL( http_lapi_delete ) },
{ LSTRKEY( "get" ), LFUNCVAL( http_lapi_get ) },
LROT_BEGIN(http)
LROT_FUNCENTRY( request, http_lapi_request )
LROT_FUNCENTRY( post, http_lapi_post )
LROT_FUNCENTRY( put, http_lapi_put )
LROT_FUNCENTRY( delete, http_lapi_delete )
LROT_FUNCENTRY( get, http_lapi_get )
{ LSTRKEY( "OK" ), LNUMVAL( 0 ) },
{ LSTRKEY( "ERROR" ), LNUMVAL( HTTP_STATUS_GENERIC_ERROR ) },
LROT_NUMENTRY( OK, 0 )
LROT_NUMENTRY( ERROR, HTTP_STATUS_GENERIC_ERROR )
{ LNILKEY, LNILVAL }
};
LROT_END( http, NULL, 0 )
NODEMCU_MODULE(HTTP, "http", http_map, NULL);
NODEMCU_MODULE(HTTP, "http", http, NULL);
......@@ -4,8 +4,8 @@
#include "module.h"
#include "lauxlib.h"
#include "platform.h"
#include "c_stdlib.h"
#include "c_string.h"
#include <stdlib.h>
#include <string.h>
#include "user_interface.h"
static uint8_t data_pin;
static uint8_t clk_pin;
......@@ -66,15 +66,15 @@ static int ICACHE_FLASH_ATTR hx711_read(lua_State* L) {
}
// Module function map
static const LUA_REG_TYPE hx711_map[] = {
{ LSTRKEY( "init" ), LFUNCVAL( hx711_init )},
{ LSTRKEY( "read" ), LFUNCVAL( hx711_read )},
{ LNILKEY, LNILVAL}
};
LROT_BEGIN(hx711)
LROT_FUNCENTRY( init, hx711_init )
LROT_FUNCENTRY( read, hx711_read )
LROT_END( hx711, NULL, 0 )
int luaopen_hx711(lua_State *L) {
// TODO: Make sure that the GPIO system is initialized
return 0;
}
NODEMCU_MODULE(HX711, "hx711", hx711_map, luaopen_hx711);
NODEMCU_MODULE(HX711, "hx711", hx711, luaopen_hx711);
......@@ -15,13 +15,16 @@ static int i2c_setup( lua_State *L )
MOD_CHECK_ID( gpio, sda );
MOD_CHECK_ID( gpio, scl );
if(scl==0 || sda==0)
return luaL_error( L, "no i2c for D0" );
if ( sda == 0 )
return luaL_error( L, "i2c SDA on D0 is not supported" );
s32 speed = ( s32 )luaL_checkinteger( L, 4 );
if (speed <= 0)
if ( speed <= 0 )
return luaL_error( L, "wrong arg range" );
lua_pushinteger( L, platform_i2c_setup( id, sda, scl, (u32)speed ) );
speed = platform_i2c_setup( id, sda, scl, (u32)speed );
if ( speed == 0 )
return luaL_error( L, "failed to initialize i2c %d", id );
lua_pushinteger( L, speed );
return 1;
}
......@@ -31,7 +34,10 @@ static int i2c_start( lua_State *L )
unsigned id = luaL_checkinteger( L, 1 );
MOD_CHECK_ID( i2c, id );
platform_i2c_send_start( id );
if (platform_i2c_configured( id ) )
platform_i2c_send_start( id );
else
luaL_error( L, "i2c %d is not configured", id );
return 0;
}
......@@ -140,18 +146,19 @@ static int i2c_read( lua_State *L )
}
// Module function map
static const LUA_REG_TYPE i2c_map[] = {
{ LSTRKEY( "setup" ), LFUNCVAL( i2c_setup ) },
{ LSTRKEY( "start" ), LFUNCVAL( i2c_start ) },
{ LSTRKEY( "stop" ), LFUNCVAL( i2c_stop ) },
{ LSTRKEY( "address" ), LFUNCVAL( i2c_address ) },
{ LSTRKEY( "write" ), LFUNCVAL( i2c_write ) },
{ LSTRKEY( "read" ), LFUNCVAL( i2c_read ) },
//{ LSTRKEY( "FAST" ), LNUMVAL( PLATFORM_I2C_SPEED_FAST ) },
{ LSTRKEY( "SLOW" ), LNUMVAL( PLATFORM_I2C_SPEED_SLOW ) },
{ LSTRKEY( "TRANSMITTER" ), LNUMVAL( PLATFORM_I2C_DIRECTION_TRANSMITTER ) },
{ LSTRKEY( "RECEIVER" ), LNUMVAL( PLATFORM_I2C_DIRECTION_RECEIVER ) },
{ LNILKEY, LNILVAL }
};
NODEMCU_MODULE(I2C, "i2c", i2c_map, NULL);
LROT_BEGIN(i2c)
LROT_FUNCENTRY( setup, i2c_setup )
LROT_FUNCENTRY( start, i2c_start )
LROT_FUNCENTRY( stop, i2c_stop )
LROT_FUNCENTRY( address, i2c_address )
LROT_FUNCENTRY( write, i2c_write )
LROT_FUNCENTRY( read, i2c_read )
LROT_NUMENTRY( FASTPLUS, PLATFORM_I2C_SPEED_FASTPLUS )
LROT_NUMENTRY( FAST, PLATFORM_I2C_SPEED_FAST )
LROT_NUMENTRY( SLOW, PLATFORM_I2C_SPEED_SLOW )
LROT_NUMENTRY( TRANSMITTER, PLATFORM_I2C_DIRECTION_TRANSMITTER )
LROT_NUMENTRY( RECEIVER, PLATFORM_I2C_DIRECTION_RECEIVER )
LROT_END( i2c, NULL, 0 )
NODEMCU_MODULE(I2C, "i2c", i2c, NULL);
......@@ -6,8 +6,8 @@
#include "module.h"
#include "lauxlib.h"
#include "platform.h"
#include "c_stdlib.h"
#include "c_string.h"
#include <stdlib.h>
#include <string.h>
static const uint32_t i2c_id = 0;
static const uint8_t i2c_addr = 0x69;
......@@ -79,10 +79,10 @@ static int l3g4200d_read(lua_State* L) {
return 3;
}
static const LUA_REG_TYPE l3g4200d_map[] = {
{ LSTRKEY( "read" ), LFUNCVAL( l3g4200d_read )},
{ LSTRKEY( "setup" ), LFUNCVAL( l3g4200d_setup )},
{ LNILKEY, LNILVAL}
};
LROT_BEGIN(l3g4200d)
LROT_FUNCENTRY( read, l3g4200d_read )
LROT_FUNCENTRY( setup, l3g4200d_setup )
LROT_END( l3g4200d, NULL, 0 )
NODEMCU_MODULE(L3G4200D, "l3g4200d", l3g4200d_map, NULL);
NODEMCU_MODULE(L3G4200D, "l3g4200d", l3g4200d, NULL);
......@@ -204,14 +204,14 @@ static int mcp4725_read(lua_State* L){
}
static const LUA_REG_TYPE mcp4725_map[] = {
{ LSTRKEY( "write" ), LFUNCVAL( mcp4725_write ) },
{ LSTRKEY( "read" ), LFUNCVAL( mcp4725_read ) },
{ LSTRKEY( "PWRDN_NONE" ), LNUMVAL(MCP4725_POWER_DOWN_NORMAL) },
{ LSTRKEY( "PWRDN_1K" ), LNUMVAL((MCP4725_POWER_DOWN_RES_1K)>>1) },
{ LSTRKEY( "PWRDN_100K" ), LNUMVAL((MCP4725_POWER_DOWN_RES_100K)>>1) },
{ LSTRKEY( "PWRDN_500K" ), LNUMVAL((MCP4725_POWER_DOWN_RES_500K)>>1) },
{ LNILKEY, LNILVAL}
};
NODEMCU_MODULE(MCP4725, "mcp4725", mcp4725_map, NULL);
LROT_BEGIN(mcp4725)
LROT_FUNCENTRY( write, mcp4725_write )
LROT_FUNCENTRY( read, mcp4725_read )
LROT_NUMENTRY( PWRDN_NONE, MCP4725_POWER_DOWN_NORMAL )
LROT_NUMENTRY( PWRDN_1K, MCP4725_POWER_DOWN_RES_1K>>1 )
LROT_NUMENTRY( PWRDN_100K, MCP4725_POWER_DOWN_RES_100K>>1 )
LROT_NUMENTRY( PWRDN_500K, MCP4725_POWER_DOWN_RES_500K>>1 )
LROT_END( mcp4725, NULL, 0 )
NODEMCU_MODULE(MCP4725, "mcp4725", mcp4725, NULL);
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