Compare commits
6 Commits
2ed77d659f
...
main
Author | SHA1 | Date | |
---|---|---|---|
0dde6af886 | |||
80d2e3c1f9 | |||
7c67644ccb | |||
615f36405d | |||
cf7479b662 | |||
dc6e12c67c |
288
.gitignore
vendored
Normal file
288
.gitignore
vendored
Normal file
@ -0,0 +1,288 @@
|
||||
# ---> VisualStudioCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
# ---> esp-idf
|
||||
# gitignore template for esp-idf, the official development framework for ESP32
|
||||
# https://github.com/espressif/esp-idf
|
||||
|
||||
build/
|
||||
sdkconfig
|
||||
sdkconfig.old
|
||||
|
||||
# ---> CMake
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
|
||||
# ---> C
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
# ---> C++
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# Backend config
|
||||
backend/config.py
|
||||
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,3 +1,3 @@
|
||||
[submodule "node/components/ttn-esp32"]
|
||||
path = node/components/ttn-esp32
|
||||
url = https://git.mosad.xyz/localhorst/ttn-esp32.git
|
||||
url = https://git.mosad.xyz/localhorst/ttn-esp32.git
|
34
README.md
34
README.md
@ -1,14 +1,30 @@
|
||||
# msv-clubhouse-node
|
||||
- Work in progress !
|
||||
- Technical demo
|
||||
|
||||
## Overview
|
||||
|
||||

