Commit Graph

2433 Commits

Author SHA1 Message Date
Fivefold 2f452b22b4
Doc update for bme280.lua (#3384)
- Changed the note about bme280_math dependency into a blue note box, like in the [bh1750 documentation](https://nodemcu.readthedocs.io/en/release/lua-modules/bh1750/)
- Added a paragraph on differentiating between BMP280 and BME280 sensors. It put it in an orange caution box for now, might be too visible for a rare problem.
- Small fixes in bme280.setup() description
2021-01-24 20:33:46 +01:00
Philip Gladstone fc1085084f
Add test board documentation (#3359) 2021-01-21 21:38:38 +01:00
Nathaniel Wesley Filardo 6316b33296
More NTest prep work for eventual test harness (#3353)
* Rename to tests/README.md

* Expand tests/README.md a bit

* NTest: remove report() in favor of named fields

Use a metatable to provide defaults which can be shadowed by the calling
code.

* NTest: remove old interface flag

I think we have few enough tests that we can verify not needing this
alert for ourselves.

* NTest tests: new standard prelude

Allow for NTest constructor to be passed in to the test itself.
The test harness can use this to provide a wrapper that will
pre-configure NTest itself.

* NTest output handler for TAP messages

* expect tests: core library functions

* expect tests: file xfer TCL module

* expect tests: add TAP-based test runner

* Begin documenting TCL goo

* Add .gitattributes to make sure lineends are correct ...

... if checked out under windows and executed under linux (say docker)

* tests/README: enumerate dependencies

* tests: more README.md

Co-authored-by: Gregor Hartmann <HHHartmann@users.noreply.github.com>
2021-01-16 21:26:22 +00:00
Nathaniel Wesley Filardo c3dd27cf9c
LiquidCrystal robustness and test (#3369)
* LiquidCrystal I2C 4-bit robustness

- Fix up some formatting
- Initialization is now more conformant with the datasheet.
- Read-backs don't needlessly (or erroneously!) store back

While here, document some unexpected behaviour of read-back commands.

* liquidcrystal i2c 4bit NTest
2021-01-13 02:36:00 +00:00
Nathaniel Wesley Filardo 109f500be7
More LED fixes (#3368)
* apa102: remove dead code

We can't store strings of hundreds of thousands of characters in RAM, so
this can't possibly have fired, historically.  Pixbufs are still RAM
objects, so that's still out.  With LFS, it would take a pathological
example to hit the required 400KB TSTRING.

* Add IRQ management functions

* ws2812: fill UART FIFOs with IRQs off

Refactor code to make the use of two fill loops less gross.
2021-01-10 17:19:10 +00:00
Gregor Hartmann 4023df7e60
fix regression in luaL_typerror and Change NTest so it can run tests on the host emulating node.task.post (#3357)
* Change NTest so it can run tests on the host emulating node.task.post
* Add executing first host test
* Regression: fix luaL_typerror
2021-01-09 22:25:22 +01:00
Gregor Hartmann 53fc7170bd
Add CI check to verify MkDocs menu items (#3367) 2021-01-08 23:39:47 +01:00
Gregor Hartmann c4aaa9e0a7
Add pixbuf to doc index
I am sure I have seen this in the PR at some time
2021-01-07 19:16:11 +01:00
Nathaniel Wesley Filardo 85df6b588d
LED strip refactor (#3158)
`ws2812` buffer extracted to new `pixbuf` module.

* The new pixbuf module has more functionality than the `ws2812`-specific buffer it replaces.
* This is work in progress towards https://github.com/nodemcu/nodemcu-firmware/issues/2916
* The LED driver modules `ws2812`, `ws2801`, `apa102`, and `tm1829` have sprouted `pixbuf` support.
* `NTest` tests for `pixbuf` now exist.

While here, document the ws2812 UART-based overlapping with mainline
execution.  Fixes https://github.com/nodemcu/nodemcu-firmware/issues/3140

Co-authored-by: Gregor Hartmann <HHHartmann@users.noreply.github.com>
2021-01-06 23:35:34 +00:00
M.K 9a26e0a94b
Makefiles: Validate LUA selection or refer to the other Makefile. (#3269) 2021-01-06 03:57:50 +01:00
Jedrzej Potoniec 9e08be7b28 httpserver: fix memory leak
There was a memory leak related to not dropping all references to
fifosock's ssend.
2021-01-05 11:07:47 +00:00
Nathaniel Wesley Filardo c695a451ee
First round of MQTT fixes (#3360)
* mqtt: remove concept of connection timeout

Just rely on the network stack to tell us when things have gone south.

* mqtt: remove write-only mqtt_state.port field

* mqtt: drop useless conditional

* mqtt: decouple message sent flag from timer

* mqtt: reconnect callback does not need to hang up

The network stack has certainly done that for us at this point.
Similarly, since we're about to call mqtt_socket_disconnected, don't
bother unregistering the timer here, either.

* mqtt: don't tick once per second

Set the timer for the duration of the wait and cancel it on the other side.

* mqtt: defer message queue destruction to _disconnect

We're going to want to publish a disconnect message for real, so doing
this in _close does no one any favors

* mqtt: miscellaneous cleanups

No functional change intended

* mqtt: close() should send disconnect message for real

This means waiting for _sent() to fire again before telling the network
stack to disconnect.

* mqtt: tidy connect and dns

- Push the self-ref to after all allocations and error returns

- Don't try to extract IPv4 from the domain string ourselves, let the
  resolver, since it can

- Don't try to connect to localhost.  That can't possibly work.

* mqtt: common up some callback invocations

* mqtt: don't retransmit messages on timeout

There's no point in retransmitting messages on timeout; the network
stack will be trying to do it for us anyway.

* mqtt: remove unnecessary NULL udata checks

* mqtt: hold strings in Lua, not C

Eliminates a host of C-side allocations.

While here, move the rest of the mqtt_connect_info structure out to its
own thing, and pack some flags using a bitfield.

* mqtt: mqtt_socket_on use lua_checkoption

* mqtt: slightly augment debug messages

These changes have made some debugging ever so slightly easier.
2021-01-05 12:07:09 +01:00
Gregor Hartmann 18d24364db
convert mispec tests to NTest and remove mispec (#3358)
* convert mispec tests to NTest and remove mispec

* fix luacheck
2020-12-31 15:54:32 +00:00
Nathaniel Wesley Filardo c2b3710f60
Add pipeutils example (#3354)
These have been handy within the test harness for streaming files and
LFS images across to the DUTs.

Add nrec method to pipe

Co-authored-by: Gregor Hartmann <HHHartmann@users.noreply.github.com>
2020-12-29 08:54:54 +01:00
Lukáš Voborský 0ef609d8f4
Add Somfy receiver (#3320) 2020-12-28 00:04:32 +01:00
Gregor Hartmann 0fb2a121c1
Add GitHub Actions (#3337)
Will build in parallel and covers more environments than the Travis build.
2020-12-25 23:35:00 +01:00
Nathaniel Wesley Filardo b1d318de62
NFC: Backport luaL_testudata to Lua 5.1 (#3352)
And move luaL_checkudata to it, as in 5.3.
2020-12-24 08:39:08 +01:00
Lukáš Voborský 9c1f4aca5b Fix DHT module (#3334)
* DHT module negative values bug fix
* Revamp of the DHT module, DHT12 support
* Updated documentation
2020-12-16 23:20:09 +01:00
Lukáš Voborský f4ba635d3c
Fix softuart module setup function parameters (#3348) 2020-12-16 12:56:55 +01:00
Philip Gladstone 432fe49612
Convert test documentation to Markdown (#3346)
* COnvert the rst to md...

* CLeanup the automatic conversion

* Try and make the tables work

* And again

* Get rid of the end-of-table marker
2020-12-12 03:24:31 +00:00
Gregor Hartmann ad8f82c6e2
fix search path for lua require (#3336) 2020-11-25 19:07:17 +00:00
Gregor Hartmann 63d82131a7
Doc fixes (#3333) 2020-11-25 12:53:46 +01:00
Nathaniel Wesley Filardo 49b09d050e
Basic hardware test examples for adc and gpio + define hardware setup (#3324) 2020-11-15 16:01:15 +01:00
Gregor Hartmann 02dcc235c9
Allow turning off softwd again as documented (#3327)
* Allow turning off softwd again as documented

* fix luacheck warnings

* fix outcome of review
2020-11-13 11:11:29 +00:00
Lukáš Voborský d279ba2fd9
BME280 Lua module - `(config[3] & 0xFC) | BME280_FORCED_MODE` workaround bug fix (#3325) 2020-11-11 22:07:20 +00:00
Gregor Hartmann c4baa9f3b9
Create NodeMCU test system based on gambiarra (#2984)
* Create mispec_file.lua

* Initial commit of gambiarra

* Adapt gambiarra to NodeMCU

* adapt to NodeMCU spacing and add nok functionality

* Some refactoring to make it easier to add new functionality

* Add methode `fail` to check failing code and pass error messages to output

- fail can be called with a function that should fail and a string which should be contained in the errormessage.
- Pass failed check reasons to output.

* Create gambiarra_file.lua

* Add reporting of tests that failed with Lua error

* ok, nok and fail will terminate the running test

* Add capability to run sync and async tests in mixed order and have a task.post inbetween them

* fix gambiarra self test to also run on device (not only host)

Use less ram in checking tests directly after they ran.
Use nateie task.post to tame watchdog.

* Update file tests + add async tmr tests

* Another fix in executing async test

* Catch errors in callbacks using node.setonerror

* change interface to return an object with several test methods

* Update README.md

* Change interface of Gambiarra + add reason for failed eq

* Update gambiarra documentation

* Add coroutine testcases to gambiarra

* Delete mispec_file.lua as it is superseeded by gambiarra_file.lua

* improve regexp for stack frame extraction

* Use Lua 53 debug capabilities

* move actual tests upfront

* remove debug code + optimization

* Show errors immediately instead of at the end of the test, freeing memory earlier

* Split tests to be run in 2 tranches

* rename to NTest and move to new location

* Add tests to checking mechanisms

* Add luacheck to tests

* Some pushing around of files

* more (last) fixes and file juggling

* Minor tweaks and forgotten checkin

* Add NTest selftest to travis

* Trying how to master travis

* another try

* restrict NTest selftest to linux
2020-11-08 14:31:11 +00:00
Lukáš Voborský b9b5815e97
DS18B20 Lua module (#3150) 2020-11-07 22:41:16 +01:00
Philip Gladstone f67792e0d3
Add support for using doubles in the LUA53 build. (#3225) 2020-11-07 22:38:40 +01:00
Gregor Hartmann 4f6792773f Fix ftpserver documentation and some formating in httpserver.md (#3322) 2020-11-07 16:23:43 +01:00
Marcel Stör 1503e280e1 Replace master with release 2020-11-07 16:23:43 +01:00
Nathaniel Wesley Filardo 0cafaca4cb MCP23017 module refactorings to save some heap (#3317)
* mcp23017: functions to metatable

Avoids closures for each module.

* mcp23017: inline constants

Saves nearly half a kilobyte of heap.
2020-11-07 16:23:43 +01:00
Marcel P 7f30381301 Add mcp23017 Lua module (#3197) 2020-11-07 16:23:43 +01:00
Nathaniel Wesley Filardo 29e5108876 Further adaptation of lfs/_init.lua
See https://github.com/nodemcu/nodemcu-firmware/issues/3278 .  Thanks to
@vsky279 and @bazooka07 for suggestions.
2020-11-07 16:23:43 +01:00
Nathaniel Wesley Filardo 3a17258d39 pipe: comment and style fixes (NFC)
Reflow comments to 80 columns; fix some typos and other nits.
2020-11-07 16:23:43 +01:00
Nathaniel Wesley Filardo a97d8f114c pipe: fix unread buffer chunk management
unread contained two subtle bugs:

 - it created a buffer chunk at pipe[1], when that position is reserved
   for the pipe reader function.  Because it shifted pipe[i] to
   pipe[i+1], including pipe[1], this was likely to manifest as the pipe
   later attempting to dequeue a function rather than a buffer chunk
   user datum.  Solve this by adjusting the loop bounds and creation
   index.

 - when it created a new buffer chunk, it left that chunk's ->start and
   ->end fields at 0, but would then exit the loop to do the tail fill,
   which was in turn assuming the exit condition of the loop when an
   existing chunk had room, namely that data had been moved to the right
   and so ->start > l.  Solve this by making new chunks empty but with
   ->start = ->end = LUAL_BUFFERSIZE.  It may be slightly better to
   instead try to leave room at both ends if the buffer was empty prior
   to this unread.

FIXES: https://github.com/nodemcu/nodemcu-firmware/issues/3155
2020-11-07 16:23:43 +01:00
Lukáš Voborský 1b29843b78 wiegand Lua 5.3 fix 2020-11-07 16:23:43 +01:00
Cody Cutrer 5ee658e22b add wiegand module (#3203)
* add wiegand module

* minor tweaks to wiegand module

 * fix a whitespace error (tabs!!!!)
 * remove an unnecessary volatile qualifier
2020-11-07 16:23:43 +01:00
Philip Gladstone 335cf62a4d Fix the initialization of the wifi default hostname. (#3303)
* It appears that the rf_pre_init is not called any more. Also cleaned up the code in
wifi_common.
* Log a message (at the right baud rate) if the hostname is invalid
* Updated the comment in the user_config.h file
2020-11-07 16:23:43 +01:00
Philip Gladstone a01aada0ff Improved startup performance and measurement tools. (#3171)
* Don't adjust the clock until after we deal with rtctime...
* Switched to using START_OPTION_CPU_FREQ_MAX instead.
* Use setfield and add caching of the startup option
* Put the startupcounts warning into a warning box
2020-11-07 16:23:43 +01:00
hanfengcan 5e849af9c5 fix: fixed the memory leak 2020-11-07 16:23:43 +01:00
Philip Gladstone ff778dfc4b Guard against freeing a ref of zero (#3308) 2020-11-07 16:23:43 +01:00
Lukáš Voborský 90a077b987 bme280 driver in Lua+C 2020-11-07 16:23:43 +01:00
Lukáš Voborský 5f53531d77 struct module minor documentation fix (#3306)
Thanks
2020-11-07 16:23:43 +01:00
Lukáš Voborský 336013ab9e Fixing bug in `file.readline` when line length exceeds 128 chars 2020-11-07 16:23:43 +01:00
Gregor Hartmann 3d9c441e09 Change from `master` to `release` 2020-11-07 16:23:43 +01:00
Nathaniel Wesley Filardo b4f2686567 crypto: remove toHex and toBase64 (#3300)
We marked these for deprecation in favor of the functions of the same
name in encoder.  Let's actually make good on that.
2020-11-07 16:23:43 +01:00
philip 53283d189e Add the submodule properly 2020-11-07 16:23:43 +01:00
philip 020f5fe107 Remove ets_printf reference 2020-11-07 16:23:43 +01:00
philip 7a25f522d2 CLean up the PR a bit 2020-11-07 16:23:43 +01:00
philip b80cfe9f1e Now use the original c99-snprintf as a submodule. 2020-11-07 16:23:43 +01:00