This commit is contained in:
Klaus K Wilting 2018-04-19 21:02:42 +02:00
parent c6191f9a24
commit de2aaf9e6a
3 changed files with 15 additions and 13 deletions

View File

@ -48,11 +48,13 @@ Hardware dependent settings (pinout etc.) are stored in board files in /hal dire
These results where metered with software version 1.2.97 while continuously scanning wifi and ble, no LoRa TXing, OLED display (if present) on, 5V USB powered.
# Building
# Preparing
Use <A HREF="https://platformio.org/">PlatformIO</A> with your preferred IDE for development and building this code.
Before compiling the code,
Before compiling the code, **create file loraconf.h in your local /src directory** using the template [loraconf.sample.h](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/loraconf.sample.h) and populate it with your personal APPEUI und APPKEY for the LoRaWAN network. If you're using popular <A HREF="https://thethingsnetwork.org">TheThingsNetwork</A> you can copy&paste the keys from TTN console or output of ttnctl.
- **edit paxcounter.conf** and taylor 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.
- **create file loraconf.h in your local /src directory** using the template [loraconf.sample.h](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/loraconf.sample.h) and populate it with your personal APPEUI und APPKEY for the LoRaWAN network. If you're using popular <A HREF="https://thethingsnetwork.org">TheThingsNetwork</A> you can copy&paste the keys from TTN console or output of ttnctl.
To join the network only method OTAA is supported, not ABP. The DEVEUI for OTAA will be derived from the device's MAC adress during device startup and is shown as well on the device's display (if it has one) as on the serial console for copying it to your LoRaWAN network server settings.
@ -60,6 +62,10 @@ If your device has a fixed DEVEUI enter this in your local loraconf.h file. Duri
If your device has silicon **Unique ID** which is stored in serial EEPROM Microchip 24AA02E64 you don't need to change anything. The Unique ID will be read during startup and DEVEUI will be generated from it, overriding settings in loraconf.h.
# Building
Use <A HREF="https://platformio.org/">PlatformIO</A> with your preferred IDE for development and building this code.
# Uploading
To upload the code 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>

View File

@ -11,9 +11,9 @@
; ---> SELECT TARGET PLATFORM HERE! <---
[platformio]
;env_default = heltec_wifi_lora_32
env_default = heltec_wifi_lora_32
;env_default = ttgov1
env_default = ttgov2
;env_default = ttgov2
;env_default = lopy
;env_default = lopy4
;env_default = lolin32lite_lora

View File

@ -41,12 +41,12 @@ Refer to LICENSE.txt file in repository for more details.
configData_t cfg; // struct holds current device configuration
osjob_t sendjob, initjob; // LMIC jobs
uint64_t uptimecounter = 0; // timer global for uptime counter
uint32_t currentMillis = 0; // timer global for state machine
uint32_t currentMillis = 0, previousDisplaymillis = 0 // timer globals for state machine
uint8_t DisplayState, LEDcount = 0; // globals for state machine
uint16_t LEDBlinkduration = 0, LEDInterval = 0, color=COLOR_NONE; // state machine variables
uint16_t macs_total = 0, macs_wifi = 0, macs_ble = 0; // MAC counters globals for display
uint16_t macs_total = 0, macs_wifi = 0, macs_ble = 0; // MAC counters globals for display
uint8_t channel = 0; // wifi channel rotation counter global for display
char display_lora[16], display_lmic[16]; // display buffers
char display_lora[16], display_lmic[16]; // display buffers
enum states LEDState = LED_OFF; // LED state global for state machine
bool joinstate = false; // LoRa network joined? global flag
@ -224,9 +224,6 @@ void sniffer_loop(void * pvParameters) {
nloop=0; channel=0; // reset wifi scan + channel loop counter
do_send(&sendjob); // Prepare and execute LoRaWAN data upload
//vTaskDelay(500/portTICK_PERIOD_MS); // tbd - is this delay really needed here?
//yield();
// clear counter if not in cumulative counter mode
if (cfg.countermode != 1) {
reset_counters(); // clear macs container and reset all counters
@ -366,8 +363,7 @@ uint64_t uptime() {
void updateDisplay() {
// timed display refresh according to refresh cycle setting
uint32_t previousDisplaymillis;
if (currentMillis - previousDisplaymillis >= DISPLAYREFRESH_MS) {
refreshDisplay();
previousDisplaymillis += DISPLAYREFRESH_MS;