mirror of https://github.com/arendst/Tasmota.git
Restrict max number of driver_ID to 95
parent
4159bf3787
commit
580ebe3047
|
@ -12,7 +12,7 @@ This wiki page is an attempt to document the Tasmota sensor API for sensor drive
|
|||
* If your sensor has configuration options please make these available by using the SensorXX framework which is already incorporated in the base code - This may not stop you from using a web-based configuration interface but since web-based configuration takes up a lot of code space in flash it is very important to make this optional by means of a compiler directive or a #define in the configuration file and as such something you need to keep in mind during your development and debugging - The more progressively optional additional features are in your driver the smaller the basic codebase can be for minimalist implementations.
|
||||
* Whilst developing drivers for devices that use the I2C bus always consider other devices already supported in the codebase which may use the same address range. This could mean you need to find a unique way of differentiating your device detection from other devices on the same address range (e.g. querying a model-specific register) and/or disabling by #undef existing devices if yours is selected with a #define statement and in such cases always provide a warning to the user during compile time using the #warning pragma such as including `#warning **** Turned off conflicting drivers SHT and VEML6070 ****` in your code.
|
||||
* DO NOT ADD WEB INTERFACE FOR SENSOR CONFIGURATION if your sensor requires additional user configuration. The reason for this is the additional program memory required but most importantly the amount of RAM required to even create minimal user interfaces. Running out of RAM during runtime will lead to abnormal behaviour of your driver and/or other drivers or the entire firmware! See sensors such as the MCP23008/MCP23017 driver on more information on how to implement sensorXX commands instead!
|
||||
* While developing you might want to enable additional debugging provided by file ``xdrv_99_debug.ino`` using define USE_DEBUG_DRIVER which provides some commands for managing configuration settings and CPU timing. In addition you can enable define PROFILE_XSNS_SENSOR_EVERY_SECOND to profile your drivers duration.
|
||||
* While developing you might want to enable additional debugging provided by file ``xdrv_95_debug.ino`` using define USE_DEBUG_DRIVER which provides some commands for managing configuration settings and CPU timing. In addition you can enable define PROFILE_XSNS_SENSOR_EVERY_SECOND to profile your drivers duration.
|
||||
* Do not assume others will know immediately how to use your addition and know that you will need to write a Wiki for it in the end.
|
||||
|
||||
# Directory/file structure
|
||||
|
@ -30,7 +30,7 @@ Any sensor driver needs a callback function following the scheme
|
|||
#ifdef USE_<driver_name>
|
||||
|
||||
// Define driver ID
|
||||
#define XSNS_<driver_ID>
|
||||
#define XSNS_<driver_ID> <driver_ID>
|
||||
|
||||
/**
|
||||
* The callback function Xsns<driver_ID>() interfaces Tasmota with the sensor driver.
|
||||
|
@ -183,7 +183,7 @@ snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"MPR121%c\":{\"Button%i\":%i}}"
|
|||
```
|
||||
|
||||
### FUNC_WEB_APPEND
|
||||
This callback ID is called every 2.5 second when HTML code should be added to the Tasmota web-interface main page, e.g.
|
||||
This callback ID is called every <WebRefresh> millisecond when HTML code should be added to the Tasmota web-interface main page, e.g.
|
||||
```
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s{s}MPR121%c Button%d{m}%d{e}"), mqtt_data, pS->id[i], j, BITC(i,j));
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue