Commit Graph

46 Commits

Author SHA1 Message Date
dnc40085 41a5736d78 Add wifi.suspend() and node.sleep() (#1231)
* Exposed forced sleep API and more
Added timer suspend functionality
* wifi.suspend
* wifi.resume
* node.sleep 
* tmr.suspend
* tmr.suspend_all
* tmr.resume
* tmr.resume_all
* Implement timer suspend functionality
* Fix for uart TX glitch
* Made some modifications to the error reporting
2017-04-04 21:31:06 +02:00
Johny Mattsson 45ae795739 Extend node.dsleep() to support instant sleep. (#1859) 2017-03-14 10:49:41 +01:00
Philip Gladstone 543f438b6b Added node.random implementation (#1665) 2016-12-26 14:14:49 +01:00
Arnim Läuger ecf8bd98d6 Add FatFs and SD card support (#1397)
* Add FatFs
* enable BUILD_FATFS for all-module build
* push vfs into rest of firmware
* align maximum filename length
* increase timeout for acmd41 during card initialization
* switch from DOS to Unix path semantics chdrive() is substituted by chdir()
* update to fatfs R.012a incl. patches 1-6
* add callback for rtc provisioning in file
* update docs
2016-09-05 20:17:13 +02:00
Marcel Stör 07aa210c50 Remove DEVKIT_VERSION_0_9 and deprecated functions (#1439) 2016-08-04 23:03:37 +02:00
Yury Popov a499716cc1 Update modules to be Lua coroutine compatible (#1423) 2016-08-02 22:33:05 +02:00
Philip Gladstone af39a0bc25 Upgrade to latest SPIFFS and add building of file systems (#1226)
Fixes #1164 and thus also #1150, #1149, #1147 and #898.

* Move to latest version of SPIFFS
* Add SPIFFS porting layer for NodeMCU
* Add option to delete output if it doesn't fit
* Change FLASHSIZE to be in bits by default: default 4mb 32mb
* Add SPIFFS_MAX_FILESYSTEM_SIZE override
* Add notes on SPIFFS_FIXED_LOCATION
* Add 1M boundary
* Include the current version of the LICENSE
2016-06-05 23:10:58 +02:00
Johny Mattsson 30d354c290 Rework ADC mode setting approach (#1285)
- Stop fighting against the SDK in terms of owning/writing the init_data block.
  NodeMCU included a default init_data block because originally the SDK did
  not, but by now it's not needed.

- Expose a way to reconfigure the ADC mode from Lua land. With most people
  using the cloud builder and not able to change the #define for byte 107
  this has been a pain point.

- Less confusion about which init_data has been used. Lua code can now simply
  state what mode it wants the ADC to be in, and not worry about the rest of
  the init_data complexities such as the init_data changing location due to
  flashing with wrong flash_size setting, or doing/not doing a chip-erase
  before loading new NodeMCU firmware.
2016-05-18 21:45:15 +02:00
philip 84487d300b Remove unusedcode 2016-03-20 12:54:16 -04:00
TerryE acddf29fb0 Address Philip's review comments 2016-03-06 17:11:18 +00:00
TerryE 9977b13bcd Update to address review comments in PR #1105 2016-03-03 15:48:09 +00:00
TerryE 4f8f192cbe Extend the node library to include a Lua implementation of task posting 2016-03-01 23:37:41 +00:00
TerryE 46ea2aa42e Make the wifi.smart functions options and remove wofs and upgrade
AFAIK no one uses the wifi.startsmart() and wifi.stopsmart().  Removing
them frees up an extra 20-25K of Flash to use as filesystem.  So I have
added a new config define WIFI_SMART_ENABLE which is enabled by default
so the default functionality is the same, but if this is commented out
then this code is omitted.

I have also removed wofs and upgrade from this build as we no longer
support these.
2016-02-26 17:23:38 +00:00
TerryE 0ef362472c Add node.egc.setmode() + constants as per #609 2016-02-20 19:15:52 +00:00
TerryE 49733f6f6d Add New Tasking I/F and rework GPIO, UART, etc to support it
As with the last commit this rolls up the follwowing, but include the various
review comments on the PR.

-   **Documentation changes**. I've added the taks FAQ as a stub new Extension
developer FAQ, and split the old FAQ into a Lua Developer FAQ and a Hardware
FAQ.

-   **Tasking I/F**.  New `app/task/Makefile`, `app/task/task.c`,
`app/include/task/task.h` and `app/Makefile` as per previous commit.  Cascade
changes to `app/driver/uart.c`, `app/include/driver/uart.h`,
`app/user/user_main.c` and `app/modules/node.c`

-   **GPIO Rework** to `app/modules/gpio.c` and `pin_map.[hc]`, `platform.[hc]`
in `app/platform`

-   **Other Optimisations** Move the `platform_*_exists()` from
`app/platform/common.c` to static inline declarations in `platform.h` as
this generates faster, smaller code. Move lgc.a routines out of iram0.
2016-02-17 17:13:17 +00:00
Johny Mattsson 182d45f928 Enable -std=gnu11 for modules dir.
Plus boat-load of fixes to actually make that build.
2016-01-20 19:40:47 +11:00
Johny Mattsson 30f8f62420 Optimized node.bootreason() for size.
Reduces the size from 179 to 102 bytes.
2016-01-15 11:42:20 +11:00
philip dc5cc6d9f4 Add the exccause parameter into the bootreason block 2016-01-14 08:16:26 -05:00
Johny Mattsson 57917601b7 Expose extended reset info via node.bootreason(). 2016-01-12 17:29:46 +11:00
dnc40085 cb0a982dc3 Minor change to node module
node.dsleep was using sint32 to hold sleep time when it should be using
uint32
2016-01-02 03:10:27 -08:00
Johny Mattsson 4e8ef87d03 Reworked module registration, removed modules.h
Module creation & registration now made a lot simpler. In essence,
each module file is now self-contained and only needs a

  NODEMCU_MODULE(MYNAME, "myname", myname_map, luaopen_myname);

line to both be automatically recognised by the Lua initialization
as well as honor the LUA_USE_MODULES_MYNAME #define.
2015-12-16 16:09:16 +11:00
Johny Mattsson 6b6456be47 Major cleanup of module registration.
As per #810 & #796, only LUA_OPTIMIZE_MEMORY=2 & MIN_OPT_LEVEL=2 are
supported when building. This commit effects that limitation.

With this change modules/auxmods.h no longer needs to be updated for
every new module, nor do module writers need to cater for a hypothetical
LUA_OPTIMIZE_MEMORY < 2 scenario.
2015-12-12 15:03:40 +11:00
Johny Mattsson 7512e628b6 Merge pull request #742 from TerryE/dev-stripdebug
Port of strip debug patch to the SDK 1.4-baseline dev
2015-11-10 12:20:36 +11:00
Johny Mattsson 382eea5079 Fix building with DEVKIT_0_9 defined.
This got broken in the 1.4.0 overhaul, mea culpa.
2015-11-09 12:15:40 +11:00
TerryE 83d06b667d Port of strip debug patch to the SDK 1.4-baseline dev 2015-11-08 23:46:08 +00:00
Johny Mattsson bf8ed500bf Moved node.key() & node.led() support into node module.
It was piggybacking on the Lua readline timer which no longer exists.

Also cleaned up injection of Lua commands via CoAP & node.input().
2015-10-12 13:26:05 +11:00
Johny Mattsson f1552605d9 Change os_update_cpu_freq... to ets_update_cpu_freq...
Again, the os_xxx version has been removed from the SDK.
2015-10-12 13:26:04 +11:00
devsaurus d0e6ab38df add write error detection in node_compile() 2015-08-11 00:08:49 +02:00
vowstar 67d785ffec Restore default data and init data before system restore. 2015-07-04 04:27:59 +08:00
vowstar 89aaf475d0 Add node.restore().
If NodeMCU can't connect Wi-Fi, please use it.
After reboot, all will be OK.
RESTORE ITEMS:
wifi_station_set_auto_connect, wifi_set_phy_mode, wifi_softap_set_config,  wifi_station_set_config, wifi_set_opmode.
2015-07-04 03:54:22 +08:00
Johny Mattsson 7bd10e8a17 Added node.bootreason() to inspect boot cause. 2015-06-27 12:34:03 +10:00
HuangRui 3dd1ac3739 Move node.readvdd33 to adc.readvdd33, fix #162. 2015-03-27 00:52:55 +08:00
Markus Gritsch b648e9a8db Added node.setcpufreq(mhz) function.
This function allows setting the CPU frequency to node.CPU80MHZ or
node.CPU160MHZ.
2015-03-17 10:23:45 +01:00
HuangRui 5c84359b5c ROM flash size can changed with detected size, fixed #283. 2015-03-16 05:40:43 +08:00
HuangRui dfce182622 Paste new version, make it can get correct flash size. 2015-03-16 00:51:47 +08:00
HuangRui ed87cbd96f Try to fix flash auto detection bug. 2015-03-16 00:48:28 +08:00
funshine bbef457e50 seperate user_config.h to speed-up compile when modules disabled/enabled 2015-03-06 11:59:04 +08:00
funshine 6e840a453f add node.compile() api 2015-02-13 15:11:59 +08:00
funshine 856b8553bf comment out ws2812 temporary. remove node.led, node.key 2015-02-12 11:05:28 +08:00
HuangRui 5894df1da6 Combined dsleep_set_options(option) to dsleep( us, option )
* dsleep( us, option )
Hardware has to support deep-sleep wake up (XPD_DCDC connects to EXT_RSTB with 0R). system_deep_sleep(0) ,set no wake up timer,connect a GPIO to pin RST, the chip will wake up by a falling-edge on pin RST.
** us: Integer
time to sleep.
if us = 0, it will sleep forever.
** option: Integer
option=0, init data byte 108 is valuable;
option>0, init data byte 108 is valueless.
More details as follows:
0, RF_CAL or not after deep-sleep wake up, depends on init data byte 108.
1, RF_CAL after deep-sleep wake up, there will belarge current.
2, no RF_CAL after deep-sleep wake up, there will only be small current.
4, disable RF after deep-sleep wake up, just like modem sleep, there will be the smallest current.
2015-01-29 14:21:38 +08:00
alonewolfx2 f4214294d3 new sleep set options added (from 0.9.5 sdk)
usage:
-- no wakeup until rst pin to low 
node.dsleep(0) 

-- 4 mean no RF after deepsleep.
node.dsleepsetoption(4)
2015-01-28 18:13:19 +02:00
alonewolfx2 4af0873122 for reading internal vdd33 pin voltage.
example usage and result
```
print(node.readvdd33())
3348
> 
```
2015-01-26 12:17:15 +02:00
HuangRui c04f2578ec Updated SDK to v0.9.5 and optimized memory. 2015-01-05 10:09:51 +08:00
funshine 04a5e67443 add node.info() to get version, chipid, flash info 2014-12-31 14:26:51 +08:00
HuangRui a93e62c444 Add node.flashid() and node.flashsize(). 2014-12-31 08:08:31 +08:00
funshine cdd13b1af3 source file first commit, folder structure refact 2014-12-22 19:35:05 +08:00