mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-06-25 18:01:33 +02:00
Compare commits
92 Commits
Author | SHA1 | Date | |
---|---|---|---|
80ea521940 | |||
5c04de6f39 | |||
0d163a1ce2 | |||
2a7e509978 | |||
1b8c7e34f9 | |||
7a574399b1 | |||
fd089d8fd3 | |||
f356ccd54a | |||
6daf773464 | |||
70a896481d | |||
390da0d090 | |||
d5e2bb12ca | |||
f4acac4c2b | |||
5137fc5c80 | |||
03066e42ef | |||
cd5257ad78 | |||
ee6336a312 | |||
61f71930e9 | |||
ec40c4c96f | |||
2bda4a9617 | |||
91b9fae111 | |||
2a1fde7736 | |||
a12d609b22 | |||
73576674b8 | |||
007a93ec7e | |||
a5f3fc6fad | |||
65e256c40a | |||
fa55a2c91d | |||
a070884441 | |||
a9c8b46b1a | |||
6954150176 | |||
548f712df2 | |||
56ce580b0e | |||
509d31ba51 | |||
9e32cec9a2 | |||
3376ea1bd5 | |||
1c7e329140 | |||
c17b212cd0 | |||
7dbda4988b | |||
d1134fd45e | |||
d5fdd715ef | |||
ca7106e97e | |||
87e5787cf7 | |||
c13d11e7d1 | |||
b0d8d4dd44 | |||
05de017bd5 | |||
e1548e9b7e | |||
c29ec9da3d | |||
b3783fba95 | |||
a22ec4a978 | |||
20498cf8b1 | |||
02e51728c4 | |||
d2816b2f32 | |||
2e32022611 | |||
74ffdac74a | |||
4ee17ec3ee | |||
476660f763 | |||
f558e69181 | |||
5bf3aab527 | |||
1aced120ba | |||
7d7824701f | |||
89feacb813 | |||
aae6f24a37 | |||
43b781a158 | |||
e055b28d1a | |||
714ba948e6 | |||
e57de64a3c | |||
fd5a2f08f9 | |||
e9389e3122 | |||
0acf19af8f | |||
aff2e42ac6 | |||
2743e7b739 | |||
c453a0037b | |||
2f249edb8e | |||
bd57ff4ab4 | |||
43bf393dbf | |||
bea7bd1852 | |||
7dd537f8d3 | |||
50d142950d | |||
d13de284b8 | |||
697d4ff7c4 | |||
ab309e40d5 | |||
932666a03f | |||
a0ad987029 | |||
271e5cd206 | |||
619568db5b | |||
0202ba7c21 | |||
119ece2b0f | |||
606446a830 | |||
a28cf00295 | |||
672e4faa92 | |||
f8eebb5c39 |
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -24,7 +24,7 @@ https://github.com/me-no-dev/EspExceptionDecoder
|
||||
|
||||
### Hardware:
|
||||
Board: ?ESP32 Dev Module? ?node32? ?ttgo_lora?
|
||||
Core Installation version: ?1.0.0? ?1.0.1-rc4? ?1.0.1? ?1.0.1-git?
|
||||
Core Installation version: ?1.0.0? ?1.0.1-rc4? ?1.0.1? ?1.0.1-git? ?1.0.2? ?1.0.3?
|
||||
IDE name: ?Arduino IDE? ?Platform.io? ?IDF component?
|
||||
Flash Frequency: ?40Mhz?
|
||||
PSRAM enabled: ?no? ?yes?
|
||||
|
64
.github/stale.yml
vendored
Normal file
64
.github/stale.yml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||
daysUntilStale: 60
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
|
||||
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
||||
daysUntilClose: 14
|
||||
|
||||
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
|
||||
onlyLabels: []
|
||||
|
||||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
- "to be implemented"
|
||||
- "for reference"
|
||||
- "move to PR"
|
||||
- "enhancement"
|
||||
|
||||
# Set to true to ignore issues in a project (defaults to false)
|
||||
exemptProjects: false
|
||||
|
||||
# Set to true to ignore issues in a milestone (defaults to false)
|
||||
exemptMilestones: false
|
||||
|
||||
# Set to true to ignore issues with an assignee (defaults to false)
|
||||
exemptAssignees: false
|
||||
|
||||
# Label to use when marking as stale
|
||||
staleLabel: stale
|
||||
|
||||
# Comment to post when marking as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed in 14 days if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
|
||||
# Comment to post when removing the stale label.
|
||||
# unmarkComment: >
|
||||
# Your comment here.
|
||||
|
||||
# Comment to post when closing a stale Issue or Pull Request.
|
||||
closeComment: >
|
||||
This stale issue has been automatically closed. Thank you for your contributions.
|
||||
|
||||
# Limit the number of actions per hour, from 1-30. Default is 30
|
||||
limitPerRun: 30
|
||||
|
||||
# Limit to only `issues` or `pulls`
|
||||
only: issues
|
||||
|
||||
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
|
||||
# pulls:
|
||||
# daysUntilStale: 30
|
||||
# markComment: >
|
||||
# This pull request has been automatically marked as stale because it has not had
|
||||
# recent activity. It will be closed if no further activity occurs. Thank you
|
||||
# for your contributions.
|
||||
|
||||
# issues:
|
||||
# exemptLabels:
|
||||
# - confirmed
|
376
.github/workflows/main.yml
vendored
Normal file
376
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,376 @@
|
||||
name: ESP32 Arduino CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release/*
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
|
||||
build-arduino-0:
|
||||
name: Build Arduino IDE Tests 0
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Run CMake Check
|
||||
run: ./tools/ci/check-cmakelists.sh
|
||||
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
#ESP32_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 0 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-1:
|
||||
name: Build Arduino IDE Tests 1
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 1 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-2:
|
||||
name: Build Arduino IDE Tests 2
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 2 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-3:
|
||||
name: Build Arduino IDE Tests 3
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 3 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-4:
|
||||
name: Build Arduino IDE Tests 4
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 4 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-5:
|
||||
name: Build Arduino IDE Tests 5
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 5 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-6:
|
||||
name: Build Arduino IDE Tests 6
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 6 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-7:
|
||||
name: Build Arduino IDE Tests 7
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 7 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-8:
|
||||
name: Build Arduino IDE Tests 8
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 8 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-9:
|
||||
name: Build Arduino IDE Tests 9
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 9 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-10:
|
||||
name: Build Arduino IDE Tests 10
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 10 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-11:
|
||||
name: Build Arduino IDE Tests 11
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 11 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-12:
|
||||
name: Build Arduino IDE Tests 12
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 12 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-13:
|
||||
name: Build Arduino IDE Tests 13
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 13 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-14:
|
||||
name: Build Arduino IDE Tests 14
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 14 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-15:
|
||||
name: Build Arduino IDE Tests 15
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 15 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-16:
|
||||
name: Build Arduino IDE Tests 16
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 16 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
build-arduino-17:
|
||||
name: Build Arduino IDE Tests 17
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-arduino-ide.sh
|
||||
- name: Test Arduino IDE
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/test-arduino-ide.sh 17 18
|
||||
- name: Sketch Sizes
|
||||
run: cat size.log
|
||||
|
||||
|
||||
build-platformio:
|
||||
name: Build PlatformIO Tests
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Pull submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Install Python Wheel
|
||||
run: pip install wheel
|
||||
- name: Install GCC Toolchain
|
||||
run: cd tools && python get.py
|
||||
- name: Install PlatformIO
|
||||
env:
|
||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||
run: ./tools/ci/prep-platformio.sh
|
||||
- name: Test PlatformIO
|
||||
run: ./tools/ci/test-platformio.sh
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -5,3 +5,10 @@ tools/esptool.exe
|
||||
tools/mkspiffs/mkspiffs
|
||||
tools/mkspiffs/mkspiffs.exe
|
||||
.DS_Store
|
||||
|
||||
#Ignore files built by Visual Studio/Visual Micro
|
||||
[Dd]ebug*/
|
||||
[Rr]elease*/
|
||||
.vs/
|
||||
__vm/
|
||||
*.vcxproj*
|
||||
|
63
.travis.yml
63
.travis.yml
@ -1,8 +1,6 @@
|
||||
sudo: false
|
||||
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
|
||||
os:
|
||||
- linux
|
||||
@ -10,22 +8,55 @@ os:
|
||||
git:
|
||||
depth: false
|
||||
|
||||
env:
|
||||
global:
|
||||
before_install:
|
||||
- git submodule update --init --recursive
|
||||
|
||||
stages:
|
||||
- build
|
||||
- deploy
|
||||
|
||||
jobs:
|
||||
include:
|
||||
|
||||
- name: "Build Arduino 0"
|
||||
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
||||
stage: build
|
||||
script: $TRAVIS_BUILD_DIR/tools/ci/build-tests.sh 0 4
|
||||
|
||||
- name: "Build Arduino 1"
|
||||
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
||||
stage: build
|
||||
script: $TRAVIS_BUILD_DIR/tools/ci/build-tests.sh 1 4
|
||||
|
||||
- name: "Build Arduino 2"
|
||||
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
||||
stage: build
|
||||
script: $TRAVIS_BUILD_DIR/tools/ci/build-tests.sh 2 4
|
||||
|
||||
- name: "Build Arduino 3"
|
||||
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
||||
stage: build
|
||||
script: $TRAVIS_BUILD_DIR/tools/ci/build-tests.sh 3 4
|
||||
|
||||
- name: "Build PlatformIO"
|
||||
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
||||
stage: build
|
||||
script: $TRAVIS_BUILD_DIR/tools/ci/build-tests.sh 4 4
|
||||
|
||||
- name: "Package & Deploy"
|
||||
if: tag IS present
|
||||
stage: deploy
|
||||
env:
|
||||
- secure: "l/4Dt+KQ/mACtGAHDUsPr66fUte840PZoQ4xpPikqWZI0uARu4l+Ym7+sHinnT6fBqrj8AJeBYGz4nFa8NK4LutZn9mSD40w+sxl0wSV4oHV8rzKe3Cd8+sMG3+o33yWoikMNjSvqa73Q0rm+SgrlInNdZbuAyixL+a2alaWSnGPm4F2xwUGj+S33TOy5P/Xp77CYtCV5S8vzyk/eEdNhoF0GYePJVdfuzCOUjXMyT5OWxORkzzQ7Hnn/Ka/RDfV8Si4HgujLQBrK5q6iPnNBFqBSqilYBepSMn4opnOBpIm0SCgePz7XQEFC83buA7GUcnCnfg38bf+dCwHaODf1d1PmqVRYt2QmfinexXtM4afAtL0iBUDtvrfnXHzwW9w82VeZhpbJSVh9DUQvB0IlsZeCz9J9PUBAi3N+SMX+9l+BomYwRUlPuKY+Ef2JKk9q6mxtUkky5R0daAlVxEhpVdQks1rT+T+NMoDMemxQ3SKEiqAHh6EgHecruszffmZ71uLX9MpERpew0qN+UFiafws+jkTjx+3yF9yut0Hf9sMbeAYzzkGzRqJTUEBJ6B29Cql8M0yRXCNN/8wuuTHhG8esstozga4ZQoIVrq7mEAgup376PTcNfr1+imbbWVQ7lJdYIuDe6OS5V3OX6np11vgK/DbhfyzvQv9Z1zAGnM="
|
||||
- REMOTE_URL=https://github.com/$TRAVIS_REPO_SLUG/releases/download/$TRAVIS_TAG
|
||||
|
||||
script:
|
||||
- bash $TRAVIS_BUILD_DIR/tools/build.sh
|
||||
|
||||
deploy:
|
||||
provider: script
|
||||
skip_cleanup: true
|
||||
script: bash $TRAVIS_BUILD_DIR/tools/deploy.sh -t$TRAVIS_TAG -a$ESP32_GITHUB_TOKEN -s$TRAVIS_REPO_SLUG -drelease
|
||||
|
||||
on:
|
||||
tags: true
|
||||
|
||||
script: bash $TRAVIS_BUILD_DIR/tools/ci/build-release.sh -a$ESP32_GITHUB_TOKEN
|
||||
before_deploy: git submodule update --init
|
||||
deploy:
|
||||
- provider: script
|
||||
skip_cleanup: true
|
||||
script: bash $TRAVIS_BUILD_DIR/tools/ci/deploy-release.sh -t$TRAVIS_TAG -a$ESP32_GITHUB_TOKEN -s$TRAVIS_REPO_SLUG -drelease
|
||||
on:
|
||||
tags: true
|
||||
|
||||
notifications:
|
||||
email:
|
||||
|
@ -209,3 +209,8 @@ set(COMPONENT_REQUIRES spi_flash mbedtls mdns ethernet)
|
||||
set(COMPONENT_PRIV_REQUIRES fatfs nvs_flash app_update spiffs bootloader_support openssl bt)
|
||||
|
||||
register_component()
|
||||
|
||||
set_source_files_properties(libraries/AzureIoT/src/az_iot/iothub_client/src/iothubtransport_mqtt_common.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
-Wno-maybe-uninitialized
|
||||
)
|
||||
|
@ -232,6 +232,12 @@ config ARDUINO_SELECTIVE_ESPmDNS
|
||||
select ARDUINO_SELECTIVE_WiFi
|
||||
default y
|
||||
|
||||
config ARDUINO_SELECTIVE_FFat
|
||||
bool "Enable FFat"
|
||||
depends on ARDUINO_SELECTIVE_COMPILATION
|
||||
select ARDUINO_SELECTIVE_FS
|
||||
default y
|
||||
|
||||
config ARDUINO_SELECTIVE_FS
|
||||
bool "Enable FS"
|
||||
depends on ARDUINO_SELECTIVE_COMPILATION
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
[Latest development release  ](https://github.com/espressif/arduino-esp32/releases/latest/) 
|
||||
|
||||
Most of the framework is implemented. Most noticable is the missing analogWrite. While analogWrite is on it's way, there are a few other options that you can use:
|
||||
Most of the framework is implemented. Most noticeable is the missing analogWrite. While analogWrite is on it's way, there are a few other options that you can use:
|
||||
- 16 channels [LEDC](cores/esp32/esp32-hal-ledc.h) which is PWM
|
||||
- 8 channels [SigmaDelta](cores/esp32/esp32-hal-sigmadelta.h) which uses SigmaDelta modulation
|
||||
- 2 channels [DAC](cores/esp32/esp32-hal-dac.h) which gives real analog output
|
||||
|
608
boards.txt
608
boards.txt
@ -44,6 +44,8 @@ esp32.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIF
|
||||
esp32.menu.PartitionScheme.default.build.partitions=default
|
||||
esp32.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
|
||||
esp32.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
|
||||
esp32.menu.PartitionScheme.default_8MB=8M Flash (3MB APP/1.5MB FAT)
|
||||
esp32.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
|
||||
esp32.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
|
||||
esp32.menu.PartitionScheme.minimal.build.partitions=minimal
|
||||
esp32.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
|
||||
@ -104,6 +106,9 @@ esp32.menu.FlashFreq.40.build.flash_freq=40m
|
||||
|
||||
esp32.menu.FlashSize.4M=4MB (32Mb)
|
||||
esp32.menu.FlashSize.4M.build.flash_size=4MB
|
||||
esp32.menu.FlashSize.8M=8MB (64Mb)
|
||||
esp32.menu.FlashSize.8M.build.flash_size=8MB
|
||||
esp32.menu.FlashSize.8M.build.partitions=default_8MB
|
||||
esp32.menu.FlashSize.2M=2MB (16Mb)
|
||||
esp32.menu.FlashSize.2M.build.flash_size=2MB
|
||||
esp32.menu.FlashSize.2M.build.partitions=minimal
|
||||
@ -225,7 +230,6 @@ esp32wrover.menu.DebugLevel.verbose=Verbose
|
||||
esp32wrover.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
pico32.name=ESP32 Pico Kit
|
||||
|
||||
pico32.upload.tool=esptool_py
|
||||
@ -279,6 +283,110 @@ pico32.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
tinypico.name=TinyPICO
|
||||
|
||||
tinypico.upload.tool=esptool_py
|
||||
tinypico.upload.maximum_size=1310720
|
||||
tinypico.upload.maximum_data_size=327680
|
||||
tinypico.upload.wait_for_upload_port=true
|
||||
|
||||
tinypico.serial.disableDTR=true
|
||||
tinypico.serial.disableRTS=true
|
||||
|
||||
tinypico.build.mcu=esp32
|
||||
tinypico.build.core=esp32
|
||||
tinypico.build.variant=pico32
|
||||
tinypico.build.board=ESP32_PICO
|
||||
|
||||
tinypico.build.f_cpu=240000000L
|
||||
tinypico.build.flash_size=4MB
|
||||
tinypico.build.flash_freq=80m
|
||||
tinypico.build.flash_mode=dio
|
||||
tinypico.build.boot=dio
|
||||
tinypico.build.partitions=default
|
||||
tinypico.build.defines=
|
||||
|
||||
tinypico.menu.UploadSpeed.921600=921600
|
||||
tinypico.menu.UploadSpeed.921600.upload.speed=921600
|
||||
tinypico.menu.UploadSpeed.115200=115200
|
||||
tinypico.menu.UploadSpeed.115200.upload.speed=115200
|
||||
tinypico.menu.UploadSpeed.256000.windows=256000
|
||||
tinypico.menu.UploadSpeed.256000.upload.speed=256000
|
||||
tinypico.menu.UploadSpeed.230400.windows.upload.speed=256000
|
||||
tinypico.menu.UploadSpeed.230400=230400
|
||||
tinypico.menu.UploadSpeed.230400.upload.speed=230400
|
||||
tinypico.menu.UploadSpeed.460800.linux=460800
|
||||
tinypico.menu.UploadSpeed.460800.macosx=460800
|
||||
tinypico.menu.UploadSpeed.460800.upload.speed=460800
|
||||
tinypico.menu.UploadSpeed.512000.windows=512000
|
||||
tinypico.menu.UploadSpeed.512000.upload.speed=512000
|
||||
|
||||
tinypico.menu.FlashMode.qio=QIO
|
||||
tinypico.menu.FlashMode.qio.build.flash_mode=dio
|
||||
tinypico.menu.FlashMode.qio.build.boot=qio
|
||||
tinypico.menu.FlashMode.dio=DIO
|
||||
tinypico.menu.FlashMode.dio.build.flash_mode=dio
|
||||
tinypico.menu.FlashMode.dio.build.boot=dio
|
||||
|
||||
tinypico.menu.FlashFreq.80=80MHz
|
||||
tinypico.menu.FlashFreq.80.build.flash_freq=80m
|
||||
tinypico.menu.FlashFreq.40=40MHz
|
||||
tinypico.menu.FlashFreq.40.build.flash_freq=40m
|
||||
|
||||
tinypico.menu.PSRAM.enabled=Enabled
|
||||
tinypico.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
|
||||
tinypico.menu.PSRAM.disabled=Disabled
|
||||
tinypico.menu.PSRAM.disabled.build.defines=
|
||||
|
||||
tinypico.menu.DebugLevel.none=None
|
||||
tinypico.menu.DebugLevel.none.build.code_debug=0
|
||||
tinypico.menu.DebugLevel.error=Error
|
||||
tinypico.menu.DebugLevel.error.build.code_debug=1
|
||||
tinypico.menu.DebugLevel.warn=Warn
|
||||
tinypico.menu.DebugLevel.warn.build.code_debug=2
|
||||
tinypico.menu.DebugLevel.info=Info
|
||||
tinypico.menu.DebugLevel.info.build.code_debug=3
|
||||
tinypico.menu.DebugLevel.debug=Debug
|
||||
tinypico.menu.DebugLevel.debug.build.code_debug=4
|
||||
tinypico.menu.DebugLevel.verbose=Verbose
|
||||
tinypico.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
magicbit.name=MagicBit
|
||||
|
||||
magicbit.upload.tool=esptool_py
|
||||
magicbit.upload.maximum_size=1310720
|
||||
magicbit.upload.maximum_data_size=327680
|
||||
magicbit.upload.wait_for_upload_port=true
|
||||
|
||||
magicbit.serial.disableDTR=true
|
||||
magicbit.serial.disableRTS=true
|
||||
|
||||
magicbit.build.mcu=esp32
|
||||
magicbit.build.core=esp32
|
||||
magicbit.build.variant=magicbit
|
||||
magicbit.build.board=ESP32_DEV
|
||||
|
||||
magicbit.build.f_cpu=240000000L
|
||||
magicbit.build.flash_size=4MB
|
||||
magicbit.build.flash_freq=40m
|
||||
magicbit.build.flash_mode=dio
|
||||
magicbit.build.boot=dio
|
||||
magicbit.build.partitions=default
|
||||
|
||||
magicbit.menu.CPUFreq.240=240MHz (WiFi/BT)
|
||||
magicbit.menu.CPUFreq.240.build.f_cpu=240000000L
|
||||
magicbit.menu.CPUFreq.160=160MHz (WiFi/BT)
|
||||
magicbit.menu.CPUFreq.160.build.f_cpu=160000000L
|
||||
magicbit.menu.CPUFreq.80=80MHz (WiFi/BT)
|
||||
magicbit.menu.CPUFreq.80.build.f_cpu=80000000L
|
||||
magicbit.menu.CPUFreq.40=40MHz (40MHz XTAL)
|
||||
|
||||
magicbit.menu.UploadSpeed.921600=921600
|
||||
magicbit.menu.UploadSpeed.921600.upload.speed=921600
|
||||
magicbit.menu.UploadSpeed.115200=115200
|
||||
magicbit.menu.UploadSpeed.115200.upload.speed=115200
|
||||
##############################################################
|
||||
turta_iot_node.name=Turta IoT Node
|
||||
|
||||
turta_iot_node.upload.tool=esptool_py
|
||||
@ -378,6 +486,128 @@ ttgo-lora32-v1.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
ttgo-t1.name=TTGO T1
|
||||
|
||||
ttgo-t1.upload.tool=esptool_py
|
||||
ttgo-t1.upload.maximum_size=1310720
|
||||
ttgo-t1.upload.maximum_data_size=327680
|
||||
ttgo-t1.upload.wait_for_upload_port=true
|
||||
|
||||
ttgo-t1.serial.disableDTR=true
|
||||
ttgo-t1.serial.disableRTS=true
|
||||
|
||||
ttgo-t1.build.mcu=esp32
|
||||
ttgo-t1.build.core=esp32
|
||||
ttgo-t1.build.variant=ttgo-t1
|
||||
ttgo-t1.build.board=TTGO_T1
|
||||
|
||||
ttgo-t1.build.f_cpu=240000000L
|
||||
ttgo-t1.build.flash_size=4MB
|
||||
ttgo-t1.build.flash_freq=40m
|
||||
ttgo-t1.build.flash_mode=dio
|
||||
ttgo-t1.build.boot=dio
|
||||
ttgo-t1.build.partitions=default
|
||||
ttgo-t1.build.defines=
|
||||
|
||||
ttgo-t1.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
|
||||
ttgo-t1.menu.PartitionScheme.default.build.partitions=default
|
||||
ttgo-t1.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
|
||||
ttgo-t1.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
|
||||
ttgo-t1.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
|
||||
ttgo-t1.menu.PartitionScheme.minimal.build.partitions=minimal
|
||||
ttgo-t1.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
|
||||
ttgo-t1.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
ttgo-t1.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
ttgo-t1.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
|
||||
ttgo-t1.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
|
||||
ttgo-t1.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
|
||||
ttgo-t1.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
|
||||
ttgo-t1.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
|
||||
ttgo-t1.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
|
||||
ttgo-t1.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
|
||||
ttgo-t1.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
|
||||
ttgo-t1.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
|
||||
ttgo-t1.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
|
||||
ttgo-t1.menu.PartitionScheme.huge_app.build.partitions=huge_app
|
||||
ttgo-t1.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
|
||||
ttgo-t1.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
||||
ttgo-t1.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
ttgo-t1.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
|
||||
ttgo-t1.menu.CPUFreq.240=240MHz (WiFi/BT)
|
||||
ttgo-t1.menu.CPUFreq.240.build.f_cpu=240000000L
|
||||
ttgo-t1.menu.CPUFreq.160=160MHz (WiFi/BT)
|
||||
ttgo-t1.menu.CPUFreq.160.build.f_cpu=160000000L
|
||||
ttgo-t1.menu.CPUFreq.80=80MHz (WiFi/BT)
|
||||
ttgo-t1.menu.CPUFreq.80.build.f_cpu=80000000L
|
||||
ttgo-t1.menu.CPUFreq.40=40MHz (40MHz XTAL)
|
||||
ttgo-t1.menu.CPUFreq.40.build.f_cpu=40000000L
|
||||
ttgo-t1.menu.CPUFreq.26=26MHz (26MHz XTAL)
|
||||
ttgo-t1.menu.CPUFreq.26.build.f_cpu=26000000L
|
||||
ttgo-t1.menu.CPUFreq.20=20MHz (40MHz XTAL)
|
||||
ttgo-t1.menu.CPUFreq.20.build.f_cpu=20000000L
|
||||
ttgo-t1.menu.CPUFreq.13=13MHz (26MHz XTAL)
|
||||
ttgo-t1.menu.CPUFreq.13.build.f_cpu=13000000L
|
||||
ttgo-t1.menu.CPUFreq.10=10MHz (40MHz XTAL)
|
||||
ttgo-t1.menu.CPUFreq.10.build.f_cpu=10000000L
|
||||
|
||||
ttgo-t1.menu.FlashMode.qio=QIO
|
||||
ttgo-t1.menu.FlashMode.qio.build.flash_mode=dio
|
||||
ttgo-t1.menu.FlashMode.qio.build.boot=qio
|
||||
ttgo-t1.menu.FlashMode.dio=DIO
|
||||
ttgo-t1.menu.FlashMode.dio.build.flash_mode=dio
|
||||
ttgo-t1.menu.FlashMode.dio.build.boot=dio
|
||||
ttgo-t1.menu.FlashMode.qout=QOUT
|
||||
ttgo-t1.menu.FlashMode.qout.build.flash_mode=dout
|
||||
ttgo-t1.menu.FlashMode.qout.build.boot=qout
|
||||
ttgo-t1.menu.FlashMode.dout=DOUT
|
||||
ttgo-t1.menu.FlashMode.dout.build.flash_mode=dout
|
||||
ttgo-t1.menu.FlashMode.dout.build.boot=dout
|
||||
|
||||
ttgo-t1.menu.FlashFreq.80=80MHz
|
||||
ttgo-t1.menu.FlashFreq.80.build.flash_freq=80m
|
||||
ttgo-t1.menu.FlashFreq.40=40MHz
|
||||
ttgo-t1.menu.FlashFreq.40.build.flash_freq=40m
|
||||
|
||||
ttgo-t1.menu.FlashSize.4M=4MB (32Mb)
|
||||
ttgo-t1.menu.FlashSize.4M.build.flash_size=4MB
|
||||
ttgo-t1.menu.FlashSize.2M=2MB (16Mb)
|
||||
ttgo-t1.menu.FlashSize.2M.build.flash_size=2MB
|
||||
ttgo-t1.menu.FlashSize.2M.build.partitions=minimal
|
||||
ttgo-t1.menu.FlashSize.16M=16MB (128Mb)
|
||||
ttgo-t1.menu.FlashSize.16M.build.flash_size=16MB
|
||||
ttgo-t1.menu.FlashSize.16M.build.partitions=ffat
|
||||
|
||||
ttgo-t1.menu.UploadSpeed.921600=921600
|
||||
ttgo-t1.menu.UploadSpeed.921600.upload.speed=921600
|
||||
ttgo-t1.menu.UploadSpeed.115200=115200
|
||||
ttgo-t1.menu.UploadSpeed.115200.upload.speed=115200
|
||||
ttgo-t1.menu.UploadSpeed.256000.windows=256000
|
||||
ttgo-t1.menu.UploadSpeed.256000.upload.speed=256000
|
||||
ttgo-t1.menu.UploadSpeed.230400.windows.upload.speed=256000
|
||||
ttgo-t1.menu.UploadSpeed.230400=230400
|
||||
ttgo-t1.menu.UploadSpeed.230400.upload.speed=230400
|
||||
ttgo-t1.menu.UploadSpeed.460800.linux=460800
|
||||
ttgo-t1.menu.UploadSpeed.460800.macosx=460800
|
||||
ttgo-t1.menu.UploadSpeed.460800.upload.speed=460800
|
||||
ttgo-t1.menu.UploadSpeed.512000.windows=512000
|
||||
ttgo-t1.menu.UploadSpeed.512000.upload.speed=512000
|
||||
|
||||
ttgo-t1.menu.DebugLevel.none=None
|
||||
ttgo-t1.menu.DebugLevel.none.build.code_debug=0
|
||||
ttgo-t1.menu.DebugLevel.error=Error
|
||||
ttgo-t1.menu.DebugLevel.error.build.code_debug=1
|
||||
ttgo-t1.menu.DebugLevel.warn=Warn
|
||||
ttgo-t1.menu.DebugLevel.warn.build.code_debug=2
|
||||
ttgo-t1.menu.DebugLevel.info=Info
|
||||
ttgo-t1.menu.DebugLevel.info.build.code_debug=3
|
||||
ttgo-t1.menu.DebugLevel.debug=Debug
|
||||
ttgo-t1.menu.DebugLevel.debug.build.code_debug=4
|
||||
ttgo-t1.menu.DebugLevel.verbose=Verbose
|
||||
ttgo-t1.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
cw02.name=XinaBox CW02
|
||||
|
||||
cw02.upload.tool=esptool_py
|
||||
@ -879,6 +1109,23 @@ lolin32.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA)
|
||||
lolin32.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
lolin32.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
|
||||
lolin32.menu.CPUFreq.240=240MHz (WiFi/BT)
|
||||
lolin32.menu.CPUFreq.240.build.f_cpu=240000000L
|
||||
lolin32.menu.CPUFreq.160=160MHz (WiFi/BT)
|
||||
lolin32.menu.CPUFreq.160.build.f_cpu=160000000L
|
||||
lolin32.menu.CPUFreq.80=80MHz (WiFi/BT)
|
||||
lolin32.menu.CPUFreq.80.build.f_cpu=80000000L
|
||||
lolin32.menu.CPUFreq.40=40MHz (40MHz XTAL)
|
||||
lolin32.menu.CPUFreq.40.build.f_cpu=40000000L
|
||||
lolin32.menu.CPUFreq.26=26MHz (26MHz XTAL)
|
||||
lolin32.menu.CPUFreq.26.build.f_cpu=26000000L
|
||||
lolin32.menu.CPUFreq.20=20MHz (40MHz XTAL)
|
||||
lolin32.menu.CPUFreq.20.build.f_cpu=20000000L
|
||||
lolin32.menu.CPUFreq.13=13MHz (26MHz XTAL)
|
||||
lolin32.menu.CPUFreq.13.build.f_cpu=13000000L
|
||||
lolin32.menu.CPUFreq.10=10MHz (40MHz XTAL)
|
||||
lolin32.menu.CPUFreq.10.build.f_cpu=10000000L
|
||||
|
||||
lolin32.menu.UploadSpeed.921600=921600
|
||||
lolin32.menu.UploadSpeed.921600.upload.speed=921600
|
||||
lolin32.menu.UploadSpeed.115200=115200
|
||||
@ -1814,6 +2061,121 @@ esp32-poe.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
|
||||
##############################################################
|
||||
|
||||
esp32-poe-iso.name=OLIMEX ESP32-PoE-ISO
|
||||
|
||||
esp32-poe-iso.upload.tool=esptool_py
|
||||
esp32-poe-iso.upload.maximum_size=1310720
|
||||
esp32-poe-iso.upload.maximum_data_size=327680
|
||||
esp32-poe-iso.upload.wait_for_upload_port=true
|
||||
|
||||
esp32-poe-iso.serial.disableDTR=true
|
||||
esp32-poe-iso.serial.disableRTS=true
|
||||
|
||||
esp32-poe-iso.build.mcu=esp32
|
||||
esp32-poe-iso.build.core=esp32
|
||||
esp32-poe-iso.build.variant=esp32-poe-iso
|
||||
esp32-poe-iso.build.board=ESP32_POE_ISO
|
||||
|
||||
esp32-poe-iso.build.f_cpu=240000000L
|
||||
esp32-poe-iso.build.flash_mode=dio
|
||||
esp32-poe-iso.build.flash_size=4MB
|
||||
esp32-poe-iso.build.boot=dio
|
||||
esp32-poe-iso.build.partitions=default
|
||||
esp32-poe-iso.build.defines=
|
||||
|
||||
esp32-poe-iso.menu.FlashFreq.80=80MHz
|
||||
esp32-poe-iso.menu.FlashFreq.80.build.flash_freq=80m
|
||||
esp32-poe-iso.menu.FlashFreq.40=40MHz
|
||||
esp32-poe-iso.menu.FlashFreq.40.build.flash_freq=40m
|
||||
|
||||
|
||||
esp32-poe-iso.menu.UploadSpeed.115200=115200
|
||||
esp32-poe-iso.menu.UploadSpeed.115200.upload.speed=115200
|
||||
|
||||
esp32-poe-iso.menu.PartitionScheme.default=Default
|
||||
esp32-poe-iso.menu.PartitionScheme.default.build.partitions=default
|
||||
esp32-poe-iso.menu.PartitionScheme.no_ota=No OTA (Large APP)
|
||||
esp32-poe-iso.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
esp32-poe-iso.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
esp32-poe-iso.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA)
|
||||
esp32-poe-iso.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
esp32-poe-iso.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
|
||||
##############################################################
|
||||
|
||||
esp32-DevKitLipo.name=OLIMEX ESP32-DevKit-LiPo
|
||||
|
||||
esp32-DevKitLipo.upload.tool=esptool_py
|
||||
esp32-DevKitLipo.upload.maximum_size=1310720
|
||||
esp32-DevKitLipo.upload.maximum_data_size=327680
|
||||
esp32-DevKitLipo.upload.wait_for_upload_port=true
|
||||
|
||||
esp32-DevKitLipo.serial.disableDTR=true
|
||||
esp32-DevKitLipo.serial.disableRTS=true
|
||||
|
||||
esp32-DevKitLipo.build.mcu=esp32
|
||||
esp32-DevKitLipo.build.core=esp32
|
||||
esp32-DevKitLipo.build.variant=esp32-devkit-lipo
|
||||
esp32-DevKitLipo.build.board=ESP32_DEVKIT_LIPO
|
||||
|
||||
esp32-DevKitLipo.build.f_cpu=240000000L
|
||||
esp32-DevKitLipo.build.flash_size=4MB
|
||||
esp32-DevKitLipo.build.flash_freq=40m
|
||||
esp32-DevKitLipo.build.flash_mode=dio
|
||||
esp32-DevKitLipo.build.boot=dio
|
||||
esp32-DevKitLipo.build.partitions=default
|
||||
esp32-DevKitLipo.build.defines=
|
||||
|
||||
esp32-DevKitLipo.menu.PartitionScheme.default=Default
|
||||
esp32-DevKitLipo.menu.PartitionScheme.default.build.partitions=default
|
||||
esp32-DevKitLipo.menu.PartitionScheme.minimal=Minimal (2MB FLASH)
|
||||
esp32-DevKitLipo.menu.PartitionScheme.minimal.build.partitions=minimal
|
||||
esp32-DevKitLipo.menu.PartitionScheme.no_ota=No OTA (Large APP)
|
||||
esp32-DevKitLipo.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
esp32-DevKitLipo.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
esp32-DevKitLipo.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA)
|
||||
esp32-DevKitLipo.menu.PartitionScheme.huge_app.build.partitions=huge_app
|
||||
esp32-DevKitLipo.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
|
||||
esp32-DevKitLipo.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA)
|
||||
esp32-DevKitLipo.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
esp32-DevKitLipo.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
esp32-DevKitLipo.menu.PartitionScheme.fatflash=16M Fat
|
||||
esp32-DevKitLipo.menu.PartitionScheme.fatflash.build.partitions=ffat
|
||||
|
||||
esp32-DevKitLipo.menu.FlashMode.qio=QIO
|
||||
esp32-DevKitLipo.menu.FlashMode.qio.build.flash_mode=dio
|
||||
esp32-DevKitLipo.menu.FlashMode.qio.build.boot=qio
|
||||
esp32-DevKitLipo.menu.FlashMode.dio=DIO
|
||||
esp32-DevKitLipo.menu.FlashMode.dio.build.flash_mode=dio
|
||||
esp32-DevKitLipo.menu.FlashMode.dio.build.boot=dio
|
||||
esp32-DevKitLipo.menu.FlashMode.qout=QOUT
|
||||
esp32-DevKitLipo.menu.FlashMode.qout.build.flash_mode=dout
|
||||
esp32-DevKitLipo.menu.FlashMode.qout.build.boot=qout
|
||||
esp32-DevKitLipo.menu.FlashMode.dout=DOUT
|
||||
esp32-DevKitLipo.menu.FlashMode.dout.build.flash_mode=dout
|
||||
esp32-DevKitLipo.menu.FlashMode.dout.build.boot=dout
|
||||
|
||||
esp32-DevKitLipo.menu.FlashFreq.80=80MHz
|
||||
esp32-DevKitLipo.menu.FlashFreq.80.build.flash_freq=80m
|
||||
esp32-DevKitLipo.menu.FlashFreq.40=40MHz
|
||||
esp32-DevKitLipo.menu.FlashFreq.40.build.flash_freq=40m
|
||||
|
||||
esp32-DevKitLipo.menu.UploadSpeed.921600=921600
|
||||
esp32-DevKitLipo.menu.UploadSpeed.921600.upload.speed=921600
|
||||
esp32-DevKitLipo.menu.UploadSpeed.115200=115200
|
||||
esp32-DevKitLipo.menu.UploadSpeed.115200.upload.speed=115200
|
||||
esp32-DevKitLipo.menu.UploadSpeed.256000.windows=256000
|
||||
esp32-DevKitLipo.menu.UploadSpeed.256000.upload.speed=256000
|
||||
esp32-DevKitLipo.menu.UploadSpeed.230400.windows.upload.speed=256000
|
||||
esp32-DevKitLipo.menu.UploadSpeed.230400=230400
|
||||
esp32-DevKitLipo.menu.UploadSpeed.230400.upload.speed=230400
|
||||
esp32-DevKitLipo.menu.UploadSpeed.460800.linux=460800
|
||||
esp32-DevKitLipo.menu.UploadSpeed.460800.macosx=460800
|
||||
esp32-DevKitLipo.menu.UploadSpeed.460800.upload.speed=460800
|
||||
esp32-DevKitLipo.menu.UploadSpeed.512000.windows=512000
|
||||
esp32-DevKitLipo.menu.UploadSpeed.512000.upload.speed=512000
|
||||
##############################################################
|
||||
|
||||
espino32.name=ThaiEasyElec's ESPino32
|
||||
|
||||
espino32.upload.tool=esptool_py
|
||||
@ -2443,7 +2805,7 @@ heltec_wifi_lora_32_V2.menu.FlashFreq.40.build.flash_freq=40m
|
||||
|
||||
heltec_wifi_lora_32_V2.menu.FlashSize.8M=8MB (64Mb)
|
||||
heltec_wifi_lora_32_V2.menu.FlashSize.8M.build.flash_size=8MB
|
||||
heltec_wifi_lora_32_V2.menu.FlashSize.2M.build.partitions=default_8MB
|
||||
heltec_wifi_lora_32_V2.menu.FlashSize.8M.build.partitions=default_8MB
|
||||
heltec_wifi_lora_32_V2.menu.FlashSize.4M=4MB (32Mb)
|
||||
heltec_wifi_lora_32_V2.menu.FlashSize.4M.build.flash_size=4MB
|
||||
heltec_wifi_lora_32_V2.menu.FlashSize.2M=2MB (16Mb)
|
||||
@ -2744,16 +3106,54 @@ alksesp32.build.boot=dio
|
||||
alksesp32.build.partitions=default
|
||||
alksesp32.build.defines=
|
||||
|
||||
alksesp32.menu.PartitionScheme.default=Default
|
||||
alksesp32.menu.PSRAM.disabled=Disabled
|
||||
alksesp32.menu.PSRAM.disabled.build.defines=
|
||||
alksesp32.menu.PSRAM.enabled=Enabled
|
||||
alksesp32.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
|
||||
|
||||
alksesp32.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
|
||||
alksesp32.menu.PartitionScheme.default.build.partitions=default
|
||||
alksesp32.menu.PartitionScheme.minimal=Minimal (2MB FLASH)
|
||||
alksesp32.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
|
||||
alksesp32.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
|
||||
alksesp32.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
|
||||
alksesp32.menu.PartitionScheme.minimal.build.partitions=minimal
|
||||
alksesp32.menu.PartitionScheme.no_ota=No OTA (Large APP)
|
||||
alksesp32.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
|
||||
alksesp32.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
alksesp32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
alksesp32.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA)
|
||||
alksesp32.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
|
||||
alksesp32.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
|
||||
alksesp32.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
|
||||
alksesp32.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
|
||||
alksesp32.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
|
||||
alksesp32.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
|
||||
alksesp32.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
|
||||
alksesp32.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
|
||||
alksesp32.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
|
||||
alksesp32.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
|
||||
alksesp32.menu.PartitionScheme.huge_app.build.partitions=huge_app
|
||||
alksesp32.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
|
||||
alksesp32.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
||||
alksesp32.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
alksesp32.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
alksesp32.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FAT)
|
||||
alksesp32.menu.PartitionScheme.fatflash.build.partitions=ffat
|
||||
|
||||
alksesp32.menu.CPUFreq.240=240MHz (WiFi/BT)
|
||||
alksesp32.menu.CPUFreq.240.build.f_cpu=240000000L
|
||||
alksesp32.menu.CPUFreq.160=160MHz (WiFi/BT)
|
||||
alksesp32.menu.CPUFreq.160.build.f_cpu=160000000L
|
||||
alksesp32.menu.CPUFreq.80=80MHz (WiFi/BT)
|
||||
alksesp32.menu.CPUFreq.80.build.f_cpu=80000000L
|
||||
alksesp32.menu.CPUFreq.40=40MHz (40MHz XTAL)
|
||||
alksesp32.menu.CPUFreq.40.build.f_cpu=40000000L
|
||||
alksesp32.menu.CPUFreq.26=26MHz (26MHz XTAL)
|
||||
alksesp32.menu.CPUFreq.26.build.f_cpu=26000000L
|
||||
alksesp32.menu.CPUFreq.20=20MHz (40MHz XTAL)
|
||||
alksesp32.menu.CPUFreq.20.build.f_cpu=20000000L
|
||||
alksesp32.menu.CPUFreq.13=13MHz (26MHz XTAL)
|
||||
alksesp32.menu.CPUFreq.13.build.f_cpu=13000000L
|
||||
alksesp32.menu.CPUFreq.10=10MHz (40MHz XTAL)
|
||||
alksesp32.menu.CPUFreq.10.build.f_cpu=10000000L
|
||||
|
||||
alksesp32.menu.FlashMode.qio=QIO
|
||||
alksesp32.menu.FlashMode.qio.build.flash_mode=dio
|
||||
@ -2778,6 +3178,9 @@ alksesp32.menu.FlashSize.4M.build.flash_size=4MB
|
||||
alksesp32.menu.FlashSize.2M=2MB (16Mb)
|
||||
alksesp32.menu.FlashSize.2M.build.flash_size=2MB
|
||||
alksesp32.menu.FlashSize.2M.build.partitions=minimal
|
||||
alksesp32.menu.FlashSize.16M=16MB (128Mb)
|
||||
alksesp32.menu.FlashSize.16M.build.flash_size=16MB
|
||||
alksesp32.menu.FlashSize.16M.build.partitions=ffat
|
||||
|
||||
alksesp32.menu.UploadSpeed.921600=921600
|
||||
alksesp32.menu.UploadSpeed.921600.upload.speed=921600
|
||||
@ -3522,4 +3925,197 @@ sparkfun_lora_gateway_1-channel.menu.UploadSpeed.512000.upload.speed=512000
|
||||
|
||||
##############################################################
|
||||
|
||||
ttgo-t-watch.name=TTGO T-Watch
|
||||
|
||||
ttgo-t-watch.upload.tool=esptool_py
|
||||
ttgo-t-watch.upload.maximum_size=6553600
|
||||
ttgo-t-watch.upload.maximum_data_size=4521984
|
||||
ttgo-t-watch.upload.wait_for_upload_port=true
|
||||
|
||||
ttgo-t-watch.serial.disableDTR=true
|
||||
ttgo-t-watch.serial.disableRTS=true
|
||||
|
||||
ttgo-t-watch.build.mcu=esp32
|
||||
ttgo-t-watch.build.core=esp32
|
||||
ttgo-t-watch.build.variant=twatch
|
||||
ttgo-t-watch.build.board=T-Watch
|
||||
|
||||
ttgo-t-watch.build.f_cpu=240000000L
|
||||
ttgo-t-watch.build.flash_size=16MB
|
||||
ttgo-t-watch.build.flash_freq=80m
|
||||
ttgo-t-watch.build.flash_mode=dio
|
||||
ttgo-t-watch.build.boot=dio
|
||||
ttgo-t-watch.build.partitions=default_16MB
|
||||
ttgo-t-watch.build.defines=
|
||||
|
||||
ttgo-t-watch.menu.PSRAM.enabled=Enabled
|
||||
ttgo-t-watch.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
|
||||
ttgo-t-watch.menu.PSRAM.disabled=Disabled
|
||||
ttgo-t-watch.menu.PSRAM.disabled.build.defines=
|
||||
|
||||
ttgo-t-watch.menu.PartitionScheme.default=Default (2 x 6.5 MB app, 3.6 MB SPIFFS)
|
||||
ttgo-t-watch.menu.PartitionScheme.default.build.partitions=default_16MB
|
||||
ttgo-t-watch.menu.PartitionScheme.large_spiffs=Large SPIFFS (7 MB)
|
||||
ttgo-t-watch.menu.PartitionScheme.large_spiffs.build.partitions=large_spiffs_16MB
|
||||
ttgo-t-watch.menu.PartitionScheme.large_spiffs.upload.maximum_size=4685824
|
||||
|
||||
ttgo-t-watch.menu.UploadSpeed.2000000=2000000
|
||||
ttgo-t-watch.menu.UploadSpeed.2000000.upload.speed=2000000
|
||||
ttgo-t-watch.menu.UploadSpeed.1152000=1152000
|
||||
ttgo-t-watch.menu.UploadSpeed.1152000.upload.speed=1152000
|
||||
ttgo-t-watch.menu.UploadSpeed.921600=921600
|
||||
ttgo-t-watch.menu.UploadSpeed.921600.upload.speed=921600
|
||||
ttgo-t-watch.menu.UploadSpeed.115200=115200
|
||||
ttgo-t-watch.menu.UploadSpeed.115200.upload.speed=115200
|
||||
ttgo-t-watch.menu.UploadSpeed.256000.windows=256000
|
||||
ttgo-t-watch.menu.UploadSpeed.256000.upload.speed=256000
|
||||
ttgo-t-watch.menu.UploadSpeed.230400.windows.upload.speed=256000
|
||||
ttgo-t-watch.menu.UploadSpeed.230400=230400
|
||||
ttgo-t-watch.menu.UploadSpeed.230400.upload.speed=230400
|
||||
ttgo-t-watch.menu.UploadSpeed.460800.linux=460800
|
||||
ttgo-t-watch.menu.UploadSpeed.460800.macosx=460800
|
||||
ttgo-t-watch.menu.UploadSpeed.460800.upload.speed=460800
|
||||
ttgo-t-watch.menu.UploadSpeed.512000.windows=512000
|
||||
ttgo-t-watch.menu.UploadSpeed.512000.upload.speed=512000
|
||||
|
||||
ttgo-t-watch.menu.DebugLevel.none=None
|
||||
ttgo-t-watch.menu.DebugLevel.none.build.code_debug=0
|
||||
ttgo-t-watch.menu.DebugLevel.error=Error
|
||||
ttgo-t-watch.menu.DebugLevel.error.build.code_debug=1
|
||||
ttgo-t-watch.menu.DebugLevel.warn=Warn
|
||||
ttgo-t-watch.menu.DebugLevel.warn.build.code_debug=2
|
||||
ttgo-t-watch.menu.DebugLevel.info=Info
|
||||
ttgo-t-watch.menu.DebugLevel.info.build.code_debug=3
|
||||
ttgo-t-watch.menu.DebugLevel.debug=Debug
|
||||
ttgo-t-watch.menu.DebugLevel.debug.build.code_debug=4
|
||||
ttgo-t-watch.menu.DebugLevel.verbose=Verbose
|
||||
ttgo-t-watch.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
d1_mini32.name=WEMOS D1 MINI ESP32
|
||||
|
||||
d1_mini32.upload.tool=esptool_py
|
||||
d1_mini32.upload.maximum_size=1310720
|
||||
d1_mini32.upload.maximum_data_size=327680
|
||||
d1_mini32.upload.wait_for_upload_port=true
|
||||
|
||||
d1_mini32.serial.disableDTR=true
|
||||
d1_mini32.serial.disableRTS=true
|
||||
|
||||
d1_mini32.build.mcu=esp32
|
||||
d1_mini32.build.core=esp32
|
||||
d1_mini32.build.variant=d1_mini32
|
||||
d1_mini32.build.board=D1_MINI32
|
||||
|
||||
d1_mini32.build.f_cpu=240000000L
|
||||
d1_mini32.build.flash_mode=dio
|
||||
d1_mini32.build.flash_size=4MB
|
||||
d1_mini32.build.boot=dio
|
||||
d1_mini32.build.partitions=default
|
||||
d1_mini32.build.defines=
|
||||
|
||||
d1_mini32.menu.FlashFreq.80=80MHz
|
||||
d1_mini32.menu.FlashFreq.80.build.flash_freq=80m
|
||||
d1_mini32.menu.FlashFreq.40=40MHz
|
||||
d1_mini32.menu.FlashFreq.40.build.flash_freq=40m
|
||||
|
||||
d1_mini32.menu.PartitionScheme.default=Default
|
||||
d1_mini32.menu.PartitionScheme.default.build.partitions=default
|
||||
d1_mini32.menu.PartitionScheme.no_ota=No OTA (Large APP)
|
||||
d1_mini32.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
d1_mini32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
d1_mini32.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA)
|
||||
d1_mini32.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
d1_mini32.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
|
||||
d1_mini32.menu.CPUFreq.240=240MHz (WiFi/BT)
|
||||
d1_mini32.menu.CPUFreq.240.build.f_cpu=240000000L
|
||||
d1_mini32.menu.CPUFreq.160=160MHz (WiFi/BT)
|
||||
d1_mini32.menu.CPUFreq.160.build.f_cpu=160000000L
|
||||
d1_mini32.menu.CPUFreq.80=80MHz (WiFi/BT)
|
||||
d1_mini32.menu.CPUFreq.80.build.f_cpu=80000000L
|
||||
d1_mini32.menu.CPUFreq.40=40MHz (40MHz XTAL)
|
||||
d1_mini32.menu.CPUFreq.40.build.f_cpu=40000000L
|
||||
d1_mini32.menu.CPUFreq.26=26MHz (26MHz XTAL)
|
||||
d1_mini32.menu.CPUFreq.26.build.f_cpu=26000000L
|
||||
d1_mini32.menu.CPUFreq.20=20MHz (40MHz XTAL)
|
||||
d1_mini32.menu.CPUFreq.20.build.f_cpu=20000000L
|
||||
d1_mini32.menu.CPUFreq.13=13MHz (26MHz XTAL)
|
||||
d1_mini32.menu.CPUFreq.13.build.f_cpu=13000000L
|
||||
d1_mini32.menu.CPUFreq.10=10MHz (40MHz XTAL)
|
||||
d1_mini32.menu.CPUFreq.10.build.f_cpu=10000000L
|
||||
|
||||
d1_mini32.menu.UploadSpeed.921600=921600
|
||||
d1_mini32.menu.UploadSpeed.921600.upload.speed=921600
|
||||
d1_mini32.menu.UploadSpeed.115200=115200
|
||||
d1_mini32.menu.UploadSpeed.115200.upload.speed=115200
|
||||
d1_mini32.menu.UploadSpeed.256000.windows=256000
|
||||
d1_mini32.menu.UploadSpeed.256000.upload.speed=256000
|
||||
d1_mini32.menu.UploadSpeed.230400.windows.upload.speed=256000
|
||||
d1_mini32.menu.UploadSpeed.230400=230400
|
||||
d1_mini32.menu.UploadSpeed.230400.upload.speed=230400
|
||||
d1_mini32.menu.UploadSpeed.460800.linux=460800
|
||||
d1_mini32.menu.UploadSpeed.460800.macosx=460800
|
||||
d1_mini32.menu.UploadSpeed.460800.upload.speed=460800
|
||||
d1_mini32.menu.UploadSpeed.512000.windows=512000
|
||||
d1_mini32.menu.UploadSpeed.512000.upload.speed=512000
|
||||
|
||||
##############################################################
|
||||
|
||||
gpy.name=Pycom GPy
|
||||
|
||||
gpy.upload.tool=esptool_py
|
||||
gpy.upload.maximum_size=1310720
|
||||
gpy.upload.maximum_data_size=327680
|
||||
gpy.upload.wait_for_upload_port=true
|
||||
|
||||
gpy.serial.disableDTR=true
|
||||
gpy.serial.disableRTS=true
|
||||
|
||||
gpy.build.mcu=esp32
|
||||
gpy.build.core=esp32
|
||||
gpy.build.variant=gpy
|
||||
gpy.build.board=PYCOM_GPY
|
||||
|
||||
gpy.build.f_cpu=240000000L
|
||||
gpy.build.flash_mode=dio
|
||||
gpy.build.flash_size=8MB
|
||||
gpy.build.boot=dio
|
||||
gpy.build.partitions=default
|
||||
|
||||
gpy.menu.FlashFreq.80=80MHz
|
||||
gpy.menu.FlashFreq.80.build.flash_freq=80m
|
||||
gpy.menu.FlashFreq.40=40MHz
|
||||
gpy.menu.FlashFreq.40.build.flash_freq=40m
|
||||
|
||||
gpy.menu.UploadSpeed.921600=921600
|
||||
gpy.menu.UploadSpeed.921600.upload.speed=921600
|
||||
gpy.menu.UploadSpeed.115200=115200
|
||||
gpy.menu.UploadSpeed.115200.upload.speed=115200
|
||||
gpy.menu.UploadSpeed.256000.windows=256000
|
||||
gpy.menu.UploadSpeed.256000.upload.speed=256000
|
||||
gpy.menu.UploadSpeed.230400.windows.upload.speed=256000
|
||||
gpy.menu.UploadSpeed.230400=230400
|
||||
gpy.menu.UploadSpeed.230400.upload.speed=230400
|
||||
gpy.menu.UploadSpeed.460800.linux=460800
|
||||
gpy.menu.UploadSpeed.460800.macosx=460800
|
||||
gpy.menu.UploadSpeed.460800.upload.speed=460800
|
||||
gpy.menu.UploadSpeed.512000.windows=512000
|
||||
gpy.menu.UploadSpeed.512000.upload.speed=512000
|
||||
|
||||
gpy.menu.DebugLevel.none=None
|
||||
gpy.menu.DebugLevel.none.build.code_debug=0
|
||||
gpy.menu.DebugLevel.error=Error
|
||||
gpy.menu.DebugLevel.error.build.code_debug=1
|
||||
gpy.menu.DebugLevel.warn=Warn
|
||||
gpy.menu.DebugLevel.warn.build.code_debug=2
|
||||
gpy.menu.DebugLevel.info=Info
|
||||
gpy.menu.DebugLevel.info.build.code_debug=3
|
||||
gpy.menu.DebugLevel.debug=Debug
|
||||
gpy.menu.DebugLevel.debug.build.code_debug=4
|
||||
gpy.menu.DebugLevel.verbose=Verbose
|
||||
gpy.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
|
@ -68,12 +68,6 @@
|
||||
#define __STRINGIFY(a) #a
|
||||
#endif
|
||||
|
||||
// undefine stdlib's abs if encountered
|
||||
#ifdef abs
|
||||
#undef abs
|
||||
#endif
|
||||
|
||||
#define abs(x) ((x)>0?(x):-(x))
|
||||
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
|
||||
#define radians(deg) ((deg)*DEG_TO_RAD)
|
||||
#define degrees(rad) ((rad)*RAD_TO_DEG)
|
||||
@ -160,6 +154,7 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
|
||||
#include "HardwareSerial.h"
|
||||
#include "Esp.h"
|
||||
|
||||
using std::abs;
|
||||
using std::isinf;
|
||||
using std::isnan;
|
||||
using std::max;
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
uint32_t getMaxAllocPsram();
|
||||
|
||||
uint8_t getChipRevision();
|
||||
uint8_t getCpuFreqMHz(){ return CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ; }
|
||||
uint32_t getCpuFreqMHz(){ return getCpuFrequencyMhz(); }
|
||||
uint32_t getCycleCount();
|
||||
const char * getSdkVersion();
|
||||
|
||||
|
@ -52,7 +52,7 @@ size_t Print::printf(const char *format, ...)
|
||||
va_list copy;
|
||||
va_start(arg, format);
|
||||
va_copy(copy, arg);
|
||||
size_t len = vsnprintf(NULL, 0, format, arg);
|
||||
size_t len = vsnprintf(NULL, 0, format, copy);
|
||||
va_end(copy);
|
||||
if(len >= sizeof(loc_buf)){
|
||||
temp = new char[len+1];
|
||||
|
@ -97,8 +97,8 @@ public:
|
||||
|
||||
float parseFloat(); // float version of parseInt
|
||||
|
||||
size_t readBytes(char *buffer, size_t length); // read chars from stream into buffer
|
||||
size_t readBytes(uint8_t *buffer, size_t length)
|
||||
virtual size_t readBytes(char *buffer, size_t length); // read chars from stream into buffer
|
||||
virtual size_t readBytes(uint8_t *buffer, size_t length)
|
||||
{
|
||||
return readBytes((char *) buffer, length);
|
||||
}
|
||||
@ -114,7 +114,7 @@ public:
|
||||
// returns the number of characters placed in the buffer (0 means no valid data found)
|
||||
|
||||
// Arduino String functions to be added here
|
||||
String readString();
|
||||
virtual String readString();
|
||||
String readStringUntil(char terminator);
|
||||
|
||||
protected:
|
||||
|
@ -2,6 +2,7 @@
|
||||
StreamString.cpp
|
||||
|
||||
Copyright (c) 2015 Markus Sattler. All rights reserved.
|
||||
This file is part of the esp8266 core for Arduino environment.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
@ -22,31 +23,28 @@
|
||||
#include <Arduino.h>
|
||||
#include "StreamString.h"
|
||||
|
||||
size_t StreamString::write(const uint8_t *data, size_t size)
|
||||
{
|
||||
size_t StreamString::write(const uint8_t *data, size_t size) {
|
||||
if(size && data) {
|
||||
if(reserve(length() + size + 1)) {
|
||||
memcpy((void *) (buffer + len), (const void *) data, size);
|
||||
len += size;
|
||||
*(buffer + len) = 0x00; // add null for string end
|
||||
const unsigned int newlen = length() + size;
|
||||
if(reserve(newlen + 1)) {
|
||||
memcpy((void *) (wbuffer() + len()), (const void *) data, size);
|
||||
setLen(newlen);
|
||||
*(wbuffer() + newlen) = 0x00; // add null for string end
|
||||
return size;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t StreamString::write(uint8_t data)
|
||||
{
|
||||
size_t StreamString::write(uint8_t data) {
|
||||
return concat((char) data);
|
||||
}
|
||||
|
||||
int StreamString::available()
|
||||
{
|
||||
int StreamString::available() {
|
||||
return length();
|
||||
}
|
||||
|
||||
int StreamString::read()
|
||||
{
|
||||
int StreamString::read() {
|
||||
if(length()) {
|
||||
char c = charAt(0);
|
||||
remove(0, 1);
|
||||
@ -56,8 +54,7 @@ int StreamString::read()
|
||||
return -1;
|
||||
}
|
||||
|
||||
int StreamString::peek()
|
||||
{
|
||||
int StreamString::peek() {
|
||||
if(length()) {
|
||||
char c = charAt(0);
|
||||
return c;
|
||||
@ -65,7 +62,6 @@ int StreamString::peek()
|
||||
return -1;
|
||||
}
|
||||
|
||||
void StreamString::flush()
|
||||
{
|
||||
void StreamString::flush() {
|
||||
}
|
||||
|
||||
|
@ -65,9 +65,12 @@ long random(long howsmall, long howbig)
|
||||
return random(diff) + howsmall;
|
||||
}
|
||||
|
||||
long map(long x, long in_min, long in_max, long out_min, long out_max)
|
||||
{
|
||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||
long map(long x, long in_min, long in_max, long out_min, long out_max) {
|
||||
long divisor = (in_max - in_min);
|
||||
if(divisor == 0){
|
||||
return -1; //AVR returns -1, SAM returns 0
|
||||
}
|
||||
return (x - in_min) * (out_max - out_min) / divisor + out_min;
|
||||
}
|
||||
|
||||
unsigned int makeWord(unsigned int w)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,7 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <pgmspace.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// An inherited class for holding the result of a concatenation. These
|
||||
// result objects are assumed to be writable by subsequent concatenations.
|
||||
@ -35,295 +36,300 @@ class StringSumHelper;
|
||||
// an abstract class used as a means to proide a unique pointer type
|
||||
// but really has no body
|
||||
class __FlashStringHelper;
|
||||
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
|
||||
#define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
|
||||
#define F(string_literal) (FPSTR(PSTR(string_literal)))
|
||||
|
||||
// The string class
|
||||
class String
|
||||
{
|
||||
// use a function pointer to allow for "if (s)" without the
|
||||
// complications of an operator bool(). for more information, see:
|
||||
// http://www.artima.com/cppsource/safebool.html
|
||||
typedef void (String::*StringIfHelperType)() const;
|
||||
void StringIfHelper() const
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
// constructors
|
||||
// creates a copy of the initial value.
|
||||
// if the initial value is null or invalid, or if memory allocation
|
||||
// fails, the string will be marked as invalid (i.e. "if (s)" will
|
||||
// be false).
|
||||
String(const char *cstr = "");
|
||||
String(const String &str);
|
||||
String(const __FlashStringHelper *str) : String(reinterpret_cast<const char *>(str)) {};
|
||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||
String(String &&rval);
|
||||
String(StringSumHelper &&rval);
|
||||
#endif
|
||||
explicit String(char c);
|
||||
explicit String(unsigned char, unsigned char base = 10);
|
||||
explicit String(int, unsigned char base = 10);
|
||||
explicit String(unsigned int, unsigned char base = 10);
|
||||
explicit String(long, unsigned char base = 10);
|
||||
explicit String(unsigned long, unsigned char base = 10);
|
||||
explicit String(float, unsigned char decimalPlaces = 2);
|
||||
explicit String(double, unsigned char decimalPlaces = 2);
|
||||
~String(void);
|
||||
|
||||
// memory management
|
||||
// return true on success, false on failure (in which case, the string
|
||||
// is left unchanged). reserve(0), if successful, will validate an
|
||||
// invalid string (i.e., "if (s)" will be true afterwards)
|
||||
unsigned char reserve(unsigned int size);
|
||||
inline unsigned int length(void) const
|
||||
{
|
||||
if(buffer) {
|
||||
return len;
|
||||
} else {
|
||||
return 0;
|
||||
class String {
|
||||
// use a function pointer to allow for "if (s)" without the
|
||||
// complications of an operator bool(). for more information, see:
|
||||
// http://www.artima.com/cppsource/safebool.html
|
||||
typedef void (String::*StringIfHelperType)() const;
|
||||
void StringIfHelper() const {
|
||||
}
|
||||
}
|
||||
|
||||
// creates a copy of the assigned value. if the value is null or
|
||||
// invalid, or if the memory allocation fails, the string will be
|
||||
// marked as invalid ("if (s)" will be false).
|
||||
String & operator =(const String &rhs);
|
||||
String & operator =(const char *cstr);
|
||||
String & operator = (const __FlashStringHelper *str);
|
||||
public:
|
||||
// constructors
|
||||
// creates a copy of the initial value.
|
||||
// if the initial value is null or invalid, or if memory allocation
|
||||
// fails, the string will be marked as invalid (i.e. "if (s)" will
|
||||
// be false).
|
||||
String(const char *cstr = "");
|
||||
String(const String &str);
|
||||
String(const __FlashStringHelper *str);
|
||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||
String & operator =(String &&rval);
|
||||
String & operator =(StringSumHelper &&rval);
|
||||
String(String &&rval);
|
||||
String(StringSumHelper &&rval);
|
||||
#endif
|
||||
explicit String(char c);
|
||||
explicit String(unsigned char, unsigned char base = 10);
|
||||
explicit String(int, unsigned char base = 10);
|
||||
explicit String(unsigned int, unsigned char base = 10);
|
||||
explicit String(long, unsigned char base = 10);
|
||||
explicit String(unsigned long, unsigned char base = 10);
|
||||
explicit String(float, unsigned char decimalPlaces = 2);
|
||||
explicit String(double, unsigned char decimalPlaces = 2);
|
||||
~String(void);
|
||||
|
||||
// memory management
|
||||
// return true on success, false on failure (in which case, the string
|
||||
// is left unchanged). reserve(0), if successful, will validate an
|
||||
// invalid string (i.e., "if (s)" will be true afterwards)
|
||||
unsigned char reserve(unsigned int size);
|
||||
inline unsigned int length(void) const {
|
||||
if(buffer()) {
|
||||
return len();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
inline void clear(void) {
|
||||
setLen(0);
|
||||
}
|
||||
inline bool isEmpty(void) const {
|
||||
return length() == 0;
|
||||
}
|
||||
|
||||
// creates a copy of the assigned value. if the value is null or
|
||||
// invalid, or if the memory allocation fails, the string will be
|
||||
// marked as invalid ("if (s)" will be false).
|
||||
String & operator =(const String &rhs);
|
||||
String & operator =(const char *cstr);
|
||||
String & operator = (const __FlashStringHelper *str);
|
||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||
String & operator =(String &&rval);
|
||||
String & operator =(StringSumHelper &&rval);
|
||||
#endif
|
||||
|
||||
// concatenate (works w/ built-in types)
|
||||
// concatenate (works w/ built-in types)
|
||||
|
||||
// returns true on success, false on failure (in which case, the string
|
||||
// is left unchanged). if the argument is null or invalid, the
|
||||
// concatenation is considered unsucessful.
|
||||
unsigned char concat(const String &str);
|
||||
unsigned char concat(const char *cstr);
|
||||
unsigned char concat(char c);
|
||||
unsigned char concat(unsigned char c);
|
||||
unsigned char concat(int num);
|
||||
unsigned char concat(unsigned int num);
|
||||
unsigned char concat(long num);
|
||||
unsigned char concat(unsigned long num);
|
||||
unsigned char concat(float num);
|
||||
unsigned char concat(double num);
|
||||
unsigned char concat(const __FlashStringHelper * str);
|
||||
// returns true on success, false on failure (in which case, the string
|
||||
// is left unchanged). if the argument is null or invalid, the
|
||||
// concatenation is considered unsuccessful.
|
||||
unsigned char concat(const String &str);
|
||||
unsigned char concat(const char *cstr);
|
||||
unsigned char concat(char c);
|
||||
unsigned char concat(unsigned char c);
|
||||
unsigned char concat(int num);
|
||||
unsigned char concat(unsigned int num);
|
||||
unsigned char concat(long num);
|
||||
unsigned char concat(unsigned long num);
|
||||
unsigned char concat(float num);
|
||||
unsigned char concat(double num);
|
||||
unsigned char concat(const __FlashStringHelper * str);
|
||||
|
||||
// if there's not enough memory for the concatenated value, the string
|
||||
// will be left unchanged (but this isn't signalled in any way)
|
||||
String & operator +=(const String &rhs)
|
||||
{
|
||||
concat(rhs);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(const char *cstr)
|
||||
{
|
||||
concat(cstr);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(char c)
|
||||
{
|
||||
concat(c);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(unsigned char num)
|
||||
{
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(int num)
|
||||
{
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(unsigned int num)
|
||||
{
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(long num)
|
||||
{
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(unsigned long num)
|
||||
{
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(float num)
|
||||
{
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(double num)
|
||||
{
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator += (const __FlashStringHelper *str)
|
||||
{
|
||||
concat(str);
|
||||
return (*this);
|
||||
}
|
||||
// if there's not enough memory for the concatenated value, the string
|
||||
// will be left unchanged (but this isn't signalled in any way)
|
||||
String & operator +=(const String &rhs) {
|
||||
concat(rhs);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(const char *cstr) {
|
||||
concat(cstr);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(char c) {
|
||||
concat(c);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(unsigned char num) {
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(int num) {
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(unsigned int num) {
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(long num) {
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(unsigned long num) {
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(float num) {
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator +=(double num) {
|
||||
concat(num);
|
||||
return (*this);
|
||||
}
|
||||
String & operator += (const __FlashStringHelper *str){
|
||||
concat(str);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, const String &rhs);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, const char *cstr);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, char c);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned char num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, int num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned int num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, long num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned long num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, float num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, double num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, const __FlashStringHelper *rhs);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, const String &rhs);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, const char *cstr);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, char c);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned char num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, int num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned int num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, long num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned long num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, float num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, double num);
|
||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, const __FlashStringHelper *rhs);
|
||||
|
||||
// comparison (only works w/ Strings and "strings")
|
||||
operator StringIfHelperType() const
|
||||
{
|
||||
return buffer ? &String::StringIfHelper : 0;
|
||||
}
|
||||
int compareTo(const String &s) const;
|
||||
unsigned char equals(const String &s) const;
|
||||
unsigned char equals(const char *cstr) const;
|
||||
unsigned char operator ==(const String &rhs) const
|
||||
{
|
||||
return equals(rhs);
|
||||
}
|
||||
unsigned char operator ==(const char *cstr) const
|
||||
{
|
||||
return equals(cstr);
|
||||
}
|
||||
unsigned char operator !=(const String &rhs) const
|
||||
{
|
||||
return !equals(rhs);
|
||||
}
|
||||
unsigned char operator !=(const char *cstr) const
|
||||
{
|
||||
return !equals(cstr);
|
||||
}
|
||||
unsigned char operator <(const String &rhs) const;
|
||||
unsigned char operator >(const String &rhs) const;
|
||||
unsigned char operator <=(const String &rhs) const;
|
||||
unsigned char operator >=(const String &rhs) const;
|
||||
unsigned char equalsIgnoreCase(const String &s) const;
|
||||
unsigned char equalsConstantTime(const String &s) const;
|
||||
unsigned char startsWith(const String &prefix) const;
|
||||
unsigned char startsWith(const String &prefix, unsigned int offset) const;
|
||||
unsigned char endsWith(const String &suffix) const;
|
||||
// comparison (only works w/ Strings and "strings")
|
||||
operator StringIfHelperType() const {
|
||||
return buffer() ? &String::StringIfHelper : 0;
|
||||
}
|
||||
int compareTo(const String &s) const;
|
||||
unsigned char equals(const String &s) const;
|
||||
unsigned char equals(const char *cstr) const;
|
||||
unsigned char operator ==(const String &rhs) const {
|
||||
return equals(rhs);
|
||||
}
|
||||
unsigned char operator ==(const char *cstr) const {
|
||||
return equals(cstr);
|
||||
}
|
||||
unsigned char operator !=(const String &rhs) const {
|
||||
return !equals(rhs);
|
||||
}
|
||||
unsigned char operator !=(const char *cstr) const {
|
||||
return !equals(cstr);
|
||||
}
|
||||
unsigned char operator <(const String &rhs) const;
|
||||
unsigned char operator >(const String &rhs) const;
|
||||
unsigned char operator <=(const String &rhs) const;
|
||||
unsigned char operator >=(const String &rhs) const;
|
||||
unsigned char equalsIgnoreCase(const String &s) const;
|
||||
unsigned char equalsConstantTime(const String &s) const;
|
||||
unsigned char startsWith(const String &prefix) const;
|
||||
unsigned char startsWith(const String &prefix, unsigned int offset) const;
|
||||
unsigned char endsWith(const String &suffix) const;
|
||||
|
||||
// character acccess
|
||||
char charAt(unsigned int index) const;
|
||||
void setCharAt(unsigned int index, char c);
|
||||
char operator [](unsigned int index) const;
|
||||
char& operator [](unsigned int index);
|
||||
void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index = 0) const;
|
||||
void toCharArray(char *buf, unsigned int bufsize, unsigned int index = 0) const
|
||||
{
|
||||
getBytes((unsigned char *) buf, bufsize, index);
|
||||
}
|
||||
const char * c_str() const
|
||||
{
|
||||
return buffer;
|
||||
}
|
||||
// character access
|
||||
char charAt(unsigned int index) const;
|
||||
void setCharAt(unsigned int index, char c);
|
||||
char operator [](unsigned int index) const;
|
||||
char& operator [](unsigned int index);
|
||||
void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index = 0) const;
|
||||
void toCharArray(char *buf, unsigned int bufsize, unsigned int index = 0) const {
|
||||
getBytes((unsigned char *) buf, bufsize, index);
|
||||
}
|
||||
const char* c_str() const { return buffer(); }
|
||||
char* begin() { return wbuffer(); }
|
||||
char* end() { return wbuffer() + length(); }
|
||||
const char* begin() const { return c_str(); }
|
||||
const char* end() const { return c_str() + length(); }
|
||||
|
||||
// search
|
||||
int indexOf(char ch) const;
|
||||
int indexOf(char ch, unsigned int fromIndex) const;
|
||||
int indexOf(const String &str) const;
|
||||
int indexOf(const String &str, unsigned int fromIndex) const;
|
||||
int lastIndexOf(char ch) const;
|
||||
int lastIndexOf(char ch, unsigned int fromIndex) const;
|
||||
int lastIndexOf(const String &str) const;
|
||||
int lastIndexOf(const String &str, unsigned int fromIndex) const;
|
||||
String substring(unsigned int beginIndex) const
|
||||
{
|
||||
return substring(beginIndex, len);
|
||||
}
|
||||
;
|
||||
String substring(unsigned int beginIndex, unsigned int endIndex) const;
|
||||
// search
|
||||
int indexOf(char ch) const;
|
||||
int indexOf(char ch, unsigned int fromIndex) const;
|
||||
int indexOf(const String &str) const;
|
||||
int indexOf(const String &str, unsigned int fromIndex) const;
|
||||
int lastIndexOf(char ch) const;
|
||||
int lastIndexOf(char ch, unsigned int fromIndex) const;
|
||||
int lastIndexOf(const String &str) const;
|
||||
int lastIndexOf(const String &str, unsigned int fromIndex) const;
|
||||
String substring(unsigned int beginIndex) const {
|
||||
return substring(beginIndex, len());
|
||||
}
|
||||
;
|
||||
String substring(unsigned int beginIndex, unsigned int endIndex) const;
|
||||
|
||||
// modification
|
||||
void replace(char find, char replace);
|
||||
void replace(const String& find, const String& replace);
|
||||
void remove(unsigned int index);
|
||||
void remove(unsigned int index, unsigned int count);
|
||||
void toLowerCase(void);
|
||||
void toUpperCase(void);
|
||||
void trim(void);
|
||||
// modification
|
||||
void replace(char find, char replace);
|
||||
void replace(const String& find, const String& replace);
|
||||
void remove(unsigned int index);
|
||||
void remove(unsigned int index, unsigned int count);
|
||||
void toLowerCase(void);
|
||||
void toUpperCase(void);
|
||||
void trim(void);
|
||||
|
||||
// parsing/conversion
|
||||
long toInt(void) const;
|
||||
float toFloat(void) const;
|
||||
double toDouble(void) const;
|
||||
// parsing/conversion
|
||||
long toInt(void) const;
|
||||
float toFloat(void) const;
|
||||
double toDouble(void) const;
|
||||
|
||||
protected:
|
||||
char *buffer; // the actual char array
|
||||
unsigned int capacity; // the array length minus one (for the '\0')
|
||||
unsigned int len; // the String length (not counting the '\0')
|
||||
protected:
|
||||
void init(void);
|
||||
void invalidate(void);
|
||||
unsigned char changeBuffer(unsigned int maxStrLen);
|
||||
unsigned char concat(const char *cstr, unsigned int length);
|
||||
protected:
|
||||
// Contains the string info when we're not in SSO mode
|
||||
struct _ptr {
|
||||
char * buff;
|
||||
uint16_t cap;
|
||||
uint16_t len;
|
||||
};
|
||||
// This allows strings up up to 11 (10 + \0 termination) without any extra space.
|
||||
enum { SSOSIZE = sizeof(struct _ptr) + 4 - 1 }; // Characters to allocate space for SSO, must be 12 or more
|
||||
struct _sso {
|
||||
char buff[SSOSIZE];
|
||||
unsigned char len : 7; // Ensure only one byte is allocated by GCC for the bitfields
|
||||
unsigned char isSSO : 1;
|
||||
} __attribute__((packed)); // Ensure that GCC doesn't expand the flag byte to a 32-bit word for alignment issues
|
||||
enum { CAPACITY_MAX = 65535 }; // If typeof(cap) changed from uint16_t, be sure to update this enum to the max value storable in the type
|
||||
union {
|
||||
struct _ptr ptr;
|
||||
struct _sso sso;
|
||||
};
|
||||
// Accessor functions
|
||||
inline bool isSSO() const { return sso.isSSO; }
|
||||
inline unsigned int len() const { return isSSO() ? sso.len : ptr.len; }
|
||||
inline unsigned int capacity() const { return isSSO() ? (unsigned int)SSOSIZE - 1 : ptr.cap; } // Size of max string not including terminal NUL
|
||||
inline void setSSO(bool set) { sso.isSSO = set; }
|
||||
inline void setLen(int len) { if (isSSO()) sso.len = len; else ptr.len = len; }
|
||||
inline void setCapacity(int cap) { if (!isSSO()) ptr.cap = cap; }
|
||||
inline void setBuffer(char *buff) { if (!isSSO()) ptr.buff = buff; }
|
||||
// Buffer accessor functions
|
||||
inline const char *buffer() const { return (const char *)(isSSO() ? sso.buff : ptr.buff); }
|
||||
inline char *wbuffer() const { return isSSO() ? const_cast<char *>(sso.buff) : ptr.buff; } // Writable version of buffer
|
||||
|
||||
// copy and move
|
||||
String & copy(const char *cstr, unsigned int length);
|
||||
String & copy(const __FlashStringHelper *pstr, unsigned int length);
|
||||
protected:
|
||||
void init(void);
|
||||
void invalidate(void);
|
||||
unsigned char changeBuffer(unsigned int maxStrLen);
|
||||
unsigned char concat(const char *cstr, unsigned int length);
|
||||
|
||||
// copy and move
|
||||
String & copy(const char *cstr, unsigned int length);
|
||||
String & copy(const __FlashStringHelper *pstr, unsigned int length);
|
||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||
void move(String &rhs);
|
||||
void move(String &rhs);
|
||||
#endif
|
||||
};
|
||||
|
||||
class StringSumHelper: public String
|
||||
{
|
||||
public:
|
||||
StringSumHelper(const String &s) :
|
||||
String(s)
|
||||
{
|
||||
}
|
||||
StringSumHelper(const char *p) :
|
||||
String(p)
|
||||
{
|
||||
}
|
||||
StringSumHelper(char c) :
|
||||
String(c)
|
||||
{
|
||||
}
|
||||
StringSumHelper(unsigned char num) :
|
||||
String(num)
|
||||
{
|
||||
}
|
||||
StringSumHelper(int num) :
|
||||
String(num)
|
||||
{
|
||||
}
|
||||
StringSumHelper(unsigned int num) :
|
||||
String(num)
|
||||
{
|
||||
}
|
||||
StringSumHelper(long num) :
|
||||
String(num)
|
||||
{
|
||||
}
|
||||
StringSumHelper(unsigned long num) :
|
||||
String(num)
|
||||
{
|
||||
}
|
||||
StringSumHelper(float num) :
|
||||
String(num)
|
||||
{
|
||||
}
|
||||
StringSumHelper(double num) :
|
||||
String(num)
|
||||
{
|
||||
}
|
||||
class StringSumHelper: public String {
|
||||
public:
|
||||
StringSumHelper(const String &s) :
|
||||
String(s) {
|
||||
}
|
||||
StringSumHelper(const char *p) :
|
||||
String(p) {
|
||||
}
|
||||
StringSumHelper(char c) :
|
||||
String(c) {
|
||||
}
|
||||
StringSumHelper(unsigned char num) :
|
||||
String(num) {
|
||||
}
|
||||
StringSumHelper(int num) :
|
||||
String(num) {
|
||||
}
|
||||
StringSumHelper(unsigned int num) :
|
||||
String(num) {
|
||||
}
|
||||
StringSumHelper(long num) :
|
||||
String(num) {
|
||||
}
|
||||
StringSumHelper(unsigned long num) :
|
||||
String(num) {
|
||||
}
|
||||
StringSumHelper(float num) :
|
||||
String(num) {
|
||||
}
|
||||
StringSumHelper(double num) :
|
||||
String(num) {
|
||||
}
|
||||
};
|
||||
|
||||
extern const String emptyString;
|
||||
|
||||
#endif // __cplusplus
|
||||
#endif // String_class_h
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "soc/rtc_cntl_reg.h"
|
||||
#include "rom/rtc.h"
|
||||
#include "soc/apb_ctrl_reg.h"
|
||||
#include "soc/efuse_reg.h"
|
||||
#include "esp32-hal.h"
|
||||
#include "esp32-hal-cpu.h"
|
||||
|
||||
@ -150,6 +151,15 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz){
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//check if cpu supports the frequency
|
||||
if(cpu_freq_mhz == 240){
|
||||
//Check if ESP32 is rated for a CPU frequency of 160MHz only
|
||||
if (REG_GET_BIT(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_CPU_FREQ_RATED) &&
|
||||
REG_GET_BIT(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_CPU_FREQ_LOW)) {
|
||||
log_e("Can not switch to 240 MHz! Chip CPU frequency rated for 160MHz.");
|
||||
cpu_freq_mhz = 160;
|
||||
}
|
||||
}
|
||||
//Get current CPU clock configuration
|
||||
rtc_clk_cpu_freq_get_config(&cconf);
|
||||
//return if frequency has not changed
|
||||
|
@ -1270,7 +1270,7 @@ i2c_err_t i2cProcQueue(i2c_t * i2c, uint32_t *readCount, uint16_t timeOutMillis)
|
||||
|
||||
i2c->dev->ctr.trans_start=1; // go for it
|
||||
|
||||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR
|
||||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
|
||||
portTickType tBefore=xTaskGetTickCount();
|
||||
#endif
|
||||
|
||||
@ -1278,7 +1278,7 @@ i2c_err_t i2cProcQueue(i2c_t * i2c, uint32_t *readCount, uint16_t timeOutMillis)
|
||||
|
||||
uint32_t eBits = xEventGroupWaitBits(i2c->i2c_event,EVENT_DONE,pdFALSE,pdTRUE,ticksTimeOut);
|
||||
|
||||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR
|
||||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
|
||||
portTickType tAfter=xTaskGetTickCount();
|
||||
#endif
|
||||
|
||||
|
@ -665,7 +665,6 @@ static void IRAM_ATTR _rmt_isr(void* arg)
|
||||
}
|
||||
|
||||
if (intr_val & _INT_ERROR(ch)) {
|
||||
digitalWrite(2, 1);
|
||||
// clear the flag
|
||||
RMT.int_clr.val = _INT_ERROR(ch);
|
||||
RMT.int_ena.val &= ~_INT_ERROR(ch);
|
||||
|
@ -343,6 +343,8 @@ void uartFlush(uart_t* uart)
|
||||
READ_PERI_REG(UART_FIFO_REG(uart->num));
|
||||
}
|
||||
|
||||
xQueueReset(uart->queue);
|
||||
|
||||
UART_MUTEX_UNLOCK();
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@ typedef unsigned long prog_uint32_t;
|
||||
#define PROGMEM
|
||||
#define PGM_P const char *
|
||||
#define PGM_VOID_P const void *
|
||||
#define FPSTR(p) ((const char *)(p))
|
||||
#define PSTR(s) (s)
|
||||
#define _SFR_BYTE(n) (n)
|
||||
|
||||
|
@ -23,5 +23,7 @@ Installation instructions for Mac OS
|
||||
|
||||
- Try `python3` instead of `python` if you get the error: `IOError: [Errno socket error] [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)` when running `python get.py`
|
||||
|
||||
- If you get the following error when running `python get.py` urllib.error.URLError: <urlopen error SSL: CERTIFICATE_VERIFY_FAILED, go to Macintosh HD > Applications > Python3.6 folder (or any other python version), and run the following scripts: Install Certificates.command and Update Shell Profile.command
|
||||
|
||||
- Restart Arduino IDE
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
Installation instructions for using PlatformIO
|
||||
=================================================
|
||||
|
||||
- [What is PlatformIO?](http://docs.platformio.org/en/latest/what-is-platformio.html?utm_source=github&utm_medium=arduino-esp32)
|
||||
- [PlatformIO IDE](http://platformio.org/platformio-ide?utm_source=github&utm_medium=arduino-esp32)
|
||||
- [PlatformIO Core](http://docs.platformio.org/en/latest/core.html?utm_source=github&utm_medium=arduino-esp32) (command line tool)
|
||||
- [Advanced usage](http://docs.platformio.org/en/latest/platforms/espressif32.html?utm_source=github&utm_medium=arduino-esp32) -
|
||||
- [What is PlatformIO?](https://docs.platformio.org/en/latest/what-is-platformio.html?utm_source=github&utm_medium=arduino-esp32)
|
||||
- [PlatformIO IDE](https://platformio.org/platformio-ide?utm_source=github&utm_medium=arduino-esp32)
|
||||
- [PlatformIO Core](https://docs.platformio.org/en/latest/core.html?utm_source=github&utm_medium=arduino-esp32) (command line tool)
|
||||
- [Advanced usage](https://docs.platformio.org/en/latest/platforms/espressif32.html?utm_source=github&utm_medium=arduino-esp32) -
|
||||
custom settings, uploading to SPIFFS, Over-the-Air (OTA), staging version
|
||||
- [Integration with Cloud and Standalone IDEs](http://docs.platformio.org/en/latest/ide.html?utm_source=github&utm_medium=arduino-esp32) -
|
||||
- [Integration with Cloud and Standalone IDEs](https://docs.platformio.org/en/latest/ide.html?utm_source=github&utm_medium=arduino-esp32) -
|
||||
Cloud9, Codeanywhere, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM, Visual Studio, and VSCode
|
||||
- [Project Examples](http://docs.platformio.org/en/latest/platforms/espressif32.html?utm_source=github&utm_medium=arduino-esp32#examples)
|
||||
- [Project Examples](https://docs.platformio.org/en/latest/platforms/espressif32.html?utm_source=github&utm_medium=arduino-esp32#examples)
|
||||
|
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name":"AsyncUDP",
|
||||
"description":"Asynchronous UDP Library for ESP32",
|
||||
"keywords":"async,udp,server,client,multicast,broadcast",
|
||||
"authors":
|
||||
{
|
||||
"name": "Hristo Gochkov",
|
||||
"maintainer": true
|
||||
},
|
||||
"repository":
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/me-no-dev/ESPAsyncUDP.git"
|
||||
},
|
||||
"frameworks": "arduino",
|
||||
"platforms":"espressif"
|
||||
}
|
@ -682,8 +682,9 @@ void AsyncUDP::_recv(udp_pcb *upcb, pbuf *pb, const ip_addr_t *addr, uint16_t po
|
||||
if(_handler) {
|
||||
AsyncUDPPacket packet(this, this_pb, addr, port, netif);
|
||||
_handler(packet);
|
||||
} else {
|
||||
pbuf_free(this_pb);
|
||||
}
|
||||
pbuf_free(this_pb);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <iomanip>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#include "esp32-hal-log.h"
|
||||
#endif
|
||||
@ -83,13 +84,11 @@ esp_bd_addr_t *BLEAddress::getNative() {
|
||||
* @return The string representation of the address.
|
||||
*/
|
||||
std::string BLEAddress::toString() {
|
||||
std::stringstream stream;
|
||||
stream << std::setfill('0') << std::setw(2) << std::hex << (int) ((uint8_t*) (m_address))[0] << ':';
|
||||
stream << std::setfill('0') << std::setw(2) << std::hex << (int) ((uint8_t*) (m_address))[1] << ':';
|
||||
stream << std::setfill('0') << std::setw(2) << std::hex << (int) ((uint8_t*) (m_address))[2] << ':';
|
||||
stream << std::setfill('0') << std::setw(2) << std::hex << (int) ((uint8_t*) (m_address))[3] << ':';
|
||||
stream << std::setfill('0') << std::setw(2) << std::hex << (int) ((uint8_t*) (m_address))[4] << ':';
|
||||
stream << std::setfill('0') << std::setw(2) << std::hex << (int) ((uint8_t*) (m_address))[5];
|
||||
return stream.str();
|
||||
auto size = 18;
|
||||
char *res = (char*)malloc(size);
|
||||
snprintf(res, size, "%02x:%02x:%02x:%02x:%02x:%02x", m_address[0], m_address[1], m_address[2], m_address[3], m_address[4], m_address[5]);
|
||||
std::string ret(res);
|
||||
free(res);
|
||||
return ret;
|
||||
} // toString
|
||||
#endif
|
||||
|
@ -484,23 +484,29 @@ void BLEAdvertisedDevice::setTXPower(int8_t txPower) {
|
||||
* @return A string representation of this device.
|
||||
*/
|
||||
std::string BLEAdvertisedDevice::toString() {
|
||||
std::stringstream ss;
|
||||
ss << "Name: " << getName() << ", Address: " << getAddress().toString();
|
||||
std::string res = "Name: " + getName() + ", Address: " + getAddress().toString();
|
||||
if (haveAppearance()) {
|
||||
ss << ", appearance: " << getAppearance();
|
||||
char val[6];
|
||||
snprintf(val, sizeof(val), "%d", getAppearance());
|
||||
res += ", appearance: ";
|
||||
res += val;
|
||||
}
|
||||
if (haveManufacturerData()) {
|
||||
char *pHex = BLEUtils::buildHexData(nullptr, (uint8_t*)getManufacturerData().data(), getManufacturerData().length());
|
||||
ss << ", manufacturer data: " << pHex;
|
||||
res += ", manufacturer data: ";
|
||||
res += pHex;
|
||||
free(pHex);
|
||||
}
|
||||
if (haveServiceUUID()) {
|
||||
ss << ", serviceUUID: " << getServiceUUID().toString();
|
||||
res += ", serviceUUID: " + getServiceUUID().toString();
|
||||
}
|
||||
if (haveTXPower()) {
|
||||
ss << ", txPower: " << (int)getTXPower();
|
||||
char val[4];
|
||||
snprintf(val, sizeof(val), "%d", getTXPower());
|
||||
res += ", txPower: ";
|
||||
res += val;
|
||||
}
|
||||
return ss.str();
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
uint8_t* BLEAdvertisedDevice::getPayload() {
|
||||
|
@ -253,6 +253,27 @@ void BLEAdvertising::stop() {
|
||||
log_v("<< stop");
|
||||
} // stop
|
||||
|
||||
/**
|
||||
* @brief Set BLE address.
|
||||
* @param [in] Bluetooth address.
|
||||
* @param [in] Bluetooth address type.
|
||||
* Set BLE address.
|
||||
*/
|
||||
|
||||
void BLEAdvertising::setDeviceAddress(esp_bd_addr_t addr, esp_ble_addr_type_t type)
|
||||
{
|
||||
log_v(">> setPrivateAddress");
|
||||
|
||||
m_advParams.own_addr_type = type;
|
||||
esp_err_t errRc = esp_ble_gap_set_rand_addr((uint8_t*)addr);
|
||||
if (errRc != ESP_OK)
|
||||
{
|
||||
log_e("esp_ble_gap_set_rand_addr: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
|
||||
return;
|
||||
}
|
||||
log_v("<< setPrivateAddress");
|
||||
} // setPrivateAddress
|
||||
|
||||
/**
|
||||
* @brief Add data to the payload to be advertised.
|
||||
* @param [in] data The data to be added to the payload.
|
||||
@ -484,7 +505,7 @@ void BLEAdvertising::handleGAPEvent(
|
||||
}
|
||||
case ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT: {
|
||||
log_i("STOP advertising");
|
||||
start();
|
||||
//start();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
void setScanFilter(bool scanRequertWhitelistOnly, bool connectWhitelistOnly);
|
||||
void setScanResponseData(BLEAdvertisementData& advertisementData);
|
||||
void setPrivateAddress(esp_ble_addr_type_t type = BLE_ADDR_TYPE_RANDOM);
|
||||
void setDeviceAddress(esp_bd_addr_t addr, esp_ble_addr_type_t type = BLE_ADDR_TYPE_RANDOM);
|
||||
|
||||
void handleGAPEvent(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t* param);
|
||||
void setMinPreferred(uint16_t);
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#define NULL_HANDLE (0xffff)
|
||||
|
||||
static BLECharacteristicCallbacks defaultCallback; //null-object-pattern
|
||||
|
||||
/**
|
||||
* @brief Construct a characteristic
|
||||
@ -40,7 +41,7 @@ BLECharacteristic::BLECharacteristic(BLEUUID uuid, uint32_t properties) {
|
||||
m_bleUUID = uuid;
|
||||
m_handle = NULL_HANDLE;
|
||||
m_properties = (esp_gatt_char_prop_t)0;
|
||||
m_pCallbacks = nullptr;
|
||||
m_pCallbacks = &defaultCallback;
|
||||
|
||||
setBroadcastProperty((properties & PROPERTY_BROADCAST) != 0);
|
||||
setReadProperty((properties & PROPERTY_READ) != 0);
|
||||
@ -220,9 +221,7 @@ void BLECharacteristic::handleGATTServerEvent(
|
||||
case ESP_GATTS_EXEC_WRITE_EVT: {
|
||||
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC) {
|
||||
m_value.commit();
|
||||
if (m_pCallbacks != nullptr) {
|
||||
m_pCallbacks->onWrite(this); // Invoke the onWrite callback handler.
|
||||
}
|
||||
m_pCallbacks->onWrite(this); // Invoke the onWrite callback handler.
|
||||
} else {
|
||||
m_value.cancel();
|
||||
}
|
||||
@ -307,7 +306,7 @@ void BLECharacteristic::handleGATTServerEvent(
|
||||
}
|
||||
} // Response needed
|
||||
|
||||
if (m_pCallbacks != nullptr && param->write.is_prep != true) {
|
||||
if (param->write.is_prep != true) {
|
||||
m_pCallbacks->onWrite(this); // Invoke the onWrite callback handler.
|
||||
}
|
||||
} // Match on handles.
|
||||
@ -378,6 +377,10 @@ void BLECharacteristic::handleGATTServerEvent(
|
||||
}
|
||||
} else { // read.is_long == false
|
||||
|
||||
// If is.long is false then this is the first (or only) request to read data, so invoke the callback
|
||||
// Invoke the read callback.
|
||||
m_pCallbacks->onRead(this);
|
||||
|
||||
std::string value = m_value.getValue();
|
||||
|
||||
if (value.length() + 1 > maxOffset) {
|
||||
@ -392,10 +395,6 @@ void BLECharacteristic::handleGATTServerEvent(
|
||||
rsp.attr_value.offset = 0;
|
||||
memcpy(rsp.attr_value.value, value.data(), rsp.attr_value.len);
|
||||
}
|
||||
|
||||
if (m_pCallbacks != nullptr) { // If is.long is false then this is the first (or only) request to read data, so invoke the callback
|
||||
m_pCallbacks->onRead(this); // Invoke the read callback.
|
||||
}
|
||||
}
|
||||
rsp.attr_value.handle = param->read.handle;
|
||||
rsp.attr_value.auth_req = ESP_GATT_AUTH_REQ_NONE;
|
||||
@ -480,10 +479,13 @@ void BLECharacteristic::notify(bool is_notification) {
|
||||
assert(getService() != nullptr);
|
||||
assert(getService()->getServer() != nullptr);
|
||||
|
||||
m_pCallbacks->onNotify(this); // Invoke the notify callback.
|
||||
|
||||
GeneralUtils::hexDump((uint8_t*)m_value.getValue().data(), m_value.getValue().length());
|
||||
|
||||
if (getService()->getServer()->getConnectedCount() == 0) {
|
||||
log_v("<< notify: No connected clients.");
|
||||
m_pCallbacks->onStatus(this, BLECharacteristicCallbacks::Status::ERROR_NO_CLIENT, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -494,12 +496,14 @@ void BLECharacteristic::notify(bool is_notification) {
|
||||
if(is_notification) {
|
||||
if (p2902 != nullptr && !p2902->getNotifications()) {
|
||||
log_v("<< notifications disabled; ignoring");
|
||||
m_pCallbacks->onStatus(this, BLECharacteristicCallbacks::Status::ERROR_NOTIFY_DISABLED, 0); // Invoke the notify callback.
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (p2902 != nullptr && !p2902->getIndications()) {
|
||||
log_v("<< indications disabled; ignoring");
|
||||
m_pCallbacks->onStatus(this, BLECharacteristicCallbacks::Status::ERROR_INDICATE_DISABLED, 0); // Invoke the notify callback.
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -510,7 +514,7 @@ void BLECharacteristic::notify(bool is_notification) {
|
||||
}
|
||||
|
||||
size_t length = m_value.getValue().length();
|
||||
if(!is_notification)
|
||||
if(!is_notification) // is indication
|
||||
m_semaphoreConfEvt.take("indicate");
|
||||
esp_err_t errRc = ::esp_ble_gatts_send_indicate(
|
||||
getService()->getServer()->getGattsIf(),
|
||||
@ -519,10 +523,23 @@ void BLECharacteristic::notify(bool is_notification) {
|
||||
if (errRc != ESP_OK) {
|
||||
log_e("<< esp_ble_gatts_send_ %s: rc=%d %s",is_notification?"notify":"indicate", errRc, GeneralUtils::errorToString(errRc));
|
||||
m_semaphoreConfEvt.give();
|
||||
m_pCallbacks->onStatus(this, BLECharacteristicCallbacks::Status::ERROR_GATT, errRc); // Invoke the notify callback.
|
||||
return;
|
||||
}
|
||||
if(!is_notification)
|
||||
m_semaphoreConfEvt.wait("indicate");
|
||||
if(!is_notification){ // is indication
|
||||
if(!m_semaphoreConfEvt.timedWait("indicate", indicationTimeout)){
|
||||
m_pCallbacks->onStatus(this, BLECharacteristicCallbacks::Status::ERROR_INDICATE_TIMEOUT, 0); // Invoke the notify callback.
|
||||
} else {
|
||||
auto code = (esp_gatt_status_t) m_semaphoreConfEvt.value();
|
||||
if(code == ESP_GATT_OK) {
|
||||
m_pCallbacks->onStatus(this, BLECharacteristicCallbacks::Status::SUCCESS_INDICATE, code); // Invoke the notify callback.
|
||||
} else {
|
||||
m_pCallbacks->onStatus(this, BLECharacteristicCallbacks::Status::ERROR_INDICATE_FAILURE, code);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m_pCallbacks->onStatus(this, BLECharacteristicCallbacks::Status::SUCCESS_NOTIFY, 0); // Invoke the notify callback.
|
||||
}
|
||||
}
|
||||
log_v("<< notify");
|
||||
} // Notify
|
||||
@ -551,7 +568,11 @@ void BLECharacteristic::setBroadcastProperty(bool value) {
|
||||
*/
|
||||
void BLECharacteristic::setCallbacks(BLECharacteristicCallbacks* pCallbacks) {
|
||||
log_v(">> setCallbacks: 0x%x", (uint32_t)pCallbacks);
|
||||
m_pCallbacks = pCallbacks;
|
||||
if (pCallbacks != nullptr){
|
||||
m_pCallbacks = pCallbacks;
|
||||
} else {
|
||||
m_pCallbacks = &defaultCallback;
|
||||
}
|
||||
log_v("<< setCallbacks");
|
||||
} // setCallbacks
|
||||
|
||||
@ -628,7 +649,9 @@ void BLECharacteristic::setValue(uint8_t* data, size_t length) {
|
||||
log_e("Size %d too large, must be no bigger than %d", length, ESP_GATT_MAX_ATTR_LEN);
|
||||
return;
|
||||
}
|
||||
m_semaphoreSetValue.take();
|
||||
m_value.setValue(data, length);
|
||||
m_semaphoreSetValue.give();
|
||||
log_v("<< setValue");
|
||||
} // setValue
|
||||
|
||||
@ -715,17 +738,18 @@ void BLECharacteristic::setWriteProperty(bool value) {
|
||||
* @return A string representation of the characteristic.
|
||||
*/
|
||||
std::string BLECharacteristic::toString() {
|
||||
std::stringstream stringstream;
|
||||
stringstream << std::hex << std::setfill('0');
|
||||
stringstream << "UUID: " << m_bleUUID.toString() + ", handle: 0x" << std::setw(2) << m_handle;
|
||||
stringstream << " " <<
|
||||
((m_properties & ESP_GATT_CHAR_PROP_BIT_READ) ? "Read " : "") <<
|
||||
((m_properties & ESP_GATT_CHAR_PROP_BIT_WRITE) ? "Write " : "") <<
|
||||
((m_properties & ESP_GATT_CHAR_PROP_BIT_WRITE_NR) ? "WriteNoResponse " : "") <<
|
||||
((m_properties & ESP_GATT_CHAR_PROP_BIT_BROADCAST) ? "Broadcast " : "") <<
|
||||
((m_properties & ESP_GATT_CHAR_PROP_BIT_NOTIFY) ? "Notify " : "") <<
|
||||
((m_properties & ESP_GATT_CHAR_PROP_BIT_INDICATE) ? "Indicate " : "");
|
||||
return stringstream.str();
|
||||
std::string res = "UUID: " + m_bleUUID.toString() + ", handle : 0x";
|
||||
char hex[5];
|
||||
snprintf(hex, sizeof(hex), "%04x", m_handle);
|
||||
res += hex;
|
||||
res += " ";
|
||||
if (m_properties & ESP_GATT_CHAR_PROP_BIT_READ) res += "Read ";
|
||||
if (m_properties & ESP_GATT_CHAR_PROP_BIT_WRITE) res += "Write ";
|
||||
if (m_properties & ESP_GATT_CHAR_PROP_BIT_WRITE_NR) res += "WriteNoResponse ";
|
||||
if (m_properties & ESP_GATT_CHAR_PROP_BIT_BROADCAST) res += "Broadcast ";
|
||||
if (m_properties & ESP_GATT_CHAR_PROP_BIT_NOTIFY) res += "Notify ";
|
||||
if (m_properties & ESP_GATT_CHAR_PROP_BIT_INDICATE) res += "Indicate ";
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
|
||||
@ -751,4 +775,27 @@ void BLECharacteristicCallbacks::onWrite(BLECharacteristic* pCharacteristic) {
|
||||
log_d("BLECharacteristicCallbacks", "<< onWrite");
|
||||
} // onWrite
|
||||
|
||||
|
||||
/**
|
||||
* @brief Callback function to support a Notify request.
|
||||
* @param [in] pCharacteristic The characteristic that is the source of the event.
|
||||
*/
|
||||
void BLECharacteristicCallbacks::onNotify(BLECharacteristic* pCharacteristic) {
|
||||
log_d("BLECharacteristicCallbacks", ">> onNotify: default");
|
||||
log_d("BLECharacteristicCallbacks", "<< onNotify");
|
||||
} // onNotify
|
||||
|
||||
|
||||
/**
|
||||
* @brief Callback function to support a Notify/Indicate Status report.
|
||||
* @param [in] pCharacteristic The characteristic that is the source of the event.
|
||||
* @param [in] s Status of the notification/indication
|
||||
* @param [in] code Additional code of underlying errors
|
||||
*/
|
||||
void BLECharacteristicCallbacks::onStatus(BLECharacteristic* pCharacteristic, Status s, uint32_t code) {
|
||||
log_d("BLECharacteristicCallbacks", ">> onStatus: default");
|
||||
log_d("BLECharacteristicCallbacks", "<< onStatus");
|
||||
} // onStatus
|
||||
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED */
|
||||
|
@ -90,6 +90,8 @@ public:
|
||||
static const uint32_t PROPERTY_INDICATE = 1<<4;
|
||||
static const uint32_t PROPERTY_WRITE_NR = 1<<5;
|
||||
|
||||
static const uint32_t indicationTimeout = 1000;
|
||||
|
||||
private:
|
||||
|
||||
friend class BLEServer;
|
||||
@ -117,6 +119,7 @@ private:
|
||||
void setHandle(uint16_t handle);
|
||||
FreeRTOS::Semaphore m_semaphoreCreateEvt = FreeRTOS::Semaphore("CreateEvt");
|
||||
FreeRTOS::Semaphore m_semaphoreConfEvt = FreeRTOS::Semaphore("ConfEvt");
|
||||
FreeRTOS::Semaphore m_semaphoreSetValue = FreeRTOS::Semaphore("SetValue");
|
||||
}; // BLECharacteristic
|
||||
|
||||
|
||||
@ -129,9 +132,22 @@ private:
|
||||
*/
|
||||
class BLECharacteristicCallbacks {
|
||||
public:
|
||||
typedef enum {
|
||||
SUCCESS_INDICATE,
|
||||
SUCCESS_NOTIFY,
|
||||
ERROR_INDICATE_DISABLED,
|
||||
ERROR_NOTIFY_DISABLED,
|
||||
ERROR_GATT,
|
||||
ERROR_NO_CLIENT,
|
||||
ERROR_INDICATE_TIMEOUT,
|
||||
ERROR_INDICATE_FAILURE
|
||||
}Status;
|
||||
|
||||
virtual ~BLECharacteristicCallbacks();
|
||||
virtual void onRead(BLECharacteristic* pCharacteristic);
|
||||
virtual void onWrite(BLECharacteristic* pCharacteristic);
|
||||
virtual void onNotify(BLECharacteristic* pCharacteristic);
|
||||
virtual void onStatus(BLECharacteristic* pCharacteristic, Status s, uint32_t code);
|
||||
};
|
||||
#endif /* CONFIG_BT_ENABLED */
|
||||
#endif /* COMPONENTS_CPP_UTILS_BLECHARACTERISTIC_H_ */
|
||||
|
@ -116,17 +116,18 @@ void BLECharacteristicMap::setByUUID(BLECharacteristic* pCharacteristic, BLEUUID
|
||||
* @return A string representation of the characteristic map.
|
||||
*/
|
||||
std::string BLECharacteristicMap::toString() {
|
||||
std::stringstream stringStream;
|
||||
stringStream << std::hex << std::setfill('0');
|
||||
std::string res;
|
||||
int count = 0;
|
||||
char hex[5];
|
||||
for (auto &myPair: m_uuidMap) {
|
||||
if (count > 0) {
|
||||
stringStream << "\n";
|
||||
}
|
||||
if (count > 0) {res += "\n";}
|
||||
snprintf(hex, sizeof(hex), "%04x", myPair.first->getHandle());
|
||||
count++;
|
||||
stringStream << "handle: 0x" << std::setw(2) << myPair.first->getHandle() << ", uuid: " + myPair.first->getUUID().toString();
|
||||
res += "handle: 0x";
|
||||
res += hex;
|
||||
res += ", uuid: " + myPair.first->getUUID().toString();
|
||||
}
|
||||
return stringStream.str();
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
|
||||
|
@ -184,10 +184,11 @@ void BLEClient::gattClientEventHandler(
|
||||
if (m_pClientCallbacks != nullptr) {
|
||||
m_pClientCallbacks->onDisconnect(this);
|
||||
}
|
||||
BLEDevice::removePeerDevice(m_appId, true);
|
||||
esp_ble_gattc_app_unregister(m_gattc_if);
|
||||
m_semaphoreOpenEvt.give(ESP_GATT_IF_NONE);
|
||||
m_semaphoreRssiCmplEvt.give();
|
||||
m_semaphoreSearchCmplEvt.give(1);
|
||||
BLEDevice::removePeerDevice(m_appId, true);
|
||||
break;
|
||||
} // ESP_GATTC_DISCONNECT_EVT
|
||||
|
||||
@ -515,14 +516,13 @@ uint16_t BLEClient::getMTU() {
|
||||
* @return A string representation of this client.
|
||||
*/
|
||||
std::string BLEClient::toString() {
|
||||
std::ostringstream ss;
|
||||
ss << "peer address: " << m_peerAddress.toString();
|
||||
ss << "\nServices:\n";
|
||||
std::string res = "peer address: " + m_peerAddress.toString();
|
||||
res += "\nServices:\n";
|
||||
for (auto &myPair : m_servicesMap) {
|
||||
ss << myPair.second->toString() << "\n";
|
||||
res += myPair.second->toString() + "\n";
|
||||
// myPair.second is the value
|
||||
}
|
||||
return ss.str();
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <string.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "BLEExceptions.h"
|
||||
//#include "BLEExceptions.h"
|
||||
#include "BLERemoteService.h"
|
||||
#include "BLEService.h"
|
||||
#include "BLEAddress.h"
|
||||
|
@ -255,10 +255,10 @@ void BLEDescriptor::setAccessPermissions(esp_gatt_perm_t perm) {
|
||||
* @return A string representation of the descriptor.
|
||||
*/
|
||||
std::string BLEDescriptor::toString() {
|
||||
std::stringstream stringstream;
|
||||
stringstream << std::hex << std::setfill('0');
|
||||
stringstream << "UUID: " << m_bleUUID.toString() + ", handle: 0x" << std::setw(2) << m_handle;
|
||||
return stringstream.str();
|
||||
char hex[5];
|
||||
snprintf(hex, sizeof(hex), "%04x", m_handle);
|
||||
std::string res = "UUID: " + m_bleUUID.toString() + ", handle: 0x" + hex;
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
|
||||
|
@ -90,17 +90,18 @@ void BLEDescriptorMap::setByHandle(uint16_t handle, BLEDescriptor* pDescriptor)
|
||||
* @return A string representation of the descriptor map.
|
||||
*/
|
||||
std::string BLEDescriptorMap::toString() {
|
||||
std::stringstream stringStream;
|
||||
stringStream << std::hex << std::setfill('0');
|
||||
std::string res;
|
||||
char hex[5];
|
||||
int count = 0;
|
||||
for (auto &myPair : m_uuidMap) {
|
||||
if (count > 0) {
|
||||
stringStream << "\n";
|
||||
}
|
||||
if (count > 0) {res += "\n";}
|
||||
snprintf(hex, sizeof(hex), "%04x", myPair.first->getHandle());
|
||||
count++;
|
||||
stringStream << "handle: 0x" << std::setw(2) << myPair.first->getHandle() << ", uuid: " + myPair.first->getUUID().toString();
|
||||
res += "handle: 0x";
|
||||
res += hex;
|
||||
res += ", uuid: " + myPair.first->getUUID().toString();
|
||||
}
|
||||
return stringStream.str();
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
|
||||
|
@ -479,9 +479,8 @@ gatts_event_handler BLEDevice::m_customGattsHandler = nullptr;
|
||||
* @return A string representation of the nature of this device.
|
||||
*/
|
||||
/* STATIC */ std::string BLEDevice::toString() {
|
||||
std::ostringstream oss;
|
||||
oss << "BD Address: " << getAddress().toString();
|
||||
return oss.str();
|
||||
std::string res = "BD Address: " + getAddress().toString();
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "sdkconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
#include "esp32-hal-log.h"
|
||||
#include "BLEEddystoneTLM.h"
|
||||
|
||||
@ -54,62 +54,44 @@ uint32_t BLEEddystoneTLM::getTime() {
|
||||
} // getTime
|
||||
|
||||
std::string BLEEddystoneTLM::toString() {
|
||||
std::stringstream ss;
|
||||
std::string out = "";
|
||||
uint32_t rawsec;
|
||||
ss << "Version ";
|
||||
ss << std::dec << m_eddystoneData.version;
|
||||
ss << "\n";
|
||||
std::string out = "";
|
||||
uint32_t rawsec = ENDIAN_CHANGE_U32(m_eddystoneData.tmil);
|
||||
char val[6];
|
||||
|
||||
ss << "Battery Voltage ";
|
||||
ss << std::dec << ENDIAN_CHANGE_U16(m_eddystoneData.volt);
|
||||
ss << " mV\n";
|
||||
out += "Version " + m_eddystoneData.version;
|
||||
out += "\n";
|
||||
out += "Battery Voltage " + ENDIAN_CHANGE_U16(m_eddystoneData.volt);
|
||||
out += " mV\n";
|
||||
|
||||
ss << "Temperature ";
|
||||
ss << (float) m_eddystoneData.temp;
|
||||
ss << " °C\n";
|
||||
out += "Temperature ";
|
||||
snprintf(val, sizeof(val), "%d", m_eddystoneData.temp);
|
||||
out += val;
|
||||
out += ".0 °C\n";
|
||||
|
||||
ss << "Adv. Count ";
|
||||
ss << std::dec << ENDIAN_CHANGE_U32(m_eddystoneData.advCount);
|
||||
out += "Adv. Count ";
|
||||
snprintf(val, sizeof(val), "%d", ENDIAN_CHANGE_U32(m_eddystoneData.advCount));
|
||||
out += val;
|
||||
out += "\n";
|
||||
|
||||
ss << "\n";
|
||||
out += "Time ";
|
||||
|
||||
ss << "Time ";
|
||||
snprintf(val, sizeof(val), "%04d", rawsec / 864000);
|
||||
out += val;
|
||||
out += ".";
|
||||
|
||||
rawsec = ENDIAN_CHANGE_U32(m_eddystoneData.tmil);
|
||||
std::stringstream buffstream;
|
||||
buffstream << "0000";
|
||||
buffstream << std::dec << rawsec / 864000;
|
||||
std::string buff = buffstream.str();
|
||||
snprintf(val, sizeof(val), "%02d", (rawsec / 36000) % 24);
|
||||
out += val;
|
||||
out += ":";
|
||||
|
||||
ss << buff.substr(buff.length() - 4, buff.length());
|
||||
ss << ".";
|
||||
snprintf(val, sizeof(val), "%02d", (rawsec / 600) % 60);
|
||||
out += val;
|
||||
out += ":";
|
||||
|
||||
buffstream.str("");
|
||||
buffstream.clear();
|
||||
buffstream << "00";
|
||||
buffstream << std::dec << (rawsec / 36000) % 24;
|
||||
buff = buffstream.str();
|
||||
ss << buff.substr(buff.length()-2, buff.length());
|
||||
ss << ":";
|
||||
snprintf(val, sizeof(val), "%02d", (rawsec / 10) % 60);
|
||||
out += val;
|
||||
out += "\n";
|
||||
|
||||
buffstream.str("");
|
||||
buffstream.clear();
|
||||
buffstream << "00";
|
||||
buffstream << std::dec << (rawsec / 600) % 60;
|
||||
buff = buffstream.str();
|
||||
ss << buff.substr(buff.length() - 2, buff.length());
|
||||
ss << ":";
|
||||
|
||||
buffstream.str("");
|
||||
buffstream.clear();
|
||||
buffstream << "00";
|
||||
buffstream << std::dec << (rawsec / 10) % 60;
|
||||
buff = buffstream.str();
|
||||
ss << buff.substr(buff.length() - 2, buff.length());
|
||||
ss << "\n";
|
||||
|
||||
return ss.str();
|
||||
return out;
|
||||
} // toString
|
||||
|
||||
/**
|
||||
|
@ -5,5 +5,5 @@
|
||||
* Author: kolban
|
||||
*/
|
||||
|
||||
#include "BLEExceptions.h"
|
||||
//#include "BLEExceptions.h"
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <esp_err.h>
|
||||
|
||||
#include <sstream>
|
||||
#include "BLEExceptions.h"
|
||||
//#include "BLEExceptions.h"
|
||||
#include "BLEUtils.h"
|
||||
#include "GeneralUtils.h"
|
||||
#include "BLERemoteDescriptor.h"
|
||||
@ -39,6 +39,7 @@ BLERemoteCharacteristic::BLERemoteCharacteristic(
|
||||
m_charProp = charProp;
|
||||
m_pRemoteService = pRemoteService;
|
||||
m_notifyCallback = nullptr;
|
||||
m_rawData = nullptr;
|
||||
|
||||
retrieveDescriptors(); // Get the descriptors for this characteristic
|
||||
log_v("<< BLERemoteCharacteristic");
|
||||
@ -399,7 +400,7 @@ std::string BLERemoteCharacteristic::readValue() {
|
||||
// Check to see that we are connected.
|
||||
if (!getRemoteService()->getClient()->isConnected()) {
|
||||
log_e("Disconnected");
|
||||
throw BLEDisconnectedException();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
m_semaphoreReadCharEvt.take("readValue");
|
||||
@ -500,11 +501,16 @@ void BLERemoteCharacteristic::removeDescriptors() {
|
||||
* @return a String representation.
|
||||
*/
|
||||
std::string BLERemoteCharacteristic::toString() {
|
||||
std::ostringstream ss;
|
||||
ss << "Characteristic: uuid: " << m_uuid.toString() <<
|
||||
", handle: " << getHandle() << " 0x" << std::hex << getHandle() <<
|
||||
", props: " << BLEUtils::characteristicPropertiesToString(m_charProp);
|
||||
return ss.str();
|
||||
std::string res = "Characteristic: uuid: " + m_uuid.toString();
|
||||
char val[6];
|
||||
res += ", handle: ";
|
||||
snprintf(val, sizeof(val), "%d", getHandle());
|
||||
res += val;
|
||||
res += " 0x";
|
||||
snprintf(val, sizeof(val), "%04x", getHandle());
|
||||
res += val;
|
||||
res += ", props: " + BLEUtils::characteristicPropertiesToString(m_charProp);
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
|
||||
@ -545,7 +551,7 @@ void BLERemoteCharacteristic::writeValue(uint8_t* data, size_t length, bool resp
|
||||
// Check to see that we are connected.
|
||||
if (!getRemoteService()->getClient()->isConnected()) {
|
||||
log_e("Disconnected");
|
||||
throw BLEDisconnectedException();
|
||||
return;
|
||||
}
|
||||
|
||||
m_semaphoreWriteCharEvt.take("writeValue");
|
||||
|
@ -55,7 +55,7 @@ std::string BLERemoteDescriptor::readValue() {
|
||||
// Check to see that we are connected.
|
||||
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
|
||||
log_e("Disconnected");
|
||||
throw BLEDisconnectedException();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
m_semaphoreReadDescrEvt.take("readValue");
|
||||
@ -113,9 +113,12 @@ uint32_t BLERemoteDescriptor::readUInt32() {
|
||||
* @retun A string representation of this BLE Remote Descriptor.
|
||||
*/
|
||||
std::string BLERemoteDescriptor::toString() {
|
||||
std::stringstream ss;
|
||||
ss << "handle: " << getHandle() << ", uuid: " << getUUID().toString();
|
||||
return ss.str();
|
||||
char val[6];
|
||||
snprintf(val, sizeof(val), "%d", getHandle());
|
||||
std::string res = "handle: ";
|
||||
res += val;
|
||||
res += ", uuid: " + getUUID().toString();
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
|
||||
@ -130,7 +133,7 @@ void BLERemoteDescriptor::writeValue(uint8_t* data, size_t length, bool response
|
||||
// Check to see that we are connected.
|
||||
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
|
||||
log_e("Disconnected");
|
||||
throw BLEDisconnectedException();
|
||||
return;
|
||||
}
|
||||
|
||||
esp_err_t errRc = ::esp_ble_gattc_write_char_descr(
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include <esp_err.h>
|
||||
#include "esp32-hal-log.h"
|
||||
|
||||
#pragma GCC diagnostic warning "-Wunused-but-set-parameter"
|
||||
|
||||
BLERemoteService::BLERemoteService(
|
||||
esp_gatt_id_t srvcId,
|
||||
BLEClient* pClient,
|
||||
@ -164,7 +166,7 @@ void BLERemoteService::retrieveCharacteristics() {
|
||||
uint16_t offset = 0;
|
||||
esp_gattc_char_elem_t result;
|
||||
while (true) {
|
||||
uint16_t count = 10; // this value is used as in parameter that allows to search max 10 chars with the same uuid
|
||||
uint16_t count = 1; // only room for 1 result allocated, so go one by one
|
||||
esp_gatt_status_t status = ::esp_ble_gattc_get_all_char(
|
||||
getClient()->getGattcIf(),
|
||||
getClient()->getConnId(),
|
||||
@ -228,7 +230,6 @@ std::map<std::string, BLERemoteCharacteristic*>* BLERemoteService::getCharacteri
|
||||
* @brief This function is designed to get characteristics map when we have multiple characteristics with the same UUID
|
||||
*/
|
||||
void BLERemoteService::getCharacteristics(std::map<uint16_t, BLERemoteCharacteristic*>* pCharacteristicMap) {
|
||||
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
|
||||
pCharacteristicMap = &m_characteristicMapByHandle;
|
||||
} // Get the characteristics map.
|
||||
|
||||
@ -317,15 +318,25 @@ void BLERemoteService::setValue(BLEUUID characteristicUuid, std::string value) {
|
||||
* @return A string representation of this remote service.
|
||||
*/
|
||||
std::string BLERemoteService::toString() {
|
||||
std::ostringstream ss;
|
||||
ss << "Service: uuid: " + m_uuid.toString();
|
||||
ss << ", start_handle: " << std::dec << m_startHandle << " 0x" << std::hex << m_startHandle <<
|
||||
", end_handle: " << std::dec << m_endHandle << " 0x" << std::hex << m_endHandle;
|
||||
std::string res = "Service: uuid: " + m_uuid.toString();
|
||||
char val[6];
|
||||
res += ", start_handle: ";
|
||||
snprintf(val, sizeof(val), "%d", m_startHandle);
|
||||
res += val;
|
||||
snprintf(val, sizeof(val), "%04x", m_startHandle);
|
||||
res += " 0x";
|
||||
res += val;
|
||||
res += ", end_handle: ";
|
||||
snprintf(val, sizeof(val), "%d", m_endHandle);
|
||||
res += val;
|
||||
snprintf(val, sizeof(val), "%04x", m_endHandle);
|
||||
res += " 0x";
|
||||
res += val;
|
||||
for (auto &myPair : m_characteristicMap) {
|
||||
ss << "\n" << myPair.second->toString();
|
||||
res += "\n" + myPair.second->toString();
|
||||
// myPair.second is the value
|
||||
}
|
||||
return ss.str();
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
|
||||
|
@ -412,4 +412,9 @@ void BLEServer::updateConnParams(esp_bd_addr_t remote_bda, uint16_t minInterval,
|
||||
conn_params.timeout = timeout; // timeout = 400*10ms = 4000ms
|
||||
esp_ble_gap_update_conn_params(&conn_params);
|
||||
}
|
||||
|
||||
void BLEServer::disconnect(uint16_t connId) {
|
||||
esp_ble_gatts_close(m_gatts_if, connId);
|
||||
}
|
||||
|
||||
#endif // CONFIG_BT_ENABLED
|
||||
|
@ -72,6 +72,7 @@ public:
|
||||
BLEService* getServiceByUUID(const char* uuid);
|
||||
BLEService* getServiceByUUID(BLEUUID uuid);
|
||||
bool connect(BLEAddress address);
|
||||
void disconnect(uint16_t connId);
|
||||
uint16_t m_appId;
|
||||
void updateConnParams(esp_bd_addr_t remote_bda, uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout);
|
||||
|
||||
|
@ -381,10 +381,12 @@ BLECharacteristic* BLEService::getCharacteristic(BLEUUID uuid) {
|
||||
* @return A string representation of this service.
|
||||
*/
|
||||
std::string BLEService::toString() {
|
||||
std::stringstream stringStream;
|
||||
stringStream << "UUID: " << getUUID().toString() <<
|
||||
", handle: 0x" << std::hex << std::setfill('0') << std::setw(2) << getHandle();
|
||||
return stringStream.str();
|
||||
std::string res = "UUID: " + getUUID().toString();
|
||||
char hex[5];
|
||||
snprintf(hex, sizeof(hex), "%04x", getHandle());
|
||||
res += ", handle: 0x";
|
||||
res += hex;
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
#include "sdkconfig.h"
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
#include <iomanip>
|
||||
#include "BLEService.h"
|
||||
|
||||
@ -73,12 +73,15 @@ void BLEServiceMap::setByHandle(uint16_t handle, BLEService* service) {
|
||||
* @return A string representation of the service map.
|
||||
*/
|
||||
std::string BLEServiceMap::toString() {
|
||||
std::stringstream stringStream;
|
||||
stringStream << std::hex << std::setfill('0');
|
||||
std::string res;
|
||||
char hex[5];
|
||||
for (auto &myPair: m_handleMap) {
|
||||
stringStream << "handle: 0x" << std::setw(2) << myPair.first << ", uuid: " + myPair.second->getUUID().toString() << "\n";
|
||||
res += "handle: 0x";
|
||||
snprintf(hex, sizeof(hex), "%04x", myPair.first);
|
||||
res += hex;
|
||||
res += ", uuid: " + myPair.second->getUUID().toString() + "\n";
|
||||
}
|
||||
return stringStream.str();
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
void BLEServiceMap::handleGATTServerEvent(
|
||||
|
@ -349,51 +349,38 @@ BLEUUID BLEUUID::to128() {
|
||||
*/
|
||||
std::string BLEUUID::toString() {
|
||||
if (!m_valueSet) return "<NULL>"; // If we have no value, nothing to format.
|
||||
|
||||
// If the UUIDs are 16 or 32 bit, pad correctly.
|
||||
std::stringstream ss;
|
||||
|
||||
if (m_uuid.len == ESP_UUID_LEN_16) { // If the UUID is 16bit, pad correctly.
|
||||
ss << "0000" <<
|
||||
std::hex <<
|
||||
std::setfill('0') <<
|
||||
std::setw(4) <<
|
||||
m_uuid.uuid.uuid16 <<
|
||||
"-0000-1000-8000-00805f9b34fb";
|
||||
return ss.str(); // Return the string
|
||||
char hex[5];
|
||||
snprintf(hex, sizeof(hex), "%04x", m_uuid.uuid.uuid16);
|
||||
return std::string(hex) + "-0000-1000-8000-00805f9b34fb";
|
||||
} // End 16bit UUID
|
||||
|
||||
if (m_uuid.len == ESP_UUID_LEN_32) { // If the UUID is 32bit, pad correctly.
|
||||
ss << std::hex <<
|
||||
std::setfill('0') <<
|
||||
std::setw(8) <<
|
||||
m_uuid.uuid.uuid32 <<
|
||||
"-0000-1000-8000-00805f9b34fb";
|
||||
return ss.str(); // return the string
|
||||
char hex[9];
|
||||
snprintf(hex, sizeof(hex), "%08x", m_uuid.uuid.uuid32);
|
||||
return std::string(hex) + "-0000-1000-8000-00805f9b34fb";
|
||||
} // End 32bit UUID
|
||||
|
||||
// The UUID is not 16bit or 32bit which means that it is 128bit.
|
||||
//
|
||||
// UUID string format:
|
||||
// AABBCCDD-EEFF-GGHH-IIJJ-KKLLMMNNOOPP
|
||||
ss << std::hex << std::setfill('0') <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[15] <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[14] <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[13] <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[12] << "-" <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[11] <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[10] << "-" <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[9] <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[8] << "-" <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[7] <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[6] << "-" <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[5] <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[4] <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[3] <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[2] <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[1] <<
|
||||
std::setw(2) << (int) m_uuid.uuid.uuid128[0];
|
||||
return ss.str();
|
||||
auto size = 35;
|
||||
char *hex = (char *)malloc(size);
|
||||
snprintf(hex, size, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
m_uuid.uuid.uuid128[15], m_uuid.uuid.uuid128[14],
|
||||
m_uuid.uuid.uuid128[13], m_uuid.uuid.uuid128[12],
|
||||
m_uuid.uuid.uuid128[11], m_uuid.uuid.uuid128[10],
|
||||
m_uuid.uuid.uuid128[9], m_uuid.uuid.uuid128[8],
|
||||
m_uuid.uuid.uuid128[7], m_uuid.uuid.uuid128[6],
|
||||
m_uuid.uuid.uuid128[5], m_uuid.uuid.uuid128[4],
|
||||
m_uuid.uuid.uuid128[3], m_uuid.uuid.uuid128[2],
|
||||
m_uuid.uuid.uuid128[1], m_uuid.uuid.uuid128[0]);
|
||||
std::string res(hex);
|
||||
free(hex);
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED */
|
||||
|
@ -604,26 +604,32 @@ static const gattService_t g_gattServices[] = {
|
||||
* @return A string representation of characteristic properties.
|
||||
*/
|
||||
std::string BLEUtils::characteristicPropertiesToString(esp_gatt_char_prop_t prop) {
|
||||
std::stringstream stream;
|
||||
stream <<
|
||||
"broadcast: " << ((prop & ESP_GATT_CHAR_PROP_BIT_BROADCAST)?"1":"0") <<
|
||||
", read: " << ((prop & ESP_GATT_CHAR_PROP_BIT_READ)?"1":"0") <<
|
||||
", write_nr: " << ((prop & ESP_GATT_CHAR_PROP_BIT_WRITE_NR)?"1":"0") <<
|
||||
", write: " << ((prop & ESP_GATT_CHAR_PROP_BIT_WRITE)?"1":"0") <<
|
||||
", notify: " << ((prop & ESP_GATT_CHAR_PROP_BIT_NOTIFY)?"1":"0") <<
|
||||
", indicate: " << ((prop & ESP_GATT_CHAR_PROP_BIT_INDICATE)?"1":"0") <<
|
||||
", auth: " << ((prop & ESP_GATT_CHAR_PROP_BIT_AUTH)?"1":"0");
|
||||
return stream.str();
|
||||
std::string res = "broadcast: ";
|
||||
res += ((prop & ESP_GATT_CHAR_PROP_BIT_BROADCAST)?"1":"0");
|
||||
res += ", read: ";
|
||||
res += ((prop & ESP_GATT_CHAR_PROP_BIT_READ)?"1":"0");
|
||||
res += ", write_nr: ";
|
||||
res += ((prop & ESP_GATT_CHAR_PROP_BIT_WRITE_NR)?"1":"0");
|
||||
res += ", write: ";
|
||||
res += ((prop & ESP_GATT_CHAR_PROP_BIT_WRITE)?"1":"0");
|
||||
res += ", notify: ";
|
||||
res += ((prop & ESP_GATT_CHAR_PROP_BIT_NOTIFY)?"1":"0");
|
||||
res += ", indicate: ";
|
||||
res += ((prop & ESP_GATT_CHAR_PROP_BIT_INDICATE)?"1":"0");
|
||||
res += ", auth: ";
|
||||
res += ((prop & ESP_GATT_CHAR_PROP_BIT_AUTH)?"1":"0");
|
||||
return res;
|
||||
} // characteristicPropertiesToString
|
||||
|
||||
/**
|
||||
* @brief Convert an esp_gatt_id_t to a string.
|
||||
*/
|
||||
static std::string gattIdToString(esp_gatt_id_t gattId) {
|
||||
std::stringstream stream;
|
||||
stream << "uuid: " << BLEUUID(gattId.uuid).toString() << ", inst_id: " << (int)gattId.inst_id;
|
||||
//sprintf(buffer, "uuid: %s, inst_id: %d", uuidToString(gattId.uuid).c_str(), gattId.inst_id);
|
||||
return stream.str();
|
||||
std::string res = "uuid: " + BLEUUID(gattId.uuid).toString() + ", inst_id: ";
|
||||
char val[8];
|
||||
snprintf(val, sizeof(val), "%d", (int)gattId.inst_id);
|
||||
res += val;
|
||||
return res;
|
||||
} // gattIdToString
|
||||
|
||||
|
||||
@ -654,23 +660,23 @@ const char* BLEUtils::addressTypeToString(esp_ble_addr_type_t type) {
|
||||
* @return std::string A string representation of the advertising flags.
|
||||
*/
|
||||
std::string BLEUtils::adFlagsToString(uint8_t adFlags) {
|
||||
std::stringstream ss;
|
||||
std::string res;
|
||||
if (adFlags & (1 << 0)) {
|
||||
ss << "[LE Limited Discoverable Mode] ";
|
||||
res += "[LE Limited Discoverable Mode] ";
|
||||
}
|
||||
if (adFlags & (1 << 1)) {
|
||||
ss << "[LE General Discoverable Mode] ";
|
||||
res += "[LE General Discoverable Mode] ";
|
||||
}
|
||||
if (adFlags & (1 << 2)) {
|
||||
ss << "[BR/EDR Not Supported] ";
|
||||
res += "[BR/EDR Not Supported] ";
|
||||
}
|
||||
if (adFlags & (1 << 3)) {
|
||||
ss << "[Simultaneous LE and BR/EDR to Same Device Capable (Controller)] ";
|
||||
res += "[Simultaneous LE and BR/EDR to Same Device Capable (Controller)] ";
|
||||
}
|
||||
if (adFlags & (1 << 4)) {
|
||||
ss << "[Simultaneous LE and BR/EDR to Same Device Capable (Host)] ";
|
||||
res += "[Simultaneous LE and BR/EDR to Same Device Capable (Host)] ";
|
||||
}
|
||||
return ss.str();
|
||||
return res;
|
||||
} // adFlagsToString
|
||||
|
||||
|
||||
@ -802,13 +808,13 @@ char* BLEUtils::buildHexData(uint8_t* target, uint8_t* source, uint8_t length) {
|
||||
* @return A string representation of a piece of memory.
|
||||
*/
|
||||
std::string BLEUtils::buildPrintData(uint8_t* source, size_t length) {
|
||||
std::ostringstream ss;
|
||||
std::string res;
|
||||
for (int i = 0; i < length; i++) {
|
||||
char c = *source;
|
||||
ss << (isprint(c) ? c : '.');
|
||||
res += (isprint(c) ? c : '.');
|
||||
source++;
|
||||
}
|
||||
return ss.str();
|
||||
return res;
|
||||
} // buildPrintData
|
||||
|
||||
|
||||
@ -1848,14 +1854,22 @@ std::string BLEUtils::gattDescriptorUUIDToString(uint32_t descriptorUUID) {
|
||||
* @return A string representation of an esp_gattc_service_elem_t.
|
||||
*/
|
||||
std::string BLEUtils::gattcServiceElementToString(esp_gattc_service_elem_t* pGATTCServiceElement) {
|
||||
std::stringstream ss;
|
||||
|
||||
ss << "[uuid: " << BLEUUID(pGATTCServiceElement->uuid).toString() <<
|
||||
", start_handle: " << pGATTCServiceElement->start_handle <<
|
||||
" 0x" << std::hex << pGATTCServiceElement->start_handle <<
|
||||
", end_handle: " << std::dec << pGATTCServiceElement->end_handle <<
|
||||
" 0x" << std::hex << pGATTCServiceElement->end_handle << "]";
|
||||
return ss.str();
|
||||
std::string res;
|
||||
char val[6];
|
||||
res += "[uuid: " + BLEUUID(pGATTCServiceElement->uuid).toString() + ", start_handle: ";
|
||||
snprintf(val, sizeof(val), "%d", pGATTCServiceElement->start_handle);
|
||||
res += val;
|
||||
res += " 0x";
|
||||
snprintf(val, sizeof(val), "%04x", pGATTCServiceElement->start_handle);
|
||||
res += val;
|
||||
res += ", end_handle: ";
|
||||
snprintf(val, sizeof(val), "%d", pGATTCServiceElement->end_handle);
|
||||
res += val;
|
||||
res += " 0x";
|
||||
snprintf(val, sizeof(val), "%04x", pGATTCServiceElement->end_handle);
|
||||
res += val;
|
||||
res += "]";
|
||||
return res;
|
||||
} // gattcServiceElementToString
|
||||
|
||||
|
||||
|
@ -61,15 +61,13 @@ uint32_t FreeRTOS::getTimeSinceStart() {
|
||||
*/
|
||||
uint32_t FreeRTOS::Semaphore::wait(std::string owner) {
|
||||
log_v(">> wait: Semaphore waiting: %s for %s", toString().c_str(), owner.c_str());
|
||||
|
||||
|
||||
if (m_usePthreads) {
|
||||
pthread_mutex_lock(&m_pthread_mutex);
|
||||
} else {
|
||||
xSemaphoreTake(m_semaphore, portMAX_DELAY);
|
||||
}
|
||||
|
||||
m_owner = owner;
|
||||
|
||||
if (m_usePthreads) {
|
||||
pthread_mutex_unlock(&m_pthread_mutex);
|
||||
} else {
|
||||
@ -77,17 +75,49 @@ uint32_t FreeRTOS::Semaphore::wait(std::string owner) {
|
||||
}
|
||||
|
||||
log_v("<< wait: Semaphore released: %s", toString().c_str());
|
||||
m_owner = std::string("<N/A>");
|
||||
return m_value;
|
||||
} // wait
|
||||
|
||||
/**
|
||||
* @brief Wait for a semaphore to be released in a given period of time by trying to take it and
|
||||
* then releasing it again. The value associated with the semaphore can be taken by value() call after return
|
||||
* @param [in] owner A debug tag.
|
||||
* @param [in] timeoutMs timeout to wait in ms.
|
||||
* @return True if we took the semaphore within timeframe.
|
||||
*/
|
||||
bool FreeRTOS::Semaphore::timedWait(std::string owner, uint32_t timeoutMs) {
|
||||
log_v(">> wait: Semaphore waiting: %s for %s", toString().c_str(), owner.c_str());
|
||||
|
||||
if (m_usePthreads && timeoutMs != portMAX_DELAY) {
|
||||
assert(false); // We apparently don't have a timed wait for pthreads.
|
||||
}
|
||||
|
||||
auto ret = pdTRUE;
|
||||
|
||||
if (m_usePthreads) {
|
||||
pthread_mutex_lock(&m_pthread_mutex);
|
||||
} else {
|
||||
ret = xSemaphoreTake(m_semaphore, timeoutMs);
|
||||
}
|
||||
|
||||
if (m_usePthreads) {
|
||||
pthread_mutex_unlock(&m_pthread_mutex);
|
||||
} else {
|
||||
xSemaphoreGive(m_semaphore);
|
||||
}
|
||||
|
||||
log_v("<< wait: Semaphore %s released: %d", toString().c_str(), ret);
|
||||
return ret;
|
||||
} // wait
|
||||
|
||||
|
||||
FreeRTOS::Semaphore::Semaphore(std::string name) {
|
||||
m_usePthreads = false; // Are we using pThreads or FreeRTOS?
|
||||
if (m_usePthreads) {
|
||||
pthread_mutex_init(&m_pthread_mutex, nullptr);
|
||||
} else {
|
||||
m_semaphore = xSemaphoreCreateMutex();
|
||||
m_semaphore = xSemaphoreCreateBinary();
|
||||
xSemaphoreGive(m_semaphore);
|
||||
}
|
||||
|
||||
m_name = name;
|
||||
@ -111,6 +141,8 @@ FreeRTOS::Semaphore::~Semaphore() {
|
||||
*/
|
||||
void FreeRTOS::Semaphore::give() {
|
||||
log_v("Semaphore giving: %s", toString().c_str());
|
||||
m_owner = std::string("<N/A>");
|
||||
|
||||
if (m_usePthreads) {
|
||||
pthread_mutex_unlock(&m_pthread_mutex);
|
||||
} else {
|
||||
@ -120,7 +152,6 @@ void FreeRTOS::Semaphore::give() {
|
||||
// FreeRTOS::sleep(10);
|
||||
// #endif
|
||||
|
||||
m_owner = std::string("<N/A>");
|
||||
} // Semaphore::give
|
||||
|
||||
|
||||
@ -203,9 +234,12 @@ bool FreeRTOS::Semaphore::take(uint32_t timeoutMs, std::string owner) {
|
||||
* @return A string representation of the semaphore.
|
||||
*/
|
||||
std::string FreeRTOS::Semaphore::toString() {
|
||||
std::stringstream stringStream;
|
||||
stringStream << "name: "<< m_name << " (0x" << std::hex << std::setfill('0') << (uint32_t)m_semaphore << "), owner: " << m_owner;
|
||||
return stringStream.str();
|
||||
char hex[9];
|
||||
std::string res = "name: " + m_name + " (0x";
|
||||
snprintf(hex, sizeof(hex), "%08x", (uint32_t)m_semaphore);
|
||||
res += hex;
|
||||
res += "), owner: " + m_owner;
|
||||
return res;
|
||||
} // toString
|
||||
|
||||
|
||||
|
@ -40,6 +40,8 @@ public:
|
||||
bool take(uint32_t timeoutMs, std::string owner = "<Unknown>");
|
||||
std::string toString();
|
||||
uint32_t wait(std::string owner = "<Unknown>");
|
||||
bool timedWait(std::string owner = "<Unknown>", uint32_t timeoutMs = portMAX_DELAY);
|
||||
uint32_t value(){ return m_value; };
|
||||
|
||||
private:
|
||||
SemaphoreHandle_t m_semaphore;
|
||||
|
@ -332,9 +332,12 @@ void GeneralUtils::hexDump(const uint8_t* pData, uint32_t length) {
|
||||
* @return A string representation of the IP address.
|
||||
*/
|
||||
std::string GeneralUtils::ipToString(uint8_t *ip) {
|
||||
std::stringstream s;
|
||||
s << (int) ip[0] << '.' << (int) ip[1] << '.' << (int) ip[2] << '.' << (int) ip[3];
|
||||
return s.str();
|
||||
auto size = 16;
|
||||
char *val = (char*)malloc(size);
|
||||
snprintf(val, size, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
|
||||
std::string res(val);
|
||||
free(val);
|
||||
return res;
|
||||
} // ipToString
|
||||
|
||||
|
||||
@ -347,11 +350,14 @@ std::string GeneralUtils::ipToString(uint8_t *ip) {
|
||||
std::vector<std::string> GeneralUtils::split(std::string source, char delimiter) {
|
||||
// See also: https://stackoverflow.com/questions/5167625/splitting-a-c-stdstring-using-tokens-e-g
|
||||
std::vector<std::string> strings;
|
||||
std::istringstream iss(source);
|
||||
std::string s;
|
||||
while (std::getline(iss, s, delimiter)) {
|
||||
strings.push_back(trim(s));
|
||||
std::size_t current, previous = 0;
|
||||
current = source.find(delimiter);
|
||||
while (current != std::string::npos) {
|
||||
strings.push_back(trim(source.substr(previous, current - previous)));
|
||||
previous = current + 1;
|
||||
current = source.find(delimiter, previous);
|
||||
}
|
||||
strings.push_back(trim(source.substr(previous, current - previous)));
|
||||
return strings;
|
||||
} // split
|
||||
|
||||
|
4
libraries/EEPROM/README.md
Normal file
4
libraries/EEPROM/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
## EEPROM
|
||||
|
||||
EEPROM is deprecated. For new applications on ESP32, use Preferences. EEPROM is provided for backwards compatibility with existing Arduino applications.
|
||||
EEPROM is implemented using a single blob within NVS, so it is a container within a container. As such, it is not going to be a high performance storage method. Preferences will directly use nvs, and store each entry as a single object therein.
|
@ -1,37 +1,21 @@
|
||||
/*
|
||||
ESP32 eeprom_class example with EEPROM library
|
||||
|
||||
This simple example demonstrates using EEPROM library to store different data in
|
||||
ESP32 Flash memory in a multiple user-defined EEPROM partition (0x1000 or 4KB max size or less).
|
||||
ESP32 Flash memory in a multiple user-defined EEPROM class objects.
|
||||
|
||||
Install 'ESP32 Partiton Manager' ONCE from https://github.com/francis94c/ESP32Partitions
|
||||
And generate different partitions with 'partition_name'
|
||||
Usage: EEPROMClass ANY_OBJECT_NAME("partition_name", size);
|
||||
|
||||
Generated partition that would work perfectly with this example
|
||||
#Name, Type, SubType, Offset, Size, Flags
|
||||
nvs, data, nvs, 0x9000, 0x5000,
|
||||
otadata, data, ota, 0xe000, 0x2000,
|
||||
app0, app, ota_0, 0x10000, 0x140000,
|
||||
app1, app, ota_1, 0x150000, 0x140000,
|
||||
eeprom0, data, 0x99, 0x290000, 0x1000,
|
||||
eeprom1, data, 0x9a, 0x291000, 0x500,
|
||||
eeprom2, data, 0x9b, 0x292000, 0x100,
|
||||
spiffs, data, spiffs, 0x293000, 0x16d000,
|
||||
|
||||
Created for arduino-esp32 on 25 Dec, 2017
|
||||
by Elochukwu Ifediora (fedy0)
|
||||
converted to nvs by lbernstone - 06/22/2019
|
||||
*/
|
||||
|
||||
#include "EEPROM.h"
|
||||
|
||||
// Instantiate eeprom objects with parameter/argument names and size same as in the partition table
|
||||
EEPROMClass NAMES("eeprom0", 0x1000);
|
||||
EEPROMClass HEIGHT("eeprom1", 0x500);
|
||||
// Instantiate eeprom objects with parameter/argument names and sizes
|
||||
EEPROMClass NAMES("eeprom0", 0x500);
|
||||
EEPROMClass HEIGHT("eeprom1", 0x200);
|
||||
EEPROMClass AGE("eeprom2", 0x100);
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
Serial.println("Testing EEPROMClass\n");
|
||||
if (!NAMES.begin(NAMES.length())) {
|
||||
@ -57,7 +41,7 @@ void setup() {
|
||||
double height = 5.8;
|
||||
uint32_t age = 47;
|
||||
|
||||
// Write: Variables ---> EEPROM partitions
|
||||
// Write: Variables ---> EEPROM stores
|
||||
NAMES.put(0, name);
|
||||
HEIGHT.put(0, height);
|
||||
AGE.put(0, age);
|
||||
@ -75,7 +59,7 @@ void setup() {
|
||||
Serial.print("age: "); Serial.println(age);
|
||||
Serial.println("------------------------------------\n");
|
||||
|
||||
// Read: Variables <--- EEPROM partitions
|
||||
// Read: Variables <--- EEPROM stores
|
||||
NAMES.get(0, name);
|
||||
HEIGHT.get(0, height);
|
||||
AGE.get(0, age);
|
||||
@ -87,6 +71,5 @@ void setup() {
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
|
||||
delay(0xFFFFFFFF);
|
||||
}
|
||||
|
@ -13,78 +13,127 @@ void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200);
|
||||
Serial.println("\nTesting EEPROM Library\n");
|
||||
if (!EEPROM.begin(EEPROM.length())) {
|
||||
if (!EEPROM.begin(1000)) {
|
||||
Serial.println("Failed to initialise EEPROM");
|
||||
Serial.println("Restarting...");
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
int address = 0; // Same address is used through the example
|
||||
int address = 0;
|
||||
|
||||
EEPROM.writeByte(address, -128); // -2^7
|
||||
Serial.println(EEPROM.readByte(address));
|
||||
address += sizeof(byte);
|
||||
|
||||
EEPROM.writeChar(address, 'A'); // Same as writyByte and readByte
|
||||
Serial.println(char(EEPROM.readChar(address)));
|
||||
address += sizeof(char);
|
||||
|
||||
EEPROM.writeUChar(address, 255); // 2^8 - 1
|
||||
Serial.println(EEPROM.readUChar(address));
|
||||
address += sizeof(unsigned char);
|
||||
|
||||
EEPROM.writeShort(address, -32768); // -2^15
|
||||
Serial.println(EEPROM.readShort(address));
|
||||
address += sizeof(short);
|
||||
|
||||
EEPROM.writeUShort(address, 65535); // 2^16 - 1
|
||||
Serial.println(EEPROM.readUShort(address));
|
||||
address += sizeof(unsigned short);
|
||||
|
||||
EEPROM.writeInt(address, -2147483648); // -2^31
|
||||
Serial.println(EEPROM.readInt(address));
|
||||
address += sizeof(int);
|
||||
|
||||
EEPROM.writeUInt(address, 4294967295); // 2^32 - 1
|
||||
Serial.println(EEPROM.readUInt(address));
|
||||
address += sizeof(unsigned int);
|
||||
|
||||
EEPROM.writeLong(address, -2147483648); // Same as writeInt and readInt
|
||||
Serial.println(EEPROM.readLong(address));
|
||||
address += sizeof(long);
|
||||
|
||||
EEPROM.writeULong(address, 4294967295); // Same as writeUInt and readUInt
|
||||
Serial.println(EEPROM.readULong(address));
|
||||
address += sizeof(unsigned long);
|
||||
|
||||
int64_t value = -9223372036854775808; // -2^63
|
||||
EEPROM.writeLong64(address, value);
|
||||
value = 0; // Clear value
|
||||
value = EEPROM.readLong64(value);
|
||||
Serial.printf("0x%08X", (uint32_t)(value >> 32)); // Print High 4 bytes in HEX
|
||||
Serial.printf("%08X\n", (uint32_t)value); // Print Low 4 bytes in HEX
|
||||
address += sizeof(int64_t);
|
||||
|
||||
uint64_t Value = 18446744073709551615; // 2^64 - 1
|
||||
EEPROM.writeULong64(address, Value);
|
||||
address += sizeof(uint64_t);
|
||||
|
||||
EEPROM.writeFloat(address, 1234.1234);
|
||||
address += sizeof(float);
|
||||
|
||||
EEPROM.writeDouble(address, 123456789.123456789);
|
||||
address += sizeof(double);
|
||||
|
||||
EEPROM.writeBool(address, true);
|
||||
address += sizeof(bool);
|
||||
|
||||
String sentence = "I love ESP32.";
|
||||
EEPROM.writeString(address, sentence);
|
||||
address += sentence.length() + 1;
|
||||
|
||||
char gratitude[21] = "Thank You Espressif!";
|
||||
EEPROM.writeString(address, gratitude);
|
||||
address += 21;
|
||||
|
||||
// See also the general purpose writeBytes() and readBytes() for BLOB in EEPROM library
|
||||
EEPROM.commit();
|
||||
address = 0;
|
||||
|
||||
Serial.println(EEPROM.readByte(address));
|
||||
address += sizeof(byte);
|
||||
|
||||
Serial.println((char)EEPROM.readChar(address));
|
||||
address += sizeof(char);
|
||||
|
||||
Serial.println(EEPROM.readUChar(address));
|
||||
address += sizeof(unsigned char);
|
||||
|
||||
Serial.println(EEPROM.readShort(address));
|
||||
address += sizeof(short);
|
||||
|
||||
Serial.println(EEPROM.readUShort(address));
|
||||
address += sizeof(unsigned short);
|
||||
|
||||
Serial.println(EEPROM.readInt(address));
|
||||
address += sizeof(int);
|
||||
|
||||
Serial.println(EEPROM.readUInt(address));
|
||||
address += sizeof(unsigned int);
|
||||
|
||||
Serial.println(EEPROM.readLong(address));
|
||||
address += sizeof(long);
|
||||
|
||||
Serial.println(EEPROM.readULong(address));
|
||||
address += sizeof(unsigned long);
|
||||
|
||||
value = 0;
|
||||
value = EEPROM.readLong64(value);
|
||||
Serial.printf("0x%08X", (uint32_t)(value >> 32)); // Print High 4 bytes in HEX
|
||||
Serial.printf("%08X\n", (uint32_t)value); // Print Low 4 bytes in HEX
|
||||
address += sizeof(int64_t);
|
||||
|
||||
Value = 0; // Clear Value
|
||||
Value = EEPROM.readULong64(Value);
|
||||
Serial.printf("0x%08X", (uint32_t)(Value >> 32)); // Print High 4 bytes in HEX
|
||||
Serial.printf("%08X\n", (uint32_t)Value); // Print Low 4 bytes in HEX
|
||||
address += sizeof(uint64_t);
|
||||
|
||||
EEPROM.writeFloat(address, 1234.1234);
|
||||
Serial.println(EEPROM.readFloat(address), 4);
|
||||
address += sizeof(float);
|
||||
|
||||
EEPROM.writeDouble(address, 123456789.123456789);
|
||||
Serial.println(EEPROM.readDouble(address), 8);
|
||||
address += sizeof(double);
|
||||
|
||||
EEPROM.writeBool(address, true);
|
||||
Serial.println(EEPROM.readBool(address));
|
||||
address += sizeof(bool);
|
||||
|
||||
String sentence = "I love ESP32.";
|
||||
EEPROM.writeString(address, sentence);
|
||||
Serial.println(EEPROM.readString(address));
|
||||
address += sentence.length() + 1;
|
||||
|
||||
char gratitude[] = "Thank You Espressif!";
|
||||
EEPROM.writeString(address, gratitude);
|
||||
Serial.println(EEPROM.readString(address));
|
||||
|
||||
// See also the general purpose writeBytes() and readBytes() for BLOB in EEPROM library
|
||||
// To avoid data overwrite, next address should be chosen/offset by using "address =+ sizeof(previousData)"
|
||||
address += 21;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
name=EEPROM
|
||||
version=1.0
|
||||
version=1.0.3
|
||||
author=Ivan Grokhotkov
|
||||
maintainer=Paolo Becchi <pbecchi@aerobusiness.it>
|
||||
sentence=Enables reading and writing data to the permanent FLASH storage, up to 4kb.
|
||||
sentence=Enables reading and writing data a sequential, addressable FLASH storage
|
||||
paragraph=
|
||||
category=Data Storage
|
||||
url=http://arduino.cc/en/Reference/EEPROM
|
||||
architectures=esp32
|
||||
architectures=esp32
|
||||
|
@ -1,10 +1,9 @@
|
||||
/*
|
||||
EEPROM.h -ported by Paolo Becchi to Esp32 from esp8266 EEPROM
|
||||
-Modified by Elochukwu Ifediora <ifedioraelochukwuc@gmail.com>
|
||||
-Converted to nvs lbernstone@gmail.com
|
||||
|
||||
Uses a one sector flash partition defined in partition table
|
||||
OR
|
||||
Multiple sector flash partitions defined by the name column in the partition table
|
||||
Uses a nvs byte array to emulate EEPROM
|
||||
|
||||
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
|
||||
This file is part of the esp8266 core for Arduino environment.
|
||||
@ -25,72 +24,121 @@
|
||||
*/
|
||||
|
||||
#include "EEPROM.h"
|
||||
|
||||
#include <nvs.h>
|
||||
#include <esp_partition.h>
|
||||
#include <esp_log.h>
|
||||
|
||||
EEPROMClass::EEPROMClass(uint32_t sector)
|
||||
: _sector(sector)
|
||||
EEPROMClass::EEPROMClass(void)
|
||||
: _handle(NULL)
|
||||
, _data(0)
|
||||
, _size(0)
|
||||
, _dirty(false)
|
||||
, _name("eeprom")
|
||||
, _user_defined_size(0)
|
||||
{
|
||||
}
|
||||
|
||||
EEPROMClass::EEPROMClass(uint32_t sector)
|
||||
// Only for compatiility, no sectors in nvs!
|
||||
: _handle(NULL)
|
||||
, _data(0)
|
||||
, _size(0)
|
||||
, _dirty(false)
|
||||
, _mypart(NULL)
|
||||
, _name("eeprom")
|
||||
, _user_defined_size(0)
|
||||
{
|
||||
}
|
||||
|
||||
EEPROMClass::EEPROMClass(const char* name, uint32_t user_defined_size)
|
||||
: _sector(0)
|
||||
: _handle(NULL)
|
||||
, _data(0)
|
||||
, _size(0)
|
||||
, _dirty(false)
|
||||
, _mypart(NULL)
|
||||
, _name(name)
|
||||
, _user_defined_size(user_defined_size)
|
||||
{
|
||||
}
|
||||
|
||||
EEPROMClass::EEPROMClass(void)
|
||||
: _sector(0)// (((uint32_t)&_SPIFFS_end - 0x40200000) / SPI_FLASH_SEC_SIZE))
|
||||
, _data(0)
|
||||
, _size(0)
|
||||
, _dirty(false)
|
||||
, _mypart(NULL)
|
||||
, _name("eeprom")
|
||||
, _user_defined_size(0)
|
||||
{
|
||||
}
|
||||
|
||||
EEPROMClass::~EEPROMClass() {
|
||||
// end();
|
||||
}
|
||||
|
||||
bool EEPROMClass::begin(size_t size) {
|
||||
if (size <= 0) {
|
||||
return false;
|
||||
if (!size) {
|
||||
return false;
|
||||
}
|
||||
if (size > SPI_FLASH_SEC_SIZE) {
|
||||
size = SPI_FLASH_SEC_SIZE;
|
||||
|
||||
esp_err_t res = nvs_open(_name, NVS_READWRITE, &_handle);
|
||||
if (res != ESP_OK) {
|
||||
log_e("Unable to open NVS namespace: %d", res);
|
||||
return false;
|
||||
}
|
||||
// _mypart = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,ESP_PARTITION_SUBTYPE_ANY, EEPROM_FLASH_PARTITION_NAME);
|
||||
_mypart = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, _name);
|
||||
if (_mypart == NULL) {
|
||||
return false;
|
||||
|
||||
size_t key_size = 0;
|
||||
res = nvs_get_blob(_handle, _name, NULL, &key_size);
|
||||
if(res != ESP_OK && res != ESP_ERR_NVS_NOT_FOUND) {
|
||||
log_e("Unable to read NVS key: %d", res);
|
||||
return false;
|
||||
}
|
||||
if (size < key_size) { // truncate
|
||||
log_w("truncating EEPROM from %d to %d", key_size, size);
|
||||
uint8_t* key_data = (uint8_t*) malloc(key_size);
|
||||
if(!key_data) {
|
||||
log_e("Not enough memory to truncate EEPROM!");
|
||||
return false;
|
||||
}
|
||||
nvs_get_blob(_handle, _name, key_data, &key_size);
|
||||
nvs_set_blob(_handle, _name, key_data, size);
|
||||
nvs_commit(_handle);
|
||||
free(key_data);
|
||||
}
|
||||
else if (size > key_size) { // expand or new
|
||||
size_t expand_size = size - key_size;
|
||||
uint8_t* expand_key = (uint8_t*) malloc(expand_size);
|
||||
if(!expand_key) {
|
||||
log_e("Not enough memory to expand EEPROM!");
|
||||
return false;
|
||||
}
|
||||
// check for adequate free space
|
||||
if(nvs_set_blob(_handle, "expand", expand_key, expand_size)) {
|
||||
log_e("Not enough space to expand EEPROM from %d to %d", key_size, size);
|
||||
free(expand_key);
|
||||
return false;
|
||||
}
|
||||
free(expand_key);
|
||||
nvs_erase_key(_handle, "expand");
|
||||
uint8_t* key_data = (uint8_t*) malloc(size);
|
||||
if(!key_data) {
|
||||
log_e("Not enough memory to expand EEPROM!");
|
||||
return false;
|
||||
}
|
||||
memset(key_data, 0xFF, size);
|
||||
if(key_size) {
|
||||
log_i("Expanding EEPROM from %d to %d", key_size, size);
|
||||
// hold data while key is deleted
|
||||
nvs_get_blob(_handle, _name, key_data, &key_size);
|
||||
nvs_erase_key(_handle, _name);
|
||||
} else {
|
||||
log_i("New EEPROM of %d bytes", size);
|
||||
}
|
||||
nvs_commit(_handle);
|
||||
nvs_set_blob(_handle, _name, key_data, size);
|
||||
free(key_data);
|
||||
nvs_commit(_handle);
|
||||
}
|
||||
size = (size + 3) & (~3);
|
||||
|
||||
if (_data) {
|
||||
delete[] _data;
|
||||
}
|
||||
|
||||
_data = new uint8_t[size];
|
||||
_size = size;
|
||||
bool ret = false;
|
||||
if (esp_partition_read (_mypart, 0, (void *) _data, _size) == ESP_OK) {
|
||||
ret = true;
|
||||
_data = (uint8_t*) malloc(size);
|
||||
if(!_data) {
|
||||
log_e("Not enough memory for %d bytes in EEPROM");
|
||||
return false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
_size = size;
|
||||
nvs_get_blob(_handle, _name, _data, &_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
void EEPROMClass::end() {
|
||||
@ -134,29 +182,21 @@ void EEPROMClass::write(int address, uint8_t value) {
|
||||
|
||||
bool EEPROMClass::commit() {
|
||||
bool ret = false;
|
||||
if (!_size)
|
||||
return false;
|
||||
if (!_dirty)
|
||||
return true;
|
||||
if (!_data)
|
||||
return false;
|
||||
|
||||
|
||||
if (esp_partition_erase_range(_mypart, 0, SPI_FLASH_SEC_SIZE) != ESP_OK)
|
||||
{
|
||||
log_e( "partition erase err.");
|
||||
if (!_size) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (esp_partition_write(_mypart, 0, (void *)_data, _size) == ESP_ERR_INVALID_SIZE)
|
||||
{
|
||||
log_e( "error in Write");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_data) {
|
||||
return false;
|
||||
}
|
||||
if (!_dirty) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ESP_OK != nvs_set_blob(_handle, _name, _data, _size)) {
|
||||
log_e( "error in write");
|
||||
} else {
|
||||
_dirty = false;
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -175,6 +215,67 @@ uint16_t EEPROMClass::length ()
|
||||
return _user_defined_size;
|
||||
}
|
||||
|
||||
/*
|
||||
Convert EEPROM partition into nvs blob
|
||||
Call convert before you call begin
|
||||
*/
|
||||
uint16_t EEPROMClass::convert (bool clear, const char* EEPROMname, const char* nvsname)
|
||||
{
|
||||
uint16_t result = 0;
|
||||
const esp_partition_t* mypart = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, EEPROMname);
|
||||
if (mypart == NULL) {
|
||||
log_i("EEPROM partition not found for conversion");
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t size = mypart->size;
|
||||
uint8_t* data = (uint8_t*) malloc(size);
|
||||
if (!data) {
|
||||
log_e("Not enough memory to convert EEPROM!");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (esp_partition_read (mypart, 0, (void *) data, size) != ESP_OK) {
|
||||
log_e("Unable to read EEPROM partition");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
bool empty;
|
||||
empty = true;
|
||||
for (int x=0; x<size; x++) {
|
||||
if (data[x] != 0xFF) {
|
||||
empty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty) {
|
||||
log_i("EEPROM partition is empty, will not convert");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
nvs_handle handle;
|
||||
if (nvs_open(nvsname, NVS_READWRITE, &handle) != ESP_OK) {
|
||||
log_e("Unable to open NVS");
|
||||
goto exit;
|
||||
}
|
||||
esp_err_t err;
|
||||
err = nvs_set_blob(handle, nvsname, data, size);
|
||||
if (err != ESP_OK) {
|
||||
log_e("Unable to add EEPROM data to NVS: %s", esp_err_to_name(err));
|
||||
goto exit;
|
||||
}
|
||||
result = size;
|
||||
|
||||
if (clear) {
|
||||
if (esp_partition_erase_range (mypart, 0, size) != ESP_OK) {
|
||||
log_w("Unable to clear EEPROM partition");
|
||||
}
|
||||
}
|
||||
exit:
|
||||
free(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
Read 'value' from 'address'
|
||||
*/
|
||||
|
@ -1,10 +1,9 @@
|
||||
/*
|
||||
EEPROM.h -ported by Paolo Becchi to Esp32 from esp8266 EEPROM
|
||||
-Modified by Elochukwu Ifediora <ifedioraelochukwuc@gmail.com>
|
||||
-Converted to nvs lbernstone@gmail.com
|
||||
|
||||
Uses a one sector flash partition defined in partition table
|
||||
OR
|
||||
Multiple sector flash partitions defined by the name column in the partition table
|
||||
Uses a nvs byte array to emulate EEPROM
|
||||
|
||||
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
|
||||
This file is part of the esp8266 core for Arduino environment.
|
||||
@ -30,19 +29,9 @@
|
||||
#define EEPROM_FLASH_PARTITION_NAME "eeprom"
|
||||
#endif
|
||||
#include <Arduino.h>
|
||||
extern "C" {
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <esp_partition.h>
|
||||
}
|
||||
typedef uint32_t nvs_handle;
|
||||
|
||||
//
|
||||
// need to define AT LEAST a flash partition for EEPROM with above name
|
||||
//
|
||||
// eeprom , data , 0x99, start address, 0x1000
|
||||
//
|
||||
class EEPROMClass {
|
||||
public:
|
||||
EEPROMClass(uint32_t sector);
|
||||
@ -58,6 +47,7 @@ class EEPROMClass {
|
||||
void end();
|
||||
|
||||
uint8_t * getDataPtr();
|
||||
uint16_t convert(bool clear, const char* EEPROMname = "eeprom", const char* nvsname = "eeprom");
|
||||
|
||||
template<typename T>
|
||||
T &get(int address, T &t) {
|
||||
@ -117,11 +107,10 @@ class EEPROMClass {
|
||||
template <class T> T writeAll (int address, const T &);
|
||||
|
||||
protected:
|
||||
uint32_t _sector;
|
||||
nvs_handle _handle;
|
||||
uint8_t* _data;
|
||||
size_t _size;
|
||||
bool _dirty;
|
||||
const esp_partition_t * _mypart;
|
||||
const char* _name;
|
||||
uint32_t _user_defined_size;
|
||||
};
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include "fb_gfx.h"
|
||||
#include "fd_forward.h"
|
||||
#include "dl_lib.h"
|
||||
#include "fr_forward.h"
|
||||
|
||||
#define ENROLL_CONFIRM_TIMES 5
|
||||
|
@ -19,7 +19,7 @@ Author:
|
||||
Pranav Cherukupalli <cherukupallip@gmail.com>
|
||||
*/
|
||||
|
||||
#define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */
|
||||
#define uS_TO_S_FACTOR 1000000ULL /* Conversion factor for micro seconds to seconds */
|
||||
#define TIME_TO_SLEEP 5 /* Time ESP32 will go to sleep (in seconds) */
|
||||
|
||||
RTC_DATA_ATTR int bootCount = 0;
|
||||
|
@ -62,7 +62,7 @@ void loop()
|
||||
for (led=0; led<NR_OF_LEDS; led++) {
|
||||
for (col=0; col<3; col++ ) {
|
||||
for (bit=0; bit<8; bit++){
|
||||
if ( (color[col] & (1<<(8-bit))) && (led == led_index) ) {
|
||||
if ( (color[col] & (1<<(7-bit))) && (led == led_index) ) {
|
||||
led_data[i].level0 = 1;
|
||||
led_data[i].duration0 = 8;
|
||||
led_data[i].level1 = 0;
|
||||
|
@ -96,7 +96,6 @@ void loop(void)
|
||||
req = req.substring(addr_start + 1, addr_end);
|
||||
Serial.print("Request: ");
|
||||
Serial.println(req);
|
||||
client.flush();
|
||||
|
||||
String s;
|
||||
if (req == "/")
|
||||
@ -115,6 +114,7 @@ void loop(void)
|
||||
}
|
||||
client.print(s);
|
||||
|
||||
client.stop();
|
||||
Serial.println("Done with client");
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ void F_Fat::end()
|
||||
log_e("Unmounting FFat partition failed! Error: %d", err);
|
||||
return;
|
||||
}
|
||||
_wl_handle = NULL;
|
||||
_wl_handle = 0;
|
||||
_impl->mountpoint(NULL);
|
||||
}
|
||||
}
|
||||
@ -109,7 +109,9 @@ size_t F_Fat::totalBytes()
|
||||
|
||||
BYTE pdrv = ff_diskio_get_pdrv_wl(_wl_handle);
|
||||
char drv[3] = {(char)(48+pdrv), ':', 0};
|
||||
FRESULT res = f_getfree(drv, &free_clust, &fs);
|
||||
if ( f_getfree(drv, &free_clust, &fs) != FR_OK){
|
||||
return 0;
|
||||
}
|
||||
tot_sect = (fs->n_fatent - 2) * fs->csize;
|
||||
sect_size = CONFIG_WL_SECTOR_SIZE;
|
||||
return tot_sect * sect_size;
|
||||
@ -123,7 +125,9 @@ size_t F_Fat::freeBytes()
|
||||
|
||||
BYTE pdrv = ff_diskio_get_pdrv_wl(_wl_handle);
|
||||
char drv[3] = {(char)(48+pdrv), ':', 0};
|
||||
FRESULT res = f_getfree(drv, &free_clust, &fs);
|
||||
if ( f_getfree(drv, &free_clust, &fs) != FR_OK){
|
||||
return 0;
|
||||
}
|
||||
free_sect = free_clust * fs->csize;
|
||||
sect_size = CONFIG_WL_SECTOR_SIZE;
|
||||
return free_sect * sect_size;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <HardwareSerial.h>
|
||||
/**
|
||||
* HTTPClient.cpp
|
||||
*
|
||||
@ -195,6 +196,11 @@ bool HTTPClient::begin(String url, const char* CAcert)
|
||||
}
|
||||
_secure = true;
|
||||
_transportTraits = TransportTraitsPtr(new TLSTraits(CAcert));
|
||||
if(!_transportTraits) {
|
||||
log_e("could not create transport traits");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -215,6 +221,11 @@ bool HTTPClient::begin(String url)
|
||||
return begin(url, (const char*)NULL);
|
||||
}
|
||||
_transportTraits = TransportTraitsPtr(new TransportTraits());
|
||||
if(!_transportTraits) {
|
||||
log_e("could not create transport traits");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // HTTPCLIENT_1_1_COMPATIBLE
|
||||
@ -333,7 +344,8 @@ bool HTTPClient::begin(String host, uint16_t port, String uri, const char* CAcer
|
||||
*/
|
||||
void HTTPClient::end(void)
|
||||
{
|
||||
disconnect();
|
||||
disconnect(false);
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
@ -342,7 +354,7 @@ void HTTPClient::end(void)
|
||||
* disconnect
|
||||
* close the TCP socket
|
||||
*/
|
||||
void HTTPClient::disconnect()
|
||||
void HTTPClient::disconnect(bool preserveClient)
|
||||
{
|
||||
if(connected()) {
|
||||
if(_client->available() > 0) {
|
||||
@ -357,7 +369,9 @@ void HTTPClient::disconnect()
|
||||
} else {
|
||||
log_d("tcp stop\n");
|
||||
_client->stop();
|
||||
_client = nullptr;
|
||||
if(!preserveClient) {
|
||||
_client = nullptr;
|
||||
}
|
||||
#ifdef HTTPCLIENT_1_1_COMPATIBLE
|
||||
if(_tcpDeprecated) {
|
||||
_transportTraits.reset(nullptr);
|
||||
@ -456,6 +470,7 @@ void HTTPClient::setTimeout(uint16_t timeout)
|
||||
void HTTPClient::useHTTP10(bool useHTTP10)
|
||||
{
|
||||
_useHTTP10 = useHTTP10;
|
||||
_reuse = !useHTTP10;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -816,7 +831,8 @@ int HTTPClient::writeToStream(Stream * stream)
|
||||
return returnError(HTTPC_ERROR_ENCODING);
|
||||
}
|
||||
|
||||
end();
|
||||
// end();
|
||||
disconnect(true);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -970,9 +986,12 @@ bool HTTPClient::hasHeader(const char* name)
|
||||
*/
|
||||
bool HTTPClient::connect(void)
|
||||
{
|
||||
|
||||
if(connected()) {
|
||||
log_d("already connected, try reuse!");
|
||||
if(_reuse) {
|
||||
log_d("already connected, reusing connection");
|
||||
} else {
|
||||
log_d("already connected, try reuse!");
|
||||
}
|
||||
while(_client->available() > 0) {
|
||||
_client->read();
|
||||
}
|
||||
@ -980,8 +999,12 @@ bool HTTPClient::connect(void)
|
||||
}
|
||||
|
||||
#ifdef HTTPCLIENT_1_1_COMPATIBLE
|
||||
if(!_client) {
|
||||
if(_transportTraits && !_client) {
|
||||
_tcpDeprecated = _transportTraits->create();
|
||||
if(!_tcpDeprecated) {
|
||||
log_e("failed to create client");
|
||||
return false;
|
||||
}
|
||||
_client = _tcpDeprecated.get();
|
||||
}
|
||||
#endif
|
||||
@ -1080,9 +1103,12 @@ int HTTPClient::handleHeaderResponse()
|
||||
return HTTPC_ERROR_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
clear();
|
||||
|
||||
_canReuse = _reuse;
|
||||
|
||||
String transferEncoding;
|
||||
_returnCode = -1;
|
||||
_size = -1;
|
||||
|
||||
_transferEncoding = HTTPC_TE_IDENTITY;
|
||||
unsigned long lastDataTime = millis();
|
||||
|
||||
@ -1097,6 +1123,9 @@ int HTTPClient::handleHeaderResponse()
|
||||
log_v("RX: '%s'", headerLine.c_str());
|
||||
|
||||
if(headerLine.startsWith("HTTP/1.")) {
|
||||
if(_canReuse) {
|
||||
_canReuse = (headerLine[sizeof "HTTP/1." - 1] != '0');
|
||||
}
|
||||
_returnCode = headerLine.substring(9, headerLine.indexOf(' ', 9)).toInt();
|
||||
} else if(headerLine.indexOf(':')) {
|
||||
String headerName = headerLine.substring(0, headerLine.indexOf(':'));
|
||||
@ -1107,8 +1136,10 @@ int HTTPClient::handleHeaderResponse()
|
||||
_size = headerValue.toInt();
|
||||
}
|
||||
|
||||
if(headerName.equalsIgnoreCase("Connection")) {
|
||||
_canReuse = headerValue.equalsIgnoreCase("keep-alive");
|
||||
if(_canReuse && headerName.equalsIgnoreCase("Connection")) {
|
||||
if(headerValue.indexOf("close") >= 0 && headerValue.indexOf("keep-alive") < 0) {
|
||||
_canReuse = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(headerName.equalsIgnoreCase("Transfer-Encoding")) {
|
||||
|
@ -197,7 +197,7 @@ protected:
|
||||
};
|
||||
|
||||
bool beginInternal(String url, const char* expectedProtocol);
|
||||
void disconnect();
|
||||
void disconnect(bool preserveClient = false);
|
||||
void clear();
|
||||
int returnError(int error);
|
||||
bool connect(void);
|
||||
@ -217,7 +217,7 @@ protected:
|
||||
String _host;
|
||||
uint16_t _port = 0;
|
||||
int32_t _connectTimeout = -1;
|
||||
bool _reuse = false;
|
||||
bool _reuse = true;
|
||||
uint16_t _tcpTimeout = HTTPCLIENT_DEFAULT_TCP_TIMEOUT;
|
||||
bool _useHTTP10 = false;
|
||||
bool _secure = false;
|
||||
|
@ -96,7 +96,7 @@ void loop() {
|
||||
client.setCACert(rootCACertificate);
|
||||
|
||||
// Reading data over SSL may be slow, use an adequate timeout
|
||||
client.setTimeout(12000);
|
||||
client.setTimeout(12000 / 1000); // timeout argument is defined in seconds for setTimeout
|
||||
|
||||
// The line below is optional. It can be used to blink the LED on the board during flashing
|
||||
// The LED will be on during download of one buffer of data from the network. The LED will
|
||||
|
@ -20,13 +20,33 @@ extern "C" {
|
||||
#include <dirent.h>
|
||||
#include "esp_spiffs.h"
|
||||
}
|
||||
|
||||
#include "SPIFFS.h"
|
||||
|
||||
using namespace fs;
|
||||
|
||||
SPIFFSFS::SPIFFSFS(FSImplPtr impl)
|
||||
: FS(impl)
|
||||
{}
|
||||
class SPIFFSImpl : public VFSImpl
|
||||
{
|
||||
public:
|
||||
SPIFFSImpl();
|
||||
virtual ~SPIFFSImpl() { }
|
||||
virtual bool exists(const char* path);
|
||||
};
|
||||
|
||||
SPIFFSImpl::SPIFFSImpl()
|
||||
{
|
||||
}
|
||||
|
||||
bool SPIFFSImpl::exists(const char* path)
|
||||
{
|
||||
File f = open(path, "r");
|
||||
return (f == true) && !f.isDirectory();
|
||||
}
|
||||
|
||||
SPIFFSFS::SPIFFSFS() : FS(FSImplPtr(new SPIFFSImpl()))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool SPIFFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFiles)
|
||||
{
|
||||
@ -98,16 +118,5 @@ size_t SPIFFSFS::usedBytes()
|
||||
return used;
|
||||
}
|
||||
|
||||
bool SPIFFSFS::exists(const char* path)
|
||||
{
|
||||
File f = open(path, "r");
|
||||
return (f == true) && !f.isDirectory();
|
||||
}
|
||||
SPIFFSFS SPIFFS;
|
||||
|
||||
bool SPIFFSFS::exists(const String& path)
|
||||
{
|
||||
return exists(path.c_str());
|
||||
}
|
||||
|
||||
|
||||
SPIFFSFS SPIFFS = SPIFFSFS(FSImplPtr(new VFSImpl()));
|
||||
|
@ -22,18 +22,17 @@ namespace fs
|
||||
class SPIFFSFS : public FS
|
||||
{
|
||||
public:
|
||||
SPIFFSFS(FSImplPtr impl);
|
||||
SPIFFSFS();
|
||||
bool begin(bool formatOnFail=false, const char * basePath="/spiffs", uint8_t maxOpenFiles=10);
|
||||
bool format();
|
||||
size_t totalBytes();
|
||||
size_t usedBytes();
|
||||
void end();
|
||||
bool exists(const char* path);
|
||||
bool exists(const String& path);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
extern fs::SPIFFSFS SPIFFS;
|
||||
|
||||
#endif /* _SPIFFS_H_ */
|
||||
|
||||
#endif
|
||||
|
@ -43,9 +43,9 @@ void Ticker::_attach_ms(uint32_t milliseconds, bool repeat, callback_with_arg_t
|
||||
}
|
||||
esp_timer_create(&_timerConfig, &_timer);
|
||||
if (repeat) {
|
||||
esp_timer_start_periodic(_timer, milliseconds * 1000);
|
||||
esp_timer_start_periodic(_timer, milliseconds * 1000ULL);
|
||||
} else {
|
||||
esp_timer_start_once(_timer, milliseconds * 1000);
|
||||
esp_timer_start_once(_timer, milliseconds * 1000ULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ class UpdateClass {
|
||||
If all bytes are written
|
||||
this call will write the config to eboot
|
||||
and return true
|
||||
If there is already an update running but is not finished and !evenIfRemainanig
|
||||
If there is already an update running but is not finished and !evenIfRemaining
|
||||
or there is an error
|
||||
this will clear everything and return false
|
||||
the last error is available through getError()
|
||||
|
@ -189,6 +189,9 @@ bool UpdateClass::_writeBuffer(){
|
||||
//this ensures that partially written firmware will not be bootable
|
||||
_buffer[0] = 0xFF;
|
||||
}
|
||||
if (!_progress && _progress_callback) {
|
||||
_progress_callback(0, _size);
|
||||
}
|
||||
if(!ESP.flashEraseSector((_partition->address + _progress)/SPI_FLASH_SEC_SIZE)){
|
||||
_abort(UPDATE_ERROR_ERASE);
|
||||
return false;
|
||||
@ -204,6 +207,9 @@ bool UpdateClass::_writeBuffer(){
|
||||
_md5.add(_buffer, _bufferLen);
|
||||
_progress += _bufferLen;
|
||||
_bufferLen = 0;
|
||||
if (_progress_callback) {
|
||||
_progress_callback(_progress, _size);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -319,9 +325,6 @@ size_t UpdateClass::writeStream(Stream &data) {
|
||||
_reset();
|
||||
return 0;
|
||||
}
|
||||
if (_progress_callback) {
|
||||
_progress_callback(0, _size);
|
||||
}
|
||||
|
||||
if(_ledPin != -1) {
|
||||
pinMode(_ledPin, OUTPUT);
|
||||
@ -352,12 +355,6 @@ size_t UpdateClass::writeStream(Stream &data) {
|
||||
if((_bufferLen == remaining() || _bufferLen == SPI_FLASH_SEC_SIZE) && !_writeBuffer())
|
||||
return written;
|
||||
written += toRead;
|
||||
if(_progress_callback) {
|
||||
_progress_callback(_progress, _size);
|
||||
}
|
||||
}
|
||||
if(_progress_callback) {
|
||||
_progress_callback(_size, _size);
|
||||
}
|
||||
return written;
|
||||
}
|
||||
|
@ -303,6 +303,7 @@ void WebServer::_uploadWriteByte(uint8_t b){
|
||||
}
|
||||
|
||||
int WebServer::_uploadReadByte(WiFiClient& client){
|
||||
if (!client.connected()) return -1;
|
||||
int res = client.read();
|
||||
if(res < 0) {
|
||||
// keep trying until you either read a valid byte or timeout
|
||||
|
@ -39,7 +39,8 @@ static const char Content_Length[] = "Content-Length";
|
||||
|
||||
|
||||
WebServer::WebServer(IPAddress addr, int port)
|
||||
: _server(addr, port)
|
||||
: _corsEnabled(false)
|
||||
, _server(addr, port)
|
||||
, _currentMethod(HTTP_ANY)
|
||||
, _currentVersion(0)
|
||||
, _currentStatus(HC_NONE)
|
||||
@ -59,7 +60,8 @@ WebServer::WebServer(IPAddress addr, int port)
|
||||
}
|
||||
|
||||
WebServer::WebServer(int port)
|
||||
: _server(port)
|
||||
: _corsEnabled(false)
|
||||
, _server(port)
|
||||
, _currentMethod(HTTP_ANY)
|
||||
, _currentVersion(0)
|
||||
, _currentStatus(HC_NONE)
|
||||
@ -104,7 +106,7 @@ void WebServer::begin(uint16_t port) {
|
||||
|
||||
String WebServer::_extractParam(String& authReq,const String& param,const char delimit){
|
||||
int _begin = authReq.indexOf(param);
|
||||
if (_begin == -1)
|
||||
if (_begin == -1)
|
||||
return "";
|
||||
return authReq.substring(_begin+param.length(),authReq.indexOf(delimit,_begin+param.length()));
|
||||
}
|
||||
@ -300,7 +302,9 @@ void WebServer::handleClient() {
|
||||
// Wait for data from client to become available
|
||||
if (_currentClient.available()) {
|
||||
if (_parseRequest(_currentClient)) {
|
||||
_currentClient.setTimeout(HTTP_MAX_SEND_WAIT);
|
||||
// because HTTP_MAX_SEND_WAIT is expressed in milliseconds,
|
||||
// it must be divided by 1000
|
||||
_currentClient.setTimeout(HTTP_MAX_SEND_WAIT / 1000);
|
||||
_contentLength = CONTENT_LENGTH_NOT_SET;
|
||||
_handleRequest();
|
||||
|
||||
@ -366,6 +370,14 @@ void WebServer::setContentLength(const size_t contentLength) {
|
||||
_contentLength = contentLength;
|
||||
}
|
||||
|
||||
void WebServer::enableCORS(boolean value) {
|
||||
_corsEnabled = value;
|
||||
}
|
||||
|
||||
void WebServer::enableCrossOrigin(boolean value) {
|
||||
enableCORS(value);
|
||||
}
|
||||
|
||||
void WebServer::_prepareHeader(String& response, int code, const char* content_type, size_t contentLength) {
|
||||
response = String(F("HTTP/1.")) + String(_currentVersion) + ' ';
|
||||
response += String(code);
|
||||
@ -388,6 +400,9 @@ void WebServer::_prepareHeader(String& response, int code, const char* content_t
|
||||
sendHeader(String(F("Accept-Ranges")),String(F("none")));
|
||||
sendHeader(String(F("Transfer-Encoding")),String(F("chunked")));
|
||||
}
|
||||
if (_corsEnabled) {
|
||||
sendHeader(String(FPSTR("Access-Control-Allow-Origin")), String("*"));
|
||||
}
|
||||
sendHeader(String(F("Connection")), String(F("close")));
|
||||
|
||||
response += _responseHeaders;
|
||||
@ -494,7 +509,7 @@ void WebServer::_streamFileCore(const size_t fileSize, const String & fileName,
|
||||
send(200, contentType, "");
|
||||
}
|
||||
|
||||
String WebServer::pathArg(unsigned int i) {
|
||||
String WebServer::pathArg(unsigned int i) {
|
||||
if (_currentHandler != nullptr)
|
||||
return _currentHandler->pathArg(i);
|
||||
return "";
|
||||
|
@ -122,6 +122,9 @@ public:
|
||||
void send_P(int code, PGM_P content_type, PGM_P content);
|
||||
void send_P(int code, PGM_P content_type, PGM_P content, size_t contentLength);
|
||||
|
||||
void enableCORS(boolean value = true);
|
||||
void enableCrossOrigin(boolean value = true);
|
||||
|
||||
void setContentLength(const size_t contentLength);
|
||||
void sendHeader(const String& name, const String& value, bool first = false);
|
||||
void sendContent(const String& content);
|
||||
@ -130,12 +133,12 @@ public:
|
||||
|
||||
static String urlDecode(const String& text);
|
||||
|
||||
template<typename T>
|
||||
template<typename T>
|
||||
size_t streamFile(T &file, const String& contentType) {
|
||||
_streamFileCore(file.size(), file.name(), contentType);
|
||||
return _currentClient.write(file);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual size_t _currentClientWrite(const char* b, size_t l) { return _currentClient.write( b, l ); }
|
||||
virtual size_t _currentClientWrite_P(PGM_P b, size_t l) { return _currentClient.write_P( b, l ); }
|
||||
@ -151,7 +154,7 @@ protected:
|
||||
int _uploadReadByte(WiFiClient& client);
|
||||
void _prepareHeader(String& response, int code, const char* content_type, size_t contentLength);
|
||||
bool _collectHeader(const char* headerName, const char* headerValue);
|
||||
|
||||
|
||||
void _streamFileCore(const size_t fileSize, const String & fileName, const String & contentType);
|
||||
|
||||
String _getRandomHexString();
|
||||
@ -163,6 +166,7 @@ protected:
|
||||
String value;
|
||||
};
|
||||
|
||||
boolean _corsEnabled;
|
||||
WiFiServer _server;
|
||||
|
||||
WiFiClient _currentClient;
|
||||
|
@ -197,6 +197,33 @@ IPAddress ETHClass::dnsIP(uint8_t dns_no)
|
||||
return IPAddress(dns_ip.u_addr.ip4.addr);
|
||||
}
|
||||
|
||||
IPAddress ETHClass::broadcastIP()
|
||||
{
|
||||
tcpip_adapter_ip_info_t ip;
|
||||
if(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_ETH, &ip)){
|
||||
return IPAddress();
|
||||
}
|
||||
return WiFiGenericClass::calculateBroadcast(IPAddress(ip.gw.addr), IPAddress(ip.netmask.addr));
|
||||
}
|
||||
|
||||
IPAddress ETHClass::networkID()
|
||||
{
|
||||
tcpip_adapter_ip_info_t ip;
|
||||
if(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_ETH, &ip)){
|
||||
return IPAddress();
|
||||
}
|
||||
return WiFiGenericClass::calculateNetworkID(IPAddress(ip.gw.addr), IPAddress(ip.netmask.addr));
|
||||
}
|
||||
|
||||
uint8_t ETHClass::subnetCIDR()
|
||||
{
|
||||
tcpip_adapter_ip_info_t ip;
|
||||
if(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_ETH, &ip)){
|
||||
return (uint8_t)0;
|
||||
}
|
||||
return WiFiGenericClass::calculateSubnetCIDR(IPAddress(ip.netmask.addr));
|
||||
}
|
||||
|
||||
const char * ETHClass::getHostname()
|
||||
{
|
||||
const char * hostname;
|
||||
|
@ -79,6 +79,10 @@ class ETHClass {
|
||||
IPAddress gatewayIP();
|
||||
IPAddress dnsIP(uint8_t dns_no = 0);
|
||||
|
||||
IPAddress broadcastIP();
|
||||
IPAddress networkID();
|
||||
uint8_t subnetCIDR();
|
||||
|
||||
uint8_t * macAddress(uint8_t* mac);
|
||||
String macAddress();
|
||||
|
||||
|
@ -235,6 +235,47 @@ IPAddress WiFiAPClass::softAPIP()
|
||||
return IPAddress(ip.ip.addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the softAP broadcast IP address.
|
||||
* @return IPAddress softAP broadcastIP
|
||||
*/
|
||||
IPAddress WiFiAPClass::softAPBroadcastIP()
|
||||
{
|
||||
tcpip_adapter_ip_info_t ip;
|
||||
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
|
||||
return IPAddress();
|
||||
}
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_AP, &ip);
|
||||
return WiFiGenericClass::calculateBroadcast(IPAddress(ip.gw.addr), IPAddress(ip.netmask.addr));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the softAP network ID.
|
||||
* @return IPAddress softAP networkID
|
||||
*/
|
||||
IPAddress WiFiAPClass::softAPNetworkID()
|
||||
{
|
||||
tcpip_adapter_ip_info_t ip;
|
||||
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
|
||||
return IPAddress();
|
||||
}
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_AP, &ip);
|
||||
return WiFiGenericClass::calculateNetworkID(IPAddress(ip.gw.addr), IPAddress(ip.netmask.addr));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the softAP subnet CIDR.
|
||||
* @return uint8_t softAP subnetCIDR
|
||||
*/
|
||||
uint8_t WiFiAPClass::softAPSubnetCIDR()
|
||||
{
|
||||
tcpip_adapter_ip_info_t ip;
|
||||
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
|
||||
return (uint8_t)0;
|
||||
}
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_AP, &ip);
|
||||
return WiFiGenericClass::calculateSubnetCIDR(IPAddress(ip.netmask.addr));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the softAP interface MAC address.
|
||||
|
@ -45,6 +45,10 @@ public:
|
||||
|
||||
IPAddress softAPIP();
|
||||
|
||||
IPAddress softAPBroadcastIP();
|
||||
IPAddress softAPNetworkID();
|
||||
uint8_t softAPSubnetCIDR();
|
||||
|
||||
bool softAPenableIpV6();
|
||||
IPv6Address softAPIPv6();
|
||||
|
||||
|
@ -226,14 +226,41 @@ int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout)
|
||||
FD_SET(sockfd, &fdset);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = timeout * 1000;
|
||||
lwip_connect_r(sockfd, (struct sockaddr*)&serveraddr, sizeof(serveraddr));
|
||||
int res = select(sockfd + 1, nullptr, &fdset, nullptr, timeout<0 ? nullptr : &tv);
|
||||
if (res != 1)
|
||||
{
|
||||
log_e("select: %d",errno);
|
||||
|
||||
int res = lwip_connect_r(sockfd, (struct sockaddr*)&serveraddr, sizeof(serveraddr));
|
||||
if (res < 0 && errno != EINPROGRESS) {
|
||||
log_e("connect on fd %d, errno: %d, \"%s\"", sockfd, errno, strerror(errno));
|
||||
close(sockfd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
res = select(sockfd + 1, nullptr, &fdset, nullptr, timeout<0 ? nullptr : &tv);
|
||||
if (res < 0) {
|
||||
log_e("select on fd %d, errno: %d, \"%s\"", sockfd, errno, strerror(errno));
|
||||
close(sockfd);
|
||||
return 0;
|
||||
} else if (res == 0) {
|
||||
log_i("select returned due to timeout %d ms for fd %d", timeout, sockfd);
|
||||
close(sockfd);
|
||||
return 0;
|
||||
} else {
|
||||
int sockerr;
|
||||
socklen_t len = (socklen_t)sizeof(int);
|
||||
res = getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &sockerr, &len);
|
||||
|
||||
if (res < 0) {
|
||||
log_e("getsockopt on fd %d, errno: %d, \"%s\"", sockfd, errno, strerror(errno));
|
||||
close(sockfd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sockerr != 0) {
|
||||
log_e("socket error on fd %d, errno: %d, \"%s\"", sockfd, sockerr, strerror(sockerr));
|
||||
close(sockfd);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
fcntl( sockfd, F_SETFL, fcntl( sockfd, F_GETFL, 0 ) & (~O_NONBLOCK) );
|
||||
clientSocketHandle.reset(new WiFiClientSocketHandle(sockfd));
|
||||
_rxBuffer.reset(new WiFiClientRxBuffer(sockfd));
|
||||
|
@ -333,7 +333,9 @@ const char * system_event_reasons[] = { "UNSPECIFIED", "AUTH_EXPIRE", "AUTH_LEAV
|
||||
#endif
|
||||
esp_err_t WiFiGenericClass::_eventCallback(void *arg, system_event_t *event)
|
||||
{
|
||||
if(event->event_id < 26) log_d("Event: %d - %s", event->event_id, system_event_names[event->event_id]);
|
||||
if(event->event_id < 26) {
|
||||
log_d("Event: %d - %s", event->event_id, system_event_names[event->event_id]);
|
||||
}
|
||||
if(event->event_id == SYSTEM_EVENT_SCAN_DONE) {
|
||||
WiFiScanClass::_scanDone();
|
||||
|
||||
@ -654,3 +656,45 @@ int WiFiGenericClass::hostByName(const char* aHostname, IPAddress& aResult)
|
||||
return (uint32_t)aResult != 0;
|
||||
}
|
||||
|
||||
IPAddress WiFiGenericClass::calculateNetworkID(IPAddress ip, IPAddress subnet) {
|
||||
IPAddress networkID;
|
||||
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
networkID[i] = subnet[i] & ip[i];
|
||||
|
||||
return networkID;
|
||||
}
|
||||
|
||||
IPAddress WiFiGenericClass::calculateBroadcast(IPAddress ip, IPAddress subnet) {
|
||||
IPAddress broadcastIp;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
broadcastIp[i] = ~subnet[i] | ip[i];
|
||||
|
||||
return broadcastIp;
|
||||
}
|
||||
|
||||
uint8_t WiFiGenericClass::calculateSubnetCIDR(IPAddress subnetMask) {
|
||||
uint8_t CIDR = 0;
|
||||
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
if (subnetMask[i] == 0x80) // 128
|
||||
CIDR += 1;
|
||||
else if (subnetMask[i] == 0xC0) // 192
|
||||
CIDR += 2;
|
||||
else if (subnetMask[i] == 0xE0) // 224
|
||||
CIDR += 3;
|
||||
else if (subnetMask[i] == 0xF0) // 242
|
||||
CIDR += 4;
|
||||
else if (subnetMask[i] == 0xF8) // 248
|
||||
CIDR += 5;
|
||||
else if (subnetMask[i] == 0xFC) // 252
|
||||
CIDR += 6;
|
||||
else if (subnetMask[i] == 0xFE) // 254
|
||||
CIDR += 7;
|
||||
else if (subnetMask[i] == 0xFF) // 255
|
||||
CIDR += 8;
|
||||
}
|
||||
|
||||
return CIDR;
|
||||
}
|
||||
|
@ -108,6 +108,10 @@ class WiFiGenericClass
|
||||
public:
|
||||
static int hostByName(const char *aHostname, IPAddress &aResult);
|
||||
|
||||
static IPAddress calculateNetworkID(IPAddress ip, IPAddress subnet);
|
||||
static IPAddress calculateBroadcast(IPAddress ip, IPAddress subnet);
|
||||
static uint8_t calculateSubnetCIDR(IPAddress subnetMask);
|
||||
|
||||
protected:
|
||||
friend class WiFiSTAClass;
|
||||
friend class WiFiScanClass;
|
||||
|
@ -34,22 +34,64 @@ WiFiMulti::WiFiMulti()
|
||||
|
||||
WiFiMulti::~WiFiMulti()
|
||||
{
|
||||
APlistClean();
|
||||
for(uint32_t i = 0; i < APlist.size(); i++) {
|
||||
WifiAPlist_t entry = APlist[i];
|
||||
if(entry.ssid) {
|
||||
free(entry.ssid);
|
||||
}
|
||||
if(entry.passphrase) {
|
||||
free(entry.passphrase);
|
||||
}
|
||||
}
|
||||
APlist.clear();
|
||||
}
|
||||
|
||||
bool WiFiMulti::addAP(const char* ssid, const char *passphrase)
|
||||
{
|
||||
return APlistAdd(ssid, passphrase);
|
||||
WifiAPlist_t newAP;
|
||||
|
||||
if(!ssid || *ssid == 0x00 || strlen(ssid) > 31) {
|
||||
// fail SSID too long or missing!
|
||||
log_e("[WIFI][APlistAdd] no ssid or ssid too long");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(passphrase && strlen(passphrase) > 63) {
|
||||
// fail passphrase too long!
|
||||
log_e("[WIFI][APlistAdd] passphrase too long");
|
||||
return false;
|
||||
}
|
||||
|
||||
newAP.ssid = strdup(ssid);
|
||||
|
||||
if(!newAP.ssid) {
|
||||
log_e("[WIFI][APlistAdd] fail newAP.ssid == 0");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(passphrase && *passphrase != 0x00) {
|
||||
newAP.passphrase = strdup(passphrase);
|
||||
if(!newAP.passphrase) {
|
||||
log_e("[WIFI][APlistAdd] fail newAP.passphrase == 0");
|
||||
free(newAP.ssid);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
newAP.passphrase = NULL;
|
||||
}
|
||||
|
||||
APlist.push_back(newAP);
|
||||
log_i("[WIFI][APlistAdd] add SSID: %s", newAP.ssid);
|
||||
return true;
|
||||
}
|
||||
|
||||
uint8_t WiFiMulti::run(uint32_t connectTimeout)
|
||||
{
|
||||
|
||||
int8_t scanResult;
|
||||
uint8_t status = WiFi.status();
|
||||
if(status == WL_CONNECTED) {
|
||||
for(uint32_t x = 0; x < APlist.size(); x++) {
|
||||
if(WiFi.SSID()==APlist[x].ssid){
|
||||
if(WiFi.SSID()==APlist[x].ssid) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
@ -119,7 +161,7 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout)
|
||||
|
||||
WiFi.begin(bestNetwork.ssid, bestNetwork.passphrase, bestChannel, bestBSSID);
|
||||
status = WiFi.status();
|
||||
|
||||
|
||||
auto startTime = millis();
|
||||
// wait for connection, fail, or timeout
|
||||
while(status != WL_CONNECTED && status != WL_NO_SSID_AVAIL && status != WL_CONNECT_FAILED && (millis() - startTime) <= connectTimeout) {
|
||||
@ -128,17 +170,17 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout)
|
||||
}
|
||||
|
||||
switch(status) {
|
||||
case 3:
|
||||
case WL_CONNECTED:
|
||||
log_i("[WIFI] Connecting done.");
|
||||
log_d("[WIFI] SSID: %s", WiFi.SSID().c_str());
|
||||
log_d("[WIFI] IP: %s", WiFi.localIP().toString().c_str());
|
||||
log_d("[WIFI] MAC: %s", WiFi.BSSIDstr().c_str());
|
||||
log_d("[WIFI] Channel: %d", WiFi.channel());
|
||||
break;
|
||||
case 1:
|
||||
case WL_NO_SSID_AVAIL:
|
||||
log_e("[WIFI] Connecting Failed AP not found.");
|
||||
break;
|
||||
case 4:
|
||||
case WL_CONNECT_FAILED:
|
||||
log_e("[WIFI] Connecting Failed.");
|
||||
break;
|
||||
default:
|
||||
@ -160,60 +202,3 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout)
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
// ##################################################################################
|
||||
|
||||
bool WiFiMulti::APlistAdd(const char* ssid, const char *passphrase)
|
||||
{
|
||||
|
||||
WifiAPlist_t newAP;
|
||||
|
||||
if(!ssid || *ssid == 0x00 || strlen(ssid) > 31) {
|
||||
// fail SSID to long or missing!
|
||||
log_e("[WIFI][APlistAdd] no ssid or ssid to long");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(passphrase && strlen(passphrase) > 63) {
|
||||
// fail passphrase to long!
|
||||
log_e("[WIFI][APlistAdd] passphrase to long");
|
||||
return false;
|
||||
}
|
||||
|
||||
newAP.ssid = strdup(ssid);
|
||||
|
||||
if(!newAP.ssid) {
|
||||
log_e("[WIFI][APlistAdd] fail newAP.ssid == 0");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(passphrase && *passphrase != 0x00) {
|
||||
newAP.passphrase = strdup(passphrase);
|
||||
if(!newAP.passphrase) {
|
||||
log_e("[WIFI][APlistAdd] fail newAP.passphrase == 0");
|
||||
free(newAP.ssid);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
newAP.passphrase = NULL;
|
||||
}
|
||||
|
||||
APlist.push_back(newAP);
|
||||
log_i("[WIFI][APlistAdd] add SSID: %s", newAP.ssid);
|
||||
return true;
|
||||
}
|
||||
|
||||
void WiFiMulti::APlistClean(void)
|
||||
{
|
||||
for(uint32_t i = 0; i < APlist.size(); i++) {
|
||||
WifiAPlist_t entry = APlist[i];
|
||||
if(entry.ssid) {
|
||||
free(entry.ssid);
|
||||
}
|
||||
if(entry.passphrase) {
|
||||
free(entry.passphrase);
|
||||
}
|
||||
}
|
||||
APlist.clear();
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,6 @@ public:
|
||||
|
||||
private:
|
||||
std::vector<WifiAPlist_t> APlist;
|
||||
bool APlistAdd(const char* ssid, const char *passphrase = NULL);
|
||||
void APlistClean(void);
|
||||
|
||||
};
|
||||
|
||||
#endif /* WIFICLIENTMULTI_H_ */
|
||||
|
@ -162,6 +162,8 @@ wl_status_t WiFiSTAClass::begin(const char* ssid, const char *passphrase, int32_
|
||||
esp_wifi_set_config(WIFI_IF_STA, &conf);
|
||||
} else if(status() == WL_CONNECTED){
|
||||
return WL_CONNECTED;
|
||||
} else {
|
||||
esp_wifi_set_config(WIFI_IF_STA, &conf);
|
||||
}
|
||||
|
||||
if(!_useStaticIp) {
|
||||
@ -198,6 +200,12 @@ wl_status_t WiFiSTAClass::begin()
|
||||
return WL_CONNECT_FAILED;
|
||||
}
|
||||
|
||||
wifi_config_t current_conf;
|
||||
if(esp_wifi_get_config(WIFI_IF_STA, ¤t_conf) != ESP_OK || esp_wifi_set_config(WIFI_IF_STA, ¤t_conf) != ESP_OK) {
|
||||
log_e("config failed");
|
||||
return WL_CONNECT_FAILED;
|
||||
}
|
||||
|
||||
if(!_useStaticIp) {
|
||||
if(tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA) == ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED){
|
||||
log_e("dhcp client start failed!");
|
||||
@ -484,6 +492,48 @@ IPAddress WiFiSTAClass::dnsIP(uint8_t dns_no)
|
||||
return IPAddress(dns_ip.u_addr.ip4.addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the broadcast ip address.
|
||||
* @return IPAddress broadcastIP
|
||||
*/
|
||||
IPAddress WiFiSTAClass::broadcastIP()
|
||||
{
|
||||
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
|
||||
return IPAddress();
|
||||
}
|
||||
tcpip_adapter_ip_info_t ip;
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip);
|
||||
return WiFiGenericClass::calculateBroadcast(IPAddress(ip.gw.addr), IPAddress(ip.netmask.addr));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the network id.
|
||||
* @return IPAddress networkID
|
||||
*/
|
||||
IPAddress WiFiSTAClass::networkID()
|
||||
{
|
||||
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
|
||||
return IPAddress();
|
||||
}
|
||||
tcpip_adapter_ip_info_t ip;
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip);
|
||||
return WiFiGenericClass::calculateNetworkID(IPAddress(ip.gw.addr), IPAddress(ip.netmask.addr));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subnet CIDR.
|
||||
* @return uint8_t subnetCIDR
|
||||
*/
|
||||
uint8_t WiFiSTAClass::subnetCIDR()
|
||||
{
|
||||
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
|
||||
return (uint8_t)0;
|
||||
}
|
||||
tcpip_adapter_ip_info_t ip;
|
||||
tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip);
|
||||
return WiFiGenericClass::calculateSubnetCIDR(IPAddress(ip.netmask.addr));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current SSID associated with the network
|
||||
* @return SSID
|
||||
|
@ -64,6 +64,10 @@ public:
|
||||
IPAddress subnetMask();
|
||||
IPAddress gatewayIP();
|
||||
IPAddress dnsIP(uint8_t dns_no = 0);
|
||||
|
||||
IPAddress broadcastIP();
|
||||
IPAddress networkID();
|
||||
uint8_t subnetCIDR();
|
||||
|
||||
bool enableIpV6();
|
||||
IPv6Address localIPv6();
|
||||
|
6
package/merge_packages.py
Normal file → Executable file
6
package/merge_packages.py
Normal file → Executable file
@ -36,7 +36,11 @@ def pkgVersionNormalized(versionString):
|
||||
verParts = re.split('\.|-rc', verStr, flags=re.IGNORECASE)
|
||||
|
||||
if len(verParts) == 3:
|
||||
verStr = str(versionString) + '-rc' + str(sys.maxint)
|
||||
if (sys.version_info > (3, 0)): # Python 3
|
||||
verStr = str(versionString) + '-rc' + str(sys.maxsize)
|
||||
else: # Python 2
|
||||
verStr = str(versionString) + '-rc' + str(sys.maxint)
|
||||
|
||||
elif len(verParts) != 4:
|
||||
print("pkgVersionNormalized WARNING: unexpected version format: {0})".format(verStr), file=sys.stderr)
|
||||
|
||||
|
@ -27,6 +27,9 @@
|
||||
},
|
||||
{
|
||||
"name": "WEMOS LoLin32"
|
||||
},
|
||||
{
|
||||
"name": "WEMOS D1 MINI ESP32"
|
||||
}
|
||||
],
|
||||
"toolsDependencies": [
|
||||
|
@ -22,7 +22,7 @@ compiler.warning_flags.all=-Wall -Werror=all -Wextra
|
||||
|
||||
compiler.path={runtime.tools.xtensa-esp32-elf-gcc.path}/bin/
|
||||
compiler.sdk.path={runtime.platform.path}/tools/sdk
|
||||
compiler.cpreprocessor.flags=-DESP_PLATFORM -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DHAVE_CONFIG_H "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/app_trace" "-I{compiler.sdk.path}/include/app_update" "-I{compiler.sdk.path}/include/asio" "-I{compiler.sdk.path}/include/bootloader_support" "-I{compiler.sdk.path}/include/bt" "-I{compiler.sdk.path}/include/coap" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/driver" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp32" "-I{compiler.sdk.path}/include/esp_adc_cal" "-I{compiler.sdk.path}/include/esp_event" "-I{compiler.sdk.path}/include/esp_http_client" "-I{compiler.sdk.path}/include/esp_http_server" "-I{compiler.sdk.path}/include/esp_https_ota" "-I{compiler.sdk.path}/include/esp_ringbuf" "-I{compiler.sdk.path}/include/ethernet" "-I{compiler.sdk.path}/include/expat" "-I{compiler.sdk.path}/include/fatfs" "-I{compiler.sdk.path}/include/freemodbus" "-I{compiler.sdk.path}/include/freertos" "-I{compiler.sdk.path}/include/heap" "-I{compiler.sdk.path}/include/idf_test" "-I{compiler.sdk.path}/include/jsmn" "-I{compiler.sdk.path}/include/json" "-I{compiler.sdk.path}/include/libsodium" "-I{compiler.sdk.path}/include/log" "-I{compiler.sdk.path}/include/lwip" "-I{compiler.sdk.path}/include/mbedtls" "-I{compiler.sdk.path}/include/mdns" "-I{compiler.sdk.path}/include/micro-ecc" "-I{compiler.sdk.path}/include/mqtt" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/nghttp" "-I{compiler.sdk.path}/include/nvs_flash" "-I{compiler.sdk.path}/include/openssl" "-I{compiler.sdk.path}/include/protobuf-c" "-I{compiler.sdk.path}/include/protocomm" "-I{compiler.sdk.path}/include/pthread" "-I{compiler.sdk.path}/include/sdmmc" "-I{compiler.sdk.path}/include/smartconfig_ack" "-I{compiler.sdk.path}/include/soc" "-I{compiler.sdk.path}/include/spi_flash" "-I{compiler.sdk.path}/include/spiffs" "-I{compiler.sdk.path}/include/tcp_transport" "-I{compiler.sdk.path}/include/tcpip_adapter" "-I{compiler.sdk.path}/include/ulp" "-I{compiler.sdk.path}/include/vfs" "-I{compiler.sdk.path}/include/wear_levelling" "-I{compiler.sdk.path}/include/wifi_provisioning" "-I{compiler.sdk.path}/include/wpa_supplicant" "-I{compiler.sdk.path}/include/xtensa-debug-module" "-I{compiler.sdk.path}/include/esp32-camera" "-I{compiler.sdk.path}/include/esp-face" "-I{compiler.sdk.path}/include/fb_gfx"
|
||||
compiler.cpreprocessor.flags=-DESP_PLATFORM -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DHAVE_CONFIG_H "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/app_trace" "-I{compiler.sdk.path}/include/app_update" "-I{compiler.sdk.path}/include/asio" "-I{compiler.sdk.path}/include/bootloader_support" "-I{compiler.sdk.path}/include/bt" "-I{compiler.sdk.path}/include/coap" "-I{compiler.sdk.path}/include/console" "-I{compiler.sdk.path}/include/driver" "-I{compiler.sdk.path}/include/esp-tls" "-I{compiler.sdk.path}/include/esp32" "-I{compiler.sdk.path}/include/esp_adc_cal" "-I{compiler.sdk.path}/include/esp_event" "-I{compiler.sdk.path}/include/esp_http_client" "-I{compiler.sdk.path}/include/esp_http_server" "-I{compiler.sdk.path}/include/esp_https_ota" "-I{compiler.sdk.path}/include/esp_ringbuf" "-I{compiler.sdk.path}/include/ethernet" "-I{compiler.sdk.path}/include/expat" "-I{compiler.sdk.path}/include/fatfs" "-I{compiler.sdk.path}/include/freemodbus" "-I{compiler.sdk.path}/include/freertos" "-I{compiler.sdk.path}/include/heap" "-I{compiler.sdk.path}/include/idf_test" "-I{compiler.sdk.path}/include/jsmn" "-I{compiler.sdk.path}/include/json" "-I{compiler.sdk.path}/include/libsodium" "-I{compiler.sdk.path}/include/log" "-I{compiler.sdk.path}/include/lwip" "-I{compiler.sdk.path}/include/mbedtls" "-I{compiler.sdk.path}/include/mdns" "-I{compiler.sdk.path}/include/micro-ecc" "-I{compiler.sdk.path}/include/mqtt" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/nghttp" "-I{compiler.sdk.path}/include/nvs_flash" "-I{compiler.sdk.path}/include/openssl" "-I{compiler.sdk.path}/include/protobuf-c" "-I{compiler.sdk.path}/include/protocomm" "-I{compiler.sdk.path}/include/pthread" "-I{compiler.sdk.path}/include/sdmmc" "-I{compiler.sdk.path}/include/smartconfig_ack" "-I{compiler.sdk.path}/include/soc" "-I{compiler.sdk.path}/include/spi_flash" "-I{compiler.sdk.path}/include/spiffs" "-I{compiler.sdk.path}/include/tcp_transport" "-I{compiler.sdk.path}/include/tcpip_adapter" "-I{compiler.sdk.path}/include/ulp" "-I{compiler.sdk.path}/include/vfs" "-I{compiler.sdk.path}/include/wear_levelling" "-I{compiler.sdk.path}/include/wifi_provisioning" "-I{compiler.sdk.path}/include/wpa_supplicant" "-I{compiler.sdk.path}/include/xtensa-debug-module" "-I{compiler.sdk.path}/include/esp-face" "-I{compiler.sdk.path}/include/esp32-camera" "-I{compiler.sdk.path}/include/esp-face" "-I{compiler.sdk.path}/include/fb_gfx"
|
||||
|
||||
compiler.c.cmd=xtensa-esp32-elf-gcc
|
||||
compiler.c.flags=-std=gnu99 -Os -g3 -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wpointer-arith {compiler.warning_flags} -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -Wno-old-style-declaration -MMD -c
|
||||
@ -34,8 +34,8 @@ compiler.S.cmd=xtensa-esp32-elf-gcc
|
||||
compiler.S.flags=-c -g3 -x assembler-with-cpp -MMD -mlongcalls
|
||||
|
||||
compiler.c.elf.cmd=xtensa-esp32-elf-gcc
|
||||
compiler.c.elf.flags=-nostdlib "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.spiram_incompatible_fns.ld -u ld_include_panic_highint_hdl -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority -u __cxa_guard_dummy -u __cxx_fatal_exception
|
||||
compiler.c.elf.libs=-lgcc -lopenssl -lbtdm_app -lfatfs -lwps -lcoexist -lwear_levelling -lesp_http_client -lprotobuf-c -lhal -lnewlib -ldriver -lbootloader_support -lpp -lfreemodbus -lmesh -lsmartconfig -ljsmn -lwpa -lethernet -lphy -lfrmn -lapp_trace -lfr_coefficients -lconsole -lulp -lwpa_supplicant -lfreertos -lbt -lmicro-ecc -lesp32-camera -lcxx -lxtensa-debug-module -ltcp_transport -lmdns -lvfs -lmtmn -lesp_ringbuf -lsoc -lcore -lfb_gfx -lsdmmc -llibsodium -lcoap -ltcpip_adapter -lprotocomm -lesp_event -limage_util -lc_nano -lesp-tls -lasio -lrtc -lspi_flash -lwpa2 -lwifi_provisioning -lesp32 -lface_recognition -lapp_update -lnghttp -lspiffs -lface_detection -lespnow -lnvs_flash -lesp_adc_cal -llog -ldl_lib -lsmartconfig_ack -lexpat -lfd_coefficients -lm -lmqtt -lc -lheap -lmbedtls -llwip -lnet80211 -lesp_http_server -lpthread -ljson -lesp_https_ota -lstdc++
|
||||
compiler.c.elf.flags=-nostdlib "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.libgcc.ld -T esp32.rom.spiram_incompatible_fns.ld -u ld_include_panic_highint_hdl -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority -u __cxa_guard_dummy -u __cxx_fatal_exception
|
||||
compiler.c.elf.libs=-lgcc -lopenssl -lbtdm_app -lfatfs -lwps -lcoexist -lwear_levelling -lesp_http_client -lprotobuf-c -lhal -lnewlib -ldriver -lbootloader_support -lpp -lfreemodbus -lmesh -lsmartconfig -ljsmn -lwpa -lethernet -lphy -lapp_trace -lconsole -lulp -lwpa_supplicant -lfreertos -lbt -lmicro-ecc -lesp32-camera -lcxx -lxtensa-debug-module -ltcp_transport -lmdns -lvfs -lesp_ringbuf -lsoc -lcore -lfb_gfx -lsdmmc -llibsodium -lcoap -ltcpip_adapter -lprotocomm -lesp_event -limage_util -lc_nano -lesp-tls -lasio -lrtc -lspi_flash -lwpa2 -lwifi_provisioning -lesp32 -lface_recognition -lapp_update -lnghttp -lspiffs -lface_detection -lespnow -lnvs_flash -lesp_adc_cal -llog -ldl_lib -lsmartconfig_ack -lexpat -lm -lfr -lmqtt -lc -lheap -lmbedtls -llwip -lnet80211 -lesp_http_server -lpthread -ljson -lesp_https_ota -lfd -lstdc++
|
||||
|
||||
compiler.as.cmd=xtensa-esp32-elf-as
|
||||
|
||||
|
@ -1,54 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#- set -e
|
||||
|
||||
if [ ! -z "$TRAVIS_TAG" ]; then
|
||||
echo "No sketch builds & tests required for tagged TravisCI builds, exiting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "travis_fold:start:sketch_test_env_prepare"
|
||||
pip install pyserial
|
||||
wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
|
||||
tar xf arduino.tar.xz
|
||||
mv arduino-nightly $HOME/arduino_ide
|
||||
mkdir -p $HOME/Arduino/libraries
|
||||
cd $HOME/arduino_ide/hardware
|
||||
mkdir espressif
|
||||
cd espressif
|
||||
ln -s $TRAVIS_BUILD_DIR esp32
|
||||
cd esp32
|
||||
git submodule update --init --recursive
|
||||
cd tools
|
||||
python get.py
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
export PATH="$HOME/arduino_ide:$TRAVIS_BUILD_DIR/tools/xtensa-esp32-elf/bin:$PATH"
|
||||
source tools/common.sh
|
||||
echo -e "travis_fold:end:sketch_test_env_prepare"
|
||||
|
||||
echo -e "travis_fold:start:sketch_test"
|
||||
build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
echo -e "travis_fold:end:sketch_test"
|
||||
|
||||
echo -e "travis_fold:start:size_report"
|
||||
cat size.log
|
||||
echo -e "travis_fold:end:size_report"
|
||||
|
||||
echo -e "travis_fold:start:platformio_test_env_prepare"
|
||||
pip install -U https://github.com/platformio/platformio/archive/develop.zip && \
|
||||
platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage && \
|
||||
sed -i 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' ~/.platformio/platforms/espressif32/platform.json && \
|
||||
ln -s $TRAVIS_BUILD_DIR ~/.platformio/packages/framework-arduinoespressif32
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
echo -e "travis_fold:end:platformio_test_env_prepare"
|
||||
|
||||
echo -e "travis_fold:start:platformio_test"
|
||||
platformio ci --board esp32dev libraries/WiFi/examples/WiFiClient && \
|
||||
platformio ci --board esp32dev libraries/WiFiClientSecure/examples/WiFiClientSecure && \
|
||||
platformio ci --board esp32dev libraries/BluetoothSerial/examples/SerialToSerialBT && \
|
||||
platformio ci --board esp32dev libraries/BLE/examples/BLE_server && \
|
||||
platformio ci --board esp32dev libraries/AzureIoT/examples/GetStarted && \
|
||||
platformio ci --board esp32dev libraries/ESP32/examples/Camera/CameraWebServer --project-option="board_build.partitions = huge_app.csv"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
echo -e "travis_fold:end:platformio_test"
|
131
tools/build.py
131
tools/build.py
@ -1,131 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# build.py — build a sketch using arduino-builder
|
||||
#
|
||||
# Wrapper script around arduino-builder which accepts some ESP8266-specific
|
||||
# options and translates them into FQBN
|
||||
#
|
||||
# Copyright © 2016 Ivan Grokhotkov
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
import subprocess
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
def compile(tmp_dir, sketch, tools_dir, hardware_dir, ide_path, f, args):
|
||||
cmd = ide_path + '/arduino-builder '
|
||||
cmd += '-compile -logger=human '
|
||||
cmd += '-build-path "' + tmp_dir + '" '
|
||||
cmd += '-tools "' + ide_path + '/tools-builder" '
|
||||
if args.library_path:
|
||||
for lib_dir in args.library_path:
|
||||
cmd += '-libraries "' + lib_dir + '" '
|
||||
cmd += '-hardware "' + ide_path + '/hardware" '
|
||||
if args.hardware_dir:
|
||||
for hw_dir in args.hardware_dir:
|
||||
cmd += '-hardware "' + hw_dir + '" '
|
||||
else:
|
||||
cmd += '-hardware "' + hardware_dir + '" '
|
||||
# Debug=Serial,DebugLevel=Core____
|
||||
cmd += '-fqbn=espressif:esp32:{board_name}:' \
|
||||
'FlashFreq={flash_freq},' \
|
||||
'PartitionScheme=huge_app,' \
|
||||
'UploadSpeed=921600'.format(**vars(args))
|
||||
cmd += ' '
|
||||
cmd += '-ide-version=10607 '
|
||||
cmd += '-warnings={warnings} '.format(**vars(args))
|
||||
if args.verbose:
|
||||
cmd += '-verbose '
|
||||
cmd += sketch
|
||||
|
||||
if args.verbose:
|
||||
print('Building: ' + cmd, file=f)
|
||||
|
||||
cmds = cmd.split(' ')
|
||||
p = subprocess.Popen(cmds, stdout=f, stderr=subprocess.STDOUT)
|
||||
p.wait()
|
||||
return p.returncode
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Sketch build helper')
|
||||
parser.add_argument('-v', '--verbose', help='Enable verbose output',
|
||||
action='store_true')
|
||||
parser.add_argument('-i', '--ide_path', help='Arduino IDE path')
|
||||
parser.add_argument('-p', '--build_path', help='Build directory')
|
||||
parser.add_argument('-l', '--library_path', help='Additional library path',
|
||||
action='append')
|
||||
parser.add_argument('-d', '--hardware_dir', help='Additional hardware path',
|
||||
action='append')
|
||||
parser.add_argument('-b', '--board_name', help='Board name', default='esp32')
|
||||
parser.add_argument('-w', '--warnings', help='Compilation warnings level',
|
||||
default='none', choices=['none', 'all', 'more'])
|
||||
parser.add_argument('-o', '--output_binary', help='File name for output binary')
|
||||
parser.add_argument('-k', '--keep', action='store_true',
|
||||
help='Don\'t delete temporary build directory')
|
||||
parser.add_argument('--flash_freq', help='Flash frequency', default=40,
|
||||
type=int, choices=[40, 80])
|
||||
parser.add_argument('sketch_path', help='Sketch file path')
|
||||
return parser.parse_args()
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
|
||||
ide_path = args.ide_path
|
||||
if not ide_path:
|
||||
ide_path = os.environ.get('ARDUINO_IDE_PATH')
|
||||
if not ide_path:
|
||||
print("Please specify Arduino IDE path via --ide_path option"
|
||||
"or ARDUINO_IDE_PATH environment variable.", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
sketch_path = args.sketch_path
|
||||
tmp_dir = args.build_path
|
||||
created_tmp_dir = False
|
||||
if not tmp_dir:
|
||||
tmp_dir = tempfile.mkdtemp()
|
||||
created_tmp_dir = True
|
||||
|
||||
tools_dir = os.path.dirname(os.path.realpath(__file__)) + '/../tools'
|
||||
# this is not the correct hardware folder to add.
|
||||
hardware_dir = os.path.dirname(os.path.realpath(__file__)) + '/../cores'
|
||||
|
||||
output_name = tmp_dir + '/' + os.path.basename(sketch_path) + '.bin'
|
||||
if args.verbose:
|
||||
print("Sketch: ", sketch_path)
|
||||
print("Build dir: ", tmp_dir)
|
||||
print("Output: ", output_name)
|
||||
|
||||
if args.verbose:
|
||||
f = sys.stdout
|
||||
else:
|
||||
f = open(tmp_dir + '/build.log', 'w')
|
||||
|
||||
res = compile(tmp_dir, sketch_path, tools_dir, hardware_dir, ide_path, f, args)
|
||||
if res != 0:
|
||||
return res
|
||||
|
||||
if args.output_binary is not None:
|
||||
shutil.copy(output_name, args.output_binary)
|
||||
|
||||
if created_tmp_dir and not args.keep:
|
||||
shutil.rmtree(tmp_dir, ignore_errors=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -z "$TRAVIS_TAG" ]; then
|
||||
# zip the package if tagged build
|
||||
tools/build-release.sh -a$ESP32_GITHUB_TOKEN
|
||||
else
|
||||
# run cmake and sketch tests
|
||||
tools/check_cmakelists.sh && tools/build-tests.sh
|
||||
fi
|
@ -1,5 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$TRAVIS_TAG" ]; then
|
||||
echo "Skipping Packaging: Regular build"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
############################################################
|
||||
# $1 - download link
|
||||
# $2 - JSON output file
|
64
tools/ci/build-tests.sh
Executable file
64
tools/ci/build-tests.sh
Executable file
@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -z "$TRAVIS_TAG" ]; then
|
||||
echo "Skipping Test: Tagged build"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
CHUNK_INDEX=$1
|
||||
CHUNKS_CNT=$2
|
||||
BUILD_PIO=0
|
||||
if [ "$#" -lt 2 ]; then
|
||||
echo "Building all sketches"
|
||||
CHUNK_INDEX=0
|
||||
CHUNKS_CNT=1
|
||||
BUILD_PIO=1
|
||||
fi
|
||||
if [ "$CHUNKS_CNT" -le 0 ]; then
|
||||
CHUNK_INDEX=0
|
||||
CHUNKS_CNT=1
|
||||
BUILD_PIO=1
|
||||
fi
|
||||
if [ "$CHUNK_INDEX" -gt "$CHUNKS_CNT" ]; then
|
||||
CHUNK_INDEX=$CHUNKS_CNT
|
||||
fi
|
||||
if [ "$CHUNK_INDEX" -eq "$CHUNKS_CNT" ]; then
|
||||
BUILD_PIO=1
|
||||
fi
|
||||
|
||||
# CMake Test
|
||||
if [ "$CHUNK_INDEX" -eq 0 ]; then
|
||||
echo -e "travis_fold:start:check_cmakelists"
|
||||
tools/ci/check-cmakelists.sh
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
echo -e "travis_fold:end:check_cmakelists"
|
||||
fi
|
||||
|
||||
if [ "$BUILD_PIO" -eq 0 ]; then
|
||||
# ArduinoIDE Test
|
||||
echo -e "travis_fold:start:prep_arduino_ide"
|
||||
tools/ci/prep-arduino-ide.sh
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
echo -e "travis_fold:end:prep_arduino_ide"
|
||||
|
||||
echo -e "travis_fold:start:test_arduino_ide"
|
||||
tools/ci/test-arduino-ide.sh $CHUNK_INDEX $CHUNKS_CNT
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
echo -e "travis_fold:end:test_arduino_ide"
|
||||
|
||||
echo -e "travis_fold:start:size_report"
|
||||
cat size.log
|
||||
echo -e "travis_fold:end:size_report"
|
||||
else
|
||||
# PlatformIO Test
|
||||
echo -e "travis_fold:start:prep_platformio"
|
||||
cd tools && python get.py && cd ..
|
||||
tools/ci/prep-platformio.sh
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
echo -e "travis_fold:end:prep_platformio"
|
||||
|
||||
echo -e "travis_fold:start:test_platformio"
|
||||
tools/ci/test-platformio.sh
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
echo -e "travis_fold:end:test_platformio"
|
||||
fi
|
@ -10,8 +10,10 @@ set -e
|
||||
|
||||
cd "`dirname $0`/.." # cd to arduino-esp32 root
|
||||
|
||||
# pull all submodules
|
||||
git submodule update --init --recursive
|
||||
|
||||
# find all source files in repo
|
||||
#REPO_SRCS=`find cores/esp32/ libraries/ -name 'examples' -prune -o -name 'main.cpp' -prune -o -name '*.c' -print -o -name '*.cpp' -print | sort`
|
||||
REPO_SRCS=`find cores/esp32/ libraries/ -name 'examples' -prune -o -name '*.c' -print -o -name '*.cpp' -print | sort`
|
||||
|
||||
# find all source files named in CMakeLists.txt COMPONENT_SRCS
|
13
tools/ci/prep-arduino-ide.sh
Executable file
13
tools/ci/prep-arduino-ide.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
pip install pyserial
|
||||
wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
|
||||
tar xf arduino.tar.xz
|
||||
mv arduino-nightly $HOME/arduino_ide
|
||||
mkdir -p $HOME/Arduino/libraries
|
||||
mkdir -p $HOME/Arduino/hardware/espressif
|
||||
cd $HOME/Arduino/hardware/espressif
|
||||
|
||||
ln -s $TRAVIS_BUILD_DIR esp32
|
||||
cd esp32/tools
|
||||
python get.py
|
6
tools/ci/prep-platformio.sh
Executable file
6
tools/ci/prep-platformio.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
pip install -U https://github.com/platformio/platformio/archive/develop.zip && \
|
||||
python -m platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage && \
|
||||
sed -i 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' ~/.platformio/platforms/espressif32/platform.json && \
|
||||
ln -s $TRAVIS_BUILD_DIR ~/.platformio/packages/framework-arduinoespressif32
|
170
tools/ci/test-arduino-ide.sh
Executable file
170
tools/ci/test-arduino-ide.sh
Executable file
@ -0,0 +1,170 @@
|
||||
#!/bin/bash
|
||||
|
||||
CHUNK_INDEX=$1
|
||||
CHUNKS_CNT=$2
|
||||
if [ "$#" -lt 2 ]; then
|
||||
echo "Building all sketches"
|
||||
CHUNK_INDEX=0
|
||||
CHUNKS_CNT=1
|
||||
fi
|
||||
if [ "$CHUNKS_CNT" -le 0 ]; then
|
||||
echo "Chunks count must be positive number"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$CHUNK_INDEX" -ge "$CHUNKS_CNT" ]; then
|
||||
echo "Chunk index must be less than chunks count"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export ARDUINO_BOARD_FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none"
|
||||
|
||||
export ARDUINO_IDE_PATH=$HOME/arduino_ide
|
||||
export ARDUINO_USR_PATH=$HOME/Arduino
|
||||
|
||||
export EXAMPLES_PATH=$TRAVIS_BUILD_DIR/libraries
|
||||
export EXAMPLES_BUILD_DIR=$HOME/build.tmp
|
||||
export EXAMPLES_CACHE_DIR=$HOME/cache.tmp
|
||||
export EXAMPLES_BUILD_CMD="$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=\"10810\" -hardware \"$ARDUINO_IDE_PATH/hardware\" -hardware \"$ARDUINO_USR_PATH/hardware\" -tools \"$ARDUINO_IDE_PATH/tools-builder\" -built-in-libraries \"$ARDUINO_IDE_PATH/libraries\" -libraries \"$ARDUINO_USR_PATH/libraries\" -fqbn=$ARDUINO_BOARD_FQBN -warnings=\"all\" -build-cache \"$EXAMPLES_CACHE_DIR\" -build-path \"$EXAMPLES_BUILD_DIR\" -verbose"
|
||||
export EXAMPLES_SIZE_BIN=$TRAVIS_BUILD_DIR/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-size
|
||||
|
||||
function print_size_info()
|
||||
{
|
||||
elf_file=$1
|
||||
|
||||
if [ -z "$elf_file" ]; then
|
||||
printf "sketch iram0.text flash.text flash.rodata dram0.data dram0.bss dram flash\n"
|
||||
return 0
|
||||
fi
|
||||
|
||||
elf_name=$(basename $elf_file)
|
||||
sketch_name="${elf_name%.*}"
|
||||
# echo $sketch_name
|
||||
declare -A segments
|
||||
while read -a tokens; do
|
||||
seg=${tokens[0]}
|
||||
seg=${seg//./}
|
||||
size=${tokens[1]}
|
||||
addr=${tokens[2]}
|
||||
if [ "$addr" -eq "$addr" -a "$addr" -ne "0" ] 2>/dev/null; then
|
||||
segments[$seg]=$size
|
||||
fi
|
||||
done < <($EXAMPLES_SIZE_BIN --format=sysv $elf_file)
|
||||
|
||||
total_ram=$((${segments[dram0data]} + ${segments[dram0bss]}))
|
||||
total_flash=$((${segments[iram0text]} + ${segments[flashtext]} + ${segments[dram0data]} + ${segments[flashrodata]}))
|
||||
printf "%-32s %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n" $sketch_name ${segments[iram0text]} ${segments[flashtext]} ${segments[flashrodata]} ${segments[dram0data]} ${segments[dram0bss]} $total_ram $total_flash
|
||||
return 0
|
||||
}
|
||||
|
||||
function build_sketch()
|
||||
{
|
||||
local sketch=$1
|
||||
echo -e "\n------------ Building $sketch ------------\n";
|
||||
rm -rf $EXAMPLES_BUILD_DIR/*
|
||||
time ($EXAMPLES_BUILD_CMD $sketch >build.log)
|
||||
local result=$?
|
||||
if [ $result -ne 0 ]; then
|
||||
echo "Build failed ($1)"
|
||||
echo "Build log:"
|
||||
cat build.log
|
||||
return $result
|
||||
fi
|
||||
rm build.log
|
||||
return 0
|
||||
}
|
||||
|
||||
function count_sketches()
|
||||
{
|
||||
local sketches=$(find $EXAMPLES_PATH -name *.ino)
|
||||
local sketchnum=0
|
||||
rm -rf sketches.txt
|
||||
for sketch in $sketches; do
|
||||
local sketchdir=$(dirname $sketch)
|
||||
local sketchdirname=$(basename $sketchdir)
|
||||
local sketchname=$(basename $sketch)
|
||||
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
||||
continue
|
||||
fi;
|
||||
if [[ -f "$sketchdir/.test.skip" ]]; then
|
||||
continue
|
||||
fi
|
||||
echo $sketch >> sketches.txt
|
||||
sketchnum=$(($sketchnum + 1))
|
||||
done
|
||||
return $sketchnum
|
||||
}
|
||||
|
||||
function build_sketches()
|
||||
{
|
||||
mkdir -p $EXAMPLES_BUILD_DIR
|
||||
mkdir -p $EXAMPLES_CACHE_DIR
|
||||
mkdir -p $ARDUINO_USR_PATH/libraries
|
||||
mkdir -p $ARDUINO_USR_PATH/hardware
|
||||
|
||||
local chunk_idex=$1
|
||||
local chunks_num=$2
|
||||
count_sketches
|
||||
local sketchcount=$?
|
||||
local sketches=$(cat sketches.txt)
|
||||
|
||||
local chunk_size=$(( $sketchcount / $chunks_num ))
|
||||
local all_chunks=$(( $chunks_num * $chunk_size ))
|
||||
if [ "$all_chunks" -lt "$sketchcount" ]; then
|
||||
chunk_size=$(( $chunk_size + 1 ))
|
||||
fi
|
||||
|
||||
local start_index=$(( $chunk_idex * $chunk_size ))
|
||||
if [ "$sketchcount" -le "$start_index" ]; then
|
||||
echo "Skipping job"
|
||||
return 0
|
||||
fi
|
||||
|
||||
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
|
||||
if [ "$end_index" -gt "$sketchcount" ]; then
|
||||
end_index=$sketchcount
|
||||
fi
|
||||
|
||||
local start_num=$(( $start_index + 1 ))
|
||||
#echo -e "Sketches: \n$sketches\n"
|
||||
echo "Found $sketchcount Sketches";
|
||||
echo "Chunk Count : $chunks_num"
|
||||
echo "Chunk Size : $chunk_size"
|
||||
echo "Start Sketch: $start_num"
|
||||
echo "End Sketch : $end_index"
|
||||
|
||||
local sketchnum=0
|
||||
print_size_info >size.log
|
||||
for sketch in $sketches; do
|
||||
local sketchdir=$(dirname $sketch)
|
||||
local sketchdirname=$(basename $sketchdir)
|
||||
local sketchname=$(basename $sketch)
|
||||
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
||||
#echo "Skipping $sketch, beacause it is not the main sketch file";
|
||||
continue
|
||||
fi;
|
||||
if [[ -f "$sketchdir/.test.skip" ]]; then
|
||||
#echo "Skipping $sketch marked";
|
||||
continue
|
||||
fi
|
||||
sketchnum=$(($sketchnum + 1))
|
||||
if [ "$sketchnum" -le "$start_index" ]; then
|
||||
#echo "Skipping $sketch index low"
|
||||
continue
|
||||
fi
|
||||
if [ "$sketchnum" -gt "$end_index" ]; then
|
||||
#echo "Skipping $sketch index high"
|
||||
continue
|
||||
fi
|
||||
build_sketch $sketch
|
||||
local result=$?
|
||||
if [ $result -ne 0 ]; then
|
||||
return $result
|
||||
fi
|
||||
print_size_info $EXAMPLES_BUILD_DIR/*.elf >>size.log
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
build_sketches $CHUNK_INDEX $CHUNKS_CNT
|
||||
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
9
tools/ci/test-platformio.sh
Executable file
9
tools/ci/test-platformio.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
python -m platformio ci --board esp32dev libraries/WiFi/examples/WiFiClient && \
|
||||
python -m platformio ci --board esp32dev libraries/WiFiClientSecure/examples/WiFiClientSecure && \
|
||||
python -m platformio ci --board esp32dev libraries/BluetoothSerial/examples/SerialToSerialBT && \
|
||||
python -m platformio ci --board esp32dev libraries/BLE/examples/BLE_server && \
|
||||
python -m platformio ci --board esp32dev libraries/AzureIoT/examples/GetStarted && \
|
||||
python -m platformio ci --board esp32dev libraries/ESP32/examples/Camera/CameraWebServer --project-option="board_build.partitions = huge_app.csv"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
@ -1,72 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function print_size_info()
|
||||
{
|
||||
elf_file=$1
|
||||
|
||||
if [ -z "$elf_file" ]; then
|
||||
printf "sketch iram0.text flash.text flash.rodata dram0.data dram0.bss dram flash\n"
|
||||
return 0
|
||||
fi
|
||||
|
||||
elf_name=$(basename $elf_file)
|
||||
sketch_name="${elf_name%.*}"
|
||||
# echo $sketch_name
|
||||
declare -A segments
|
||||
while read -a tokens; do
|
||||
seg=${tokens[0]}
|
||||
seg=${seg//./}
|
||||
size=${tokens[1]}
|
||||
addr=${tokens[2]}
|
||||
if [ "$addr" -eq "$addr" -a "$addr" -ne "0" ] 2>/dev/null; then
|
||||
segments[$seg]=$size
|
||||
fi
|
||||
done < <(xtensa-esp32-elf-size --format=sysv $elf_file)
|
||||
|
||||
total_ram=$((${segments[dram0data]} + ${segments[dram0bss]}))
|
||||
total_flash=$((${segments[iram0text]} + ${segments[flashtext]} + ${segments[dram0data]} + ${segments[flashrodata]}))
|
||||
printf "%-28s %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n" $sketch_name ${segments[iram0text]} ${segments[flashtext]} ${segments[flashrodata]} ${segments[dram0data]} ${segments[dram0bss]} $total_ram $total_flash
|
||||
return 0
|
||||
}
|
||||
|
||||
function build_sketches()
|
||||
{
|
||||
#set +e
|
||||
local arduino=$1
|
||||
local srcpath=$2
|
||||
local build_arg=$3
|
||||
local build_dir=build.tmp
|
||||
mkdir -p $build_dir
|
||||
local build_cmd="python tools/build.py -b esp32 -v -k -p $PWD/$build_dir $build_arg "
|
||||
local sketches=$(find $srcpath -name *.ino)
|
||||
print_size_info >size.log
|
||||
export ARDUINO_IDE_PATH=$arduino
|
||||
for sketch in $sketches; do
|
||||
rm -rf $build_dir/*
|
||||
local sketchdir=$(dirname $sketch)
|
||||
local sketchdirname=$(basename $sketchdir)
|
||||
local sketchname=$(basename $sketch)
|
||||
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
||||
echo "Skipping $sketch, beacause it is not the main sketch file";
|
||||
continue
|
||||
fi;
|
||||
if [[ -f "$sketchdir/.test.skip" ]]; then
|
||||
echo -e "\n ------------ Skipping $sketch ------------ \n";
|
||||
continue
|
||||
fi
|
||||
echo -e "\n ------------ Building $sketch ------------ \n";
|
||||
# $arduino --verify $sketch;
|
||||
#echo "$build_cmd $sketch"
|
||||
time ($build_cmd $sketch >build.log)
|
||||
local result=$?
|
||||
if [ $result -ne 0 ]; then
|
||||
echo "Build failed ($1)"
|
||||
echo "Build log:"
|
||||
cat build.log
|
||||
return $result
|
||||
fi
|
||||
rm build.log
|
||||
print_size_info $build_dir/*.elf >>size.log
|
||||
done
|
||||
#set -e
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user