Commit Graph

1820 Commits

Author SHA1 Message Date
Marcel Stör 3acb6b7c79
Add node.bootreason (#3413) 2021-04-02 08:03:17 +02:00
Nate Clark ef5d9ff405 Bump ESP-IDF to 3.3.4 2021-03-24 15:28:59 +01:00
tomsci 6ba98f348d
Add uart.txflush() (#3390) 2021-02-14 08:43:20 +01:00
jmdasnoy fb12af06e7
Fix I2C timeout (#3377) 2021-01-22 13:01:21 +01:00
tomsci d5f0094576
Add node.sleep()(#3370)
Supporting wakeup from (non-EXT1) GPIO, UART, ULP, timer and touch
2021-01-17 09:00:12 +01:00
Kit Klein 830366188d
Add node.osoutput() method for ESP32 (#3363) 2021-01-05 12:34:35 +01:00
Kit Klein 1b77d5d3b5 ensure tmr ref is valid before cb occurs 2021-01-05 11:08:26 +00:00
Marcel Stör 7c07f91483 Reset user version values
Undos changes from #3135
2020-09-17 18:17:24 +02:00
Nathaniel Wesley Filardo dd3b217df2
Kconfig: rename LUA_MODULE_* to NODEMCU_CMODULE_* (#3135)
Using the NODEMCU_ namespace prefix makes it obvious that these are not
part of Lua proper (contrast, e.g., LUA_BUILTIN_STRING).  Using
"CMODULE" gives us room to differentiate between modules whose
implementation is in C and whose implemenation is in Lua ("LMODULE").

The ESP8266 branch can adopt the same convention when it moves to
Kconfig; see https://github.com/nodemcu/nodemcu-firmware/issues/3130
2020-08-23 22:49:18 +02:00
Marcel Stör 572f731b61
Update build.md 2020-08-23 21:56:18 +02:00
tomsci fa2348f36b
Support for GPIO wakeup in node.dsleep() (#3115) 2020-08-22 10:32:45 +02:00
M.K 8db97c0f52
Fix method name encoder.fromBase64 in example code (#3247) 2020-08-22 10:31:08 +02:00
David Thornley 7774b5fa30
Fix bthci compilation issue (#3201)
Manifests as multiple definition of esp_event_send during compilation, as bthci triggers inclusion of `event_loop.c`. Also improved lbth_init() to support BTDM or BLE_ONLY controller modes.
2020-08-03 13:39:42 +02:00
Javier Peletier 084d6cabc5
Add support for external modules (#3100) 2020-07-27 19:08:19 +02:00
Marcel Stör cd53865c78
Bump ESP-IDF to 3.3.2 LTS (#3196) 2020-07-08 08:46:16 +02:00
kiritnarain 04e01fd4ef
Fix conflict between documentation and example for method newChannel() (#3184)
It now correctly uses ledc.newChannel() and saves the return value instead of invoking ledc.setup().
2020-06-30 13:52:12 +02:00
Marcel Stör 6fe68679af Revert "Bump toolchain to 20190731.0"
This reverts commit f93c9efa09.
2020-06-20 22:38:36 +02:00
Marcel Stör f93c9efa09
Bump toolchain to 20190731.0 2020-06-20 22:32:55 +02:00
Javier Peletier f4887bf134
JTAG debugging quick guide for Linux (#3088) 2020-05-18 19:58:15 +02:00
tomsci b8e8ffa53a
Expose gpio_set_drive_capability API to Lua (#3099) 2020-05-18 19:56:43 +02:00
Marcel Stör 189fe9646f
Correct level value in gpio.trig() callback (#2883) 2020-05-02 21:18:17 +02:00
Tom Sutcliffe b4c94fa8ae Correct level value in gpio.trig() callback (#2883) 2020-05-01 15:21:15 +01:00
Marcel Stör 43588c1646
Address build error when path contains whitespace #3083 2020-04-30 13:31:50 +02:00
David Thornley 2a9bf13ab8 Address build error when path contains whitespace
The path environment under Windows Subsystem for Linux typically 
contains paths with spaces.

Error Manifests as: -

Setting IDF_PATH and re-invoking...
/bin/sh: 1: Syntax error: "(" unexpected
Makefile:21: recipe for target 'flash' failed

Tested on Ubuntu 18.04 both on Linux proper and WSL.
2020-04-29 23:38:29 +10:00
tomsci f7b8cf018e
Unref gpio.trig callbacks when type=INTR_DISABLE (#3072)
Fixes #2880
2020-04-27 14:29:08 +02:00
Kit Klein a8b46af905
Correct wifi auth types for esp32 (#3047)
Correcting the AP config auth types.  The ones defined in the current documentation don't seem to exist.
2020-02-26 12:30:22 +01:00
Marcel Stör 1e177194b0 Fix doc header 2020-02-11 23:30:20 +01:00
Marcel Stör 035bef406a Fix formatting and function sorting 2020-02-09 23:50:33 +01:00
Marcel Stör c923588b13
Update ESP-IDF to v3.3.1 (#2898) 2020-01-19 13:15:22 +01:00
Marcel Stör fb3ffe397a Revert "Upgrade ESP-IDF to tag v3.3.1"
This reverts commit f54d110f9a.
2020-01-06 13:52:56 +01:00
Marcel Stör f54d110f9a Upgrade ESP-IDF to tag v3.3.1 2020-01-06 13:48:39 +01:00
M.K e18bd24f1e Auto-detect CPU architecture for make (#2999)
The repo we download from only has x86_64 anyway currently, but a
download error will be much more informative than bogus errors from
an incompatible compiler.
2020-01-06 13:43:52 +01:00
M.K aef9ea16a3 Auto-install SDK if user forgot to. (#2994) (#2998) 2020-01-05 08:26:18 +01:00
f4grx bfd2259165 Avoid the use of invalid GPIOS when setting up a one-wire bus. (#2934)
Fixes #2933
2019-10-29 22:34:15 +01:00
John Lauer 9a5327cab1 Add touch sensor module (#2863)
* Touch module 1st checkin
* ESP32. Check-in 2 for Touch sensor module
* ESP32: Touch module. Sample Lua code.
* ESP32: Latest YouTube vid
* ESP32: Touch docs update
* Added opt_* methods for value retrieval
2019-10-27 19:49:56 +01:00
Johny Mattsson b0558d5bbe
Fix uart regressions & bugs (#2817)
* Fix uart regressions & bugs.

Using `uart.on()` with a search character was broken in that it did
not invoke the callback on a full UART buffer as documented. Logic reworked
to match docs again.

Fixed memory leak on `task_post()` failure (eep!).

Improved logic to attempt to coalesce input bytes to reduce the number of
`task_post()` slots used up by the platform uart.

Finally, added a semaphore to prevent the platform uart from overrunning
the `task_post()` slots all the time on high baud rates (e.g. 1mbit).
With the semaphore in there, the LVM RTOS task gets a chance to actually
process the received data and free up a `task_post()` slot or two.
The above mentioned read coalescing then allows the platform uart to
immediately catch up.

Also added an error log message if the `task_post()` actually does fail.

* Don't cache the uart delims.

Doing so makes reconfiguring those settings from within the callback not
take effect until the currently buffered bytes have been processed.
2019-10-13 09:49:44 +11:00
f4grx a4fa6c5cd3 Fix the ug8 and ucg modules broken by eaac369. (#2927) 2019-09-27 12:29:43 +10:00
Arnim Läuger d20778ed09
Support eth boards without power pin, extend docs (#2855)
* fix handling of optional power pin

* add init example for wESP32

* add example for eth.on()
2019-08-12 22:31:19 +02:00
Marcel Stör 7ad6bc1be7
Upgrade toolchains (#2869) 2019-08-01 21:29:16 +02:00
Javier Peletier b5146f8883 Added required libraries to build env setup instructions (#2844) 2019-07-23 18:38:27 +10:00
Johny Mattsson eaac369dec
LFS support for ESP32 NodeMCU (#2801)
* Port LFS from ESP8266 to ESP32
2019-07-22 19:13:43 +10:00
Arnim Läuger 7cb61a27d2 Esp32 eth (#2820)
Ethernet module added.
2019-07-20 12:47:43 +10:00
Johny Mattsson d8131bc407 Minor esp32 fixes (#2837)
* Move task_post() into IRAM so it can be used by IRAM'd ISRs.

* Don't leave crud on stack on pcall error.
2019-07-19 21:16:46 +02:00
Johny Mattsson f44e6e9639 Fix net module data loss & RTOS task unsafety (#2829)
To avoid races between the lwIP callbacks (lwIP RTOS task) and the Lua
handlers (LVM RTOS task), the data flow and ownership has been simplified
and cleaned up.

lwIP callbacks now have no visibility of the userdata struct. They are
limited to creating small event objects and task_post()ing them over
to the LVM "thread", passing ownership in doing so. The shared identifier
then becomes the struct netconn*.

On the LVM side, we keep a linked list of active userdata objects. This
allows us to retrieve the correct userdata when we get an event with
a netconn pointer. Because this list is only ever used within the LVM
task, no locking is necessary.

The old approach of stashing a userdata pointer into the 'socket' field
on the netconn has been removed entirely, as this was both not
thread/RTOS-task safe, and also interfered with the IDFs internal use
of the socket field (even when using only the netconn layer). As an
added benefit, this removed the need for all the SYS_ARCH_PROTECT()
locking stuff.

The need to track receive events before the corresponding userdata object
has been established has been removed by virtue of not reordering the
"accept" and the "recv" events any more (previously accepts were posted
with medium priority, while the receives where high priority, leading
to the observed reordering and associated headaches).

The workaround for IDF issue 784 has been removed as it is now not needed
and is in fact directly harmful as it results in a double-free. Yay for
getting rid of old workarounds!

DNS resolution code paths were merged for the two instances of "socket"
initiated resolves (connect/dns functions).

Also fixed an instance of using a stack variable for receiving the resolved
IP address, with said variable going out of scope before the DNS resolution
necessarily completed (hello, memory corruption!).

Where possible, moved to use the Lua allocator rather than plain malloc.

Finally, the NodeMCU task posting mechanism got a polish and an adjustment.
Given all the Bad(tm) that tends to happen if something fails task posting,
I went through a couple of iterations on how to avoid that. Alas, the
preferred solution of blocking non-LVM RTOS tasks until a slot is free
turned out to not be viable, as this easily resulted in deadlocks with the
lwIP stack. After much deliberation I settled on increasing the number of
available queue slots for the task_post() mechanism, but in the interest
of user control also now made it user configurable via Kconfig.
2019-07-14 23:20:20 +02:00
Johny Mattsson c0145e03f9 Fix net module losing TCP data. (#2825)
The netbuf_data() function only returns data from the first pbuf in the
chain. We need to use netbuf_first() and netbuf_next() to walk the
pbuf chain and act on each in turn.
2019-07-11 09:43:25 +02:00
John Lauer fead54e744 Add video walk through of build process (#2826) 2019-07-10 19:55:19 +02:00
devsaurus d92d300577 add otaupgrade.md 2019-07-06 14:22:02 +02:00
Johny Mattsson ca89bff073 OTA support for ESP32 (#2812)
* Implemented otaupgrade module.

* Added partition table example for otaupgrade.

* Copy-paste omission. Whoops.

* Updated otaupgrade docs after review.
2019-07-06 14:21:08 +02:00
Johny Mattsson e11087bfdf Improved crypto module for ESP32, now with HMAC (#2815)
* Leaner, meaner crypto module; now with HMAC

Based on my testing, mbedtls pulls in all its algorithm regardless of
whether the NodeMCU crypto module was using them or not. As such, the
space savings from omitting algorithms were only in the tens of bytes.

By switching to using the mbedtls generic message digest interface, the
crypto module itself could be shrunk in size and complexity. Despite
adding support for HMAC on all algorithms (plus including RIPEMD160),
this version is 330 bytes smaller.

* Updated crypto module docs.

* Removed superfluous brackets in crypto docs.

Copy-paste considered harmful... >.>
2019-07-04 23:24:59 +02:00
devsaurus 1f1eeaf358 fix unref default file descriptor while still in use 2019-07-03 23:54:08 +02:00