cyberman54 / ESP32-Paxcounter

Wifi & BLE driven passenger flow metering with cheap ESP32 boards
https://cyberman54.github.io/ESP32-Paxcounter/
Other
1.69k stars 397 forks source link

first version of protocol Cayenne for adding ANY SENSOR via serial #812

Closed raqueltac closed 1 year ago

raqueltac commented 3 years ago

I need some help for integrating this portion of code. At this moment, the new files do not interact with the original code, so the pacounter code works but without the new feature.

The idea is to add any sensor to a ESP32/ESP8266 and to send the payload in Cayenne LPP format to the ESP32 with Paxcounter code. It would make it easy to reuse code for any sensor (temperature, humidity, gyrometer, digital input, ...) without modifying Paxcounter code, just by adding 2 new files. These new files receive and process the payload sent by the tx in Cayenne LPP format. If a temperature data is received, it detects the prefix, stores the payload and does some operations (maximum and minimum value and arithmetic media). So the idea is to send this new payload (maximum and minimum value and arithmetic media of the temperature, in this example) to TTN using the SENDCYCLE value. But I'm not sure of how to add new data to the payload to be sent, could you help me?

raqueltac commented 3 years ago

I'm working on the integration with the files: sensor.cpp, senddata.cpp... I'll upload the new work as soon as I finish it (help found: https://github.com/cyberman54/ESP32-Paxcounter/discussions/732)

raqueltac commented 3 years ago

Can I use bit 1 of bitmask for indicating that ESP32 is receiving data sensors via serial? Or is it going to be used for another purpouse? @cyberman54

If not I think I can use user sensor 3, for example.

cyberman54 commented 3 years ago

Intention of the payloadmask variable is to give flexible control over which sensor's data is to be collected and sent (= payload) during runtime. Purpose is to keep payloads as small as possible.

Your approach sounds more like to control a hardware related task. This should be abstracted from the payload, e.g. by using hardware specific settings in the board specific hardware abstracation layer file (/src/hal/$board.h).