Updated Sensor API (markdown)

andrethomas 2018-07-14 20:55:38 +02:00
parent 66e71d7161
commit e7b35de0d2
1 changed files with 22 additions and 1 deletions

@ -102,7 +102,28 @@ This callback ID is called every 50 milliseconds, e.g. for near real-time operat
This callback ID is called every second.
### FUNC_PREP_BEFORE_TELEPERIOD
???
This callback ID is called before TELEPERIOD and is intended.
You would normally want to make sure you've detected and initialised before it is used by JSON_APPEND etc so that its ready to serve data.
The generally accepted way to use this would be to detect your sensor and once this is done set a sensor value accordingly so that the function does not use unnecessary resources during future calls, for example:
```
void MySensorDetect()
{
if (MySensorDetected) { return; }
/*
* Perform the code which needs to be completed to
* detect your sensor and then set MySensorDetected to
* a non-zero value which will prevent this section
* of your code to re-run every time the function is
* called.
*
* Under normal circumstances you'd not need to do
* re-detect or initialise your sensor once it has been
* done
*/
}
```
### FUNC_JSON_APPEND
This callback ID is called when `TELEPERIOD` is due to append telemetry data to the MQTT JSON string, e.g.