|
||||
|
||||
## Hardware ##
|
||||
|
||||
[ESP32 LoRa 868MHz OLED DevBoard](https://de.aliexpress.com/item/33018609928.html)
|
||||
- [ESP32 LoRa 868MHz OLED DevBoard](https://de.aliexpress.com/item/33018609928.html)
|
||||
- [Bosch BMP280](https://de.aliexpress.com/item/1005003406725433.html)
|
||||
- [Reed Switch](https://de.aliexpress.com/item/1005004549803034.html)
|
||||
- [Wind speed sensor](https://de.aliexpress.com/item/1005001330214766.html)
|
||||
- [Wind direction sensor](https://de.aliexpress.com/item/4000590284491.html)
|
||||
|
||||
[Wind speed sensor](https://de.aliexpress.com/item/1005001330214766.html)
|
||||
|
||||
[Wind direction sensor](https://de.aliexpress.com/item/4000590284491.html)
|
||||
## Register Device at TTN
|
||||
|
||||
## Build ##
|
||||
0. Register manually a device.
|
||||
1. Frequency plan Europe 863-870 MHz (SF9 for RX2 - recommended)
|
||||
2. LoRaWAN version LoRaWAN Specification 1.0.2
|
||||
3. Regional Parameters version RP001 Regional Parameters 1.0.2
|
||||
4. JoinEUI all zeros
|
||||
5. Generate keys
|
||||
|
||||
## Build Node Firmware
|
||||
|
||||
0. Clone repo
|
||||
1. Init GIT-submodules
|
||||
@ -43,7 +59,7 @@ TTN LoRa frequency / region
|
||||
- `nano /etc/systemd/system/msv-clubhouse-backend.service`
|
||||
- `systemctl daemon-reload && systemctl enable --now msv-clubhouse-backend.service`
|
||||
|
||||
JS Payload Formatter:
|
||||
## JS Payload Formatter
|
||||
|
||||
```
|
||||
function Decoder(bytes, port) {
|
||||
@ -116,4 +132,10 @@ function sflt162f(rawSflt16)
|
||||
|
||||
return f_unscaled;
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
## Grafana Dashboard
|
||||
|
||||
see `frontend/`
|
||||
|
||||

|
1
doc/architecture.drawio
Normal file
1
doc/architecture.drawio
Normal file
@ -0,0 +1 @@
|
||||
<mxfile host="app.diagrams.net" modified="2023-03-08T19:13:03.452Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36" version="16.2.6" etag="yEJ7_XEJp48WvqINRjwf" type="device"><diagram id="C9XAk7C7BT5UWB5t5WFN" name="Page-1">7Vxbc+I6Ev41VJ19gLIs33iEEDJTk8lkktTOzhMlbAHeYyzWFiGcX38kW/JVgJOYy54kNZXYbUmWu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nJPhaKM7QthoCCFJFkYRdTcO5+35uEO415d3UrujirLprWTNYKwFhewMOttMUatWLNhjNEahtYr13jxzq/BndIKC+HvdZp3Znsi5g7/habJeHwl1J3znWAjKppF506W/zuYbYT7qxO7Wk+zK+kh431KUh7l+KlEuDuVmO9xPN11r0NvlU7xY2WRZOBztiyS3AQ4rUObb1J3ilvU+Y71KTepuSUo7cG36dwKZ+LgjjU46441bJDz/f7z6an7iBmfPlqu15C+/PlWKXzDKm25riSLL2WS9nfhyY7Iso1alIozW1jG5y5HMRqXo+jnXNyGdTHKAzqvyPZfko2A59Ic86ya06SQqVa/9EGqkrJ9nbOVJMmwbq9z7S9xjCMfM/FooxMccbgoGRng7DLavQmWCeAmQjMU8jMpIxQvpgRF3vE9LMO2HPtVHhYwoNm4uuZALZJZKXp4RYWfZffkllL7Z7wuqn7X0Y2i6cue7jB8yV01kX84h1Y84KvIqbVqTuXYHp6hdboTXHPQFDU7b3Ef2rTWdkNrfV43T1VMVz0lQGJ3wdoMv98nx8FUILOrUIvrRke1Z1/ZVweAb6xXd8af8HKFI0TXUbIhLwub098dXgaN4zh5mM0pfeFB7GvnqHsLoFY5X6c7itzOSY+1m+ZFoZlTigFBTwMZvH0i2mkRTSYqLhvR5Cz3IdoDZuqpa48bn3JkOx2gjQiTJ++N6D8ItKB5dtC6gGxFDlr95PBoEbQ0+AlaZwKtpkmT84JWg5zJIMRLkqrHCRFr44det2MP41WCmbyK0fMj7CY1JPbonwNihm6dG8R2++JNZeioRPg1K6BdryRNLwiuQL5qKs/LOErxboBsQY1AXy8bQ0X2CCrUSD+aGh06iPNGNbq5//qjaZHyp3pkxahaRT2c+hEQFcqAY6mHtdvUvEs9OnAs/n3qyKshpF82Rea5dURVTVhxR9pxL1DI+cCLeW5YSLThh0x2GKD/m/N9jTXKOZpCGZUK+Gyn4lA94RvOB7Lb/D+5TCvA8v8qFF7/DQ==</diagram></mxfile>
|
BIN
doc/architecture.png
Normal file
BIN
doc/architecture.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 352 KiB |
BIN
doc/screenshot_dashboard.png
Normal file
BIN
doc/screenshot_dashboard.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 186 KiB |
@ -36,21 +36,18 @@
|
||||
"description": "Wenn die Türe offen, dann ist wohl jemand am Platz.",
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"mappings": [
|
||||
{
|
||||
"options": {
|
||||
"0": {
|
||||
"color": "red",
|
||||
"index": 1,
|
||||
"text": "Türe geschlossen"
|
||||
},
|
||||
"1": {
|
||||
"color": "green",
|
||||
"index": 0,
|
||||
"text": "Türe offen"
|
||||
},
|
||||
"1": {
|
||||
"color": "red",
|
||||
"index": 1,
|
||||
"text": "Türe geschlossen"
|
||||
}
|
||||
},
|
||||
"type": "value"
|
||||
@ -68,7 +65,8 @@
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
@ -80,8 +78,8 @@
|
||||
},
|
||||
"id": 2,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"colorMode": "background",
|
||||
"graphMode": "none",
|
||||
"justifyMode": "auto",
|
||||
"orientation": "auto",
|
||||
"reduceOptions": {
|
||||
@ -550,7 +548,7 @@
|
||||
},
|
||||
"editorMode": "builder",
|
||||
"expr": "msv_clubhouse_temperature",
|
||||
"legendFormat": "Luftdruck Außen",
|
||||
"legendFormat": "Temperatur Außen",
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
}
|
||||
@ -558,6 +556,193 @@
|
||||
"title": "Tempertur Außen",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "x08D2Hlnz"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"axisCenteredZero": false,
|
||||
"axisColorMode": "text",
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"barAlignment": 0,
|
||||
"drawStyle": "line",
|
||||
"fillOpacity": 0,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"viz": false
|
||||
},
|
||||
"lineInterpolation": "linear",
|
||||
"lineWidth": 1,
|
||||
"pointSize": 5,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"showPoints": "auto",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"group": "A",
|
||||
"mode": "none"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"decimals": 2,
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "velocityms"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 15
|
||||
},
|
||||
"id": 16,
|
||||
"options": {
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "x08D2Hlnz"
|
||||
},
|
||||
"editorMode": "builder",
|
||||
"expr": "msv_clubhouse_windspeed",
|
||||
"legendFormat": "Windgeschwindigkeit",
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Windgeschwindigkeit ",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"collapsed": false,
|
||||
"gridPos": {
|
||||
"h": 1,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 23
|
||||
},
|
||||
"id": 14,
|
||||
"panels": [],
|
||||
"title": "Metadaten des Systems",
|
||||
"type": "row"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "x08D2Hlnz"
|
||||
},
|
||||
"description": "",
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"mappings": [
|
||||
{
|
||||
"options": {
|
||||
"0": {
|
||||
"color": "red",
|
||||
"index": 1,
|
||||
"text": "Error"
|
||||
},
|
||||
"1": {
|
||||
"color": "green",
|
||||
"index": 0,
|
||||
"text": "OK"
|
||||
}
|
||||
},
|
||||
"type": "value"
|
||||
}
|
||||
],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 5,
|
||||
"x": 0,
|
||||
"y": 24
|
||||
},
|
||||
"id": 18,
|
||||
"options": {
|
||||
"colorMode": "background",
|
||||
"graphMode": "none",
|
||||
"justifyMode": "auto",
|
||||
"orientation": "auto",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"pluginVersion": "9.3.6",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "x08D2Hlnz"
|
||||
},
|
||||
"editorMode": "builder",
|
||||
"expr": "msv_clubhouse_exporter_scrape_healthy",
|
||||
"legendFormat": "__auto",
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Zustand TTN Scrape",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
@ -620,8 +805,8 @@
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 15
|
||||
"x": 5,
|
||||
"y": 24
|
||||
},
|
||||
"id": 10,
|
||||
"options": {
|
||||
@ -714,8 +899,8 @@
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 15
|
||||
"x": 5,
|
||||
"y": 33
|
||||
},
|
||||
"id": 12,
|
||||
"options": {
|
||||
@ -761,6 +946,6 @@
|
||||
"timezone": "",
|
||||
"title": "MSV Moos Modellflugplatz",
|
||||
"uid": "nuH5csxVz",
|
||||
"version": 6,
|
||||
"version": 11,
|
||||
"weekStart": ""
|
||||
}
|
5
node/.vscode/settings.json
vendored
Normal file
5
node/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"idf.adapterTargetName": "esp32",
|
||||
"idf.port": "/dev/ttyUSB0",
|
||||
"idf.flashType": "UART"
|
||||
}
|
1
node/components/ttn-esp32
Submodule
1
node/components/ttn-esp32
Submodule
Submodule node/components/ttn-esp32 added at 877784640d
@ -5,24 +5,29 @@
|
||||
void sendMessages(void* pvParameter)
|
||||
{
|
||||
while (1) {
|
||||
printf("Sending message...\n");
|
||||
dummyPayload();
|
||||
printf("Sending msg...\n");
|
||||
ssd1306_display_clear();
|
||||
const char *pcTask1 = "Sending message...\n";
|
||||
const char *pcTask1 = "Sending msg...\n";
|
||||
xTaskCreate(&task_ssd1306_display_text, "task_ssd1306_display_text", 4096, (void *) pcTask1, 5, NULL);
|
||||
TTNResponseCode res = ttn.transmitMessage(msgData, sizeof(msgData) - 1);
|
||||
TTNResponseCode res = ttn.transmitMessage((uint8_t*) &pDummyPayload, sizeof(pDummyPayload));
|
||||
|
||||
if(res == kTTNSuccessfulTransmission){
|
||||
printf("Message sent.\n");
|
||||
printf("msg sent.\n");
|
||||
ssd1306_display_clear();
|
||||
const char *pcTask1 = "Message sent.\n";
|
||||
const char *pcTask1 = "msg sent.\n";
|
||||
xTaskCreate(&task_ssd1306_display_text, "task_ssd1306_display_text", 4096, (void *) pcTask1, 5, NULL);
|
||||
}else{
|
||||
printf("Transmission failed.\n");
|
||||
printf("Transm failed.\n");
|
||||
ssd1306_display_clear();
|
||||
const char *pcTask1 = "Transmission failed.\n";
|
||||
const char *pcTask1 = "Transm failed.\n";
|
||||
xTaskCreate(&task_ssd1306_display_text, "task_ssd1306_display_text", 4096, (void *) pcTask1, 5, NULL);
|
||||
}
|
||||
|
||||
printf("sleeping...\n");
|
||||
ssd1306_display_clear();
|
||||
const char *pcTask2 = "sleeping...\n";
|
||||
xTaskCreate(&task_ssd1306_display_text, "task_ssd1306_display_text", 4096, (void *) pcTask2, 5, NULL);
|
||||
vTaskDelay(TX_INTERVAL * pdMS_TO_TICKS(1000));
|
||||
}
|
||||
}
|
||||
@ -35,6 +40,28 @@ void messageReceived(const uint8_t* message, size_t length, ttn_port_t port)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void dummyPayload(){
|
||||
|
||||
uint16_t u16Temperature = (uint16_t) esp_random();
|
||||
uint16_t u16Pressure = (uint16_t) esp_random();
|
||||
uint16_t u16Windspeed = (uint16_t) esp_random();
|
||||
uint16_t u16Winddirection = (uint16_t) esp_random();
|
||||
|
||||
if((esp_random()%2) == 0){
|
||||
pDummyPayload.auxState = AUX_STATE_DOOR_CLOSED;
|
||||
}else{
|
||||
pDummyPayload.auxState = AUX_STATE_DOOR_OPEN;
|
||||
}
|
||||
|
||||
memcpy(pDummyPayload.degreesC, &u16Temperature, 2);
|
||||
memcpy(pDummyPayload.pressure, &u16Pressure, 2);
|
||||
memcpy(pDummyPayload.windspeed, &u16Windspeed, 2);
|
||||
memcpy(pDummyPayload.winddirection, &u16Winddirection, 2);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
extern "C" void app_main(void)
|
||||
{
|
||||
esp_err_t err;
|
||||
@ -66,6 +93,7 @@ extern "C" void app_main(void)
|
||||
// Register callback for received messages
|
||||
ttn.onMessage(messageReceived);
|
||||
|
||||
printf("random: %li\n", esp_random());
|
||||
|
||||
i2c_master_init();
|
||||
ssd1306_init();
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "driver/i2c.h"
|
||||
#include "esp_random.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "TheThingsNetwork.h"
|
||||
|
||||
@ -27,7 +29,23 @@
|
||||
static TheThingsNetwork ttn;
|
||||
|
||||
const unsigned TX_INTERVAL = 60*15;
|
||||
static uint8_t msgData[] = "BBBBBBBB"; //8x 0x
|
||||
//static uint8_t msgData[] = "BBBBBBBB"; //8x 0x
|
||||
|
||||
#define AUX_STATE_DOOR_OPEN 0x1
|
||||
#define AUX_STATE_DOOR_CLOSED 0x2
|
||||
|
||||
struct payload {
|
||||
uint8_t degreesC[2];
|
||||
uint8_t pressure[2];
|
||||
uint8_t windspeed[2];
|
||||
uint8_t winddirection[2];
|
||||
uint8_t auxState;
|
||||
};
|
||||
|
||||
|
||||
static struct payload pDummyPayload;
|
||||
|
||||
|
||||
void dummyPayload(void);
|
||||
|
||||
#endif /* MAIN_H */
|
Reference in New Issue
Block a user