-
Notifications
You must be signed in to change notification settings - Fork 25
03. Adding Support of multiple Sensors
Matthias Prinke edited this page Jun 20, 2024
·
1 revision
The SW should be able to receive data from multiple sensors, e.g. a Weather Sensor and a Soil Moisture Sensor.
Option for skipping unwanted sensors (e.g. neighbours') - currently messages are received and decoded regardless of type or ID of sensor!
3 Different solutions have been considered:
- decode radio messages in order as received
- save decoded data into temporary buffer
- copy data into final structure
Pros:
- easy to implement
- clean code structure
Cons:
- memory wasted for temporary buffer
- time for copying data
- handle radio messages in predefined order
- save decoded data into final structure
Pros:
- easy to implement
- clean code structure
- efficient memory utilization
Cons:
- inefficient usage of CPU time waiting for desired message
- decode radio messages in order as received
- save decoded data into final buffer in reception order; check for data already received (either complete or incomplete)
- map data buffer (order of reception) to predefined order or search for desired sensor ID/type for presentation
Pros:
- efficient memory utilization
- efficient usage of CPU time
Cons:
- somewhat difficult to implement
- potentially fuzzy code structure
Solution #3 has been implemented and the code does not look too bad, IMHO!