All XsnsFunctions added.

Rene Bartsch 2018-07-12 15:20:44 +02:00
parent 55e4b7190f
commit 792e5fbc49
1 changed files with 40 additions and 4 deletions

@ -47,12 +47,22 @@ boolean Xsns<driverID>(byte callback_id)
### Callback IDs
#### FUNC_PRE_INIT
???
#### FUNC_INIT
This callback ID is called when sensor drivers should be initialized.
#### FUNC_LOOP
???
#### FUNC_EVERY_50_MSECOND
This callback ID is called every 50 milliseconds, e.g. for near real-time operation
#### FUNC_EVERY_SECOND
This callback ID is called every second.
#### FUNC_PREP_BEFORE_TELEPERIOD
???
#### FUNC_JSON_APPEND
This callback ID is called when `TELEPERIOD` is due to append telemetry data to the MQTT JSON string, e.g.
```
@ -66,11 +76,36 @@ snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s{s}MPR121%c Button%d{m}%d{e}"),
```
It should be wrapped in `#ifdef USE_WEBSERVER ... #endif // USE_WEBSERVER`
### Useful functions
#### `int snprintf_P(char * __s, size_t __n, const char * format_string, char* text)`
This function formats text like `printf()`.
#### FUNC_SAVE_BEFORE_RESTART
???
#### `void MqttPublishPrefixTopic_P(uint8_t prefix, const char* subtopic, boolean retained)`
#### FUNC_COMMAND
???
#### FUNC_MQTT_SUBSCRIBE
???
#### FUNC_MQTT_INIT
???
#### FUNC_MQTT_DATA
???
#### FUNC_SET_POWER
???
#### FUNC_SHOW_SENSOR
???
#### FUNC_RULES_PROCESS
???
#### FUNC_FREE_MEM
???
### Useful functions
#### void MqttPublishPrefixTopic_P(uint8_t prefix, const char* subtopic, boolean retained)
This function publishes MQTT messages immediately, e.g.
```
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"MPR121%c\":{\"Button%i\":%i}}"), pS->id[i], j, BITC(i,j));
@ -87,6 +122,7 @@ snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_I2C "MPR121(%c) " D_FOUND_AT "
AddLogSerial(LOG_LEVEL_INFO);
```
#### void AddLogMissed(char *sensor, uint8_t misses)
???
### Useful pre-processor directives
### `PSTR("string")`