提交 136e0973 编写于 作者: N Nathaniel Wesley Filardo

Merge dev into release

While we intend our release strategy to be that we just fast-forward our
`release` branch to `dev`, things have come a little off the wheels.
This is a "git merge -s recursive -X theirs" of `dev` into `release`
instead.
name: Create Release
on:
push:
tags:
- '3.*-release_*'
jobs:
build_luac_cross_win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build luac.cross.exe
run: |
set
"%programfiles%\git\usr\bin\xargs"
cd msvc
"%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" /p:Configuration=Release /p:Platform=x64
mv luac-cross/x64/Release/luac.cross.exe ..
shell: cmd
- name: Upload luac.cross
if: ${{ success() }}
uses: actions/upload-artifact@v2
with:
name: luac.cross_51_float_win
path: luac.cross.exe
Create_Release:
name: Create Release
needs: build_luac_cross_win
runs-on: ubuntu-latest
steps:
- name: Set release name
run: |
echo "RELEASE_NAME=${GITHUB_REF/*\/}" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{env.RELEASE_NAME }}
release_name: ${{env.RELEASE_NAME }}
body: |
Please note that as per #3164 this project switched the default branch from `master` to `release` with the previous release. For the time being both are kept in sync as to ease the transition for our community. However, expect `master` to disappear sooner or later.
## Breaking Changes
- Description - #<PR_Id>
## New Modules
- [wiegand](https://nodemcu.readthedocs.io/en/latest/modules/wiegand/) C module - #3203
## Bug Fixes
Please see [the release milestone](https://github.com/nodemcu/nodemcu-firmware/milestone/16?closed=1) for details.
## Deprecation
prerelease: false
draft: true
- name: Download luac.cross
uses: actions/download-artifact@v1
with:
name: luac.cross_51_float_win
path: ./
- name: upload luac.cross to release
id: upload-luac-cross
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./luac.cross.exe
asset_name: luac.cross_${{env.RELEASE_NAME }}_x64_float_Lua51.exe
asset_content_type: application/x-msdownload
name: CI
on:
push:
branches: [ release ]
pull_request:
branches: [ dev, release ]
jobs:
build:
strategy:
fail-fast: false
matrix:
lua_ver: [51, 53]
numbers: ['float']
include:
- lua_ver: 51
numbers: 'integral'
- lua_ver: 53
numbers: '64bit'
runs-on: ubuntu-16.04
env:
LUA: ${{ matrix.lua_ver }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: pip install pyserial
shell: bash
- run: sudo apt install srecord
shell: bash
- name: Build firmware
if: matrix.numbers == 'float'
run: make
shell: bash
- name: Build integral firmware
if: ${{ matrix.numbers == 'integral' }}
run: |
make EXTRA_CCFLAGS="-DLUA_NUMBER_INTEGRAL"
mv luac.cross.int luac.cross
shell: bash
- name: Build 64bit firmware
if: ${{ matrix.numbers == '64bit' }}
run: |
make EXTRA_CCFLAGS="-DLUA_NUMBER_64BITS"
shell: bash
- name: Upload luac.cross
if: ${{ success() }}
uses: actions/upload-artifact@v2
with:
name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}
path: luac.cross
build_luac_cross_win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build luac.cross.exe
run: |
set
"%programfiles%\git\usr\bin\xargs"
cd msvc
"%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" /p:Configuration=Release /p:Platform=x64
mv luac-cross/x64/Release/luac.cross.exe ..
shell: cmd
- name: Upload luac.cross
if: ${{ success() }}
uses: actions/upload-artifact@v2
with:
name: luac.cross_51_float_win
path: luac.cross.exe
compile_lua:
strategy:
fail-fast: false
matrix:
lua_ver: [51, 53]
numbers: ['float']
filter: [ 'cat' ]
include:
- lua_ver: 51
numbers: 'integral'
filter: 'grep -v "lua_modules/lm92/lm92.lua\|lua_modules/hdc1000/HDC1000.lua\|lua_examples/u8g2/graphics_test.lua"'
- lua_ver: 53
numbers: '64bit'
filter: 'cat'
needs: build
runs-on: ubuntu-16.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: false
- name: Download luac.cross
uses: actions/download-artifact@v1
with:
name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}
path: ./
- name: Fix file permission
run: chmod +x luac.cross
- name: compile Lua
run: |
find lua_modules lua_examples tests/NTest* -iname "*.lua" | ${{ matrix.filter }} | xargs --delimiter="\n" echo
find lua_modules lua_examples tests/NTest* -iname "*.lua" | ${{ matrix.filter }} | xargs --delimiter="\n" ./luac.cross -p
shell: bash
compile_lua_win:
strategy:
fail-fast: false
matrix:
lua_ver: [51]
numbers: ['float']
filter: [ 'cat' ]
needs: build_luac_cross_win
runs-on: windows-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: false
- name: Download luac.cross
uses: actions/download-artifact@v1
with:
name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}_win
path: ./
- name: compile Lua
run: |
PATH="/C/Program\ Files/Git/usr/bin:${PATH}"
find lua_modules lua_examples tests/NTest* -iname "*.lua" | ${{ matrix.filter }} | xargs --delimiter="\n" echo
find lua_modules lua_examples tests/NTest* -iname "*.lua" | ${{ matrix.filter }} | xargs --delimiter="\n" ./luac.cross -p
shell: bash
NTest:
strategy:
fail-fast: false
matrix:
lua_ver: [51, 53]
numbers: ['float']
include:
- lua_ver: 51
numbers: 'integral'
- lua_ver: 53
numbers: '64bit'
needs: build
runs-on: ubuntu-16.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: false
- name: Download luac.cross
uses: actions/download-artifact@v1
with:
name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}
path: ./
- name: Fix file permission
run: chmod +x luac.cross
- name: NTest selfcheck
run: |
cd tests/NTest
../../luac.cross -e ../NTest/NTest_NTest.lua | tee log
grep "failed. 0" log
shell: bash
- name: NTest hosttests
run: |
cd tests
cp NTest/NTest.lua .
../luac.cross -e NTest_lua.lua | tee log
(if grep " ==> " log ; then exit 1 ; fi)
shell: bash
NTest_win:
strategy:
fail-fast: false
matrix:
lua_ver: [51]
numbers: ['float']
needs: build_luac_cross_win
runs-on: windows-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: false
- name: Download luac.cross
uses: actions/download-artifact@v1
with:
name: luac.cross_${{ matrix.lua_ver }}_${{ matrix.numbers }}_win
path: ./
- name: NTest selfcheck
run: |
cd tests/NTest
../../luac.cross.exe -e ../NTest/NTest_NTest.lua | tee log
grep "failed. 0" log
shell: bash
- name: NTest hosttests
run: |
cd tests
cp NTest/NTest.lua .
../luac.cross.exe -e NTest_lua.lua | tee log
(if grep " ==> " log ; then exit 1 ; fi)
shell: bash
luacheck:
strategy:
fail-fast: false
matrix:
include:
- os: 'linux'
vm: 'ubuntu-16.04'
- os: 'windows'
vm: 'windows-latest'
runs-on: ${{ matrix.vm }}
steps:
- uses: actions/checkout@v2
with:
submodules: false
- run: sudo apt install luarocks
if : matrix.os == 'linux'
shell: bash
- name: get luacheck.exe # is also done in the travis script but in this action it does not run in bash
if : matrix.os == 'windows'
run: |
mkdir cache
C:msys64\usr\bin\wget.exe --tries=5 --timeout=10 --waitretry=10 --read-timeout=10 --retry-connrefused -O cache/luacheck.exe https://github.com/mpeterv/luacheck/releases/download/0.23.0/luacheck.exe
shell: cmd
- name: luacheck
run: |
PATH="/C/Program\ Files/Git/usr/bin:${PATH}"
./tools/travis/run-luacheck-${{ matrix.os }}.sh
shell: bash
doc_check:
strategy:
fail-fast: false
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v2
with:
submodules: false
- name: all_modules_linked
run: ./tools/check_docs_module_linkage.sh
shell: bash
......@@ -32,7 +32,10 @@ script:
- if [ "$OS" = "linux" -a "$TRAVIS_PULL_REQUEST" != "false" ]; then bash "$TRAVIS_BUILD_DIR"/tools/travis/pr-build.sh; fi
- cd "$TRAVIS_BUILD_DIR"
- echo "checking:"
- find lua_modules lua_examples -iname "*.lua" -print0 | xargs -0 echo
- find lua_modules lua_examples -iname "*.lua" -print0 | xargs -0 $LUACC -p
- find lua_modules lua_examples tests/NTest* -iname "*.lua" -print0 | xargs -0 echo
- find lua_modules lua_examples tests/NTest* -iname "*.lua" -print0 | xargs -0 $LUACC -p
- cd tests/NTest
- if [ "$OS" = "linux" ]; then ../../$LUACC -e ../NTest/NTest_NTest.lua; fi
- cd "$TRAVIS_BUILD_DIR"
- if [ "$OS" = "linux" ]; then bash "$TRAVIS_BUILD_DIR"/tools/travis/run-luacheck-linux.sh; fi
- if [ "$OS" = "windows" ]; then bash "$TRAVIS_BUILD_DIR"/tools/travis/run-luacheck-windows.sh; fi
......@@ -78,7 +78,7 @@ As a Windows or Mac user you could also resort to [GitHub Desktop](https://deskt
You need to sync your fork with the NodeMCU upstream repository from time to time, latest before you rebase (see flow above).
1. `git fetch upstream`
1. `git checkout dev` but you may do this for `master` as well
1. `git checkout dev` but you may do this for `release` as well
1. `git merge upstream/dev`
### Commit messages
......@@ -114,8 +114,8 @@ Don't forget to [reference affected issues](https://help.github.com/articles/clo
- Add notes to the description of the milestone in the course of the ~2 months it lives.
- Be careful and reluctant to merge PRs once we're past the 6-weeks mark of a milestone. Ideally, we don't merge anything in the last 2 weeks.
- Cutting a release
- Create a PR for the `master` branch for collaborators to approve.
- Create a PR for the `release` branch for collaborators to approve.
- Once approved merge it. :exclamation::boom::exclamation: Make sure you do NOT "squash and merge" but make a regular merge commit!
- Fetch the changes into your local clone and create an annotated tag like so: `git tag -a <SDK-version>-master_<yyyyMMdd> -m ""`, `git push --tags`
- Fetch the changes into your local clone and create an annotated tag like so: `git tag -a <SDK-version>-release_<yyyyMMdd> -m ""`, `git push --tags`
- Create a new [release](https://github.com/nodemcu/nodemcu-firmware/releases) based on the tag you just pushed. The version name is the same as the tag name.
- Write release notes. Mention breaking changes explicitly. Since every PR that went into this release is linked to from the milestone it should be fairly easy to include important changes in the release notes.
......@@ -2,8 +2,8 @@
[![Join the chat at https://gitter.im/nodemcu/nodemcu-firmware](https://img.shields.io/gitter/room/badges/shields.svg)](https://gitter.im/nodemcu/nodemcu-firmware?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/nodemcu/nodemcu-firmware.svg)](https://travis-ci.org/nodemcu/nodemcu-firmware)
[![Documentation Status](https://img.shields.io/badge/docs-master-yellow.svg?style=flat)](http://nodemcu.readthedocs.io/en/master/)
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/nodemcu/nodemcu-firmware/blob/master/LICENSE)
[![Documentation Status](https://img.shields.io/badge/docs-release-yellow.svg?style=flat)](http://nodemcu.readthedocs.io/en/release/)
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/nodemcu/nodemcu-firmware/blob/release/LICENSE)
### A Lua based firmware for ESP8266 WiFi SOC
......@@ -14,9 +14,9 @@ The firmware was initially developed as is a companion project to the popular ES
# Summary
- Easy to program wireless node and/or access point
- Based on Lua 5.1.4 but without `debug`, `io`, `os` and (most of the) `math` modules
- Based on Lua 5.1.4 or Lua 5.3 but without `debug`, `io`, `os` and (most of the) `math` modules
- Asynchronous event-driven programming model
- more than **65 built-in modules**
- more than **70 built-in C modules** and **close to 20 Lua modules**
- Firmware available with or without floating point support (integer-only uses less memory)
- Up-to-date documentation at [https://nodemcu.readthedocs.io](https://nodemcu.readthedocs.io)
......@@ -48,23 +48,23 @@ wifi.sta.config{ssid="SSID", pwd="password"}
The entire [NodeMCU documentation](https://nodemcu.readthedocs.io) is maintained right in this repository at [/docs](docs). The fact that the API documentation is maintained in the same repository as the code that *provides* the API ensures consistency between the two. With every commit the documentation is rebuilt by Read the Docs and thus transformed from terse Markdown into a nicely browsable HTML site at [https://nodemcu.readthedocs.io](https://nodemcu.readthedocs.io).
- How to [build the firmware](https://nodemcu.readthedocs.io/en/master/en/build/)
- How to [flash the firmware](https://nodemcu.readthedocs.io/en/master/en/flash/)
- How to [upload code and NodeMCU IDEs](https://nodemcu.readthedocs.io/en/master/en/upload/)
- How to [build the firmware](https://nodemcu.readthedocs.io/en/release/build/)
- How to [flash the firmware](https://nodemcu.readthedocs.io/en/release/flash/)
- How to [upload code and NodeMCU IDEs](https://nodemcu.readthedocs.io/en/release/upload/)
- API documentation for every module
# Releases
Due to the ever-growing number of modules available within NodeMCU, pre-built binaries are no longer made available. Use the automated [custom firmware build service](http://nodemcu-build.com/) to get the specific firmware configuration you need, or consult the [documentation](http://nodemcu.readthedocs.io/en/master/en/build/) for other options to build your own firmware.
Due to the ever-growing number of modules available within NodeMCU, pre-built binaries are no longer made available. Use the automated [custom firmware build service](http://nodemcu-build.com/) to get the specific firmware configuration you need, or consult the [documentation](http://nodemcu.readthedocs.io/en/release/build/) for other options to build your own firmware.
This project uses two main branches, `release` and `dev`. `dev` is actively worked on and it's also where PRs should be created against. `release` thus can be considered "stable" even though there are no automated regression tests. The goal is to merge back to `release` roughly every 2 months. Depending on the current "heat" (issues, PRs) we accept changes to `dev` for 5-6 weeks and then hold back for 2-3 weeks before the next snap is completed.
A new tag is created every time `dev` is merged back to `master`. They are listed in the [releases section here on GitHub](https://github.com/nodemcu/nodemcu-firmware/releases). Tag names follow the \<SDK-version\>-master_yyyymmdd pattern.
A new tag is created every time `dev` is merged back to `release`. They are listed in the [releases section here on GitHub](https://github.com/nodemcu/nodemcu-firmware/releases). Tag names follow the \<SDK-version\>-release_yyyymmdd pattern.
# Support
See [https://nodemcu.readthedocs.io/en/master/en/support/](https://nodemcu.readthedocs.io/en/master/en/support/).
See [https://nodemcu.readthedocs.io/en/release/support/](https://nodemcu.readthedocs.io/en/release/support/).
# License
[MIT](https://github.com/nodemcu/nodemcu-firmware/blob/master/LICENSE) © [zeroday](https://github.com/NodeMCU)/[nodemcu.com](http://nodemcu.com/index_en.html)
[MIT](https://github.com/nodemcu/nodemcu-firmware/blob/release/LICENSE) © [zeroday](https://github.com/NodeMCU)/[nodemcu.com](http://nodemcu.com/index_en.html)
......@@ -16,10 +16,15 @@ TARGET = eagle
FLAVOR = debug
# Handle Lua Directory selector
ifeq ("$(LUA)","53")
ifeq ("$(LUA)","")
LUA_DIR := lua
else ifeq ("$(LUA)","51")
LUA_DIR := lua
else ifeq ("$(LUA)","53")
LUA_DIR := lua53
else
LUA_DIR := lua
$(error Unsupported value "$(LUA)" for variable "LUA", \
expected "51", "53" or unset/empty)
endif
ifndef PDIR # {
......@@ -158,7 +163,7 @@ DDEFINES += \
# Required for each makefile to inherit from the parent
#
INCLUDES := -I $(PDIR)libc -I $(PDIR)$(LUA_DIR) -I $(PDIR)platform \
$(INCLUDES) -I $(PDIR) -I $(PDIR)include
$(INCLUDES) -I $(PDIR) -I $(PDIR)include
PDIR := ../$(PDIR)
sinclude $(PDIR)Makefile
......
......@@ -26,6 +26,7 @@
//
// Released to the public domain
//
// #define NODE_DEBUG
#include "user_interface.h"
#include "platform.h"
......@@ -40,21 +41,14 @@
#define HIGH 1
#endif /* ifndef HIGH */
#define COMBINE_HIGH_AND_LOW_BYTE(byte_high, byte_low) ((uint16_t)((byte_high) << 8) | (byte_low))
static double dht_humidity;
static double dht_temperature;
static uint8_t dht_bytes[5]; // buffer to receive data
typedef enum {
Humidity = 0,
Temperature,
Humidity8,
Temperature8
} dht_Signal;
static int dht_readSensor(uint8_t pin, uint8_t wakeupDelay);
static double getValue(dht_Signal s);
static bool verifyChecksum();
/////////////////////////////////////////////////////
//
......@@ -79,10 +73,15 @@ double dht_getTemperature(void)
// DHTLIB_OK
// DHTLIB_ERROR_CHECKSUM
// DHTLIB_ERROR_TIMEOUT
int dht_read_universal(uint8_t pin)
int dht_read(uint8_t pin, dht_type type)
{
// READ VALUES
int rv = dht_readSensor(pin, DHTLIB_DHT_UNI_WAKEUP);
int rv = dht_readSensor(pin,
type == DHT22 ? DHTLIB_DHT_WAKEUP :
type == DHT11 ? DHTLIB_DHT11_WAKEUP :
DHTLIB_DHT_UNI_WAKEUP
);
if (rv != DHTLIB_OK)
{
dht_humidity = DHTLIB_INVALID_VALUE; // invalid value, or is NaN prefered?
......@@ -90,129 +89,73 @@ int dht_read_universal(uint8_t pin)
return rv; // propagate error value
}
#if defined(DHT_DEBUG_BYTES)
int i;
for (i = 0; i < 5; i++)
{
DHT_DEBUG("%02X\n", dht_bytes[i]);
}
#endif // defined(DHT_DEBUG_BYTES)
NODE_DBG("DHT registers: %x\t%x\t%x\t%x\t%x == %x\n", dht_bytes[0], dht_bytes[1], dht_bytes[2], dht_bytes[3], dht_bytes[4], (uint8_t)(dht_bytes[0] + dht_bytes[1] + dht_bytes[2] + dht_bytes[3]));
// Assume it is DHT11
// Assume it is special case of DHT11,
// i.e. positive temperature and dht_bytes[3] == 0 ((dht_bytes[3] & 0x0f) * 0.1 to be added to temperature readout)
// If it is DHT11, both temp and humidity's decimal
dht_humidity = dht_bytes[0];
dht_temperature = dht_bytes[2];
if ((dht_bytes[1] == 0) && (dht_bytes[3] == 0))
{
// It may DHT11
// CONVERT AND STORE
DHT_DEBUG("DHT11 method\n");
dht_humidity = getValue(Humidity8);
dht_temperature = getValue(Temperature8);
NODE_DBG("DHT11 method\n");
// TEST CHECKSUM
if (!verifyChecksum())
{
// It may not DHT11
dht_humidity = DHTLIB_INVALID_VALUE; // invalid value, or is NaN prefered?
dht_temperature = DHTLIB_INVALID_VALUE; // invalid value
// Do nothing
}
else
uint8_t sum = dht_bytes[0] + dht_bytes[2];
if (dht_bytes[4] == sum)
{
return DHTLIB_OK;
}
}
// Assume it is not DHT11
// Assume it is not DHT11 special case
// CONVERT AND STORE
DHT_DEBUG("DHTxx method\n");
dht_humidity = getValue(Humidity);
dht_temperature = getValue(Temperature);
// TEST CHECKSUM
if (!verifyChecksum())
{
return DHTLIB_ERROR_CHECKSUM;
NODE_DBG("DHTxx method\n");
switch (type) {
case DHT11:
case DHT12:
dht_humidity += dht_bytes[1] * 0.1;
break;
default:
dht_humidity = COMBINE_HIGH_AND_LOW_BYTE(dht_bytes[0], dht_bytes[1]) * 0.1;
break;
}
return DHTLIB_OK;
}
// return values:
// DHTLIB_OK
// DHTLIB_ERROR_CHECKSUM
// DHTLIB_ERROR_TIMEOUT
int dht_read11(uint8_t pin)
{
// READ VALUES
int rv = dht_readSensor(pin, DHTLIB_DHT11_WAKEUP);
if (rv != DHTLIB_OK)
{
dht_humidity = DHTLIB_INVALID_VALUE; // invalid value, or is NaN prefered?
dht_temperature = DHTLIB_INVALID_VALUE; // invalid value
return rv;
}
// CONVERT AND STORE
dht_humidity = getValue(Humidity8);
dht_temperature = getValue(Temperature8);
// TEST CHECKSUM
if (!verifyChecksum()) return DHTLIB_ERROR_CHECKSUM;
return DHTLIB_OK;
}