added some code references

This commit is contained in:
Tim Huyeng 2022-11-21 18:36:58 +01:00
parent cbc0e65db5
commit cec7e1916f
3 changed files with 72 additions and 20 deletions

View File

@ -2,55 +2,106 @@
## Install Platformio ## Install Platformio
Install <A HREF="https://platformio.org/">PlatformIO IDE for embedded development</A> to build this project. Platformio integrates with your favorite IDE, choose e.g. Visual Studio Code, Atom, Eclipse etc. Install <A HREF="https://platformio.org/">PlatformIO IDE for embedded development</A> to build this project. Platformio integrates with your favorite IDE, choose e.g. [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide), Atom, Eclipse etc.
Compile time configuration is spread across several files. Before compiling the code, edit or create the following files: Compile time configuration is spread across several files. Before compiling the code, edit or create the following files:
## platformio.ini ## platformio.ini
Edit `platformio_orig.ini` (for ESP32 CPU based boards) *or* `platformio_orig_s3.ini` (for ESP32-S3 CPU based boards) and select desired board in section **board**. To add a new board, create an appropriate hardware abstraction layer file in hal subdirectory, and add a pointer to this file in section **board**. Copy or rename to `platformio.ini` in the root directory of the project. Now start Platformio. Edit `platformio_orig.ini` (for ESP32 CPU based boards) *or* `platformio_orig_s3.ini` (for ESP32-S3 CPU based boards) and select desired board in section **board**. To add a new board, create an appropriate hardware abstraction layer file in hal subdirectory, and add a pointer to this file in section **board**. Copy or rename to `platformio.ini` in the root directory of the project. Now start Platformio.
### Selecting a board
``` bash title="Copy with terminal" ```ini linenums="6" title="Uncomment your board"
cp platformio_orig.ini platformio.ini --8<-- "platformio_orig.ini:6:36"
``` ```
=== "Copy"
``` bash
cp platformio_orig.ini platformio.ini
```
=== "Rename"
``` bash
mv platformio_orig.ini platformio.ini
```
!!! info !!! info
Platformio is looking for `platformio.ini` in the root directory and won't start if it does not find this file! Platformio is looking for `platformio.ini` in the root directory and won't start if it does not find this file!
## paxcounter.conf ## paxcounter.conf
Edit `src/paxcounter_orig.conf` and tailor settings in this file according to your needs and use case. Please take care of the duty cycle regulations of the LoRaWAN network you're going to use. Copy or rename to `src/paxcounter.conf`. Edit `src/paxcounter_orig.conf` and tailor settings in this file according to your needs and use case. Please take care of the duty cycle regulations of the LoRaWAN network you're going to use. Copy or rename to `src/paxcounter.conf`.
``` bash title="Copy with terminal" === "Copy"
cp src/paxcounter_orig.conf src/paxcounter.conf ``` bash
``` cp src/paxcounter_orig.conf src/paxcounter.conf
```
=== "Rename"
``` bash
mv src/paxcounter_orig.conf src/paxcounter.conf
```
If your device has a **real time clock** it can be updated by either LoRaWAN network or GPS time, according to settings *TIME_SYNC_INTERVAL* and *TIME_SYNC_LORAWAN* in `paxcounter.conf`. If your device has a **real time clock** it can be updated by either LoRaWAN network or GPS time, according to settings *TIME_SYNC_INTERVAL* and *TIME_SYNC_LORAWAN* in `paxcounter.conf`.
```c linenums="85" title="paxcounter.conf"
--8<-- "src/paxcounter_orig.conf:85:85"
```
## src/lmic_config.h ## src/lmic_config.h
Edit `src/lmic_config.h` and tailor settings in this file according to your country and device hardware. Please take care of national regulations when selecting the frequency band for LoRaWAN. Edit `src/lmic_config.h` and tailor settings in this file according to your country and device hardware. Please take care of national regulations when selecting the frequency band for LoRaWAN.
```c linenums="9" title="national regulations in src/lmic_config.h "
--8<-- "src/lmic_config.h:9:18"
```
## src/loraconf.h ## src/loraconf.h
Create file `src/loraconf.h` using the template [src/loraconf_sample.h](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/loraconf_sample.h) and adjust settings to use your personal values. To join the network and activate your paxcounter, you must configure either OTAA or ABP join method. You should use OTAA, whenever possible. To understand the differences of the two methods, [this article](https://www.thethingsnetwork.org/docs/devices/registration.html) may be useful. Create file `src/loraconf.h` using the template [src/loraconf_sample.h](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/loraconf_sample.h) and adjust settings to use your personal values. To join the network and activate your paxcounter, you must configure either OTAA or ABP join method. You should use OTAA, whenever possible. To understand the differences of the two methods, [this article](https://www.thethingsnetwork.org/docs/devices/registration.html) may be useful.
``` bash title="Copy with terminal" === "Copy"
cp src/loraconf_sample.h src/loraconf.h ``` bash
``` cp src/loraconf_sample.h src/loraconf.h
```
=== "Rename"
``` bash
mv src/loraconf_sample.h src/loraconf.h
```
To configure OTAA, leave `#define LORA_ABP` deactivated (commented). To use ABP, activate (uncomment) `#define LORA_ABP` in the file `src/loraconf.h`. To configure OTAA, leave `#define LORA_ABP` deactivated (commented). To use ABP, activate (uncomment) `#define LORA_ABP` in the file `src/loraconf.h`.
The file `src/loraconf_sample.h` contains more information about the values to provide. The file `src/loraconf_sample.h` contains more information about the values to provide.
## src/ota.conf === "Activate OTAA (Default), Deactivate ABP"
Create file `src/ota.conf` using the template [src/ota_sample.conf](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/ota_sample.conf) and enter your WIFI network&key. These settings are used for downloading updates via WiFi, either from a remote https server, or locally via WebUI. If you want to use a remote server, you need a <A HREF="https://github.com/paxexpress/docs">PAX.express repository</A>. Enter your PAX.express credentials in ota.conf. If you don't need wireless firmware updates just rename ota.sample.conf to ota.conf. ``` c linenums="18" title="src/loraconf.h"
--8<-- "src/loraconf_sample.h:18:18"
```
=== "Deactivate OTAA, Activate ABP"
``` c linenums="18" title="src/loraconf.h"
#define LORA_ABP
```
``` bash title="Copy with terminal"
cp src/ota_sample.conf src/ota.conf ## src/ota.conf
``` Create file `src/ota.conf` using the template [src/ota_sample.conf](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/ota_sample.conf) and enter your WIFI network & key. These settings are used for downloading updates via WiFi, either from a remote https server, or locally via WebUI. If you want to use a remote server, you need a <A HREF="https://github.com/paxexpress/docs">PAX.express repository</A>. Enter your PAX.express credentials in ota.conf. If you don't need wireless firmware updates just rename ota.sample.conf to ota.conf.
=== "Copy"
``` bash
cp src/ota_sample.conf src/ota.conf
```
=== "Rename"
``` bash
mv src/ota_sample.conf src/ota.conf
```
# Building # Building
Use <A HREF="https://platformio.org/">PlatformIO</A> with your preferred IDE for development and building this code. Make sure you have latest PlatformIO version. Use <A HREF="https://platformio.org/">PlatformIO</A> with your preferred IDE for development and building this code. Make sure you have latest PlatformIO version.
# Uploading # Uploading
!!! warning
1. After editing `paxcounter.conf`, use "clean" button before "build" in PlatformIO!
2. Clear NVRAM of the board to delete previous stored runtime settings (`pio run -t erase`)
- **by cable, via USB/UART interface:** - **by cable, via USB/UART interface:**
To upload the code via cable to your ESP32 board this needs to be switched from run to bootloader mode. Boards with USB bridge like Heltec and TTGO usually have an onboard logic which allows soft switching by the upload tool. In PlatformIO this happenes automatically.<p> To upload the code via cable to your ESP32 board this needs to be switched from run to bootloader mode. Boards with USB bridge like Heltec and TTGO usually have an onboard logic which allows soft switching by the upload tool. In PlatformIO this happenes automatically.<p>
The LoPy/LoPy4/FiPy board needs to be set manually. See these The LoPy/LoPy4/FiPy board needs to be set manually. See these

View File

@ -8,7 +8,7 @@ Copyright 2018-2022 Klaus Wilting <verkehrsrot@arcor.de>
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
@ -16,9 +16,9 @@ Copyright 2018-2022 Klaus Wilting <verkehrsrot@arcor.de>
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
NOTICE: !!! info
Parts of the source files in this repository are made available under different licenses, Parts of the source files in this repository are made available under different licenses,
see file <A HREF="https://github.com/cyberman54/ESP32-Paxcounter/blob/master/LICENSE">LICENSE.txt</A> in this repository. Refer to each individual source file for more details. see file <A HREF="https://github.com/cyberman54/ESP32-Paxcounter/blob/master/LICENSE">LICENSE.txt</A> in this repository. Refer to each individual source file for more details.
# Credits # Credits

View File

@ -43,6 +43,7 @@ markdown_extensions:
- md_in_html - md_in_html
- admonition - admonition
- pymdownx.details - pymdownx.details
- pymdownx.superfences - pymdownx.tabbed:
alternate_style: true
repo_url: https://github.com/cyberman54/ESP32-Paxcounter repo_url: https://github.com/cyberman54/ESP32-Paxcounter