mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 23:07:17 +00:00
Increase sensor support
This commit is contained in:
parent
46bf60ac15
commit
d64a6a1b10
@ -825,27 +825,144 @@ const uint8_t kXsnsList[] = {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XSNS_99
|
#ifdef XSNS_99
|
||||||
XSNS_99
|
XSNS_99,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_100
|
||||||
|
XSNS_100,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_101
|
||||||
|
XSNS_101,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_102
|
||||||
|
XSNS_102,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_103
|
||||||
|
XSNS_103,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_104
|
||||||
|
XSNS_104,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_105
|
||||||
|
XSNS_105,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_106
|
||||||
|
XSNS_106,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_107
|
||||||
|
XSNS_107,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_108
|
||||||
|
XSNS_108,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_109
|
||||||
|
XSNS_109,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_110
|
||||||
|
XSNS_110,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_111
|
||||||
|
XSNS_111,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_112
|
||||||
|
XSNS_112,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_113
|
||||||
|
XSNS_113,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_114
|
||||||
|
XSNS_114,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_115
|
||||||
|
XSNS_115,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_116
|
||||||
|
XSNS_116,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_117
|
||||||
|
XSNS_117,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_118
|
||||||
|
XSNS_118,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_119
|
||||||
|
XSNS_119,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_120
|
||||||
|
XSNS_120,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_121
|
||||||
|
XSNS_121,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_122
|
||||||
|
XSNS_122,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_123
|
||||||
|
XSNS_123,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_124
|
||||||
|
XSNS_124,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_125
|
||||||
|
XSNS_125,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_126
|
||||||
|
XSNS_126,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_127
|
||||||
|
XSNS_127,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_128
|
||||||
|
XSNS_128
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
bool XsnsEnabled(uint32_t sns_index)
|
bool XsnsEnabled(uint32_t sns_index) {
|
||||||
{
|
|
||||||
if (sns_index < sizeof(kXsnsList)) {
|
if (sns_index < sizeof(kXsnsList)) {
|
||||||
#ifdef XFUNC_PTR_IN_ROM
|
#ifdef XFUNC_PTR_IN_ROM
|
||||||
uint32_t index = pgm_read_byte(kXsnsList + sns_index);
|
uint32_t index = pgm_read_byte(kXsnsList + sns_index);
|
||||||
#else
|
#else
|
||||||
uint32_t index = kXsnsList[sns_index];
|
uint32_t index = kXsnsList[sns_index];
|
||||||
#endif
|
#endif
|
||||||
return bitRead(Settings.sensors[index / 32], index % 32);
|
if (index < MAX_XSNS_DRIVERS) {
|
||||||
|
return bitRead(Settings.sensors[index / 32], index % 32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XsnsSensorState(void)
|
void XsnsSensorState(void) {
|
||||||
{
|
|
||||||
ResponseAppend_P(PSTR("\"")); // Use string for enable/disable signal
|
ResponseAppend_P(PSTR("\"")); // Use string for enable/disable signal
|
||||||
for (uint32_t i = 0; i < sizeof(kXsnsList); i++) {
|
for (uint32_t i = 0; i < sizeof(kXsnsList); i++) {
|
||||||
#ifdef XFUNC_PTR_IN_ROM
|
#ifdef XFUNC_PTR_IN_ROM
|
||||||
@ -866,8 +983,7 @@ void XsnsSensorState(void)
|
|||||||
* Function call to all xsns
|
* Function call to all xsns
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
bool XsnsNextCall(uint8_t Function, uint8_t &xsns_index)
|
bool XsnsNextCall(uint8_t Function, uint8_t &xsns_index) {
|
||||||
{
|
|
||||||
if (0 == xsns_present) {
|
if (0 == xsns_present) {
|
||||||
xsns_index = 0;
|
xsns_index = 0;
|
||||||
return false;
|
return false;
|
||||||
@ -891,8 +1007,7 @@ bool XsnsNextCall(uint8_t Function, uint8_t &xsns_index)
|
|||||||
return xsns_func_ptr[xsns_index](Function);
|
return xsns_func_ptr[xsns_index](Function);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XsnsCall(uint8_t Function)
|
bool XsnsCall(uint8_t Function) {
|
||||||
{
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
DEBUG_TRACE_LOG(PSTR("SNS: %d"), Function);
|
DEBUG_TRACE_LOG(PSTR("SNS: %d"), Function);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user