Commit Graph

1194 Commits

Author SHA1 Message Date
Nathaniel Wesley Filardo af426d0315 Networking rampage and accumulated fixes (#3060)
* espconn: remove unused espconn code, take 1

This is the easiest part of https://github.com/nodemcu/nodemcu-firmware/issues/3004 .
It removes a bunch of functions that were never called in our tree.

* espconn: De-orbit espconn_gethostbyname

Further work on https://github.com/nodemcu/nodemcu-firmware/issues/3004

While here, remove `mqtt`'s charming DNS-retry logic (which is neither
shared with nor duplicated in other modules) and update its :connect()
return value behavior and documentation.

* espconn: remove scary global pktinfo

A write-only global!  How about that.

* net: remove deprecated methods

All the TLS stuff moved over there a long time ago, and
net_createUDPSocket should just do what it says on the tin.

* espconn_secure: remove ESPCONN_SERVER support

We can barely function as a TLS client; being a TLS server seems like a
real stretch.  This code was never called from Lua anyway.

* espconn_secure: more code removal

* espconn_secure: simplify ssl options structure

There is nothing "ssl_packet" about this structure.  Get rid of the
terrifying "pbuffer" pointer.

Squash two structure types together and eliminate an unused field.

* espconn_secure: refactor mbedtls_msg_info_load

Split out espconn_mbedtls_parse, which we can use as part of our effort
towards addressing https://github.com/nodemcu/nodemcu-firmware/issues/3032

* espconn_secure: introduce TLS cert/key callbacks

The new feature part of https://github.com/nodemcu/nodemcu-firmware/issues/3032
Subsequent work will remove the old mechanism.

* tls: add deprecation warnings

* luacheck: net.ifinfo is a thing now

* tls: remove use of espconn->reverse

* mqtt: stop using espconn->reverse

Instead, just place the espconn structure itself at the top of the user
data.  This enlarges the structure somewhat but removes one more layer
of dynamic heap usage and NULL checks.

While here, simplify the code a bit.

* mqtt: remove redundant pointer to connect_info

Everywhere we have the mqtt_state_t we also have the lmqtt_userdata.

* mqtt: doc fixes

* mqtt: note bug

