mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-06-25 18:01:33 +02:00
Compare commits
81 Commits
Author | SHA1 | Date | |
---|---|---|---|
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:
|
### Hardware:
|
||||||
Board: ?ESP32 Dev Module? ?node32? ?ttgo_lora?
|
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?
|
IDE name: ?Arduino IDE? ?Platform.io? ?IDF component?
|
||||||
Flash Frequency: ?40Mhz?
|
Flash Frequency: ?40Mhz?
|
||||||
PSRAM enabled: ?no? ?yes?
|
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
|
426
.github/workflows/main.yml
vendored
Normal file
426
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,426 @@
|
|||||||
|
name: ESP32 Arduino CI
|
||||||
|
|
||||||
|
on: [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/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
ESP32_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GITHUB_EVENT_NAME: ${{ github.event_name }}
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- name: Install Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/prep-arduino-ide.sh
|
||||||
|
- name: Test Arduino IDE
|
||||||
|
env:
|
||||||
|
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
||||||
|
run: ./tools/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: Run CMake Check
|
||||||
|
run: ./tools/check_cmakelists.sh
|
||||||
|
|
||||||
|
- 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/prep-platformio.sh
|
||||||
|
- name: Test PlatformIO
|
||||||
|
run: ./tools/test-platformio.sh
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -5,3 +5,10 @@ tools/esptool.exe
|
|||||||
tools/mkspiffs/mkspiffs
|
tools/mkspiffs/mkspiffs
|
||||||
tools/mkspiffs/mkspiffs.exe
|
tools/mkspiffs/mkspiffs.exe
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
#Ignore files built by Visual Studio/Visual Micro
|
||||||
|
[Dd]ebug*/
|
||||||
|
[Rr]elease*/
|
||||||
|
.vs/
|
||||||
|
__vm/
|
||||||
|
*.vcxproj*
|
||||||
|
@ -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)
|
set(COMPONENT_PRIV_REQUIRES fatfs nvs_flash app_update spiffs bootloader_support openssl bt)
|
||||||
|
|
||||||
register_component()
|
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
|
select ARDUINO_SELECTIVE_WiFi
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
config ARDUINO_SELECTIVE_FFat
|
||||||
|
bool "Enable FFat"
|
||||||
|
depends on ARDUINO_SELECTIVE_COMPILATION
|
||||||
|
select ARDUINO_SELECTIVE_FS
|
||||||
|
default y
|
||||||
|
|
||||||
config ARDUINO_SELECTIVE_FS
|
config ARDUINO_SELECTIVE_FS
|
||||||
bool "Enable FS"
|
bool "Enable FS"
|
||||||
depends on ARDUINO_SELECTIVE_COMPILATION
|
depends on ARDUINO_SELECTIVE_COMPILATION
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
[Latest development release  ](https://github.com/espressif/arduino-esp32/releases/latest/) 
|
[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
|
- 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
|
- 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
|
- 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.default.build.partitions=default
|
||||||
esp32.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
|
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.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=Minimal (1.3MB APP/700KB SPIFFS)
|
||||||
esp32.menu.PartitionScheme.minimal.build.partitions=minimal
|
esp32.menu.PartitionScheme.minimal.build.partitions=minimal
|
||||||
esp32.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
|
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=4MB (32Mb)
|
||||||
esp32.menu.FlashSize.4M.build.flash_size=4MB
|
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=2MB (16Mb)
|
||||||
esp32.menu.FlashSize.2M.build.flash_size=2MB
|
esp32.menu.FlashSize.2M.build.flash_size=2MB
|
||||||
esp32.menu.FlashSize.2M.build.partitions=minimal
|
esp32.menu.FlashSize.2M.build.partitions=minimal
|
||||||
@ -225,7 +230,6 @@ esp32wrover.menu.DebugLevel.verbose=Verbose
|
|||||||
esp32wrover.menu.DebugLevel.verbose.build.code_debug=5
|
esp32wrover.menu.DebugLevel.verbose.build.code_debug=5
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
||||||
pico32.name=ESP32 Pico Kit
|
pico32.name=ESP32 Pico Kit
|
||||||
|
|
||||||
pico32.upload.tool=esptool_py
|
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.name=Turta IoT Node
|
||||||
|
|
||||||
turta_iot_node.upload.tool=esptool_py
|
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.name=XinaBox CW02
|
||||||
|
|
||||||
cw02.upload.tool=esptool_py
|
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.build.partitions=min_spiffs
|
||||||
lolin32.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
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=921600
|
||||||
lolin32.menu.UploadSpeed.921600.upload.speed=921600
|
lolin32.menu.UploadSpeed.921600.upload.speed=921600
|
||||||
lolin32.menu.UploadSpeed.115200=115200
|
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.name=ThaiEasyElec's ESPino32
|
||||||
|
|
||||||
espino32.upload.tool=esptool_py
|
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=8MB (64Mb)
|
||||||
heltec_wifi_lora_32_V2.menu.FlashSize.8M.build.flash_size=8MB
|
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=4MB (32Mb)
|
||||||
heltec_wifi_lora_32_V2.menu.FlashSize.4M.build.flash_size=4MB
|
heltec_wifi_lora_32_V2.menu.FlashSize.4M.build.flash_size=4MB
|
||||||
heltec_wifi_lora_32_V2.menu.FlashSize.2M=2MB (16Mb)
|
heltec_wifi_lora_32_V2.menu.FlashSize.2M=2MB (16Mb)
|
||||||
@ -2744,16 +3106,54 @@ alksesp32.build.boot=dio
|
|||||||
alksesp32.build.partitions=default
|
alksesp32.build.partitions=default
|
||||||
alksesp32.build.defines=
|
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.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.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.build.partitions=no_ota
|
||||||
alksesp32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
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.build.partitions=min_spiffs
|
||||||
alksesp32.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
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=QIO
|
||||||
alksesp32.menu.FlashMode.qio.build.flash_mode=dio
|
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=2MB (16Mb)
|
||||||
alksesp32.menu.FlashSize.2M.build.flash_size=2MB
|
alksesp32.menu.FlashSize.2M.build.flash_size=2MB
|
||||||
alksesp32.menu.FlashSize.2M.build.partitions=minimal
|
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=921600
|
||||||
alksesp32.menu.UploadSpeed.921600.upload.speed=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
|
#define __STRINGIFY(a) #a
|
||||||
#endif
|
#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 constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
|
||||||
#define radians(deg) ((deg)*DEG_TO_RAD)
|
#define radians(deg) ((deg)*DEG_TO_RAD)
|
||||||
#define degrees(rad) ((rad)*RAD_TO_DEG)
|
#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 "HardwareSerial.h"
|
||||||
#include "Esp.h"
|
#include "Esp.h"
|
||||||
|
|
||||||
|
using std::abs;
|
||||||
using std::isinf;
|
using std::isinf;
|
||||||
using std::isnan;
|
using std::isnan;
|
||||||
using std::max;
|
using std::max;
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
uint32_t getMaxAllocPsram();
|
uint32_t getMaxAllocPsram();
|
||||||
|
|
||||||
uint8_t getChipRevision();
|
uint8_t getChipRevision();
|
||||||
uint8_t getCpuFreqMHz(){ return CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ; }
|
uint32_t getCpuFreqMHz(){ return getCpuFrequencyMhz(); }
|
||||||
uint32_t getCycleCount();
|
uint32_t getCycleCount();
|
||||||
const char * getSdkVersion();
|
const char * getSdkVersion();
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ size_t Print::printf(const char *format, ...)
|
|||||||
va_list copy;
|
va_list copy;
|
||||||
va_start(arg, format);
|
va_start(arg, format);
|
||||||
va_copy(copy, arg);
|
va_copy(copy, arg);
|
||||||
size_t len = vsnprintf(NULL, 0, format, arg);
|
size_t len = vsnprintf(NULL, 0, format, copy);
|
||||||
va_end(copy);
|
va_end(copy);
|
||||||
if(len >= sizeof(loc_buf)){
|
if(len >= sizeof(loc_buf)){
|
||||||
temp = new char[len+1];
|
temp = new char[len+1];
|
||||||
|
@ -97,8 +97,8 @@ public:
|
|||||||
|
|
||||||
float parseFloat(); // float version of parseInt
|
float parseFloat(); // float version of parseInt
|
||||||
|
|
||||||
size_t readBytes(char *buffer, size_t length); // read chars from stream into buffer
|
virtual 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(uint8_t *buffer, size_t length)
|
||||||
{
|
{
|
||||||
return readBytes((char *) buffer, 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)
|
// returns the number of characters placed in the buffer (0 means no valid data found)
|
||||||
|
|
||||||
// Arduino String functions to be added here
|
// Arduino String functions to be added here
|
||||||
String readString();
|
virtual String readString();
|
||||||
String readStringUntil(char terminator);
|
String readStringUntil(char terminator);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
StreamString.cpp
|
StreamString.cpp
|
||||||
|
|
||||||
Copyright (c) 2015 Markus Sattler. All rights reserved.
|
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
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
@ -22,31 +23,28 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "StreamString.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(size && data) {
|
||||||
if(reserve(length() + size + 1)) {
|
const unsigned int newlen = length() + size;
|
||||||
memcpy((void *) (buffer + len), (const void *) data, size);
|
if(reserve(newlen + 1)) {
|
||||||
len += size;
|
memcpy((void *) (wbuffer() + len()), (const void *) data, size);
|
||||||
*(buffer + len) = 0x00; // add null for string end
|
setLen(newlen);
|
||||||
|
*(wbuffer() + newlen) = 0x00; // add null for string end
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t StreamString::write(uint8_t data)
|
size_t StreamString::write(uint8_t data) {
|
||||||
{
|
|
||||||
return concat((char) data);
|
return concat((char) data);
|
||||||
}
|
}
|
||||||
|
|
||||||
int StreamString::available()
|
int StreamString::available() {
|
||||||
{
|
|
||||||
return length();
|
return length();
|
||||||
}
|
}
|
||||||
|
|
||||||
int StreamString::read()
|
int StreamString::read() {
|
||||||
{
|
|
||||||
if(length()) {
|
if(length()) {
|
||||||
char c = charAt(0);
|
char c = charAt(0);
|
||||||
remove(0, 1);
|
remove(0, 1);
|
||||||
@ -56,8 +54,7 @@ int StreamString::read()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int StreamString::peek()
|
int StreamString::peek() {
|
||||||
{
|
|
||||||
if(length()) {
|
if(length()) {
|
||||||
char c = charAt(0);
|
char c = charAt(0);
|
||||||
return c;
|
return c;
|
||||||
@ -65,7 +62,6 @@ int StreamString::peek()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StreamString::flush()
|
void StreamString::flush() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,9 +65,12 @@ long random(long howsmall, long howbig)
|
|||||||
return random(diff) + howsmall;
|
return random(diff) + howsmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
long map(long x, long in_min, long in_max, long out_min, long out_max)
|
long map(long x, long in_min, long in_max, long out_min, long out_max) {
|
||||||
{
|
long divisor = (in_max - in_min);
|
||||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_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)
|
unsigned int makeWord(unsigned int w)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <pgmspace.h>
|
#include <pgmspace.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
// An inherited class for holding the result of a concatenation. These
|
// An inherited class for holding the result of a concatenation. These
|
||||||
// result objects are assumed to be writable by subsequent concatenations.
|
// result objects are assumed to be writable by subsequent concatenations.
|
||||||
@ -35,295 +36,292 @@ class StringSumHelper;
|
|||||||
// an abstract class used as a means to proide a unique pointer type
|
// an abstract class used as a means to proide a unique pointer type
|
||||||
// but really has no body
|
// but really has no body
|
||||||
class __FlashStringHelper;
|
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
|
// The string class
|
||||||
class String
|
class String {
|
||||||
{
|
// use a function pointer to allow for "if (s)" without the
|
||||||
// use a function pointer to allow for "if (s)" without the
|
// complications of an operator bool(). for more information, see:
|
||||||
// complications of an operator bool(). for more information, see:
|
// http://www.artima.com/cppsource/safebool.html
|
||||||
// http://www.artima.com/cppsource/safebool.html
|
typedef void (String::*StringIfHelperType)() const;
|
||||||
typedef void (String::*StringIfHelperType)() const;
|
void StringIfHelper() 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;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// creates a copy of the assigned value. if the value is null or
|
public:
|
||||||
// invalid, or if the memory allocation fails, the string will be
|
// constructors
|
||||||
// marked as invalid ("if (s)" will be false).
|
// creates a copy of the initial value.
|
||||||
String & operator =(const String &rhs);
|
// if the initial value is null or invalid, or if memory allocation
|
||||||
String & operator =(const char *cstr);
|
// fails, the string will be marked as invalid (i.e. "if (s)" will
|
||||||
String & operator = (const __FlashStringHelper *str);
|
// be false).
|
||||||
|
String(const char *cstr = "");
|
||||||
|
String(const String &str);
|
||||||
|
String(const __FlashStringHelper *str);
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
String & operator =(String &&rval);
|
String(String &&rval);
|
||||||
String & operator =(StringSumHelper &&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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
#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
|
// returns true on success, false on failure (in which case, the string
|
||||||
// is left unchanged). if the argument is null or invalid, the
|
// is left unchanged). if the argument is null or invalid, the
|
||||||
// concatenation is considered unsucessful.
|
// concatenation is considered unsucessful.
|
||||||
unsigned char concat(const String &str);
|
unsigned char concat(const String &str);
|
||||||
unsigned char concat(const char *cstr);
|
unsigned char concat(const char *cstr);
|
||||||
unsigned char concat(char c);
|
unsigned char concat(char c);
|
||||||
unsigned char concat(unsigned char c);
|
unsigned char concat(unsigned char c);
|
||||||
unsigned char concat(int num);
|
unsigned char concat(int num);
|
||||||
unsigned char concat(unsigned int num);
|
unsigned char concat(unsigned int num);
|
||||||
unsigned char concat(long num);
|
unsigned char concat(long num);
|
||||||
unsigned char concat(unsigned long num);
|
unsigned char concat(unsigned long num);
|
||||||
unsigned char concat(float num);
|
unsigned char concat(float num);
|
||||||
unsigned char concat(double num);
|
unsigned char concat(double num);
|
||||||
unsigned char concat(const __FlashStringHelper * str);
|
unsigned char concat(const __FlashStringHelper * str);
|
||||||
|
|
||||||
// if there's not enough memory for the concatenated value, the string
|
// if there's not enough memory for the concatenated value, the string
|
||||||
// will be left unchanged (but this isn't signalled in any way)
|
// will be left unchanged (but this isn't signalled in any way)
|
||||||
String & operator +=(const String &rhs)
|
String & operator +=(const String &rhs) {
|
||||||
{
|
concat(rhs);
|
||||||
concat(rhs);
|
return (*this);
|
||||||
return (*this);
|
}
|
||||||
}
|
String & operator +=(const char *cstr) {
|
||||||
String & operator +=(const char *cstr)
|
concat(cstr);
|
||||||
{
|
return (*this);
|
||||||
concat(cstr);
|
}
|
||||||
return (*this);
|
String & operator +=(char c) {
|
||||||
}
|
concat(c);
|
||||||
String & operator +=(char c)
|
return (*this);
|
||||||
{
|
}
|
||||||
concat(c);
|
String & operator +=(unsigned char num) {
|
||||||
return (*this);
|
concat(num);
|
||||||
}
|
return (*this);
|
||||||
String & operator +=(unsigned char num)
|
}
|
||||||
{
|
String & operator +=(int num) {
|
||||||
concat(num);
|
concat(num);
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
String & operator +=(int num)
|
String & operator +=(unsigned int num) {
|
||||||
{
|
concat(num);
|
||||||
concat(num);
|
return (*this);
|
||||||
return (*this);
|
}
|
||||||
}
|
String & operator +=(long num) {
|
||||||
String & operator +=(unsigned int num)
|
concat(num);
|
||||||
{
|
return (*this);
|
||||||
concat(num);
|
}
|
||||||
return (*this);
|
String & operator +=(unsigned long num) {
|
||||||
}
|
concat(num);
|
||||||
String & operator +=(long num)
|
return (*this);
|
||||||
{
|
}
|
||||||
concat(num);
|
String & operator +=(float num) {
|
||||||
return (*this);
|
concat(num);
|
||||||
}
|
return (*this);
|
||||||
String & operator +=(unsigned long num)
|
}
|
||||||
{
|
String & operator +=(double num) {
|
||||||
concat(num);
|
concat(num);
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
String & operator +=(float num)
|
String & operator += (const __FlashStringHelper *str){
|
||||||
{
|
concat(str);
|
||||||
concat(num);
|
return (*this);
|
||||||
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 String &rhs);
|
||||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, const char *cstr);
|
friend StringSumHelper & operator +(const StringSumHelper &lhs, const char *cstr);
|
||||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, char c);
|
friend StringSumHelper & operator +(const StringSumHelper &lhs, char c);
|
||||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned char num);
|
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned char num);
|
||||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, int num);
|
friend StringSumHelper & operator +(const StringSumHelper &lhs, int num);
|
||||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned 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, long num);
|
||||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned 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, float num);
|
||||||
friend StringSumHelper & operator +(const StringSumHelper &lhs, double 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 __FlashStringHelper *rhs);
|
||||||
|
|
||||||
// comparison (only works w/ Strings and "strings")
|
// comparison (only works w/ Strings and "strings")
|
||||||
operator StringIfHelperType() const
|
operator StringIfHelperType() const {
|
||||||
{
|
return buffer() ? &String::StringIfHelper : 0;
|
||||||
return buffer ? &String::StringIfHelper : 0;
|
}
|
||||||
}
|
int compareTo(const String &s) const;
|
||||||
int compareTo(const String &s) const;
|
unsigned char equals(const String &s) const;
|
||||||
unsigned char equals(const String &s) const;
|
unsigned char equals(const char *cstr) const;
|
||||||
unsigned char equals(const char *cstr) const;
|
unsigned char operator ==(const String &rhs) const {
|
||||||
unsigned char operator ==(const String &rhs) const
|
return equals(rhs);
|
||||||
{
|
}
|
||||||
return equals(rhs);
|
unsigned char operator ==(const char *cstr) const {
|
||||||
}
|
return equals(cstr);
|
||||||
unsigned char operator ==(const char *cstr) const
|
}
|
||||||
{
|
unsigned char operator !=(const String &rhs) const {
|
||||||
return equals(cstr);
|
return !equals(rhs);
|
||||||
}
|
}
|
||||||
unsigned char operator !=(const String &rhs) const
|
unsigned char operator !=(const char *cstr) const {
|
||||||
{
|
return !equals(cstr);
|
||||||
return !equals(rhs);
|
}
|
||||||
}
|
unsigned char operator <(const String &rhs) const;
|
||||||
unsigned char operator !=(const char *cstr) const
|
unsigned char operator >(const String &rhs) const;
|
||||||
{
|
unsigned char operator <=(const String &rhs) const;
|
||||||
return !equals(cstr);
|
unsigned char operator >=(const String &rhs) const;
|
||||||
}
|
unsigned char equalsIgnoreCase(const String &s) const;
|
||||||
unsigned char operator <(const String &rhs) const;
|
unsigned char equalsConstantTime(const String &s) const;
|
||||||
unsigned char operator >(const String &rhs) const;
|
unsigned char startsWith(const String &prefix) const;
|
||||||
unsigned char operator <=(const String &rhs) const;
|
unsigned char startsWith(const String &prefix, unsigned int offset) const;
|
||||||
unsigned char operator >=(const String &rhs) const;
|
unsigned char endsWith(const String &suffix) 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
|
// character acccess
|
||||||
char charAt(unsigned int index) const;
|
char charAt(unsigned int index) const;
|
||||||
void setCharAt(unsigned int index, char c);
|
void setCharAt(unsigned int index, char c);
|
||||||
char operator [](unsigned int index) const;
|
char operator [](unsigned int index) const;
|
||||||
char& operator [](unsigned int index);
|
char& operator [](unsigned int index);
|
||||||
void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index = 0) const;
|
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
|
void toCharArray(char *buf, unsigned int bufsize, unsigned int index = 0) const {
|
||||||
{
|
getBytes((unsigned char *) buf, bufsize, index);
|
||||||
getBytes((unsigned char *) buf, bufsize, index);
|
}
|
||||||
}
|
const char* c_str() const { return buffer(); }
|
||||||
const char * c_str() const
|
char* begin() { return wbuffer(); }
|
||||||
{
|
char* end() { return wbuffer() + length(); }
|
||||||
return buffer;
|
const char* begin() const { return c_str(); }
|
||||||
}
|
const char* end() const { return c_str() + length(); }
|
||||||
|
|
||||||
// search
|
// search
|
||||||
int indexOf(char ch) const;
|
int indexOf(char ch) const;
|
||||||
int indexOf(char ch, unsigned int fromIndex) const;
|
int indexOf(char ch, unsigned int fromIndex) const;
|
||||||
int indexOf(const String &str) const;
|
int indexOf(const String &str) const;
|
||||||
int indexOf(const String &str, unsigned int fromIndex) const;
|
int indexOf(const String &str, unsigned int fromIndex) const;
|
||||||
int lastIndexOf(char ch) const;
|
int lastIndexOf(char ch) const;
|
||||||
int lastIndexOf(char ch, unsigned int fromIndex) const;
|
int lastIndexOf(char ch, unsigned int fromIndex) const;
|
||||||
int lastIndexOf(const String &str) const;
|
int lastIndexOf(const String &str) const;
|
||||||
int lastIndexOf(const String &str, unsigned int fromIndex) const;
|
int lastIndexOf(const String &str, unsigned int fromIndex) const;
|
||||||
String substring(unsigned int beginIndex) const
|
String substring(unsigned int beginIndex) const {
|
||||||
{
|
return substring(beginIndex, len());
|
||||||
return substring(beginIndex, len);
|
}
|
||||||
}
|
;
|
||||||
;
|
String substring(unsigned int beginIndex, unsigned int endIndex) const;
|
||||||
String substring(unsigned int beginIndex, unsigned int endIndex) const;
|
|
||||||
|
|
||||||
// modification
|
// modification
|
||||||
void replace(char find, char replace);
|
void replace(char find, char replace);
|
||||||
void replace(const String& find, const String& replace);
|
void replace(const String& find, const String& replace);
|
||||||
void remove(unsigned int index);
|
void remove(unsigned int index);
|
||||||
void remove(unsigned int index, unsigned int count);
|
void remove(unsigned int index, unsigned int count);
|
||||||
void toLowerCase(void);
|
void toLowerCase(void);
|
||||||
void toUpperCase(void);
|
void toUpperCase(void);
|
||||||
void trim(void);
|
void trim(void);
|
||||||
|
|
||||||
// parsing/conversion
|
// parsing/conversion
|
||||||
long toInt(void) const;
|
long toInt(void) const;
|
||||||
float toFloat(void) const;
|
float toFloat(void) const;
|
||||||
double toDouble(void) const;
|
double toDouble(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
char *buffer; // the actual char array
|
// Contains the string info when we're not in SSO mode
|
||||||
unsigned int capacity; // the array length minus one (for the '\0')
|
struct _ptr {
|
||||||
unsigned int len; // the String length (not counting the '\0')
|
char * buff;
|
||||||
protected:
|
uint16_t cap;
|
||||||
void init(void);
|
uint16_t len;
|
||||||
void invalidate(void);
|
};
|
||||||
unsigned char changeBuffer(unsigned int maxStrLen);
|
|
||||||
unsigned char concat(const char *cstr, unsigned int length);
|
|
||||||
|
|
||||||
// copy and move
|
// SSO is handled by checking the last byte of sso_buff.
|
||||||
String & copy(const char *cstr, unsigned int length);
|
// When not in SSO mode, that byte is set to 0xff, while when in SSO mode it is always 0x00 (so it can serve as the string terminator as well as a flag)
|
||||||
String & copy(const __FlashStringHelper *pstr, unsigned int length);
|
// This allows strings up up to 12 (11 + \0 termination) without any extra space.
|
||||||
|
enum { SSOSIZE = sizeof(struct _ptr) + 4 }; // Characters to allocate space for SSO, must be 12 or more
|
||||||
|
enum { CAPACITY_MAX = 65535 }; // If size of capacity changed, be sure to update this enum
|
||||||
|
union {
|
||||||
|
struct _ptr ptr;
|
||||||
|
char sso_buf[SSOSIZE];
|
||||||
|
};
|
||||||
|
// Accessor functions
|
||||||
|
inline bool sso() const { return sso_buf[SSOSIZE - 1] == 0; }
|
||||||
|
inline unsigned int len() const { return sso() ? strlen(sso_buf) : ptr.len; }
|
||||||
|
inline unsigned int capacity() const { return sso() ? SSOSIZE - 1 : ptr.cap; }
|
||||||
|
inline void setSSO(bool sso) { sso_buf[SSOSIZE - 1] = sso ? 0x00 : 0xff; }
|
||||||
|
inline void setLen(int len) { if (!sso()) ptr.len = len; }
|
||||||
|
inline void setCapacity(int cap) { if (!sso()) ptr.cap = cap; }
|
||||||
|
inline void setBuffer(char *buff) { if (!sso()) ptr.buff = buff; }
|
||||||
|
// Buffer accessor functions
|
||||||
|
inline const char *buffer() const { return (const char *)(sso() ? sso_buf : ptr.buff); }
|
||||||
|
inline char *wbuffer() const { return sso() ? const_cast<char *>(sso_buf) : ptr.buff; } // Writable version of buffer
|
||||||
|
|
||||||
|
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__
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
void move(String &rhs);
|
void move(String &rhs);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class StringSumHelper: public String
|
class StringSumHelper: public String {
|
||||||
{
|
public:
|
||||||
public:
|
StringSumHelper(const String &s) :
|
||||||
StringSumHelper(const String &s) :
|
String(s) {
|
||||||
String(s)
|
}
|
||||||
{
|
StringSumHelper(const char *p) :
|
||||||
}
|
String(p) {
|
||||||
StringSumHelper(const char *p) :
|
}
|
||||||
String(p)
|
StringSumHelper(char c) :
|
||||||
{
|
String(c) {
|
||||||
}
|
}
|
||||||
StringSumHelper(char c) :
|
StringSumHelper(unsigned char num) :
|
||||||
String(c)
|
String(num) {
|
||||||
{
|
}
|
||||||
}
|
StringSumHelper(int num) :
|
||||||
StringSumHelper(unsigned char num) :
|
String(num) {
|
||||||
String(num)
|
}
|
||||||
{
|
StringSumHelper(unsigned int num) :
|
||||||
}
|
String(num) {
|
||||||
StringSumHelper(int num) :
|
}
|
||||||
String(num)
|
StringSumHelper(long num) :
|
||||||
{
|
String(num) {
|
||||||
}
|
}
|
||||||
StringSumHelper(unsigned int num) :
|
StringSumHelper(unsigned long num) :
|
||||||
String(num)
|
String(num) {
|
||||||
{
|
}
|
||||||
}
|
StringSumHelper(float num) :
|
||||||
StringSumHelper(long num) :
|
String(num) {
|
||||||
String(num)
|
}
|
||||||
{
|
StringSumHelper(double 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 // __cplusplus
|
||||||
#endif // String_class_h
|
#endif // String_class_h
|
||||||
|
@ -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
|
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();
|
portTickType tBefore=xTaskGetTickCount();
|
||||||
#endif
|
#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);
|
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();
|
portTickType tAfter=xTaskGetTickCount();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -665,7 +665,6 @@ static void IRAM_ATTR _rmt_isr(void* arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (intr_val & _INT_ERROR(ch)) {
|
if (intr_val & _INT_ERROR(ch)) {
|
||||||
digitalWrite(2, 1);
|
|
||||||
// clear the flag
|
// clear the flag
|
||||||
RMT.int_clr.val = _INT_ERROR(ch);
|
RMT.int_clr.val = _INT_ERROR(ch);
|
||||||
RMT.int_ena.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));
|
READ_PERI_REG(UART_FIFO_REG(uart->num));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xQueueReset(uart->queue);
|
||||||
|
|
||||||
UART_MUTEX_UNLOCK();
|
UART_MUTEX_UNLOCK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ typedef unsigned long prog_uint32_t;
|
|||||||
#define PROGMEM
|
#define PROGMEM
|
||||||
#define PGM_P const char *
|
#define PGM_P const char *
|
||||||
#define PGM_VOID_P const void *
|
#define PGM_VOID_P const void *
|
||||||
#define FPSTR(p) ((const char *)(p))
|
|
||||||
#define PSTR(s) (s)
|
#define PSTR(s) (s)
|
||||||
#define _SFR_BYTE(n) (n)
|
#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`
|
- 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
|
- Restart Arduino IDE
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
Installation instructions for using PlatformIO
|
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)
|
- [What is PlatformIO?](https://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 IDE](https://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)
|
- [PlatformIO Core](https://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) -
|
- [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
|
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
|
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) {
|
if(_handler) {
|
||||||
AsyncUDPPacket packet(this, this_pb, addr, port, netif);
|
AsyncUDPPacket packet(this, this_pb, addr, port, netif);
|
||||||
_handler(packet);
|
_handler(packet);
|
||||||
|
} else {
|
||||||
|
pbuf_free(this_pb);
|
||||||
}
|
}
|
||||||
pbuf_free(this_pb);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <malloc.h>
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
#include "esp32-hal-log.h"
|
#include "esp32-hal-log.h"
|
||||||
#endif
|
#endif
|
||||||
@ -83,13 +84,11 @@ esp_bd_addr_t *BLEAddress::getNative() {
|
|||||||
* @return The string representation of the address.
|
* @return The string representation of the address.
|
||||||
*/
|
*/
|
||||||
std::string BLEAddress::toString() {
|
std::string BLEAddress::toString() {
|
||||||
std::stringstream stream;
|
auto size = 18;
|
||||||
stream << std::setfill('0') << std::setw(2) << std::hex << (int) ((uint8_t*) (m_address))[0] << ':';
|
char *res = (char*)malloc(size);
|
||||||
stream << std::setfill('0') << std::setw(2) << std::hex << (int) ((uint8_t*) (m_address))[1] << ':';
|
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]);
|
||||||
stream << std::setfill('0') << std::setw(2) << std::hex << (int) ((uint8_t*) (m_address))[2] << ':';
|
std::string ret(res);
|
||||||
stream << std::setfill('0') << std::setw(2) << std::hex << (int) ((uint8_t*) (m_address))[3] << ':';
|
free(res);
|
||||||
stream << std::setfill('0') << std::setw(2) << std::hex << (int) ((uint8_t*) (m_address))[4] << ':';
|
return ret;
|
||||||
stream << std::setfill('0') << std::setw(2) << std::hex << (int) ((uint8_t*) (m_address))[5];
|
|
||||||
return stream.str();
|
|
||||||
} // toString
|
} // toString
|
||||||
#endif
|
#endif
|
||||||
|
@ -484,23 +484,29 @@ void BLEAdvertisedDevice::setTXPower(int8_t txPower) {
|
|||||||
* @return A string representation of this device.
|
* @return A string representation of this device.
|
||||||
*/
|
*/
|
||||||
std::string BLEAdvertisedDevice::toString() {
|
std::string BLEAdvertisedDevice::toString() {
|
||||||
std::stringstream ss;
|
std::string res = "Name: " + getName() + ", Address: " + getAddress().toString();
|
||||||
ss << "Name: " << getName() << ", Address: " << getAddress().toString();
|
|
||||||
if (haveAppearance()) {
|
if (haveAppearance()) {
|
||||||
ss << ", appearance: " << getAppearance();
|
char val[6];
|
||||||
|
snprintf(val, sizeof(val), "%d", getAppearance());
|
||||||
|
res += ", appearance: ";
|
||||||
|
res += val;
|
||||||
}
|
}
|
||||||
if (haveManufacturerData()) {
|
if (haveManufacturerData()) {
|
||||||
char *pHex = BLEUtils::buildHexData(nullptr, (uint8_t*)getManufacturerData().data(), getManufacturerData().length());
|
char *pHex = BLEUtils::buildHexData(nullptr, (uint8_t*)getManufacturerData().data(), getManufacturerData().length());
|
||||||
ss << ", manufacturer data: " << pHex;
|
res += ", manufacturer data: ";
|
||||||
|
res += pHex;
|
||||||
free(pHex);
|
free(pHex);
|
||||||
}
|
}
|
||||||
if (haveServiceUUID()) {
|
if (haveServiceUUID()) {
|
||||||
ss << ", serviceUUID: " << getServiceUUID().toString();
|
res += ", serviceUUID: " + getServiceUUID().toString();
|
||||||
}
|
}
|
||||||
if (haveTXPower()) {
|
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
|
} // toString
|
||||||
|
|
||||||
uint8_t* BLEAdvertisedDevice::getPayload() {
|
uint8_t* BLEAdvertisedDevice::getPayload() {
|
||||||
|
@ -253,6 +253,27 @@ void BLEAdvertising::stop() {
|
|||||||
log_v("<< stop");
|
log_v("<< stop");
|
||||||
} // 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.
|
* @brief Add data to the payload to be advertised.
|
||||||
* @param [in] data The data to be added to the payload.
|
* @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: {
|
case ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT: {
|
||||||
log_i("STOP advertising");
|
log_i("STOP advertising");
|
||||||
start();
|
//start();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -58,6 +58,7 @@ public:
|
|||||||
void setScanFilter(bool scanRequertWhitelistOnly, bool connectWhitelistOnly);
|
void setScanFilter(bool scanRequertWhitelistOnly, bool connectWhitelistOnly);
|
||||||
void setScanResponseData(BLEAdvertisementData& advertisementData);
|
void setScanResponseData(BLEAdvertisementData& advertisementData);
|
||||||
void setPrivateAddress(esp_ble_addr_type_t type = BLE_ADDR_TYPE_RANDOM);
|
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 handleGAPEvent(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t* param);
|
||||||
void setMinPreferred(uint16_t);
|
void setMinPreferred(uint16_t);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#define NULL_HANDLE (0xffff)
|
#define NULL_HANDLE (0xffff)
|
||||||
|
|
||||||
|
static BLECharacteristicCallbacks defaultCallback; //null-object-pattern
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a characteristic
|
* @brief Construct a characteristic
|
||||||
@ -40,7 +41,7 @@ BLECharacteristic::BLECharacteristic(BLEUUID uuid, uint32_t properties) {
|
|||||||
m_bleUUID = uuid;
|
m_bleUUID = uuid;
|
||||||
m_handle = NULL_HANDLE;
|
m_handle = NULL_HANDLE;
|
||||||
m_properties = (esp_gatt_char_prop_t)0;
|
m_properties = (esp_gatt_char_prop_t)0;
|
||||||
m_pCallbacks = nullptr;
|
m_pCallbacks = &defaultCallback;
|
||||||
|
|
||||||
setBroadcastProperty((properties & PROPERTY_BROADCAST) != 0);
|
setBroadcastProperty((properties & PROPERTY_BROADCAST) != 0);
|
||||||
setReadProperty((properties & PROPERTY_READ) != 0);
|
setReadProperty((properties & PROPERTY_READ) != 0);
|
||||||
@ -220,9 +221,7 @@ void BLECharacteristic::handleGATTServerEvent(
|
|||||||
case ESP_GATTS_EXEC_WRITE_EVT: {
|
case ESP_GATTS_EXEC_WRITE_EVT: {
|
||||||
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC) {
|
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC) {
|
||||||
m_value.commit();
|
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 {
|
} else {
|
||||||
m_value.cancel();
|
m_value.cancel();
|
||||||
}
|
}
|
||||||
@ -307,7 +306,7 @@ void BLECharacteristic::handleGATTServerEvent(
|
|||||||
}
|
}
|
||||||
} // Response needed
|
} // 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.
|
m_pCallbacks->onWrite(this); // Invoke the onWrite callback handler.
|
||||||
}
|
}
|
||||||
} // Match on handles.
|
} // Match on handles.
|
||||||
@ -378,6 +377,10 @@ void BLECharacteristic::handleGATTServerEvent(
|
|||||||
}
|
}
|
||||||
} else { // read.is_long == false
|
} 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();
|
std::string value = m_value.getValue();
|
||||||
|
|
||||||
if (value.length() + 1 > maxOffset) {
|
if (value.length() + 1 > maxOffset) {
|
||||||
@ -392,10 +395,6 @@ void BLECharacteristic::handleGATTServerEvent(
|
|||||||
rsp.attr_value.offset = 0;
|
rsp.attr_value.offset = 0;
|
||||||
memcpy(rsp.attr_value.value, value.data(), rsp.attr_value.len);
|
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.handle = param->read.handle;
|
||||||
rsp.attr_value.auth_req = ESP_GATT_AUTH_REQ_NONE;
|
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() != nullptr);
|
||||||
assert(getService()->getServer() != 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());
|
GeneralUtils::hexDump((uint8_t*)m_value.getValue().data(), m_value.getValue().length());
|
||||||
|
|
||||||
if (getService()->getServer()->getConnectedCount() == 0) {
|
if (getService()->getServer()->getConnectedCount() == 0) {
|
||||||
log_v("<< notify: No connected clients.");
|
log_v("<< notify: No connected clients.");
|
||||||
|
m_pCallbacks->onStatus(this, BLECharacteristicCallbacks::Status::ERROR_NO_CLIENT, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,12 +496,14 @@ void BLECharacteristic::notify(bool is_notification) {
|
|||||||
if(is_notification) {
|
if(is_notification) {
|
||||||
if (p2902 != nullptr && !p2902->getNotifications()) {
|
if (p2902 != nullptr && !p2902->getNotifications()) {
|
||||||
log_v("<< notifications disabled; ignoring");
|
log_v("<< notifications disabled; ignoring");
|
||||||
|
m_pCallbacks->onStatus(this, BLECharacteristicCallbacks::Status::ERROR_NOTIFY_DISABLED, 0); // Invoke the notify callback.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (p2902 != nullptr && !p2902->getIndications()) {
|
if (p2902 != nullptr && !p2902->getIndications()) {
|
||||||
log_v("<< indications disabled; ignoring");
|
log_v("<< indications disabled; ignoring");
|
||||||
|
m_pCallbacks->onStatus(this, BLECharacteristicCallbacks::Status::ERROR_INDICATE_DISABLED, 0); // Invoke the notify callback.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -510,7 +514,7 @@ void BLECharacteristic::notify(bool is_notification) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t length = m_value.getValue().length();
|
size_t length = m_value.getValue().length();
|
||||||
if(!is_notification)
|
if(!is_notification) // is indication
|
||||||
m_semaphoreConfEvt.take("indicate");
|
m_semaphoreConfEvt.take("indicate");
|
||||||
esp_err_t errRc = ::esp_ble_gatts_send_indicate(
|
esp_err_t errRc = ::esp_ble_gatts_send_indicate(
|
||||||
getService()->getServer()->getGattsIf(),
|
getService()->getServer()->getGattsIf(),
|
||||||
@ -519,10 +523,23 @@ void BLECharacteristic::notify(bool is_notification) {
|
|||||||
if (errRc != ESP_OK) {
|
if (errRc != ESP_OK) {
|
||||||
log_e("<< esp_ble_gatts_send_ %s: rc=%d %s",is_notification?"notify":"indicate", errRc, GeneralUtils::errorToString(errRc));
|
log_e("<< esp_ble_gatts_send_ %s: rc=%d %s",is_notification?"notify":"indicate", errRc, GeneralUtils::errorToString(errRc));
|
||||||
m_semaphoreConfEvt.give();
|
m_semaphoreConfEvt.give();
|
||||||
|
m_pCallbacks->onStatus(this, BLECharacteristicCallbacks::Status::ERROR_GATT, errRc); // Invoke the notify callback.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!is_notification)
|
if(!is_notification){ // is indication
|
||||||
m_semaphoreConfEvt.wait("indicate");
|
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");
|
log_v("<< notify");
|
||||||
} // Notify
|
} // Notify
|
||||||
@ -551,7 +568,11 @@ void BLECharacteristic::setBroadcastProperty(bool value) {
|
|||||||
*/
|
*/
|
||||||
void BLECharacteristic::setCallbacks(BLECharacteristicCallbacks* pCallbacks) {
|
void BLECharacteristic::setCallbacks(BLECharacteristicCallbacks* pCallbacks) {
|
||||||
log_v(">> setCallbacks: 0x%x", (uint32_t)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");
|
log_v("<< setCallbacks");
|
||||||
} // 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);
|
log_e("Size %d too large, must be no bigger than %d", length, ESP_GATT_MAX_ATTR_LEN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_semaphoreSetValue.take();
|
||||||
m_value.setValue(data, length);
|
m_value.setValue(data, length);
|
||||||
|
m_semaphoreSetValue.give();
|
||||||
log_v("<< setValue");
|
log_v("<< setValue");
|
||||||
} // setValue
|
} // setValue
|
||||||
|
|
||||||
@ -715,17 +738,18 @@ void BLECharacteristic::setWriteProperty(bool value) {
|
|||||||
* @return A string representation of the characteristic.
|
* @return A string representation of the characteristic.
|
||||||
*/
|
*/
|
||||||
std::string BLECharacteristic::toString() {
|
std::string BLECharacteristic::toString() {
|
||||||
std::stringstream stringstream;
|
std::string res = "UUID: " + m_bleUUID.toString() + ", handle : 0x";
|
||||||
stringstream << std::hex << std::setfill('0');
|
char hex[5];
|
||||||
stringstream << "UUID: " << m_bleUUID.toString() + ", handle: 0x" << std::setw(2) << m_handle;
|
snprintf(hex, sizeof(hex), "%04x", m_handle);
|
||||||
stringstream << " " <<
|
res += hex;
|
||||||
((m_properties & ESP_GATT_CHAR_PROP_BIT_READ) ? "Read " : "") <<
|
res += " ";
|
||||||
((m_properties & ESP_GATT_CHAR_PROP_BIT_WRITE) ? "Write " : "") <<
|
if (m_properties & ESP_GATT_CHAR_PROP_BIT_READ) res += "Read ";
|
||||||
((m_properties & ESP_GATT_CHAR_PROP_BIT_WRITE_NR) ? "WriteNoResponse " : "") <<
|
if (m_properties & ESP_GATT_CHAR_PROP_BIT_WRITE) res += "Write ";
|
||||||
((m_properties & ESP_GATT_CHAR_PROP_BIT_BROADCAST) ? "Broadcast " : "") <<
|
if (m_properties & ESP_GATT_CHAR_PROP_BIT_WRITE_NR) res += "WriteNoResponse ";
|
||||||
((m_properties & ESP_GATT_CHAR_PROP_BIT_NOTIFY) ? "Notify " : "") <<
|
if (m_properties & ESP_GATT_CHAR_PROP_BIT_BROADCAST) res += "Broadcast ";
|
||||||
((m_properties & ESP_GATT_CHAR_PROP_BIT_INDICATE) ? "Indicate " : "");
|
if (m_properties & ESP_GATT_CHAR_PROP_BIT_NOTIFY) res += "Notify ";
|
||||||
return stringstream.str();
|
if (m_properties & ESP_GATT_CHAR_PROP_BIT_INDICATE) res += "Indicate ";
|
||||||
|
return res;
|
||||||
} // toString
|
} // toString
|
||||||
|
|
||||||
|
|
||||||
@ -751,4 +775,27 @@ void BLECharacteristicCallbacks::onWrite(BLECharacteristic* pCharacteristic) {
|
|||||||
log_d("BLECharacteristicCallbacks", "<< onWrite");
|
log_d("BLECharacteristicCallbacks", "<< onWrite");
|
||||||
} // 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 */
|
#endif /* CONFIG_BT_ENABLED */
|
||||||
|
@ -90,6 +90,8 @@ public:
|
|||||||
static const uint32_t PROPERTY_INDICATE = 1<<4;
|
static const uint32_t PROPERTY_INDICATE = 1<<4;
|
||||||
static const uint32_t PROPERTY_WRITE_NR = 1<<5;
|
static const uint32_t PROPERTY_WRITE_NR = 1<<5;
|
||||||
|
|
||||||
|
static const uint32_t indicationTimeout = 1000;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
friend class BLEServer;
|
friend class BLEServer;
|
||||||
@ -117,6 +119,7 @@ private:
|
|||||||
void setHandle(uint16_t handle);
|
void setHandle(uint16_t handle);
|
||||||
FreeRTOS::Semaphore m_semaphoreCreateEvt = FreeRTOS::Semaphore("CreateEvt");
|
FreeRTOS::Semaphore m_semaphoreCreateEvt = FreeRTOS::Semaphore("CreateEvt");
|
||||||
FreeRTOS::Semaphore m_semaphoreConfEvt = FreeRTOS::Semaphore("ConfEvt");
|
FreeRTOS::Semaphore m_semaphoreConfEvt = FreeRTOS::Semaphore("ConfEvt");
|
||||||
|
FreeRTOS::Semaphore m_semaphoreSetValue = FreeRTOS::Semaphore("SetValue");
|
||||||
}; // BLECharacteristic
|
}; // BLECharacteristic
|
||||||
|
|
||||||
|
|
||||||
@ -129,9 +132,22 @@ private:
|
|||||||
*/
|
*/
|
||||||
class BLECharacteristicCallbacks {
|
class BLECharacteristicCallbacks {
|
||||||
public:
|
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 ~BLECharacteristicCallbacks();
|
||||||
virtual void onRead(BLECharacteristic* pCharacteristic);
|
virtual void onRead(BLECharacteristic* pCharacteristic);
|
||||||
virtual void onWrite(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 /* CONFIG_BT_ENABLED */
|
||||||
#endif /* COMPONENTS_CPP_UTILS_BLECHARACTERISTIC_H_ */
|
#endif /* COMPONENTS_CPP_UTILS_BLECHARACTERISTIC_H_ */
|
||||||
|
@ -116,17 +116,18 @@ void BLECharacteristicMap::setByUUID(BLECharacteristic* pCharacteristic, BLEUUID
|
|||||||
* @return A string representation of the characteristic map.
|
* @return A string representation of the characteristic map.
|
||||||
*/
|
*/
|
||||||
std::string BLECharacteristicMap::toString() {
|
std::string BLECharacteristicMap::toString() {
|
||||||
std::stringstream stringStream;
|
std::string res;
|
||||||
stringStream << std::hex << std::setfill('0');
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
char hex[5];
|
||||||
for (auto &myPair: m_uuidMap) {
|
for (auto &myPair: m_uuidMap) {
|
||||||
if (count > 0) {
|
if (count > 0) {res += "\n";}
|
||||||
stringStream << "\n";
|
snprintf(hex, sizeof(hex), "%04x", myPair.first->getHandle());
|
||||||
}
|
|
||||||
count++;
|
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
|
} // toString
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,10 +184,11 @@ void BLEClient::gattClientEventHandler(
|
|||||||
if (m_pClientCallbacks != nullptr) {
|
if (m_pClientCallbacks != nullptr) {
|
||||||
m_pClientCallbacks->onDisconnect(this);
|
m_pClientCallbacks->onDisconnect(this);
|
||||||
}
|
}
|
||||||
BLEDevice::removePeerDevice(m_appId, true);
|
|
||||||
esp_ble_gattc_app_unregister(m_gattc_if);
|
esp_ble_gattc_app_unregister(m_gattc_if);
|
||||||
|
m_semaphoreOpenEvt.give(ESP_GATT_IF_NONE);
|
||||||
m_semaphoreRssiCmplEvt.give();
|
m_semaphoreRssiCmplEvt.give();
|
||||||
m_semaphoreSearchCmplEvt.give(1);
|
m_semaphoreSearchCmplEvt.give(1);
|
||||||
|
BLEDevice::removePeerDevice(m_appId, true);
|
||||||
break;
|
break;
|
||||||
} // ESP_GATTC_DISCONNECT_EVT
|
} // ESP_GATTC_DISCONNECT_EVT
|
||||||
|
|
||||||
@ -515,14 +516,13 @@ uint16_t BLEClient::getMTU() {
|
|||||||
* @return A string representation of this client.
|
* @return A string representation of this client.
|
||||||
*/
|
*/
|
||||||
std::string BLEClient::toString() {
|
std::string BLEClient::toString() {
|
||||||
std::ostringstream ss;
|
std::string res = "peer address: " + m_peerAddress.toString();
|
||||||
ss << "peer address: " << m_peerAddress.toString();
|
res += "\nServices:\n";
|
||||||
ss << "\nServices:\n";
|
|
||||||
for (auto &myPair : m_servicesMap) {
|
for (auto &myPair : m_servicesMap) {
|
||||||
ss << myPair.second->toString() << "\n";
|
res += myPair.second->toString() + "\n";
|
||||||
// myPair.second is the value
|
// myPair.second is the value
|
||||||
}
|
}
|
||||||
return ss.str();
|
return res;
|
||||||
} // toString
|
} // toString
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "BLEExceptions.h"
|
//#include "BLEExceptions.h"
|
||||||
#include "BLERemoteService.h"
|
#include "BLERemoteService.h"
|
||||||
#include "BLEService.h"
|
#include "BLEService.h"
|
||||||
#include "BLEAddress.h"
|
#include "BLEAddress.h"
|
||||||
|
@ -255,10 +255,10 @@ void BLEDescriptor::setAccessPermissions(esp_gatt_perm_t perm) {
|
|||||||
* @return A string representation of the descriptor.
|
* @return A string representation of the descriptor.
|
||||||
*/
|
*/
|
||||||
std::string BLEDescriptor::toString() {
|
std::string BLEDescriptor::toString() {
|
||||||
std::stringstream stringstream;
|
char hex[5];
|
||||||
stringstream << std::hex << std::setfill('0');
|
snprintf(hex, sizeof(hex), "%04x", m_handle);
|
||||||
stringstream << "UUID: " << m_bleUUID.toString() + ", handle: 0x" << std::setw(2) << m_handle;
|
std::string res = "UUID: " + m_bleUUID.toString() + ", handle: 0x" + hex;
|
||||||
return stringstream.str();
|
return res;
|
||||||
} // toString
|
} // toString
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,17 +90,18 @@ void BLEDescriptorMap::setByHandle(uint16_t handle, BLEDescriptor* pDescriptor)
|
|||||||
* @return A string representation of the descriptor map.
|
* @return A string representation of the descriptor map.
|
||||||
*/
|
*/
|
||||||
std::string BLEDescriptorMap::toString() {
|
std::string BLEDescriptorMap::toString() {
|
||||||
std::stringstream stringStream;
|
std::string res;
|
||||||
stringStream << std::hex << std::setfill('0');
|
char hex[5];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (auto &myPair : m_uuidMap) {
|
for (auto &myPair : m_uuidMap) {
|
||||||
if (count > 0) {
|
if (count > 0) {res += "\n";}
|
||||||
stringStream << "\n";
|
snprintf(hex, sizeof(hex), "%04x", myPair.first->getHandle());
|
||||||
}
|
|
||||||
count++;
|
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
|
} // toString
|
||||||
|
|
||||||
|
|
||||||
|
@ -479,9 +479,8 @@ gatts_event_handler BLEDevice::m_customGattsHandler = nullptr;
|
|||||||
* @return A string representation of the nature of this device.
|
* @return A string representation of the nature of this device.
|
||||||
*/
|
*/
|
||||||
/* STATIC */ std::string BLEDevice::toString() {
|
/* STATIC */ std::string BLEDevice::toString() {
|
||||||
std::ostringstream oss;
|
std::string res = "BD Address: " + getAddress().toString();
|
||||||
oss << "BD Address: " << getAddress().toString();
|
return res;
|
||||||
return oss.str();
|
|
||||||
} // toString
|
} // toString
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#if defined(CONFIG_BT_ENABLED)
|
#if defined(CONFIG_BT_ENABLED)
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sstream>
|
#include <stdio.h>
|
||||||
#include "esp32-hal-log.h"
|
#include "esp32-hal-log.h"
|
||||||
#include "BLEEddystoneTLM.h"
|
#include "BLEEddystoneTLM.h"
|
||||||
|
|
||||||
@ -54,62 +54,44 @@ uint32_t BLEEddystoneTLM::getTime() {
|
|||||||
} // getTime
|
} // getTime
|
||||||
|
|
||||||
std::string BLEEddystoneTLM::toString() {
|
std::string BLEEddystoneTLM::toString() {
|
||||||
std::stringstream ss;
|
std::string out = "";
|
||||||
std::string out = "";
|
uint32_t rawsec = ENDIAN_CHANGE_U32(m_eddystoneData.tmil);
|
||||||
uint32_t rawsec;
|
char val[6];
|
||||||
ss << "Version ";
|
|
||||||
ss << std::dec << m_eddystoneData.version;
|
|
||||||
ss << "\n";
|
|
||||||
|
|
||||||
ss << "Battery Voltage ";
|
out += "Version " + m_eddystoneData.version;
|
||||||
ss << std::dec << ENDIAN_CHANGE_U16(m_eddystoneData.volt);
|
out += "\n";
|
||||||
ss << " mV\n";
|
out += "Battery Voltage " + ENDIAN_CHANGE_U16(m_eddystoneData.volt);
|
||||||
|
out += " mV\n";
|
||||||
|
|
||||||
ss << "Temperature ";
|
out += "Temperature ";
|
||||||
ss << (float) m_eddystoneData.temp;
|
snprintf(val, sizeof(val), "%d", m_eddystoneData.temp);
|
||||||
ss << " °C\n";
|
out += val;
|
||||||
|
out += ".0 °C\n";
|
||||||
|
|
||||||
ss << "Adv. Count ";
|
out += "Adv. Count ";
|
||||||
ss << std::dec << ENDIAN_CHANGE_U32(m_eddystoneData.advCount);
|
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);
|
snprintf(val, sizeof(val), "%02d", (rawsec / 36000) % 24);
|
||||||
std::stringstream buffstream;
|
out += val;
|
||||||
buffstream << "0000";
|
out += ":";
|
||||||
buffstream << std::dec << rawsec / 864000;
|
|
||||||
std::string buff = buffstream.str();
|
|
||||||
|
|
||||||
ss << buff.substr(buff.length() - 4, buff.length());
|
snprintf(val, sizeof(val), "%02d", (rawsec / 600) % 60);
|
||||||
ss << ".";
|
out += val;
|
||||||
|
out += ":";
|
||||||
|
|
||||||
buffstream.str("");
|
snprintf(val, sizeof(val), "%02d", (rawsec / 10) % 60);
|
||||||
buffstream.clear();
|
out += val;
|
||||||
buffstream << "00";
|
out += "\n";
|
||||||
buffstream << std::dec << (rawsec / 36000) % 24;
|
|
||||||
buff = buffstream.str();
|
|
||||||
ss << buff.substr(buff.length()-2, buff.length());
|
|
||||||
ss << ":";
|
|
||||||
|
|
||||||
buffstream.str("");
|
return out;
|
||||||
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();
|
|
||||||
} // toString
|
} // toString
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
* Author: kolban
|
* Author: kolban
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "BLEExceptions.h"
|
//#include "BLEExceptions.h"
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <esp_err.h>
|
#include <esp_err.h>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "BLEExceptions.h"
|
//#include "BLEExceptions.h"
|
||||||
#include "BLEUtils.h"
|
#include "BLEUtils.h"
|
||||||
#include "GeneralUtils.h"
|
#include "GeneralUtils.h"
|
||||||
#include "BLERemoteDescriptor.h"
|
#include "BLERemoteDescriptor.h"
|
||||||
@ -39,6 +39,7 @@ BLERemoteCharacteristic::BLERemoteCharacteristic(
|
|||||||
m_charProp = charProp;
|
m_charProp = charProp;
|
||||||
m_pRemoteService = pRemoteService;
|
m_pRemoteService = pRemoteService;
|
||||||
m_notifyCallback = nullptr;
|
m_notifyCallback = nullptr;
|
||||||
|
m_rawData = nullptr;
|
||||||
|
|
||||||
retrieveDescriptors(); // Get the descriptors for this characteristic
|
retrieveDescriptors(); // Get the descriptors for this characteristic
|
||||||
log_v("<< BLERemoteCharacteristic");
|
log_v("<< BLERemoteCharacteristic");
|
||||||
@ -399,7 +400,7 @@ std::string BLERemoteCharacteristic::readValue() {
|
|||||||
// Check to see that we are connected.
|
// Check to see that we are connected.
|
||||||
if (!getRemoteService()->getClient()->isConnected()) {
|
if (!getRemoteService()->getClient()->isConnected()) {
|
||||||
log_e("Disconnected");
|
log_e("Disconnected");
|
||||||
throw BLEDisconnectedException();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_semaphoreReadCharEvt.take("readValue");
|
m_semaphoreReadCharEvt.take("readValue");
|
||||||
@ -500,11 +501,16 @@ void BLERemoteCharacteristic::removeDescriptors() {
|
|||||||
* @return a String representation.
|
* @return a String representation.
|
||||||
*/
|
*/
|
||||||
std::string BLERemoteCharacteristic::toString() {
|
std::string BLERemoteCharacteristic::toString() {
|
||||||
std::ostringstream ss;
|
std::string res = "Characteristic: uuid: " + m_uuid.toString();
|
||||||
ss << "Characteristic: uuid: " << m_uuid.toString() <<
|
char val[6];
|
||||||
", handle: " << getHandle() << " 0x" << std::hex << getHandle() <<
|
res += ", handle: ";
|
||||||
", props: " << BLEUtils::characteristicPropertiesToString(m_charProp);
|
snprintf(val, sizeof(val), "%d", getHandle());
|
||||||
return ss.str();
|
res += val;
|
||||||
|
res += " 0x";
|
||||||
|
snprintf(val, sizeof(val), "%04x", getHandle());
|
||||||
|
res += val;
|
||||||
|
res += ", props: " + BLEUtils::characteristicPropertiesToString(m_charProp);
|
||||||
|
return res;
|
||||||
} // toString
|
} // toString
|
||||||
|
|
||||||
|
|
||||||
@ -545,7 +551,7 @@ void BLERemoteCharacteristic::writeValue(uint8_t* data, size_t length, bool resp
|
|||||||
// Check to see that we are connected.
|
// Check to see that we are connected.
|
||||||
if (!getRemoteService()->getClient()->isConnected()) {
|
if (!getRemoteService()->getClient()->isConnected()) {
|
||||||
log_e("Disconnected");
|
log_e("Disconnected");
|
||||||
throw BLEDisconnectedException();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_semaphoreWriteCharEvt.take("writeValue");
|
m_semaphoreWriteCharEvt.take("writeValue");
|
||||||
|
@ -55,7 +55,7 @@ std::string BLERemoteDescriptor::readValue() {
|
|||||||
// Check to see that we are connected.
|
// Check to see that we are connected.
|
||||||
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
|
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
|
||||||
log_e("Disconnected");
|
log_e("Disconnected");
|
||||||
throw BLEDisconnectedException();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_semaphoreReadDescrEvt.take("readValue");
|
m_semaphoreReadDescrEvt.take("readValue");
|
||||||
@ -113,9 +113,12 @@ uint32_t BLERemoteDescriptor::readUInt32() {
|
|||||||
* @retun A string representation of this BLE Remote Descriptor.
|
* @retun A string representation of this BLE Remote Descriptor.
|
||||||
*/
|
*/
|
||||||
std::string BLERemoteDescriptor::toString() {
|
std::string BLERemoteDescriptor::toString() {
|
||||||
std::stringstream ss;
|
char val[6];
|
||||||
ss << "handle: " << getHandle() << ", uuid: " << getUUID().toString();
|
snprintf(val, sizeof(val), "%d", getHandle());
|
||||||
return ss.str();
|
std::string res = "handle: ";
|
||||||
|
res += val;
|
||||||
|
res += ", uuid: " + getUUID().toString();
|
||||||
|
return res;
|
||||||
} // toString
|
} // toString
|
||||||
|
|
||||||
|
|
||||||
@ -130,7 +133,7 @@ void BLERemoteDescriptor::writeValue(uint8_t* data, size_t length, bool response
|
|||||||
// Check to see that we are connected.
|
// Check to see that we are connected.
|
||||||
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
|
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
|
||||||
log_e("Disconnected");
|
log_e("Disconnected");
|
||||||
throw BLEDisconnectedException();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t errRc = ::esp_ble_gattc_write_char_descr(
|
esp_err_t errRc = ::esp_ble_gattc_write_char_descr(
|
||||||
|
@ -164,7 +164,7 @@ void BLERemoteService::retrieveCharacteristics() {
|
|||||||
uint16_t offset = 0;
|
uint16_t offset = 0;
|
||||||
esp_gattc_char_elem_t result;
|
esp_gattc_char_elem_t result;
|
||||||
while (true) {
|
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(
|
esp_gatt_status_t status = ::esp_ble_gattc_get_all_char(
|
||||||
getClient()->getGattcIf(),
|
getClient()->getGattcIf(),
|
||||||
getClient()->getConnId(),
|
getClient()->getConnId(),
|
||||||
@ -317,15 +317,25 @@ void BLERemoteService::setValue(BLEUUID characteristicUuid, std::string value) {
|
|||||||
* @return A string representation of this remote service.
|
* @return A string representation of this remote service.
|
||||||
*/
|
*/
|
||||||
std::string BLERemoteService::toString() {
|
std::string BLERemoteService::toString() {
|
||||||
std::ostringstream ss;
|
std::string res = "Service: uuid: " + m_uuid.toString();
|
||||||
ss << "Service: uuid: " + m_uuid.toString();
|
char val[6];
|
||||||
ss << ", start_handle: " << std::dec << m_startHandle << " 0x" << std::hex << m_startHandle <<
|
res += ", start_handle: ";
|
||||||
", end_handle: " << std::dec << m_endHandle << " 0x" << std::hex << m_endHandle;
|
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) {
|
for (auto &myPair : m_characteristicMap) {
|
||||||
ss << "\n" << myPair.second->toString();
|
res += "\n" + myPair.second->toString();
|
||||||
// myPair.second is the value
|
// myPair.second is the value
|
||||||
}
|
}
|
||||||
return ss.str();
|
return res;
|
||||||
} // toString
|
} // 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
|
conn_params.timeout = timeout; // timeout = 400*10ms = 4000ms
|
||||||
esp_ble_gap_update_conn_params(&conn_params);
|
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
|
#endif // CONFIG_BT_ENABLED
|
||||||
|
@ -72,6 +72,7 @@ public:
|
|||||||
BLEService* getServiceByUUID(const char* uuid);
|
BLEService* getServiceByUUID(const char* uuid);
|
||||||
BLEService* getServiceByUUID(BLEUUID uuid);
|
BLEService* getServiceByUUID(BLEUUID uuid);
|
||||||
bool connect(BLEAddress address);
|
bool connect(BLEAddress address);
|
||||||
|
void disconnect(uint16_t connId);
|
||||||
uint16_t m_appId;
|
uint16_t m_appId;
|
||||||
void updateConnParams(esp_bd_addr_t remote_bda, uint16_t minInterval, uint16_t maxInterval, uint16_t latency, uint16_t timeout);
|
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.
|
* @return A string representation of this service.
|
||||||
*/
|
*/
|
||||||
std::string BLEService::toString() {
|
std::string BLEService::toString() {
|
||||||
std::stringstream stringStream;
|
std::string res = "UUID: " + getUUID().toString();
|
||||||
stringStream << "UUID: " << getUUID().toString() <<
|
char hex[5];
|
||||||
", handle: 0x" << std::hex << std::setfill('0') << std::setw(2) << getHandle();
|
snprintf(hex, sizeof(hex), "%04x", getHandle());
|
||||||
return stringStream.str();
|
res += ", handle: 0x";
|
||||||
|
res += hex;
|
||||||
|
return res;
|
||||||
} // toString
|
} // toString
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#if defined(CONFIG_BT_ENABLED)
|
#if defined(CONFIG_BT_ENABLED)
|
||||||
#include <sstream>
|
#include <stdio.h>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include "BLEService.h"
|
#include "BLEService.h"
|
||||||
|
|
||||||
@ -73,12 +73,15 @@ void BLEServiceMap::setByHandle(uint16_t handle, BLEService* service) {
|
|||||||
* @return A string representation of the service map.
|
* @return A string representation of the service map.
|
||||||
*/
|
*/
|
||||||
std::string BLEServiceMap::toString() {
|
std::string BLEServiceMap::toString() {
|
||||||
std::stringstream stringStream;
|
std::string res;
|
||||||
stringStream << std::hex << std::setfill('0');
|
char hex[5];
|
||||||
for (auto &myPair: m_handleMap) {
|
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
|
} // toString
|
||||||
|
|
||||||
void BLEServiceMap::handleGATTServerEvent(
|
void BLEServiceMap::handleGATTServerEvent(
|
||||||
|
@ -349,51 +349,38 @@ BLEUUID BLEUUID::to128() {
|
|||||||
*/
|
*/
|
||||||
std::string BLEUUID::toString() {
|
std::string BLEUUID::toString() {
|
||||||
if (!m_valueSet) return "<NULL>"; // If we have no value, nothing to format.
|
if (!m_valueSet) return "<NULL>"; // If we have no value, nothing to format.
|
||||||
|
|
||||||
// If the UUIDs are 16 or 32 bit, pad correctly.
|
// 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.
|
if (m_uuid.len == ESP_UUID_LEN_16) { // If the UUID is 16bit, pad correctly.
|
||||||
ss << "0000" <<
|
char hex[5];
|
||||||
std::hex <<
|
snprintf(hex, sizeof(hex), "%04x", m_uuid.uuid.uuid16);
|
||||||
std::setfill('0') <<
|
return std::string(hex) + "-0000-1000-8000-00805f9b34fb";
|
||||||
std::setw(4) <<
|
|
||||||
m_uuid.uuid.uuid16 <<
|
|
||||||
"-0000-1000-8000-00805f9b34fb";
|
|
||||||
return ss.str(); // Return the string
|
|
||||||
} // End 16bit UUID
|
} // End 16bit UUID
|
||||||
|
|
||||||
if (m_uuid.len == ESP_UUID_LEN_32) { // If the UUID is 32bit, pad correctly.
|
if (m_uuid.len == ESP_UUID_LEN_32) { // If the UUID is 32bit, pad correctly.
|
||||||
ss << std::hex <<
|
char hex[9];
|
||||||
std::setfill('0') <<
|
snprintf(hex, sizeof(hex), "%08x", m_uuid.uuid.uuid32);
|
||||||
std::setw(8) <<
|
return std::string(hex) + "-0000-1000-8000-00805f9b34fb";
|
||||||
m_uuid.uuid.uuid32 <<
|
|
||||||
"-0000-1000-8000-00805f9b34fb";
|
|
||||||
return ss.str(); // return the string
|
|
||||||
} // End 32bit UUID
|
} // End 32bit UUID
|
||||||
|
|
||||||
// The UUID is not 16bit or 32bit which means that it is 128bit.
|
// The UUID is not 16bit or 32bit which means that it is 128bit.
|
||||||
//
|
//
|
||||||
// UUID string format:
|
// UUID string format:
|
||||||
// AABBCCDD-EEFF-GGHH-IIJJ-KKLLMMNNOOPP
|
// AABBCCDD-EEFF-GGHH-IIJJ-KKLLMMNNOOPP
|
||||||
ss << std::hex << std::setfill('0') <<
|
auto size = 35;
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[15] <<
|
char *hex = (char *)malloc(size);
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[14] <<
|
snprintf(hex, size, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[13] <<
|
m_uuid.uuid.uuid128[15], m_uuid.uuid.uuid128[14],
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[12] << "-" <<
|
m_uuid.uuid.uuid128[13], m_uuid.uuid.uuid128[12],
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[11] <<
|
m_uuid.uuid.uuid128[11], m_uuid.uuid.uuid128[10],
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[10] << "-" <<
|
m_uuid.uuid.uuid128[9], m_uuid.uuid.uuid128[8],
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[9] <<
|
m_uuid.uuid.uuid128[7], m_uuid.uuid.uuid128[6],
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[8] << "-" <<
|
m_uuid.uuid.uuid128[5], m_uuid.uuid.uuid128[4],
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[7] <<
|
m_uuid.uuid.uuid128[3], m_uuid.uuid.uuid128[2],
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[6] << "-" <<
|
m_uuid.uuid.uuid128[1], m_uuid.uuid.uuid128[0]);
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[5] <<
|
std::string res(hex);
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[4] <<
|
free(hex);
|
||||||
std::setw(2) << (int) m_uuid.uuid.uuid128[3] <<
|
return res;
|
||||||
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();
|
|
||||||
} // toString
|
} // toString
|
||||||
|
|
||||||
#endif /* CONFIG_BT_ENABLED */
|
#endif /* CONFIG_BT_ENABLED */
|
||||||
|
@ -604,26 +604,32 @@ static const gattService_t g_gattServices[] = {
|
|||||||
* @return A string representation of characteristic properties.
|
* @return A string representation of characteristic properties.
|
||||||
*/
|
*/
|
||||||
std::string BLEUtils::characteristicPropertiesToString(esp_gatt_char_prop_t prop) {
|
std::string BLEUtils::characteristicPropertiesToString(esp_gatt_char_prop_t prop) {
|
||||||
std::stringstream stream;
|
std::string res = "broadcast: ";
|
||||||
stream <<
|
res += ((prop & ESP_GATT_CHAR_PROP_BIT_BROADCAST)?"1":"0");
|
||||||
"broadcast: " << ((prop & ESP_GATT_CHAR_PROP_BIT_BROADCAST)?"1":"0") <<
|
res += ", read: ";
|
||||||
", read: " << ((prop & ESP_GATT_CHAR_PROP_BIT_READ)?"1":"0") <<
|
res += ((prop & ESP_GATT_CHAR_PROP_BIT_READ)?"1":"0");
|
||||||
", write_nr: " << ((prop & ESP_GATT_CHAR_PROP_BIT_WRITE_NR)?"1":"0") <<
|
res += ", write_nr: ";
|
||||||
", write: " << ((prop & ESP_GATT_CHAR_PROP_BIT_WRITE)?"1":"0") <<
|
res += ((prop & ESP_GATT_CHAR_PROP_BIT_WRITE_NR)?"1":"0");
|
||||||
", notify: " << ((prop & ESP_GATT_CHAR_PROP_BIT_NOTIFY)?"1":"0") <<
|
res += ", write: ";
|
||||||
", indicate: " << ((prop & ESP_GATT_CHAR_PROP_BIT_INDICATE)?"1":"0") <<
|
res += ((prop & ESP_GATT_CHAR_PROP_BIT_WRITE)?"1":"0");
|
||||||
", auth: " << ((prop & ESP_GATT_CHAR_PROP_BIT_AUTH)?"1":"0");
|
res += ", notify: ";
|
||||||
return stream.str();
|
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
|
} // characteristicPropertiesToString
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Convert an esp_gatt_id_t to a string.
|
* @brief Convert an esp_gatt_id_t to a string.
|
||||||
*/
|
*/
|
||||||
static std::string gattIdToString(esp_gatt_id_t gattId) {
|
static std::string gattIdToString(esp_gatt_id_t gattId) {
|
||||||
std::stringstream stream;
|
std::string res = "uuid: " + BLEUUID(gattId.uuid).toString() + ", inst_id: ";
|
||||||
stream << "uuid: " << BLEUUID(gattId.uuid).toString() << ", inst_id: " << (int)gattId.inst_id;
|
char val[8];
|
||||||
//sprintf(buffer, "uuid: %s, inst_id: %d", uuidToString(gattId.uuid).c_str(), gattId.inst_id);
|
snprintf(val, sizeof(val), "%d", (int)gattId.inst_id);
|
||||||
return stream.str();
|
res += val;
|
||||||
|
return res;
|
||||||
} // gattIdToString
|
} // 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.
|
* @return std::string A string representation of the advertising flags.
|
||||||
*/
|
*/
|
||||||
std::string BLEUtils::adFlagsToString(uint8_t adFlags) {
|
std::string BLEUtils::adFlagsToString(uint8_t adFlags) {
|
||||||
std::stringstream ss;
|
std::string res;
|
||||||
if (adFlags & (1 << 0)) {
|
if (adFlags & (1 << 0)) {
|
||||||
ss << "[LE Limited Discoverable Mode] ";
|
res += "[LE Limited Discoverable Mode] ";
|
||||||
}
|
}
|
||||||
if (adFlags & (1 << 1)) {
|
if (adFlags & (1 << 1)) {
|
||||||
ss << "[LE General Discoverable Mode] ";
|
res += "[LE General Discoverable Mode] ";
|
||||||
}
|
}
|
||||||
if (adFlags & (1 << 2)) {
|
if (adFlags & (1 << 2)) {
|
||||||
ss << "[BR/EDR Not Supported] ";
|
res += "[BR/EDR Not Supported] ";
|
||||||
}
|
}
|
||||||
if (adFlags & (1 << 3)) {
|
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)) {
|
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
|
} // 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.
|
* @return A string representation of a piece of memory.
|
||||||
*/
|
*/
|
||||||
std::string BLEUtils::buildPrintData(uint8_t* source, size_t length) {
|
std::string BLEUtils::buildPrintData(uint8_t* source, size_t length) {
|
||||||
std::ostringstream ss;
|
std::string res;
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
char c = *source;
|
char c = *source;
|
||||||
ss << (isprint(c) ? c : '.');
|
res += (isprint(c) ? c : '.');
|
||||||
source++;
|
source++;
|
||||||
}
|
}
|
||||||
return ss.str();
|
return res;
|
||||||
} // buildPrintData
|
} // buildPrintData
|
||||||
|
|
||||||
|
|
||||||
@ -1848,14 +1854,22 @@ std::string BLEUtils::gattDescriptorUUIDToString(uint32_t descriptorUUID) {
|
|||||||
* @return A string representation of an esp_gattc_service_elem_t.
|
* @return A string representation of an esp_gattc_service_elem_t.
|
||||||
*/
|
*/
|
||||||
std::string BLEUtils::gattcServiceElementToString(esp_gattc_service_elem_t* pGATTCServiceElement) {
|
std::string BLEUtils::gattcServiceElementToString(esp_gattc_service_elem_t* pGATTCServiceElement) {
|
||||||
std::stringstream ss;
|
std::string res;
|
||||||
|
char val[6];
|
||||||
ss << "[uuid: " << BLEUUID(pGATTCServiceElement->uuid).toString() <<
|
res += "[uuid: " + BLEUUID(pGATTCServiceElement->uuid).toString() + ", start_handle: ";
|
||||||
", start_handle: " << pGATTCServiceElement->start_handle <<
|
snprintf(val, sizeof(val), "%d", pGATTCServiceElement->start_handle);
|
||||||
" 0x" << std::hex << pGATTCServiceElement->start_handle <<
|
res += val;
|
||||||
", end_handle: " << std::dec << pGATTCServiceElement->end_handle <<
|
res += " 0x";
|
||||||
" 0x" << std::hex << pGATTCServiceElement->end_handle << "]";
|
snprintf(val, sizeof(val), "%04x", pGATTCServiceElement->start_handle);
|
||||||
return ss.str();
|
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
|
} // gattcServiceElementToString
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,15 +61,13 @@ uint32_t FreeRTOS::getTimeSinceStart() {
|
|||||||
*/
|
*/
|
||||||
uint32_t FreeRTOS::Semaphore::wait(std::string owner) {
|
uint32_t FreeRTOS::Semaphore::wait(std::string owner) {
|
||||||
log_v(">> wait: Semaphore waiting: %s for %s", toString().c_str(), owner.c_str());
|
log_v(">> wait: Semaphore waiting: %s for %s", toString().c_str(), owner.c_str());
|
||||||
|
|
||||||
if (m_usePthreads) {
|
if (m_usePthreads) {
|
||||||
pthread_mutex_lock(&m_pthread_mutex);
|
pthread_mutex_lock(&m_pthread_mutex);
|
||||||
} else {
|
} else {
|
||||||
xSemaphoreTake(m_semaphore, portMAX_DELAY);
|
xSemaphoreTake(m_semaphore, portMAX_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_owner = owner;
|
|
||||||
|
|
||||||
if (m_usePthreads) {
|
if (m_usePthreads) {
|
||||||
pthread_mutex_unlock(&m_pthread_mutex);
|
pthread_mutex_unlock(&m_pthread_mutex);
|
||||||
} else {
|
} else {
|
||||||
@ -77,17 +75,49 @@ uint32_t FreeRTOS::Semaphore::wait(std::string owner) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_v("<< wait: Semaphore released: %s", toString().c_str());
|
log_v("<< wait: Semaphore released: %s", toString().c_str());
|
||||||
m_owner = std::string("<N/A>");
|
|
||||||
return m_value;
|
return m_value;
|
||||||
} // wait
|
} // 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) {
|
FreeRTOS::Semaphore::Semaphore(std::string name) {
|
||||||
m_usePthreads = false; // Are we using pThreads or FreeRTOS?
|
m_usePthreads = false; // Are we using pThreads or FreeRTOS?
|
||||||
if (m_usePthreads) {
|
if (m_usePthreads) {
|
||||||
pthread_mutex_init(&m_pthread_mutex, nullptr);
|
pthread_mutex_init(&m_pthread_mutex, nullptr);
|
||||||
} else {
|
} else {
|
||||||
m_semaphore = xSemaphoreCreateMutex();
|
m_semaphore = xSemaphoreCreateBinary();
|
||||||
|
xSemaphoreGive(m_semaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_name = name;
|
m_name = name;
|
||||||
@ -111,6 +141,8 @@ FreeRTOS::Semaphore::~Semaphore() {
|
|||||||
*/
|
*/
|
||||||
void FreeRTOS::Semaphore::give() {
|
void FreeRTOS::Semaphore::give() {
|
||||||
log_v("Semaphore giving: %s", toString().c_str());
|
log_v("Semaphore giving: %s", toString().c_str());
|
||||||
|
m_owner = std::string("<N/A>");
|
||||||
|
|
||||||
if (m_usePthreads) {
|
if (m_usePthreads) {
|
||||||
pthread_mutex_unlock(&m_pthread_mutex);
|
pthread_mutex_unlock(&m_pthread_mutex);
|
||||||
} else {
|
} else {
|
||||||
@ -120,7 +152,6 @@ void FreeRTOS::Semaphore::give() {
|
|||||||
// FreeRTOS::sleep(10);
|
// FreeRTOS::sleep(10);
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
m_owner = std::string("<N/A>");
|
|
||||||
} // Semaphore::give
|
} // Semaphore::give
|
||||||
|
|
||||||
|
|
||||||
@ -203,9 +234,12 @@ bool FreeRTOS::Semaphore::take(uint32_t timeoutMs, std::string owner) {
|
|||||||
* @return A string representation of the semaphore.
|
* @return A string representation of the semaphore.
|
||||||
*/
|
*/
|
||||||
std::string FreeRTOS::Semaphore::toString() {
|
std::string FreeRTOS::Semaphore::toString() {
|
||||||
std::stringstream stringStream;
|
char hex[9];
|
||||||
stringStream << "name: "<< m_name << " (0x" << std::hex << std::setfill('0') << (uint32_t)m_semaphore << "), owner: " << m_owner;
|
std::string res = "name: " + m_name + " (0x";
|
||||||
return stringStream.str();
|
snprintf(hex, sizeof(hex), "%08x", (uint32_t)m_semaphore);
|
||||||
|
res += hex;
|
||||||
|
res += "), owner: " + m_owner;
|
||||||
|
return res;
|
||||||
} // toString
|
} // toString
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ public:
|
|||||||
bool take(uint32_t timeoutMs, std::string owner = "<Unknown>");
|
bool take(uint32_t timeoutMs, std::string owner = "<Unknown>");
|
||||||
std::string toString();
|
std::string toString();
|
||||||
uint32_t wait(std::string owner = "<Unknown>");
|
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:
|
private:
|
||||||
SemaphoreHandle_t m_semaphore;
|
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.
|
* @return A string representation of the IP address.
|
||||||
*/
|
*/
|
||||||
std::string GeneralUtils::ipToString(uint8_t *ip) {
|
std::string GeneralUtils::ipToString(uint8_t *ip) {
|
||||||
std::stringstream s;
|
auto size = 16;
|
||||||
s << (int) ip[0] << '.' << (int) ip[1] << '.' << (int) ip[2] << '.' << (int) ip[3];
|
char *val = (char*)malloc(size);
|
||||||
return s.str();
|
snprintf(val, size, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
|
||||||
|
std::string res(val);
|
||||||
|
free(val);
|
||||||
|
return res;
|
||||||
} // ipToString
|
} // ipToString
|
||||||
|
|
||||||
|
|
||||||
@ -347,11 +350,14 @@ std::string GeneralUtils::ipToString(uint8_t *ip) {
|
|||||||
std::vector<std::string> GeneralUtils::split(std::string source, char delimiter) {
|
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
|
// See also: https://stackoverflow.com/questions/5167625/splitting-a-c-stdstring-using-tokens-e-g
|
||||||
std::vector<std::string> strings;
|
std::vector<std::string> strings;
|
||||||
std::istringstream iss(source);
|
std::size_t current, previous = 0;
|
||||||
std::string s;
|
current = source.find(delimiter);
|
||||||
while (std::getline(iss, s, delimiter)) {
|
while (current != std::string::npos) {
|
||||||
strings.push_back(trim(s));
|
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;
|
return strings;
|
||||||
} // split
|
} // 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
|
ESP32 eeprom_class example with EEPROM library
|
||||||
|
|
||||||
This simple example demonstrates using EEPROM library to store different data in
|
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
|
Created for arduino-esp32 on 25 Dec, 2017
|
||||||
by Elochukwu Ifediora (fedy0)
|
by Elochukwu Ifediora (fedy0)
|
||||||
|
converted to nvs by lbernstone - 06/22/2019
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "EEPROM.h"
|
#include "EEPROM.h"
|
||||||
|
|
||||||
// Instantiate eeprom objects with parameter/argument names and size same as in the partition table
|
// Instantiate eeprom objects with parameter/argument names and sizes
|
||||||
EEPROMClass NAMES("eeprom0", 0x1000);
|
EEPROMClass NAMES("eeprom0", 0x500);
|
||||||
EEPROMClass HEIGHT("eeprom1", 0x500);
|
EEPROMClass HEIGHT("eeprom1", 0x200);
|
||||||
EEPROMClass AGE("eeprom2", 0x100);
|
EEPROMClass AGE("eeprom2", 0x100);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// put your setup code here, to run once:
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println("Testing EEPROMClass\n");
|
Serial.println("Testing EEPROMClass\n");
|
||||||
if (!NAMES.begin(NAMES.length())) {
|
if (!NAMES.begin(NAMES.length())) {
|
||||||
@ -57,7 +41,7 @@ void setup() {
|
|||||||
double height = 5.8;
|
double height = 5.8;
|
||||||
uint32_t age = 47;
|
uint32_t age = 47;
|
||||||
|
|
||||||
// Write: Variables ---> EEPROM partitions
|
// Write: Variables ---> EEPROM stores
|
||||||
NAMES.put(0, name);
|
NAMES.put(0, name);
|
||||||
HEIGHT.put(0, height);
|
HEIGHT.put(0, height);
|
||||||
AGE.put(0, age);
|
AGE.put(0, age);
|
||||||
@ -75,7 +59,7 @@ void setup() {
|
|||||||
Serial.print("age: "); Serial.println(age);
|
Serial.print("age: "); Serial.println(age);
|
||||||
Serial.println("------------------------------------\n");
|
Serial.println("------------------------------------\n");
|
||||||
|
|
||||||
// Read: Variables <--- EEPROM partitions
|
// Read: Variables <--- EEPROM stores
|
||||||
NAMES.get(0, name);
|
NAMES.get(0, name);
|
||||||
HEIGHT.get(0, height);
|
HEIGHT.get(0, height);
|
||||||
AGE.get(0, age);
|
AGE.get(0, age);
|
||||||
@ -87,6 +71,5 @@ void setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
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:
|
// put your setup code here, to run once:
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println("\nTesting EEPROM Library\n");
|
Serial.println("\nTesting EEPROM Library\n");
|
||||||
if (!EEPROM.begin(EEPROM.length())) {
|
if (!EEPROM.begin(1000)) {
|
||||||
Serial.println("Failed to initialise EEPROM");
|
Serial.println("Failed to initialise EEPROM");
|
||||||
Serial.println("Restarting...");
|
Serial.println("Restarting...");
|
||||||
delay(1000);
|
delay(1000);
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
int address = 0; // Same address is used through the example
|
int address = 0;
|
||||||
|
|
||||||
EEPROM.writeByte(address, -128); // -2^7
|
EEPROM.writeByte(address, -128); // -2^7
|
||||||
Serial.println(EEPROM.readByte(address));
|
address += sizeof(byte);
|
||||||
|
|
||||||
EEPROM.writeChar(address, 'A'); // Same as writyByte and readByte
|
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
|
EEPROM.writeUChar(address, 255); // 2^8 - 1
|
||||||
Serial.println(EEPROM.readUChar(address));
|
address += sizeof(unsigned char);
|
||||||
|
|
||||||
EEPROM.writeShort(address, -32768); // -2^15
|
EEPROM.writeShort(address, -32768); // -2^15
|
||||||
Serial.println(EEPROM.readShort(address));
|
address += sizeof(short);
|
||||||
|
|
||||||
EEPROM.writeUShort(address, 65535); // 2^16 - 1
|
EEPROM.writeUShort(address, 65535); // 2^16 - 1
|
||||||
Serial.println(EEPROM.readUShort(address));
|
address += sizeof(unsigned short);
|
||||||
|
|
||||||
EEPROM.writeInt(address, -2147483648); // -2^31
|
EEPROM.writeInt(address, -2147483648); // -2^31
|
||||||
Serial.println(EEPROM.readInt(address));
|
address += sizeof(int);
|
||||||
|
|
||||||
EEPROM.writeUInt(address, 4294967295); // 2^32 - 1
|
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
|
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
|
EEPROM.writeULong(address, 4294967295); // Same as writeUInt and readUInt
|
||||||
Serial.println(EEPROM.readULong(address));
|
address += sizeof(unsigned long);
|
||||||
|
|
||||||
int64_t value = -9223372036854775808; // -2^63
|
int64_t value = -9223372036854775808; // -2^63
|
||||||
EEPROM.writeLong64(address, value);
|
EEPROM.writeLong64(address, value);
|
||||||
value = 0; // Clear value
|
address += sizeof(int64_t);
|
||||||
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
|
|
||||||
|
|
||||||
uint64_t Value = 18446744073709551615; // 2^64 - 1
|
uint64_t Value = 18446744073709551615; // 2^64 - 1
|
||||||
EEPROM.writeULong64(address, Value);
|
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 = 0; // Clear Value
|
||||||
Value = EEPROM.readULong64(Value);
|
Value = EEPROM.readULong64(Value);
|
||||||
Serial.printf("0x%08X", (uint32_t)(Value >> 32)); // Print High 4 bytes in HEX
|
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
|
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);
|
Serial.println(EEPROM.readFloat(address), 4);
|
||||||
|
address += sizeof(float);
|
||||||
|
|
||||||
EEPROM.writeDouble(address, 123456789.123456789);
|
|
||||||
Serial.println(EEPROM.readDouble(address), 8);
|
Serial.println(EEPROM.readDouble(address), 8);
|
||||||
|
address += sizeof(double);
|
||||||
|
|
||||||
EEPROM.writeBool(address, true);
|
|
||||||
Serial.println(EEPROM.readBool(address));
|
Serial.println(EEPROM.readBool(address));
|
||||||
|
address += sizeof(bool);
|
||||||
|
|
||||||
String sentence = "I love ESP32.";
|
|
||||||
EEPROM.writeString(address, sentence);
|
|
||||||
Serial.println(EEPROM.readString(address));
|
Serial.println(EEPROM.readString(address));
|
||||||
|
address += sentence.length() + 1;
|
||||||
|
|
||||||
char gratitude[] = "Thank You Espressif!";
|
|
||||||
EEPROM.writeString(address, gratitude);
|
|
||||||
Serial.println(EEPROM.readString(address));
|
Serial.println(EEPROM.readString(address));
|
||||||
|
address += 21;
|
||||||
// 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)"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// put your main code here, to run repeatedly:
|
// put your main code here, to run repeatedly:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
name=EEPROM
|
name=EEPROM
|
||||||
version=1.0
|
version=1.0.3
|
||||||
author=Ivan Grokhotkov
|
author=Ivan Grokhotkov
|
||||||
maintainer=Paolo Becchi <pbecchi@aerobusiness.it>
|
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=
|
paragraph=
|
||||||
category=Data Storage
|
category=Data Storage
|
||||||
url=http://arduino.cc/en/Reference/EEPROM
|
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
|
EEPROM.h -ported by Paolo Becchi to Esp32 from esp8266 EEPROM
|
||||||
-Modified by Elochukwu Ifediora <ifedioraelochukwuc@gmail.com>
|
-Modified by Elochukwu Ifediora <ifedioraelochukwuc@gmail.com>
|
||||||
|
-Converted to nvs lbernstone@gmail.com
|
||||||
|
|
||||||
Uses a one sector flash partition defined in partition table
|
Uses a nvs byte array to emulate EEPROM
|
||||||
OR
|
|
||||||
Multiple sector flash partitions defined by the name column in the partition table
|
|
||||||
|
|
||||||
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
|
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
|
||||||
This file is part of the esp8266 core for Arduino environment.
|
This file is part of the esp8266 core for Arduino environment.
|
||||||
@ -25,72 +24,121 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "EEPROM.h"
|
#include "EEPROM.h"
|
||||||
|
#include <nvs.h>
|
||||||
|
#include <esp_partition.h>
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
|
|
||||||
EEPROMClass::EEPROMClass(uint32_t sector)
|
EEPROMClass::EEPROMClass(void)
|
||||||
: _sector(sector)
|
: _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)
|
, _data(0)
|
||||||
, _size(0)
|
, _size(0)
|
||||||
, _dirty(false)
|
, _dirty(false)
|
||||||
, _mypart(NULL)
|
|
||||||
, _name("eeprom")
|
, _name("eeprom")
|
||||||
, _user_defined_size(0)
|
, _user_defined_size(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
EEPROMClass::EEPROMClass(const char* name, uint32_t user_defined_size)
|
EEPROMClass::EEPROMClass(const char* name, uint32_t user_defined_size)
|
||||||
: _sector(0)
|
: _handle(NULL)
|
||||||
, _data(0)
|
, _data(0)
|
||||||
, _size(0)
|
, _size(0)
|
||||||
, _dirty(false)
|
, _dirty(false)
|
||||||
, _mypart(NULL)
|
|
||||||
, _name(name)
|
, _name(name)
|
||||||
, _user_defined_size(user_defined_size)
|
, _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() {
|
EEPROMClass::~EEPROMClass() {
|
||||||
// end();
|
// end();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EEPROMClass::begin(size_t size) {
|
bool EEPROMClass::begin(size_t size) {
|
||||||
if (size <= 0) {
|
if (!size) {
|
||||||
return false;
|
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);
|
size_t key_size = 0;
|
||||||
if (_mypart == NULL) {
|
res = nvs_get_blob(_handle, _name, NULL, &key_size);
|
||||||
return false;
|
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) {
|
if (_data) {
|
||||||
delete[] _data;
|
delete[] _data;
|
||||||
}
|
}
|
||||||
|
|
||||||
_data = new uint8_t[size];
|
_data = (uint8_t*) malloc(size);
|
||||||
_size = size;
|
if(!_data) {
|
||||||
bool ret = false;
|
log_e("Not enough memory for %d bytes in EEPROM");
|
||||||
if (esp_partition_read (_mypart, 0, (void *) _data, _size) == ESP_OK) {
|
return false;
|
||||||
ret = true;
|
|
||||||
}
|
}
|
||||||
|
_size = size;
|
||||||
return ret;
|
nvs_get_blob(_handle, _name, _data, &_size);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EEPROMClass::end() {
|
void EEPROMClass::end() {
|
||||||
@ -134,29 +182,21 @@ void EEPROMClass::write(int address, uint8_t value) {
|
|||||||
|
|
||||||
bool EEPROMClass::commit() {
|
bool EEPROMClass::commit() {
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if (!_size)
|
if (!_size) {
|
||||||
return false;
|
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.");
|
|
||||||
}
|
}
|
||||||
else
|
if (!_data) {
|
||||||
{
|
return false;
|
||||||
if (esp_partition_write(_mypart, 0, (void *)_data, _size) == ESP_ERR_INVALID_SIZE)
|
}
|
||||||
{
|
if (!_dirty) {
|
||||||
log_e( "error in Write");
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if (ESP_OK != nvs_set_blob(_handle, _name, _data, _size)) {
|
||||||
|
log_e( "error in write");
|
||||||
|
} else {
|
||||||
_dirty = false;
|
_dirty = false;
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -175,6 +215,67 @@ uint16_t EEPROMClass::length ()
|
|||||||
return _user_defined_size;
|
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'
|
Read 'value' from 'address'
|
||||||
*/
|
*/
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
EEPROM.h -ported by Paolo Becchi to Esp32 from esp8266 EEPROM
|
EEPROM.h -ported by Paolo Becchi to Esp32 from esp8266 EEPROM
|
||||||
-Modified by Elochukwu Ifediora <ifedioraelochukwuc@gmail.com>
|
-Modified by Elochukwu Ifediora <ifedioraelochukwuc@gmail.com>
|
||||||
|
-Converted to nvs lbernstone@gmail.com
|
||||||
|
|
||||||
Uses a one sector flash partition defined in partition table
|
Uses a nvs byte array to emulate EEPROM
|
||||||
OR
|
|
||||||
Multiple sector flash partitions defined by the name column in the partition table
|
|
||||||
|
|
||||||
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
|
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
|
||||||
This file is part of the esp8266 core for Arduino environment.
|
This file is part of the esp8266 core for Arduino environment.
|
||||||
@ -30,19 +29,9 @@
|
|||||||
#define EEPROM_FLASH_PARTITION_NAME "eeprom"
|
#define EEPROM_FLASH_PARTITION_NAME "eeprom"
|
||||||
#endif
|
#endif
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
#include <stddef.h>
|
typedef uint32_t nvs_handle;
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <esp_partition.h>
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// need to define AT LEAST a flash partition for EEPROM with above name
|
|
||||||
//
|
|
||||||
// eeprom , data , 0x99, start address, 0x1000
|
|
||||||
//
|
|
||||||
class EEPROMClass {
|
class EEPROMClass {
|
||||||
public:
|
public:
|
||||||
EEPROMClass(uint32_t sector);
|
EEPROMClass(uint32_t sector);
|
||||||
@ -58,6 +47,7 @@ class EEPROMClass {
|
|||||||
void end();
|
void end();
|
||||||
|
|
||||||
uint8_t * getDataPtr();
|
uint8_t * getDataPtr();
|
||||||
|
uint16_t convert(bool clear, const char* EEPROMname = "eeprom", const char* nvsname = "eeprom");
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T &get(int address, T &t) {
|
T &get(int address, T &t) {
|
||||||
@ -117,11 +107,10 @@ class EEPROMClass {
|
|||||||
template <class T> T writeAll (int address, const T &);
|
template <class T> T writeAll (int address, const T &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint32_t _sector;
|
nvs_handle _handle;
|
||||||
uint8_t* _data;
|
uint8_t* _data;
|
||||||
size_t _size;
|
size_t _size;
|
||||||
bool _dirty;
|
bool _dirty;
|
||||||
const esp_partition_t * _mypart;
|
|
||||||
const char* _name;
|
const char* _name;
|
||||||
uint32_t _user_defined_size;
|
uint32_t _user_defined_size;
|
||||||
};
|
};
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "fb_gfx.h"
|
#include "fb_gfx.h"
|
||||||
#include "fd_forward.h"
|
#include "fd_forward.h"
|
||||||
#include "dl_lib.h"
|
|
||||||
#include "fr_forward.h"
|
#include "fr_forward.h"
|
||||||
|
|
||||||
#define ENROLL_CONFIRM_TIMES 5
|
#define ENROLL_CONFIRM_TIMES 5
|
||||||
|
@ -19,7 +19,7 @@ Author:
|
|||||||
Pranav Cherukupalli <cherukupallip@gmail.com>
|
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) */
|
#define TIME_TO_SLEEP 5 /* Time ESP32 will go to sleep (in seconds) */
|
||||||
|
|
||||||
RTC_DATA_ATTR int bootCount = 0;
|
RTC_DATA_ATTR int bootCount = 0;
|
||||||
|
@ -62,7 +62,7 @@ void loop()
|
|||||||
for (led=0; led<NR_OF_LEDS; led++) {
|
for (led=0; led<NR_OF_LEDS; led++) {
|
||||||
for (col=0; col<3; col++ ) {
|
for (col=0; col<3; col++ ) {
|
||||||
for (bit=0; bit<8; bit++){
|
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].level0 = 1;
|
||||||
led_data[i].duration0 = 8;
|
led_data[i].duration0 = 8;
|
||||||
led_data[i].level1 = 0;
|
led_data[i].level1 = 0;
|
||||||
|
@ -96,7 +96,6 @@ void loop(void)
|
|||||||
req = req.substring(addr_start + 1, addr_end);
|
req = req.substring(addr_start + 1, addr_end);
|
||||||
Serial.print("Request: ");
|
Serial.print("Request: ");
|
||||||
Serial.println(req);
|
Serial.println(req);
|
||||||
client.flush();
|
|
||||||
|
|
||||||
String s;
|
String s;
|
||||||
if (req == "/")
|
if (req == "/")
|
||||||
@ -115,6 +114,7 @@ void loop(void)
|
|||||||
}
|
}
|
||||||
client.print(s);
|
client.print(s);
|
||||||
|
|
||||||
|
client.stop();
|
||||||
Serial.println("Done with client");
|
Serial.println("Done with client");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void F_Fat::end()
|
|||||||
log_e("Unmounting FFat partition failed! Error: %d", err);
|
log_e("Unmounting FFat partition failed! Error: %d", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_wl_handle = NULL;
|
_wl_handle = 0;
|
||||||
_impl->mountpoint(NULL);
|
_impl->mountpoint(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,7 +109,9 @@ size_t F_Fat::totalBytes()
|
|||||||
|
|
||||||
BYTE pdrv = ff_diskio_get_pdrv_wl(_wl_handle);
|
BYTE pdrv = ff_diskio_get_pdrv_wl(_wl_handle);
|
||||||
char drv[3] = {(char)(48+pdrv), ':', 0};
|
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;
|
tot_sect = (fs->n_fatent - 2) * fs->csize;
|
||||||
sect_size = CONFIG_WL_SECTOR_SIZE;
|
sect_size = CONFIG_WL_SECTOR_SIZE;
|
||||||
return tot_sect * sect_size;
|
return tot_sect * sect_size;
|
||||||
@ -123,7 +125,9 @@ size_t F_Fat::freeBytes()
|
|||||||
|
|
||||||
BYTE pdrv = ff_diskio_get_pdrv_wl(_wl_handle);
|
BYTE pdrv = ff_diskio_get_pdrv_wl(_wl_handle);
|
||||||
char drv[3] = {(char)(48+pdrv), ':', 0};
|
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;
|
free_sect = free_clust * fs->csize;
|
||||||
sect_size = CONFIG_WL_SECTOR_SIZE;
|
sect_size = CONFIG_WL_SECTOR_SIZE;
|
||||||
return free_sect * sect_size;
|
return free_sect * sect_size;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <HardwareSerial.h>
|
||||||
/**
|
/**
|
||||||
* HTTPClient.cpp
|
* HTTPClient.cpp
|
||||||
*
|
*
|
||||||
@ -195,6 +196,11 @@ bool HTTPClient::begin(String url, const char* CAcert)
|
|||||||
}
|
}
|
||||||
_secure = true;
|
_secure = true;
|
||||||
_transportTraits = TransportTraitsPtr(new TLSTraits(CAcert));
|
_transportTraits = TransportTraitsPtr(new TLSTraits(CAcert));
|
||||||
|
if(!_transportTraits) {
|
||||||
|
log_e("could not create transport traits");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,6 +221,11 @@ bool HTTPClient::begin(String url)
|
|||||||
return begin(url, (const char*)NULL);
|
return begin(url, (const char*)NULL);
|
||||||
}
|
}
|
||||||
_transportTraits = TransportTraitsPtr(new TransportTraits());
|
_transportTraits = TransportTraitsPtr(new TransportTraits());
|
||||||
|
if(!_transportTraits) {
|
||||||
|
log_e("could not create transport traits");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif // HTTPCLIENT_1_1_COMPATIBLE
|
#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)
|
void HTTPClient::end(void)
|
||||||
{
|
{
|
||||||
disconnect();
|
disconnect(false);
|
||||||
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -342,7 +354,7 @@ void HTTPClient::end(void)
|
|||||||
* disconnect
|
* disconnect
|
||||||
* close the TCP socket
|
* close the TCP socket
|
||||||
*/
|
*/
|
||||||
void HTTPClient::disconnect()
|
void HTTPClient::disconnect(bool preserveClient)
|
||||||
{
|
{
|
||||||
if(connected()) {
|
if(connected()) {
|
||||||
if(_client->available() > 0) {
|
if(_client->available() > 0) {
|
||||||
@ -357,7 +369,9 @@ void HTTPClient::disconnect()
|
|||||||
} else {
|
} else {
|
||||||
log_d("tcp stop\n");
|
log_d("tcp stop\n");
|
||||||
_client->stop();
|
_client->stop();
|
||||||
_client = nullptr;
|
if(!preserveClient) {
|
||||||
|
_client = nullptr;
|
||||||
|
}
|
||||||
#ifdef HTTPCLIENT_1_1_COMPATIBLE
|
#ifdef HTTPCLIENT_1_1_COMPATIBLE
|
||||||
if(_tcpDeprecated) {
|
if(_tcpDeprecated) {
|
||||||
_transportTraits.reset(nullptr);
|
_transportTraits.reset(nullptr);
|
||||||
@ -456,6 +470,7 @@ void HTTPClient::setTimeout(uint16_t timeout)
|
|||||||
void HTTPClient::useHTTP10(bool useHTTP10)
|
void HTTPClient::useHTTP10(bool useHTTP10)
|
||||||
{
|
{
|
||||||
_useHTTP10 = useHTTP10;
|
_useHTTP10 = useHTTP10;
|
||||||
|
_reuse = !useHTTP10;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -816,7 +831,8 @@ int HTTPClient::writeToStream(Stream * stream)
|
|||||||
return returnError(HTTPC_ERROR_ENCODING);
|
return returnError(HTTPC_ERROR_ENCODING);
|
||||||
}
|
}
|
||||||
|
|
||||||
end();
|
// end();
|
||||||
|
disconnect(true);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,9 +986,12 @@ bool HTTPClient::hasHeader(const char* name)
|
|||||||
*/
|
*/
|
||||||
bool HTTPClient::connect(void)
|
bool HTTPClient::connect(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(connected()) {
|
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) {
|
while(_client->available() > 0) {
|
||||||
_client->read();
|
_client->read();
|
||||||
}
|
}
|
||||||
@ -980,8 +999,12 @@ bool HTTPClient::connect(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HTTPCLIENT_1_1_COMPATIBLE
|
#ifdef HTTPCLIENT_1_1_COMPATIBLE
|
||||||
if(!_client) {
|
if(_transportTraits && !_client) {
|
||||||
_tcpDeprecated = _transportTraits->create();
|
_tcpDeprecated = _transportTraits->create();
|
||||||
|
if(!_tcpDeprecated) {
|
||||||
|
log_e("failed to create client");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
_client = _tcpDeprecated.get();
|
_client = _tcpDeprecated.get();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1080,9 +1103,12 @@ int HTTPClient::handleHeaderResponse()
|
|||||||
return HTTPC_ERROR_NOT_CONNECTED;
|
return HTTPC_ERROR_NOT_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clear();
|
||||||
|
|
||||||
|
_canReuse = _reuse;
|
||||||
|
|
||||||
String transferEncoding;
|
String transferEncoding;
|
||||||
_returnCode = -1;
|
|
||||||
_size = -1;
|
|
||||||
_transferEncoding = HTTPC_TE_IDENTITY;
|
_transferEncoding = HTTPC_TE_IDENTITY;
|
||||||
unsigned long lastDataTime = millis();
|
unsigned long lastDataTime = millis();
|
||||||
|
|
||||||
@ -1097,6 +1123,9 @@ int HTTPClient::handleHeaderResponse()
|
|||||||
log_v("RX: '%s'", headerLine.c_str());
|
log_v("RX: '%s'", headerLine.c_str());
|
||||||
|
|
||||||
if(headerLine.startsWith("HTTP/1.")) {
|
if(headerLine.startsWith("HTTP/1.")) {
|
||||||
|
if(_canReuse) {
|
||||||
|
_canReuse = (headerLine[sizeof "HTTP/1." - 1] != '0');
|
||||||
|
}
|
||||||
_returnCode = headerLine.substring(9, headerLine.indexOf(' ', 9)).toInt();
|
_returnCode = headerLine.substring(9, headerLine.indexOf(' ', 9)).toInt();
|
||||||
} else if(headerLine.indexOf(':')) {
|
} else if(headerLine.indexOf(':')) {
|
||||||
String headerName = headerLine.substring(0, headerLine.indexOf(':'));
|
String headerName = headerLine.substring(0, headerLine.indexOf(':'));
|
||||||
@ -1107,8 +1136,10 @@ int HTTPClient::handleHeaderResponse()
|
|||||||
_size = headerValue.toInt();
|
_size = headerValue.toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(headerName.equalsIgnoreCase("Connection")) {
|
if(_canReuse && headerName.equalsIgnoreCase("Connection")) {
|
||||||
_canReuse = headerValue.equalsIgnoreCase("keep-alive");
|
if(headerValue.indexOf("close") >= 0 && headerValue.indexOf("keep-alive") < 0) {
|
||||||
|
_canReuse = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(headerName.equalsIgnoreCase("Transfer-Encoding")) {
|
if(headerName.equalsIgnoreCase("Transfer-Encoding")) {
|
||||||
|
@ -197,7 +197,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool beginInternal(String url, const char* expectedProtocol);
|
bool beginInternal(String url, const char* expectedProtocol);
|
||||||
void disconnect();
|
void disconnect(bool preserveClient = false);
|
||||||
void clear();
|
void clear();
|
||||||
int returnError(int error);
|
int returnError(int error);
|
||||||
bool connect(void);
|
bool connect(void);
|
||||||
@ -217,7 +217,7 @@ protected:
|
|||||||
String _host;
|
String _host;
|
||||||
uint16_t _port = 0;
|
uint16_t _port = 0;
|
||||||
int32_t _connectTimeout = -1;
|
int32_t _connectTimeout = -1;
|
||||||
bool _reuse = false;
|
bool _reuse = true;
|
||||||
uint16_t _tcpTimeout = HTTPCLIENT_DEFAULT_TCP_TIMEOUT;
|
uint16_t _tcpTimeout = HTTPCLIENT_DEFAULT_TCP_TIMEOUT;
|
||||||
bool _useHTTP10 = false;
|
bool _useHTTP10 = false;
|
||||||
bool _secure = false;
|
bool _secure = false;
|
||||||
|
@ -96,7 +96,7 @@ void loop() {
|
|||||||
client.setCACert(rootCACertificate);
|
client.setCACert(rootCACertificate);
|
||||||
|
|
||||||
// Reading data over SSL may be slow, use an adequate timeout
|
// 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 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
|
// 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 <dirent.h>
|
||||||
#include "esp_spiffs.h"
|
#include "esp_spiffs.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "SPIFFS.h"
|
#include "SPIFFS.h"
|
||||||
|
|
||||||
using namespace fs;
|
using namespace fs;
|
||||||
|
|
||||||
SPIFFSFS::SPIFFSFS(FSImplPtr impl)
|
class SPIFFSImpl : public VFSImpl
|
||||||
: FS(impl)
|
{
|
||||||
{}
|
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)
|
bool SPIFFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFiles)
|
||||||
{
|
{
|
||||||
@ -98,16 +118,5 @@ size_t SPIFFSFS::usedBytes()
|
|||||||
return used;
|
return used;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SPIFFSFS::exists(const char* path)
|
SPIFFSFS SPIFFS;
|
||||||
{
|
|
||||||
File f = open(path, "r");
|
|
||||||
return (f == true) && !f.isDirectory();
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
class SPIFFSFS : public FS
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SPIFFSFS(FSImplPtr impl);
|
SPIFFSFS();
|
||||||
bool begin(bool formatOnFail=false, const char * basePath="/spiffs", uint8_t maxOpenFiles=10);
|
bool begin(bool formatOnFail=false, const char * basePath="/spiffs", uint8_t maxOpenFiles=10);
|
||||||
bool format();
|
bool format();
|
||||||
size_t totalBytes();
|
size_t totalBytes();
|
||||||
size_t usedBytes();
|
size_t usedBytes();
|
||||||
void end();
|
void end();
|
||||||
bool exists(const char* path);
|
|
||||||
bool exists(const String& path);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern fs::SPIFFSFS SPIFFS;
|
extern fs::SPIFFSFS SPIFFS;
|
||||||
|
|
||||||
#endif /* _SPIFFS_H_ */
|
|
||||||
|
#endif
|
||||||
|
@ -62,7 +62,7 @@ class UpdateClass {
|
|||||||
If all bytes are written
|
If all bytes are written
|
||||||
this call will write the config to eboot
|
this call will write the config to eboot
|
||||||
and return true
|
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
|
or there is an error
|
||||||
this will clear everything and return false
|
this will clear everything and return false
|
||||||
the last error is available through getError()
|
the last error is available through getError()
|
||||||
|
@ -189,6 +189,9 @@ bool UpdateClass::_writeBuffer(){
|
|||||||
//this ensures that partially written firmware will not be bootable
|
//this ensures that partially written firmware will not be bootable
|
||||||
_buffer[0] = 0xFF;
|
_buffer[0] = 0xFF;
|
||||||
}
|
}
|
||||||
|
if (!_progress && _progress_callback) {
|
||||||
|
_progress_callback(0, _size);
|
||||||
|
}
|
||||||
if(!ESP.flashEraseSector((_partition->address + _progress)/SPI_FLASH_SEC_SIZE)){
|
if(!ESP.flashEraseSector((_partition->address + _progress)/SPI_FLASH_SEC_SIZE)){
|
||||||
_abort(UPDATE_ERROR_ERASE);
|
_abort(UPDATE_ERROR_ERASE);
|
||||||
return false;
|
return false;
|
||||||
@ -204,6 +207,9 @@ bool UpdateClass::_writeBuffer(){
|
|||||||
_md5.add(_buffer, _bufferLen);
|
_md5.add(_buffer, _bufferLen);
|
||||||
_progress += _bufferLen;
|
_progress += _bufferLen;
|
||||||
_bufferLen = 0;
|
_bufferLen = 0;
|
||||||
|
if (_progress_callback) {
|
||||||
|
_progress_callback(_progress, _size);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,9 +325,6 @@ size_t UpdateClass::writeStream(Stream &data) {
|
|||||||
_reset();
|
_reset();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (_progress_callback) {
|
|
||||||
_progress_callback(0, _size);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(_ledPin != -1) {
|
if(_ledPin != -1) {
|
||||||
pinMode(_ledPin, OUTPUT);
|
pinMode(_ledPin, OUTPUT);
|
||||||
@ -352,12 +355,6 @@ size_t UpdateClass::writeStream(Stream &data) {
|
|||||||
if((_bufferLen == remaining() || _bufferLen == SPI_FLASH_SEC_SIZE) && !_writeBuffer())
|
if((_bufferLen == remaining() || _bufferLen == SPI_FLASH_SEC_SIZE) && !_writeBuffer())
|
||||||
return written;
|
return written;
|
||||||
written += toRead;
|
written += toRead;
|
||||||
if(_progress_callback) {
|
|
||||||
_progress_callback(_progress, _size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(_progress_callback) {
|
|
||||||
_progress_callback(_size, _size);
|
|
||||||
}
|
}
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
@ -303,6 +303,7 @@ void WebServer::_uploadWriteByte(uint8_t b){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int WebServer::_uploadReadByte(WiFiClient& client){
|
int WebServer::_uploadReadByte(WiFiClient& client){
|
||||||
|
if (!client.connected()) return -1;
|
||||||
int res = client.read();
|
int res = client.read();
|
||||||
if(res < 0) {
|
if(res < 0) {
|
||||||
// keep trying until you either read a valid byte or timeout
|
// 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)
|
WebServer::WebServer(IPAddress addr, int port)
|
||||||
: _server(addr, port)
|
: _corsEnabled(false)
|
||||||
|
, _server(addr, port)
|
||||||
, _currentMethod(HTTP_ANY)
|
, _currentMethod(HTTP_ANY)
|
||||||
, _currentVersion(0)
|
, _currentVersion(0)
|
||||||
, _currentStatus(HC_NONE)
|
, _currentStatus(HC_NONE)
|
||||||
@ -59,7 +60,8 @@ WebServer::WebServer(IPAddress addr, int port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebServer::WebServer(int port)
|
WebServer::WebServer(int port)
|
||||||
: _server(port)
|
: _corsEnabled(false)
|
||||||
|
, _server(port)
|
||||||
, _currentMethod(HTTP_ANY)
|
, _currentMethod(HTTP_ANY)
|
||||||
, _currentVersion(0)
|
, _currentVersion(0)
|
||||||
, _currentStatus(HC_NONE)
|
, _currentStatus(HC_NONE)
|
||||||
@ -104,7 +106,7 @@ void WebServer::begin(uint16_t port) {
|
|||||||
|
|
||||||
String WebServer::_extractParam(String& authReq,const String& param,const char delimit){
|
String WebServer::_extractParam(String& authReq,const String& param,const char delimit){
|
||||||
int _begin = authReq.indexOf(param);
|
int _begin = authReq.indexOf(param);
|
||||||
if (_begin == -1)
|
if (_begin == -1)
|
||||||
return "";
|
return "";
|
||||||
return authReq.substring(_begin+param.length(),authReq.indexOf(delimit,_begin+param.length()));
|
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
|
// Wait for data from client to become available
|
||||||
if (_currentClient.available()) {
|
if (_currentClient.available()) {
|
||||||
if (_parseRequest(_currentClient)) {
|
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;
|
_contentLength = CONTENT_LENGTH_NOT_SET;
|
||||||
_handleRequest();
|
_handleRequest();
|
||||||
|
|
||||||
@ -366,6 +370,14 @@ void WebServer::setContentLength(const size_t contentLength) {
|
|||||||
_contentLength = 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) {
|
void WebServer::_prepareHeader(String& response, int code, const char* content_type, size_t contentLength) {
|
||||||
response = String(F("HTTP/1.")) + String(_currentVersion) + ' ';
|
response = String(F("HTTP/1.")) + String(_currentVersion) + ' ';
|
||||||
response += String(code);
|
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("Accept-Ranges")),String(F("none")));
|
||||||
sendHeader(String(F("Transfer-Encoding")),String(F("chunked")));
|
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")));
|
sendHeader(String(F("Connection")), String(F("close")));
|
||||||
|
|
||||||
response += _responseHeaders;
|
response += _responseHeaders;
|
||||||
@ -494,7 +509,7 @@ void WebServer::_streamFileCore(const size_t fileSize, const String & fileName,
|
|||||||
send(200, contentType, "");
|
send(200, contentType, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
String WebServer::pathArg(unsigned int i) {
|
String WebServer::pathArg(unsigned int i) {
|
||||||
if (_currentHandler != nullptr)
|
if (_currentHandler != nullptr)
|
||||||
return _currentHandler->pathArg(i);
|
return _currentHandler->pathArg(i);
|
||||||
return "";
|
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);
|
||||||
void send_P(int code, PGM_P content_type, PGM_P content, size_t contentLength);
|
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 setContentLength(const size_t contentLength);
|
||||||
void sendHeader(const String& name, const String& value, bool first = false);
|
void sendHeader(const String& name, const String& value, bool first = false);
|
||||||
void sendContent(const String& content);
|
void sendContent(const String& content);
|
||||||
@ -130,12 +133,12 @@ public:
|
|||||||
|
|
||||||
static String urlDecode(const String& text);
|
static String urlDecode(const String& text);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
size_t streamFile(T &file, const String& contentType) {
|
size_t streamFile(T &file, const String& contentType) {
|
||||||
_streamFileCore(file.size(), file.name(), contentType);
|
_streamFileCore(file.size(), file.name(), contentType);
|
||||||
return _currentClient.write(file);
|
return _currentClient.write(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual size_t _currentClientWrite(const char* b, size_t l) { return _currentClient.write( b, l ); }
|
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 ); }
|
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);
|
int _uploadReadByte(WiFiClient& client);
|
||||||
void _prepareHeader(String& response, int code, const char* content_type, size_t contentLength);
|
void _prepareHeader(String& response, int code, const char* content_type, size_t contentLength);
|
||||||
bool _collectHeader(const char* headerName, const char* headerValue);
|
bool _collectHeader(const char* headerName, const char* headerValue);
|
||||||
|
|
||||||
void _streamFileCore(const size_t fileSize, const String & fileName, const String & contentType);
|
void _streamFileCore(const size_t fileSize, const String & fileName, const String & contentType);
|
||||||
|
|
||||||
String _getRandomHexString();
|
String _getRandomHexString();
|
||||||
@ -163,6 +166,7 @@ protected:
|
|||||||
String value;
|
String value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
boolean _corsEnabled;
|
||||||
WiFiServer _server;
|
WiFiServer _server;
|
||||||
|
|
||||||
WiFiClient _currentClient;
|
WiFiClient _currentClient;
|
||||||
|
@ -197,6 +197,33 @@ IPAddress ETHClass::dnsIP(uint8_t dns_no)
|
|||||||
return IPAddress(dns_ip.u_addr.ip4.addr);
|
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 * ETHClass::getHostname()
|
||||||
{
|
{
|
||||||
const char * hostname;
|
const char * hostname;
|
||||||
|
@ -79,6 +79,10 @@ class ETHClass {
|
|||||||
IPAddress gatewayIP();
|
IPAddress gatewayIP();
|
||||||
IPAddress dnsIP(uint8_t dns_no = 0);
|
IPAddress dnsIP(uint8_t dns_no = 0);
|
||||||
|
|
||||||
|
IPAddress broadcastIP();
|
||||||
|
IPAddress networkID();
|
||||||
|
uint8_t subnetCIDR();
|
||||||
|
|
||||||
uint8_t * macAddress(uint8_t* mac);
|
uint8_t * macAddress(uint8_t* mac);
|
||||||
String macAddress();
|
String macAddress();
|
||||||
|
|
||||||
|
@ -235,6 +235,47 @@ IPAddress WiFiAPClass::softAPIP()
|
|||||||
return IPAddress(ip.ip.addr);
|
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.
|
* Get the softAP interface MAC address.
|
||||||
|
@ -45,6 +45,10 @@ public:
|
|||||||
|
|
||||||
IPAddress softAPIP();
|
IPAddress softAPIP();
|
||||||
|
|
||||||
|
IPAddress softAPBroadcastIP();
|
||||||
|
IPAddress softAPNetworkID();
|
||||||
|
uint8_t softAPSubnetCIDR();
|
||||||
|
|
||||||
bool softAPenableIpV6();
|
bool softAPenableIpV6();
|
||||||
IPv6Address softAPIPv6();
|
IPv6Address softAPIPv6();
|
||||||
|
|
||||||
|
@ -226,14 +226,41 @@ int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout)
|
|||||||
FD_SET(sockfd, &fdset);
|
FD_SET(sockfd, &fdset);
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = timeout * 1000;
|
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);
|
int res = lwip_connect_r(sockfd, (struct sockaddr*)&serveraddr, sizeof(serveraddr));
|
||||||
if (res != 1)
|
if (res < 0 && errno != EINPROGRESS) {
|
||||||
{
|
log_e("connect on fd %d, errno: %d, \"%s\"", sockfd, errno, strerror(errno));
|
||||||
log_e("select: %d",errno);
|
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
return 0;
|
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) );
|
fcntl( sockfd, F_SETFL, fcntl( sockfd, F_GETFL, 0 ) & (~O_NONBLOCK) );
|
||||||
clientSocketHandle.reset(new WiFiClientSocketHandle(sockfd));
|
clientSocketHandle.reset(new WiFiClientSocketHandle(sockfd));
|
||||||
_rxBuffer.reset(new WiFiClientRxBuffer(sockfd));
|
_rxBuffer.reset(new WiFiClientRxBuffer(sockfd));
|
||||||
|
@ -333,7 +333,9 @@ const char * system_event_reasons[] = { "UNSPECIFIED", "AUTH_EXPIRE", "AUTH_LEAV
|
|||||||
#endif
|
#endif
|
||||||
esp_err_t WiFiGenericClass::_eventCallback(void *arg, system_event_t *event)
|
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) {
|
if(event->event_id == SYSTEM_EVENT_SCAN_DONE) {
|
||||||
WiFiScanClass::_scanDone();
|
WiFiScanClass::_scanDone();
|
||||||
|
|
||||||
@ -654,3 +656,45 @@ int WiFiGenericClass::hostByName(const char* aHostname, IPAddress& aResult)
|
|||||||
return (uint32_t)aResult != 0;
|
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:
|
public:
|
||||||
static int hostByName(const char *aHostname, IPAddress &aResult);
|
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:
|
protected:
|
||||||
friend class WiFiSTAClass;
|
friend class WiFiSTAClass;
|
||||||
friend class WiFiScanClass;
|
friend class WiFiScanClass;
|
||||||
|
@ -34,22 +34,64 @@ WiFiMulti::WiFiMulti()
|
|||||||
|
|
||||||
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)
|
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)
|
uint8_t WiFiMulti::run(uint32_t connectTimeout)
|
||||||
{
|
{
|
||||||
|
|
||||||
int8_t scanResult;
|
int8_t scanResult;
|
||||||
uint8_t status = WiFi.status();
|
uint8_t status = WiFi.status();
|
||||||
if(status == WL_CONNECTED) {
|
if(status == WL_CONNECTED) {
|
||||||
for(uint32_t x = 0; x < APlist.size(); x++) {
|
for(uint32_t x = 0; x < APlist.size(); x++) {
|
||||||
if(WiFi.SSID()==APlist[x].ssid){
|
if(WiFi.SSID()==APlist[x].ssid) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,7 +161,7 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout)
|
|||||||
|
|
||||||
WiFi.begin(bestNetwork.ssid, bestNetwork.passphrase, bestChannel, bestBSSID);
|
WiFi.begin(bestNetwork.ssid, bestNetwork.passphrase, bestChannel, bestBSSID);
|
||||||
status = WiFi.status();
|
status = WiFi.status();
|
||||||
|
|
||||||
auto startTime = millis();
|
auto startTime = millis();
|
||||||
// wait for connection, fail, or timeout
|
// wait for connection, fail, or timeout
|
||||||
while(status != WL_CONNECTED && status != WL_NO_SSID_AVAIL && status != WL_CONNECT_FAILED && (millis() - startTime) <= connectTimeout) {
|
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) {
|
switch(status) {
|
||||||
case 3:
|
case WL_CONNECTED:
|
||||||
log_i("[WIFI] Connecting done.");
|
log_i("[WIFI] Connecting done.");
|
||||||
log_d("[WIFI] SSID: %s", WiFi.SSID().c_str());
|
log_d("[WIFI] SSID: %s", WiFi.SSID().c_str());
|
||||||
log_d("[WIFI] IP: %s", WiFi.localIP().toString().c_str());
|
log_d("[WIFI] IP: %s", WiFi.localIP().toString().c_str());
|
||||||
log_d("[WIFI] MAC: %s", WiFi.BSSIDstr().c_str());
|
log_d("[WIFI] MAC: %s", WiFi.BSSIDstr().c_str());
|
||||||
log_d("[WIFI] Channel: %d", WiFi.channel());
|
log_d("[WIFI] Channel: %d", WiFi.channel());
|
||||||
break;
|
break;
|
||||||
case 1:
|
case WL_NO_SSID_AVAIL:
|
||||||
log_e("[WIFI] Connecting Failed AP not found.");
|
log_e("[WIFI] Connecting Failed AP not found.");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case WL_CONNECT_FAILED:
|
||||||
log_e("[WIFI] Connecting Failed.");
|
log_e("[WIFI] Connecting Failed.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -160,60 +202,3 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout)
|
|||||||
|
|
||||||
return status;
|
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:
|
private:
|
||||||
std::vector<WifiAPlist_t> APlist;
|
std::vector<WifiAPlist_t> APlist;
|
||||||
bool APlistAdd(const char* ssid, const char *passphrase = NULL);
|
|
||||||
void APlistClean(void);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* WIFICLIENTMULTI_H_ */
|
#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);
|
esp_wifi_set_config(WIFI_IF_STA, &conf);
|
||||||
} else if(status() == WL_CONNECTED){
|
} else if(status() == WL_CONNECTED){
|
||||||
return WL_CONNECTED;
|
return WL_CONNECTED;
|
||||||
|
} else {
|
||||||
|
esp_wifi_set_config(WIFI_IF_STA, &conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!_useStaticIp) {
|
if(!_useStaticIp) {
|
||||||
@ -198,6 +200,12 @@ wl_status_t WiFiSTAClass::begin()
|
|||||||
return WL_CONNECT_FAILED;
|
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(!_useStaticIp) {
|
||||||
if(tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA) == ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED){
|
if(tcpip_adapter_dhcpc_start(TCPIP_ADAPTER_IF_STA) == ESP_ERR_TCPIP_ADAPTER_DHCPC_START_FAILED){
|
||||||
log_e("dhcp client 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);
|
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 the current SSID associated with the network
|
||||||
* @return SSID
|
* @return SSID
|
||||||
|
@ -64,6 +64,10 @@ public:
|
|||||||
IPAddress subnetMask();
|
IPAddress subnetMask();
|
||||||
IPAddress gatewayIP();
|
IPAddress gatewayIP();
|
||||||
IPAddress dnsIP(uint8_t dns_no = 0);
|
IPAddress dnsIP(uint8_t dns_no = 0);
|
||||||
|
|
||||||
|
IPAddress broadcastIP();
|
||||||
|
IPAddress networkID();
|
||||||
|
uint8_t subnetCIDR();
|
||||||
|
|
||||||
bool enableIpV6();
|
bool enableIpV6();
|
||||||
IPv6Address localIPv6();
|
IPv6Address localIPv6();
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "WEMOS LoLin32"
|
"name": "WEMOS LoLin32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "WEMOS D1 MINI ESP32"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"toolsDependencies": [
|
"toolsDependencies": [
|
||||||
|
@ -22,7 +22,7 @@ compiler.warning_flags.all=-Wall -Werror=all -Wextra
|
|||||||
|
|
||||||
compiler.path={runtime.tools.xtensa-esp32-elf-gcc.path}/bin/
|
compiler.path={runtime.tools.xtensa-esp32-elf-gcc.path}/bin/
|
||||||
compiler.sdk.path={runtime.platform.path}/tools/sdk
|
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.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
|
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.S.flags=-c -g3 -x assembler-with-cpp -MMD -mlongcalls
|
||||||
|
|
||||||
compiler.c.elf.cmd=xtensa-esp32-elf-gcc
|
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.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 -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.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
|
compiler.as.cmd=xtensa-esp32-elf-as
|
||||||
|
|
||||||
|
@ -1,54 +1,33 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#- set -e
|
# CMake Test
|
||||||
|
echo -e "travis_fold:start:check_cmakelists"
|
||||||
if [ ! -z "$TRAVIS_TAG" ]; then
|
tools/check_cmakelists.sh
|
||||||
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
|
if [ $? -ne 0 ]; then exit 1; fi
|
||||||
echo -e "travis_fold:end:sketch_test"
|
echo -e "travis_fold:end:check_cmakelists"
|
||||||
|
|
||||||
|
# ArduinoIDE Test
|
||||||
|
echo -e "travis_fold:start:prep_arduino_ide"
|
||||||
|
tools/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/test-arduino-ide.sh
|
||||||
|
if [ $? -ne 0 ]; then exit 1; fi
|
||||||
|
echo -e "travis_fold:end:test_arduino_ide"
|
||||||
|
|
||||||
echo -e "travis_fold:start:size_report"
|
echo -e "travis_fold:start:size_report"
|
||||||
cat size.log
|
cat size.log
|
||||||
echo -e "travis_fold:end:size_report"
|
echo -e "travis_fold:end:size_report"
|
||||||
|
|
||||||
echo -e "travis_fold:start:platformio_test_env_prepare"
|
# PlatformIO Test
|
||||||
pip install -U https://github.com/platformio/platformio/archive/develop.zip && \
|
echo -e "travis_fold:start:prep_platformio"
|
||||||
platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage && \
|
tools/prep-platformio.sh
|
||||||
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
|
if [ $? -ne 0 ]; then exit 1; fi
|
||||||
echo -e "travis_fold:end:platformio_test_env_prepare"
|
echo -e "travis_fold:end:prep_platformio"
|
||||||
|
|
||||||
echo -e "travis_fold:start:platformio_test"
|
echo -e "travis_fold:start:test_platformio"
|
||||||
platformio ci --board esp32dev libraries/WiFi/examples/WiFiClient && \
|
tools/test-platformio.sh
|
||||||
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
|
if [ $? -ne 0 ]; then exit 1; fi
|
||||||
echo -e "travis_fold:end:platformio_test"
|
echo -e "travis_fold:end:test_platformio"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
if [ ! -z "$TRAVIS_TAG" ]; then
|
if [ ! -z "$TRAVIS_TAG" ]; then
|
||||||
# zip the package if tagged build
|
# zip the package if tagged build
|
||||||
tools/build-release.sh -a$ESP32_GITHUB_TOKEN
|
tools/build-release.sh -a$ESP32_GITHUB_TOKEN
|
||||||
else
|
#else
|
||||||
# run cmake and sketch tests
|
# run cmake and sketch tests
|
||||||
tools/check_cmakelists.sh && tools/build-tests.sh
|
#tools/build-tests.sh
|
||||||
fi
|
fi
|
||||||
|
@ -10,8 +10,10 @@ set -e
|
|||||||
|
|
||||||
cd "`dirname $0`/.." # cd to arduino-esp32 root
|
cd "`dirname $0`/.." # cd to arduino-esp32 root
|
||||||
|
|
||||||
|
# pull all submodules
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
# find all source files in repo
|
# 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`
|
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
|
# find all source files named in CMakeLists.txt COMPONENT_SRCS
|
||||||
|
@ -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
|
|
||||||
}
|
|
@ -236,7 +236,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
|
|||||||
def parser(unparsed_args):
|
def parser(unparsed_args):
|
||||||
parser = optparse.OptionParser(
|
parser = optparse.OptionParser(
|
||||||
usage = "%prog [options]",
|
usage = "%prog [options]",
|
||||||
description = "Transmit image over the air to the esp8266 module with OTA support."
|
description = "Transmit image over the air to the esp32 module with OTA support."
|
||||||
)
|
)
|
||||||
|
|
||||||
# destination ip and port
|
# destination ip and port
|
||||||
@ -244,7 +244,7 @@ def parser(unparsed_args):
|
|||||||
group.add_option("-i", "--ip",
|
group.add_option("-i", "--ip",
|
||||||
dest = "esp_ip",
|
dest = "esp_ip",
|
||||||
action = "store",
|
action = "store",
|
||||||
help = "ESP8266 IP Address.",
|
help = "ESP32 IP Address.",
|
||||||
default = False
|
default = False
|
||||||
)
|
)
|
||||||
group.add_option("-I", "--host_ip",
|
group.add_option("-I", "--host_ip",
|
||||||
@ -256,8 +256,8 @@ def parser(unparsed_args):
|
|||||||
group.add_option("-p", "--port",
|
group.add_option("-p", "--port",
|
||||||
dest = "esp_port",
|
dest = "esp_port",
|
||||||
type = "int",
|
type = "int",
|
||||||
help = "ESP8266 ota Port. Default 8266",
|
help = "ESP32 ota Port. Default 3232",
|
||||||
default = 8266
|
default = 3232
|
||||||
)
|
)
|
||||||
group.add_option("-P", "--host_port",
|
group.add_option("-P", "--host_port",
|
||||||
dest = "host_port",
|
dest = "host_port",
|
||||||
@ -310,7 +310,7 @@ def parser(unparsed_args):
|
|||||||
group.add_option("-t", "--timeout",
|
group.add_option("-t", "--timeout",
|
||||||
dest = "timeout",
|
dest = "timeout",
|
||||||
type = "int",
|
type = "int",
|
||||||
help = "Timeout to wait for the ESP8266 to accept invitation",
|
help = "Timeout to wait for the ESP32 to accept invitation",
|
||||||
default = 10
|
default = 10
|
||||||
)
|
)
|
||||||
parser.add_option_group(group)
|
parser.add_option_group(group)
|
||||||
|
@ -3,5 +3,4 @@ nvs, data, nvs, 0x9000, 0x5000,
|
|||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
app0, app, ota_0, 0x10000, 0x140000,
|
app0, app, ota_0, 0x10000, 0x140000,
|
||||||
app1, app, ota_1, 0x150000,0x140000,
|
app1, app, ota_1, 0x150000,0x140000,
|
||||||
eeprom, data, 0x99, 0x290000,0x1000,
|
spiffs, data, spiffs, 0x290000,0x170000,
|
||||||
spiffs, data, spiffs, 0x291000,0x16F000,
|
|
||||||
|
|
@ -3,5 +3,4 @@ nvs, data, nvs, 0x9000, 0x5000,
|
|||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
app0, app, ota_0, 0x10000, 0x640000,
|
app0, app, ota_0, 0x10000, 0x640000,
|
||||||
app1, app, ota_1, 0x650000,0x640000,
|
app1, app, ota_1, 0x650000,0x640000,
|
||||||
eeprom, data, 0x99, 0xc90000,0x1000,
|
spiffs, data, spiffs, 0xc90000,0x370000,
|
||||||
spiffs, data, spiffs, 0xc91000,0x36F000,
|
|
||||||
|
|
@ -3,5 +3,4 @@ nvs, data, nvs, 0x9000, 0x5000,
|
|||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
app0, app, ota_0, 0x10000, 0x330000,
|
app0, app, ota_0, 0x10000, 0x330000,
|
||||||
app1, app, ota_1, 0x340000,0x330000,
|
app1, app, ota_1, 0x340000,0x330000,
|
||||||
eeprom, data, 0x99, 0x670000,0x1000,
|
spiffs, data, spiffs, 0x670000,0x190000,
|
||||||
spiffs, data, spiffs, 0x671000,0x18F000,
|
|
||||||
|
|
@ -3,5 +3,4 @@ nvs, data, nvs, 0x9000, 0x5000,
|
|||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
app0, app, ota_0, 0x10000, 0x140000,
|
app0, app, ota_0, 0x10000, 0x140000,
|
||||||
app1, app, ota_1, 0x150000,0x140000,
|
app1, app, ota_1, 0x150000,0x140000,
|
||||||
eeprom, data, 0x99, 0x290000,0x1000,
|
ffat, data, fat, 0x291000,0x170000,
|
||||||
ffat, data, fat, 0x291000,0x16F000,
|
|
||||||
|
|
@ -3,6 +3,5 @@ nvs, data, nvs, 0x9000, 0x5000,
|
|||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
app0, app, ota_0, 0x10000, 0x200000,
|
app0, app, ota_0, 0x10000, 0x200000,
|
||||||
app1, app, ota_1, 0x210000,0x200000,
|
app1, app, ota_1, 0x210000,0x200000,
|
||||||
eeprom, data, 0x99, 0x410000,0x1000,
|
ffat, data, fat, 0x410000,0xBEF000,
|
||||||
ffat, data, fat, 0x411000,0xBEE000,
|
|
||||||
# to create/use ffat, see https://github.com/marcmerlin/esp32_fatfsimage
|
# to create/use ffat, see https://github.com/marcmerlin/esp32_fatfsimage
|
||||||
|
|
@ -2,5 +2,4 @@
|
|||||||
nvs, data, nvs, 0x9000, 0x5000,
|
nvs, data, nvs, 0x9000, 0x5000,
|
||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
app0, app, ota_0, 0x10000, 0x300000,
|
app0, app, ota_0, 0x10000, 0x300000,
|
||||||
eeprom, data, 0x99, 0x310000,0x1000,
|
spiffs, data, spiffs, 0x310000,0xF0000,
|
||||||
spiffs, data, spiffs, 0x311000,0xEF000,
|
|
||||||
|
|
@ -3,5 +3,4 @@ nvs, data, nvs, 0x9000, 0x5000,
|
|||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
app0, app, ota_0, 0x10000, 0x480000,
|
app0, app, ota_0, 0x10000, 0x480000,
|
||||||
app1, app, ota_1, 0x490000,0x480000,
|
app1, app, ota_1, 0x490000,0x480000,
|
||||||
eeprom, data, 0x99, 0x910000,0x1000,
|
spiffs, data, spiffs, 0x910000,0x6F0000,
|
||||||
spiffs, data, spiffs, 0x911000,0x6EF000,
|
|
||||||
|
|
@ -3,5 +3,4 @@ nvs, data, nvs, 0x9000, 0x5000,
|
|||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
app0, app, ota_0, 0x10000, 0x1E0000,
|
app0, app, ota_0, 0x10000, 0x1E0000,
|
||||||
app1, app, ota_1, 0x1F0000,0x1E0000,
|
app1, app, ota_1, 0x1F0000,0x1E0000,
|
||||||
eeprom, data, 0x99, 0x3D0000,0x1000,
|
spiffs, data, spiffs, 0x3D0000,0x30000,
|
||||||
spiffs, data, spiffs, 0x3D1000,0x2F000,
|
|
||||||
|
|
@ -2,5 +2,4 @@
|
|||||||
nvs, data, nvs, 0x9000, 0x5000,
|
nvs, data, nvs, 0x9000, 0x5000,
|
||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
app0, app, ota_0, 0x10000, 0x140000,
|
app0, app, ota_0, 0x10000, 0x140000,
|
||||||
eeprom, data, 0x99, 0x150000, 0x1000,
|
spiffs, data, spiffs, 0x150000, 0xB0000,
|
||||||
spiffs, data, spiffs, 0x151000, 0xAF000,
|
|
||||||
|
|
@ -2,5 +2,4 @@
|
|||||||
nvs, data, nvs, 0x9000, 0x5000,
|
nvs, data, nvs, 0x9000, 0x5000,
|
||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
app0, app, ota_0, 0x10000, 0x200000,
|
app0, app, ota_0, 0x10000, 0x200000,
|
||||||
eeprom, data, 0x99, 0x210000,0x1000,
|
spiffs, data, spiffs, 0x210000,0x1F0000,
|
||||||
spiffs, data, spiffs, 0x211000,0x1EF000,
|
|
||||||
|
|
@ -2,5 +2,4 @@
|
|||||||
nvs, data, nvs, 0x9000, 0x5000,
|
nvs, data, nvs, 0x9000, 0x5000,
|
||||||
otadata, data, ota, 0xe000, 0x2000,
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
app0, app, ota_0, 0x10000, 0x100000,
|
app0, app, ota_0, 0x10000, 0x100000,
|
||||||
eeprom, data, 0x99, 0x110000,0x1000,
|
spiffs, data, spiffs, 0x110000,0x2F0000,
|
||||||
spiffs, data, spiffs, 0x111000,0x2EF000,
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user