* tls: allow :on(...,nil) to unregister a callback
2020-06-09 22:26:52 +02:00
Nathaniel Wesley Filardo 30f706fb03 WIP: MQTT fixes (#2986)
* mqtt: expose "connfail" callback via :on()

This makes it just like all the other callbacks in the module and is a
revision of behavior called out in
https://github.com/nodemcu/nodemcu-firmware/pull/2967

* mqtt: clarify when puback callback fires

* mqtt: Don't reference stack buffers from the heap

The confusingly-named "mqtt_connection_t" object is just a triple of
  - a serialized mqtt message pointer and length
  - a buffer pointer (to which the above can be written)
  - a message identifier

The last of these must be passed around the mqtt state machine, but the
first two are very local and the buffer is always sourced from the C
stack.  Unfortunately, because the entire structure is persisted in the
heap, some callers assume that they can always use the structure without
reinitialization (see mqtt_socket_close), which will trash the C stack.

Sever the pairing between message id and local state, punt the local
state entirely out of the heap, and rename things to be less confusing.
2020-06-09 22:26:52 +02:00
Nathaniel Wesley Filardo 446c058fa6 net: rename net.if.info to net.ifinfo (#3033)
Reserved words are always reserved in Lua, so let's not have people
typing net["if"]...
2020-06-09 22:26:52 +02:00
galjonsfigur 1cacd9334a Fix timing of softuart module RX (#3029) 2020-06-09 22:26:52 +02:00
sergio fd3f0ddad4 Add flag to disable start-up banner (#3026) 2020-06-09 22:26:52 +02:00
Gregor Hartmann 115d0f88b9 Document tls.cert.auth (#3010) 2020-06-09 22:26:52 +02:00
M.K 3aba085f82 Clarify LFS build info is its size (#3022) 2020-06-09 22:26:52 +02:00
Nikolay Fiykov 2ae9af58fc Expose CPU CCOUNT register as tmr function (#2906) 2020-06-09 22:26:52 +02:00
galjonsfigur 50d88f7731 Fix compile warning and set correct order in module LROT (#2996) 2020-06-09 22:26:52 +02:00
M.K 27e127e7ea Minor typo and wording fixes (#2991) 2020-06-09 22:26:52 +02:00
Lukáš Voborský 36df8d009f Add DCC decoder module (#2905) 2020-06-09 22:26:06 +02:00
galjonsfigur db1e4454de Initial version of software UART C module (#2673) 2020-06-09 22:26:06 +02:00
Nathaniel Wesley Filardo 863dfb59ed SSL rampage (#2938)
* Remove stale putative MD2 support

This hasn't worked in a while, presumably since one of our upstream
merges.  Don't bother making it work, since MD2 is generally considered
insecure.

* Land mbedtls 2.16.3-77-gf02988e57

* TLS: remove some dead code from espconn_mbedtls

There was some... frankly kind of scary buffer and data shuffling if
ESP8266_PLATFORM was defined.  Since we don't, in fact, define that
preprocessor symbol, just drop the code lest anyone (possibly future-me)
be scared.

* TLS: espconn_mbedtls: run through astyle

No functional changes

* TLS: espconn_mbedtls: put the file_params on the stack

There's no need to malloc a structure that's used only locally.

* TLS: Further minor tidying of mbedtls glue

What an absolute shitshow this is.  mbedtls should absolutely not
be mentioned inside sys/socket.h and app/mbedtls/app/lwIPSocket.c is not
so much glue as it as a complete copy of a random subset of lwIP; it
should go, but we aren't there yet.

Get rid of the mysterious "mbedlts_record" struct, which housed merely a
length of bytes sent solely for gating the "record sent" callback.

Remove spurious __attribute__((weak)) from symbols not otherwise
defined and rename them to emphasize that they are not actually part of
mbedtls proper.

* TLS: Rampage esp mbedtls glue and delete unused code

This at least makes the shitshow smaller

* TLS: lwip: fix some memp definitions

I presume these also need the new arguments

* TLS: Remove more non-NodeMCU code from our mbedtls

* TLS: drop support for 1.1

Depending on who you ask it's either EOL already or EOL soon, so
we may as well get rid of it now.
2020-06-09 22:26:06 +02:00
Nathaniel Wesley Filardo 948325a996 New `net.if.info` call to show LwIP information (#2862)
* Remove app/include/netif/wlan_lwip_if.h

This file appears to be unused in our tree.

* New `net.if.info` call to show LwIP information

This is a generalization of `wifi.sta`'s and `wifi.ap`'s `getip` and
`getmac` calls.  I don't propose to deprecate those, but perhaps we
should, in the documentation, point users at this function instead.

The direct motivation is to permit continued use of DHCP-provided NTP
servers in a future where
https://github.com/nodemcu/nodemcu-firmware/pull/2819 has landed, now
that https://github.com/nodemcu/nodemcu-firmware/pull/2709 is in the
tree.  But rather than exposing just that information, a more general
interface seems useful.
2020-06-09 22:26:06 +02:00
Marcel Stör 1b4b442142 Streaming support for hx711 (#2915) 2020-06-09 22:26:06 +02:00
Gregor Hartmann d4b5b0cbaf Fixes for `ws2812` and `ws2812_effects` (#2953)
* clean effects library
* Fix several issues in ws2812 and effects
* Implement working way of calling shift from callback
2020-06-09 22:26:06 +02:00
Lukáš Voborský e7be7644c0 Update sensor driver for BME680 to 3.5.9 (#2969) 2020-06-09 22:26:06 +02:00
Matsievskiy S.V 1759ebb360 fix lfs upload issue 2020-06-09 22:26:06 +02:00
Nathaniel Wesley Filardo 282ebd100d Deprecate crypto.to{Hex,Base64} (#2929)
The internal implementation already preferentially forwards to the
encoder module, so we should just remove these functions as they confuse
people into thinking that we don't have their inverses (see the feature
request https://github.com/nodemcu/nodemcu-firmware/issues/2907).

Update the docs to refer to the encoder version and add deprecation
warnings to the runtime implementations.
2020-06-09 22:26:06 +02:00
Marcel Stör da53d1938f Fix invalid smartconfig include
Fixes #2928, #2923
2020-06-09 22:26:06 +02:00
Marcel Stör 08ea0c8d27 Remove superfluous module def
Fixes #2920
2020-06-09 22:26:06 +02:00
Marcel Stör 16b2cc5107 Revert "Add streaming support for hx711 device (#2793)" (#2914)
This reverts commit 32ad759409.
2020-06-09 22:26:06 +02:00
Philip Gladstone 9809a607fd Add streaming support for hx711 device (#2793) 2020-06-09 22:26:06 +02:00
Terry Ellison 08426e48f1 Rebased against current dev, tweaks for clean compile 2020-06-09 22:26:06 +02:00
Terry Ellison 6d81dd6c0a Rebased against current dev 2020-06-09 22:26:06 +02:00
Terry Ellison ce2e50c651 Updates following JM review 2020-06-09 22:26:06 +02:00
Terry Ellison e7c29fe38e Lua 5.1 to 5.3 realignement phase 1 2020-06-09 22:26:06 +02:00
Gregor Hartmann 739b675b72 add build_date to build info (#2888) 2019-08-15 12:33:22 +02:00
Nathaniel Wesley Filardo 15afa7fd2e
Merge pull request #2830 from HHHartmann/Extend-node.info
Extend node.info
2019-08-04 20:52:41 +01:00
Gregor Hartmann 0659e5529e Fix enduser_setup default POST request (#2852) 2019-08-01 21:31:18 +02:00
Nathaniel Wesley Filardo 7d387dd4d6 Simplify and tidy SNTP (#2700)
* list_ref can become LUA_REFNIL, because that's what rawgeti returns
  for LUA_NOREF.  Defensively guard for this, rather than falling into
  the sntp_dolookups loop with nil on the stack.

* set_repeat_mode should not call itself, but should rather always do
  what it's going to do and then optionally do the rest if directed.

* sntp_sync should not try to special case the single string argument:
  we should be queueing that name for DNS resolution, too.  Towards that
  end, if we are given a single string, build a table and make that the
  list_ref and call off to sntp_dolookups, just like we otherwise do.

FIXES: #2699
2019-07-27 14:20:26 +02:00
Gregor Hartmann 73e6651fe8 Add support for DCHP NTP server (option 42) (#2709)
* Add DHCP option 42 / NTP

* Update dhcp.c

* resolve merge conflict

* add lineend at end of file

* fix merge conflict resolution error
2019-07-27 08:21:35 +02:00
Gregor 06666a7854 using lua_setfield now 2019-07-27 05:36:06 +00:00
Gregor 5fafa6378c change to better UI and get information directly from .h file 2019-07-27 05:36:06 +00:00
Gregor 063988f12a Change DTS to string since it is too big as number 2019-07-27 05:36:05 +00:00
Gregor 6f1e366946 Revert "update file permission"
This reverts commit af9b123bc1c0603859caf9fcd6fcfdeeeb08dbce.
2019-07-27 05:36:05 +00:00
Gregor 2d80042f91 update file permission 2019-07-27 05:36:05 +00:00
Gregor ad90e8dd51 tweal the startup message a bit 2019-07-27 05:36:04 +00:00
Gregor e0273185db include buildinfo generation in makefile 2019-07-27 05:36:04 +00:00
Gregor 4b279939b6 Add release info 2019-07-27 05:36:02 +00:00
Gregor 21c35a1a97 Create buildinfo.h and return new Values in node.info 2019-07-27 05:36:02 +00:00
Terry Ellison c7ff86ff27
remove luacheck run for Travs and minor tweaks following #2838 (#2845) 2019-07-23 20:29:44 +03:00
Terry Ellison 98c2c0520d
Dev make cleanup (#2842) 2019-07-23 18:47:18 +03:00
Johny Mattsson f7a545b951
Evict c_types.h, tidy up a other c_prefixes. (#2841) 2019-07-23 14:22:38 +10:00
Johny Mattsson 526d21dab4 Major cleanup - c_whatever is finally history. (#2838)
The PR removed the bulk of non-newlib headers from the NodeMCU source base.  
app/libc has now been cut down to the bare minimum overrides to shadow the 
corresponding functions in the SDK's libc. The old c_xyz.h headerfiles have been 
nuked in favour of the standard <xyz.h> headers, with a few exceptions over in 
sdk-overrides. Again, shipping a libc.a without headers is a terrible thing to do. We're 
still living on a prayer that libc was configured the same was as a default-configured
xtensa gcc toolchain assumes it is. That part I cannot do anything about, unfortunately, 
but it's no worse than it has been before.

This enables our source files to compile successfully using the standard header files, 
and use the typical malloc()/calloc()/realloc()/free(), the strwhatever()s and 
memwhatever()s. These end up, through macro and linker magic, mapped to the 
appropriate SDK or ROM functions.
2019-07-22 00:58:21 +03:00
Nathaniel Wesley Filardo 9f8b74debd MQTT tweaks (#2822)
* mqtt:connect() secure parameter should be boolean

Continue to honor the old 0/1 values, but make them undocumented and add
a deprecation warning to the code and docs.  Eventually, this should go
away.

* mqtt: rip out deprecated autoreconnect

* mqtt: expose all the callbacks via :on
2019-07-16 11:30:41 +02:00
Philip Gladstone 891799279d
Merge pull request #2832 from HHHartmann/ws2812-buffer-mix
fix rounding in ws2812:buffer:mix

Looks good to me.
2019-07-14 16:05:13 -04:00
Gregor bd0549ac4a fix rounding in ws2812:buffer:mix 2019-07-14 21:48:07 +02:00
Gregor Hartmann a0d0682232 Update enduser_setup.html.gz.def.h (#2827) 2019-07-11 12:57:49 +02:00
Marcel Stör 0398c3360b
Save the post data in a file on the filesystem (#2810)
* Use cross-browser JS for query params in EUS

* Update EUS doc to explain how to use parameters

* Remove ; in Lua code

* Rewrite the endpoint table

* Do not use properties as global Lua variables

* remove enduser_setup.html.gz

* rename folder 'eus' to 'enduser_setup'

* Change input type for password to "password"

* Replace outdated captive portal screen shot
2019-07-08 21:48:16 +02:00
Arnim Läuger bc7ffb3eb8 fix unref default file descriptor while still in use (#2818) 2019-07-05 07:55:54 +02:00
Marcel Stör 2d584a2a6a Fix ROTable call
Fixes #2806
2019-06-22 12:47:14 +02:00
Terry Ellison 5f147a7352
Baseline version of Pipe library (#2797) 2019-06-19 15:16:17 +03:00
galjonsfigur a9256aec8b Fix issue #2753 and fix documentation example (#2776) 2019-06-01 18:05:19 +02:00
Nikolay Fiykov 5f43a414e7 Add pwm2 module (#2747) 2019-05-25 22:08:13 +02:00
Terry Ellison 036bff5665
Use dynamic memory for cached DNS names (#2763)
Fixes #2511
2019-05-20 15:05:52 +01:00
Terry Ellison d6980ad802
SDK 3.0 tranche3 (#2761)
Force libpp.a into iRAM, and backout redundant IRAM_DATA_ATTR changes
2019-05-19 14:38:23 +01:00
Terry Ellison f1b5dfc34e
SDK-3.0 tranche updates (#2757)
includes some dRAM -> iRAM optimisations
2019-05-17 13:04:19 +01:00
Terry Ellison 1990f95740
Updated ROTables 1st tranch (#2742)
Updated ROTables
2019-05-08 14:08:20 +03:00
Terry Ellison e0f3dbed41
Fix 2749 + restore correct user_modules.h (#2750) 2019-05-07 18:49:16 +03:00
Terry Ellison bc61528db7
1st Tranch of SDK 3.0 follow up changes (#2732)
1st Tranche of SDK 3.0 follow up changes
2019-05-01 18:29:11 +01:00
devsaurus b7a99358cc u8g2: fix return value 2019-04-28 21:32:31 +02:00
Arnim Läuger 530c353ff8
Update u8g2 to v2.25.10 (#2735)
* Upgrade u8g2 and add updateDisplayArea bindings

* u8g2 2.25.10

* add displays for 2.24.3 and 2.25.10

* remove workaround for hal pointer and make use of u8x8's user_ptr

* fix doc

* add binding for `updateDisplay()`
2019-04-28 15:45:04 +02:00
Terry Ellison c3e24436f2
Lua string optimisation in file.c + get/put contents methods (#2717)
* Lua string optimisation in file.c + get/put contents methods

* Doc fix: move putcontents() into correct alphabetic order slot in list of static methods
2019-04-11 22:17:00 +01:00
ziggurat29 5a6992c26a added spiffsimg host tools project to msvc build configuration. (#2686) 2019-04-09 14:38:49 +01:00
Terry Ellison fc94439b74 crypto.c: Clarify comments on use of userdata for header + context + key opad blocks 2019-04-08 13:57:46 +01:00
Terry Ellison 528973548c fix EM:0 error, and other memory leaks, plus minor typos in doc 2019-04-05 18:23:13 +01:00
Terry Ellison 9a47107920
SDK 3.0 release (#2692)
* Rebaseline firmware to non-OS SDK version 3.0
* Note that SDK version 3.0 introduces the concept of a Flash Partition Table(PT).  This is located at Flash offset 0x10000 in our firmware build.
* The firmware is now PT aware with both LFS and SPIFFS taking their partition size and location from the PT
* A new tool `tools/nodemcu-partition.py` is now used to initialise these data and can also download LFS and SPIFFS images to these partitions.
2019-04-05 16:01:45 +01:00
Nathaniel Wesley Filardo b6cd2c3edd Remove moribund C ds18b20 module (#2492)
Just use Lua speaking OW (via C) instead.
2019-04-05 15:55:07 +01:00
Nathaniel Wesley Filardo f0565ea576 mbedtls bump to 2.7.9 (#2655)
No major fixes, but was looking anyway.

Specifically, to
https://github.com/ARMmbed/mbedtls.git 079e813949251be1e7a9d395abd20b2c63422787
2019-04-05 06:57:02 +02:00
Natalia ab61e9c03a I2C sw driver with support of multiple buses, Slow, Fast, FastPlus, and user-defined speed selection (#2465)
* I2C driver speed-up, i2c.SLOW, i2c.FAST and user-defined speed selection

* - Multiple buses (up to 10) with different speeds on each bus
- Standard(Slow, 100kHz), Fast(400kHz) and FastPlus(1MHz) modes or an 
arbitrary clock speed
- Sharing SDA line over multiple I²C buses to save available pins
- GPIO16 pin can be used as SCL pin, but it does not support clock 
stretching and selected bus will be limited to FAST speed.

* Dynamic memory allocation, error checks, simplification, timing tweaks.

* Separated the code of old driver for better compatibility and simplicity

* Change of driver interface

* Add bus status check in setup(); simplify getDC(); remove unnesessary lines in ACK read/write

* Fix for moved doc file and trailing whitespaces
2019-04-05 06:56:11 +02:00
Terry Ellison 3f5ae99e42
Fix unaligned load/store exception in luaR_findentry (#2702) 2019-03-24 22:47:29 +00:00
Philip Gladstone a90de79c26 Minor fix to allow building of luac.cross.int (#2697)
* Minor fix to allow building of luac.cross.int
* Reapply some changes lost due to merge damage
2019-03-21 09:56:30 +01:00
Arnim Läuger ebd147b34f DHT11 read sometimes failed with checksum error (#2679)
* DHT11 read sometimes failed with checksum error.

The code assumed DHT11 devices only ever return zero in the temperature and humidity decimal fraction bytes. The datasheet doesn't guarantee this is the case, and by observation I have noticed that indeed the DHT11 may sometimes return another number, usually close to zero. This means that the code would fail with a checksum error, as the fraction bytes were not included when the checksum was calculated. These bytes are now taken into account and also returned as part of the measurement.

This also means that the related dht.read() function is non-functional. If you have a DHT11 device that returns a non-zero decimal part, dht.read() will interpret it as a DHT22 result and return the wrong measurement. For this reason dht.read() should be retired. This patch does not address this issue.
2019-02-23 22:03:21 +01:00
ziggurat29 f801bf126d fixes #2677 minor syntax issues with some dummy variables that bracket the rodata section (#2678) 2019-02-23 20:49:30 +01:00
ziggurat29 62789da0bb added MSVC project configuration for host-side tools (#2665)
Added MSVC project configuration (@ziggurat29) and support of MinGW (@TerryE) for host-side`luac.cross` tool
2019-02-23 14:09:29 +00:00
Nathaniel Wesley Filardo 30ff0a1620 Raise MQTT_CONNECT_TIMEOUT (#2674)
Should fix https://github.com/nodemcu/nodemcu-firmware/issues/2576
2019-02-19 22:33:25 +01:00
sergio d77666c0e8 trailing spaces cleanup (#2659) 2019-02-17 18:26:29 +00:00
Philip Gladstone d75830407e Initial version of code to support multiple hardware timers (#2497)
* Initial version of code to support multiple hardware timers
* MAde the time sinca last tick work again
* Add some documentation to the code
2019-02-16 13:57:59 +01:00
Arnim Läuger d7da14d69e MQTT: print deprecation message regardless of autoreconnect value (#2668) 2019-02-14 23:32:16 +01:00
ziggurat29 0c7758a555 Fix occasional luac.cross crash (#2661)
A block of memory is accessed after having been freed. This was obscured by the fact that 'oBuf' is a pointer into the middle of the block 'dynamicTables', so when dynamicTables is freed, oBuf is pointing to freed memory. Occasionally, luac.cross would crash because of this.
2019-02-12 22:30:54 +01:00
Mark Schlögel 83cb35da52 Patch 1 (#2646)
Increase http timeout 10s -> 60s
2019-02-05 20:59:35 +01:00
Nathaniel Wesley Filardo 06367cb71c Tell the truth about DNS in TLS module (#2643)
Purge the never-functional :dns() method, but document the DNS callback
in :on().

Fixes #2640
2019-02-02 22:08:21 +01:00
Nathaniel Wesley Filardo e87aef8328 Wrap CC invocations in uzlib (#2642) 2019-02-01 21:32:22 +00:00
Arnim Läuger 09533fdf23 set default value for summary var to unbreak standalone builds (#2618) 2019-01-24 21:29:32 +01:00
Nathaniel Wesley Filardo 0e89fb24ba Expunge integer timers (#2603) 2019-01-22 22:59:41 +01:00
Javier Peletier 386867e2fd ESP8266: fix memory leak in encoder.fromHex and avoid use luaM_free (#2617) 2019-01-20 12:45:30 +01:00
galjonsfigur 5d2bb87ceb Updated FatFS from 0.12a to 0.13c (#2608)
Files changed only by the author of FatFS (only updated to new version):

- 00history.txt
- 00readme.txt
- ff.c
- ff.h
- ffunicode.c
- diskio.h
- integer.h
- files in `option` folder except `syscall.c`

Changes:
- removed option folder (now everything is in ffunicode.c)
- modified Makefile to support new version of FatFS
- removed syscall.c and modified ffsystem.c from FatFS author instead
- modified files: diskio.c, ffconf.h to mimic changes from new version
- modified files: fatfs_config.h, myfatfs.c
because of changes of configuration keywords in 0.13 version
- removed empty lines from beginning of files:
fatfs_prefix_lib.h, myfatfs.c, sdcard.c
- changed version number in documentation
2019-01-16 22:30:42 +01:00
Nathaniel Wesley Filardo 6e95d74fbd Update TLS protocol support (#2587)
* Update TLS protocol support

TLS1.0 is past PCI's EOL; BEAST is no more
Enable elliptic curve key exchanges
	Do not enable the smallest ECs for security
	Do not enable the largest ECs for computational time
	Do not enable 25519 (sad) because it doesn't go across the wire
Drop non-PFS key exchanges
Drop ARC4, Blowfish, DES, genprime, XTEA code
Drop renegotiation support completely
	It takes so much heap that it's not likely to work out well

Tidy handling of SSL_BUFFER_SIZE

Update docs
Drop mention of startcom, since they are no more, for letsencrypt

* Update mbedtls to 2.7.7

Preserve our vsnprintf and platform hacks

* Introduce TLS maximum fragment size knob

Reduce buffer size to 4Ki by default and advertize that.  That's the
largest we can advertize with the TLS MFL extension, so there's no
point in making them larger.  The truly adventurous can re-raise
SSL_BUFFER_SIZE and undefine the SSL_MAX_FRAGMENT_LENGTH_CODE and get
back to the earlier behavior.

* Default to mbedTLS debug with DEVELOP_VERSION
2019-01-15 17:02:32 +01:00
Javier Peletier c6653b5921 fix number2integer conversion in ESP8266 for floating-point builds (#2609) 2019-01-15 13:00:37 +00:00
andyleap 0a500eb95d Add set clock div (#2572)
* Add spi.set_clock_div

This will allow the SPI clock divider to be changed relatively simply,
to better support multiple devices with varying SPI clock rate support

* Add documentation
2018-12-16 12:07:20 +01:00
Arnim Läuger 031fd0a913 Reduce default make verbosity (#2583) 2018-12-09 21:39:43 +01:00
Nathaniel Wesley Filardo 61433c448e Deprecate C ds18b20 module (#2581) 2018-12-05 21:38:11 +01:00
Terry Ellison 401fa56b86
Minor Luac fixes (#2579) 2018-12-03 21:41:50 +00:00
Johan Ström 2d958750b5 Handle large/chunked/fragmented MQTT messages properly (#2571)
* MQTT: handle large/chunked/fragmented messages properly

If a message spans multiple TCP packets it must be buffered before
delivered to LUA. Prior code did not do this at all, so this "patch"
really adds proper handling of fragmented MQTT packets.
This could also occur if multiple small messages was sent in a
single TCP packet, and the last message did not completely fit in that
packet.

Introduces a new option to the mqtt.Client constructor:
max_publish_length which defaults to 1024

Introduces a new 'overflow' callback.

Fixes issue #2308 and proper fix for PR #2544.

* mqtt.md: clarified heap allocation

* mqtt: ensure ack is sent for overflowed publish

If QoS is used we should still acknowledge that we received it, or server might retransmit it later.
2018-11-30 22:12:46 +01:00
Natalia b77033f920 Always compile `app/crypto` folder (#2573) 2018-11-28 14:03:33 +01:00
galjonsfigur d5aca39f48 Fix build problem with luac.cross when DEVELOPMENT_USE_GDB is used (#2569) 2018-11-23 18:02:07 +00:00
Carsten Elton Sørensen bb9a5977d3 Calling vol:umount() would fail (#2558)
The volume returned by file.mount() could not be unmounted, because vol:umount() would fail with a cryptic error about the uncallable nature of the volume userdata object. This was due to the wrong metatable name being used for setting up the volume structure. The correct name, as registered elsewhere in file.c, is now used, and vol:umount() is callable.
2018-11-16 21:37:18 +01:00
Johan Ström 33613be550 Increase MQTT recv buffer size to support MTU 1500 (#2308) (#2544)
Any TCP packet with more than 1024 bytes of payload was silently
dropped. With MTU of 1500 the TCP payload can be up to 1460 bytes
(1500 - 20(IP hdr) - 20(TCP hdr))
2018-11-13 23:43:24 +01:00
Arnim Läuger 46671928c0 establish delay as event to trigger flushing of spi buffer (#2517) 2018-11-13 13:18:03 +01:00
Arnim Läuger 5767475766 re-rename ENABLE_TIMER_SUSPEND to TIMER_SUSPEND_ENABLE in user_config.h (#2520) 2018-10-28 23:07:59 +01:00
Arnim Läuger cbd19f895f
u8g2: include "large" fonts (#2531) 2018-10-24 22:48:50 +02:00
Natalia 0bdcb81526 u8g2 i2c multibus support (#2526)
* u8g2 support for more than only one i2c bus

* Removed unnecessary #include
2018-10-20 10:29:29 +02:00
Arnim Läuger 67567af959 Submodulify ucg and update to v1.5.2 (#2503)
* turn ucg into submodule
* update ucg to 1.5.2
* add license note to doc
* align docs with esp32
* move ucg hal into platform folder
adapt examples
2018-10-19 21:18:50 +01:00
Terry Ellison 5f67de8d48
Optimise ROTable accesses and interface (#2505)
-  Optimise ROTable accesses and interface

This includes some refinements to the ROTable cache which remove the linker cludges on the CROSS_COMPILE builds.  Also keyhole tweaks to some of the Lua VM code to implrove runtimes.

I also noticed some compile time warnings during the build; the change to uz_unzip.c doesn't impact the compiled code, but does remove the compiler warnings.
2018-10-13 17:14:33 +03:00
Nathaniel Wesley Filardo 3c824d7a81 Cron fixes, part 2 (+) (#2515)
* Restore WRAPCC when building Lua
* Fix several parsing bugs
2018-10-10 17:36:00 +01:00
Nathaniel Wesley Filardo 8790924c31 Check os_realloc calls (#2513) 2018-10-09 21:58:03 +01:00
Arnim Läuger 509be837a8 Update u8g2 to v2.23.18 (#2500)
* Update u8g2 to v2.23.18
* serve wdt for long delays
2018-10-07 21:46:56 +01:00
Terry Ellison 172fb276ca
Add compression to LFS images (#2448)
* Merge of LFS compress, optimize against current dev
* Fixes to LFS compress patch
2018-09-29 16:57:51 +03:00
Nathaniel Wesley Filardo 0e103a39dd Better fix for HTTP header decode (#2491)
See https://github.com/nodemcu/nodemcu-firmware/issues/2482
2018-09-21 11:57:52 +02:00
Nate Clark 0abb26170b Decode chunked responses case insensitve headers (#2483) 2018-09-12 16:28:46 +02:00
Terry Ellison 94abbe70cb
Fix #2430 node.input() not working (#2469) 2018-08-27 12:46:51 +01:00
Gregor Hartmann 91656c3d76 create luac.cross.{integer|float} (#2450)
Use separate names for the integer and float  `luac.cross` binaries.  Also adds local/lua directory which is already supported by tools makefile to build LFS image.
2018-08-11 18:28:01 +01:00
Nathaniel Wesley Filardo a57fe552e8 app/lua/luac_cross: WRAPCC CC here, too (#2453)
Not that Lua takes very long to compile, but allowing for ccache here
should still help the builder(s) consume a little less time and power.
2018-08-11 13:50:12 +02:00
Nathaniel Wesley Filardo fd12be9966 file: list now takes optional pattern for filtering (#2452)
Thanks to @TerryE for many useful suggestions
2018-08-10 16:38:48 +01:00
Marcel Stör cddefbcae9 Add comment for font list 2018-07-30 23:25:55 +02:00
devsaurus 62f48fe170 unbreak firmware build without u8g2 submodule 2018-07-29 12:43:42 +02:00
devsaurus c03df2b4bd adapt to new optional build strategy 2018-07-22 15:17:58 +02:00
devsaurus eba5d57db7 allow definition of font and display tables in an external file 2018-07-22 13:51:12 +02:00
devsaurus 5f3e210f98 doc clarifications, code alignment with esp32 2018-07-22 13:51:12 +02:00
devsaurus adc08d17c3 fix malloc/free from stdlib 2018-07-22 13:51:12 +02:00
devsaurus 15d4311f40 add docs 2018-07-22 13:51:12 +02:00
devsaurus 87bb96dfbe port u8g2 module from esp32 platform 2018-07-22 13:51:10 +02:00
devsaurus 7d04636689 submodule u8g2 2.19.8 2018-07-22 13:51:03 +02:00
devsaurus 1f7593538f remove u8g 2018-07-22 13:51:00 +02:00
Nathaniel Wesley Filardo fd745e0981 Espressif SDK v2.2.1 (#2401)
Minimally build and boot tested, but the changes look pretty boring
2018-07-20 23:07:16 +02:00
TerryE 7956a47bb4 Add Cygwin support for app/lua/luac_cross make and spiffsimg 2018-07-04 15:31:15 +01:00
TerryE 2ab061f510 merge current dev to resolve update conflcts in node.c 2018-06-22 22:44:19 +01:00
TerryE 4f21224d56 LFS patch updates following review II and testing 2018-06-22 22:29:16 +01:00
Terry Ellison 994e8faa2b
Merge pull request #2383 from dnc40085/dev_file.read()_retval_fix
Fix for lack of nil return in file.read() when EOF is reached
2018-05-27 10:52:25 +01:00
Arnim Läuger 7a54ae06c7 Set safe defaults for scan config (#2378) 2018-05-22 14:55:14 +02:00
dnc40085 07ced63969 Dev wifi/wifi_eventmon malloc/free update (#2318)
* updated wifi_eventmon to store events in LUA_REGISTRYINDEX

* updated wifi_eventmon debug comments

* Updated wifi.c to remove c_free()

In wifi_ap_listclient(app/modules/wifi.c), c_free() was replaced with
wifi_softap_free_station_info()

* Removed unnecessary line of code from app/modules/wifi_eventmon.c
2018-05-20 09:46:04 +02:00
dnc40085 dd02faef27 Add function node.getcpufreq() (#2375) 2018-05-20 09:38:33 +02:00
dnc40085 cbcb1b1a9f Fixed lack of nil return in file.read() when EOF is reached 2018-05-18 22:08:42 -07:00
Arnim Läuger 914a4afc96 Fix MQTT connect leak (#2368)
* fix application of patch 0018-feat-espconn-Modification-for-espconn.patch in #2269
espconn_tcp_reconnect() was removed instead of espconn_list_delete()
2018-05-15 20:55:31 +02:00
dnc40085 106841c26c Add message indicating that node.sleep() was disabled during build. (#2367) 2018-05-08 22:43:12 +02:00
dnc40085 6a261aecdb Fixed bug that caused crash when printing wifi.suspend disabled msg (#2365) 2018-05-07 13:55:59 +02:00
Terry Ellison 3ec252df6a
Merge pull request #2357 from dnc40085/dev_cb_register_task_id_fix
Fixed coding errors in app/pm/swtimer.c
2018-04-27 19:19:35 +01:00
Terry Ellison 45fea23d66
Merge pull request #2322 from peturdainn/peturdainn-patch-1
fix for ds18b20 negative decimals
2018-04-27 11:35:07 +01:00
dnc40085 6069ebdc90 Update node.dsleep() to support longer deep sleep duration. (#2358)
* Update node.dsleep() to support longer deep sleep duration.
* Updated documentation for node.dsleepMax()
2018-04-26 22:45:24 +02:00
dnc40085 da2bc7395d Changed out of memory response from system halt to system restart 2018-04-22 22:18:36 -07:00
dnc40085 2735426fc0 Removed pragma defines that were mistakenly left in 2018-04-22 22:02:55 -07:00
dnc40085 2e201cd835 Fixed coding errors in app/pm/swtimer.c 2018-04-22 18:36:23 -07:00
TerryE 4f7af452a8 corrections to dev merge 2018-04-20 02:34:52 +01:00
Terry Ellison 6db7414270
Merge branch 'dev' into dev-LFS 2018-04-19 16:43:55 +01:00
TerryE 88bd9e01d3 LFS patch updates following review 2018-04-19 16:27:47 +01:00
dnc40085 96e5c026a8 Refactor timer suspend portion of node.sleep (pmsleep) (#2287)
* pmsleep refactor
* Shortened swtmr disabled message 
* Added swtimer debug module option to user_modules.h.
* Added comments to user_config.h.
* Fixed error in documentation for node.sleep()
* remove blank sntp.c that got added in during rebase onto dev(6218b92)
* Added #ifdefs around SWTIMER_REG_CB to prevent inclusion of disabled
code
2018-04-13 21:41:14 +02:00
philip 81435ceecf Missed setting the ID into the data block 2018-04-12 22:09:52 -04:00
Philip Gladstone cda8da622d Put each ICACHE_RAM_ATTR function in its own section. (#2334)
* Put each ICACHE_RAM_ATTR function in its own section.

* Chached the macro names to be less likely to cause problems
2018-04-07 22:44:42 +02:00
Johny Mattsson 085f35da73 Tie in the EGC with the SDK's heap knowledge. (#2319)
Added `node.egc.meminfo()` to expose LVM usage (to make the regular
`node.egc.ON_MEM_LIMIT` option usable).

Extended the `node.egc.ON_MEM_LIMIT` option to also take negative limits,
in which case that's taken as a request to keep a certain amount of heap
available for non-Lua use.
2018-04-06 14:52:03 +02:00