2018-01-05 11:26:19 +00:00
|
|
|
/*
|
2019-10-27 10:13:24 +00:00
|
|
|
xdrv_interface.ino - Driver interface support for Tasmota
|
2018-01-05 11:26:19 +00:00
|
|
|
|
2021-01-01 12:44:04 +00:00
|
|
|
Copyright (C) 2021 Theo Arends inspired by ESPEasy
|
2018-01-05 11:26:19 +00:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-11-07 10:57:28 +00:00
|
|
|
#ifdef XFUNC_PTR_IN_ROM
|
2019-01-28 13:08:33 +00:00
|
|
|
bool (* const xdrv_func_ptr[])(uint8_t) PROGMEM = { // Driver Function Pointers
|
2018-11-07 10:38:24 +00:00
|
|
|
#else
|
2019-01-28 13:08:33 +00:00
|
|
|
bool (* const xdrv_func_ptr[])(uint8_t) = { // Driver Function Pointers
|
2018-11-07 10:38:24 +00:00
|
|
|
#endif
|
|
|
|
|
2018-01-05 11:26:19 +00:00
|
|
|
#ifdef XDRV_01
|
2018-01-24 16:31:20 +00:00
|
|
|
&Xdrv01,
|
2018-01-05 11:26:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_02
|
2018-01-24 16:31:20 +00:00
|
|
|
&Xdrv02,
|
2018-01-05 11:26:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_03
|
2018-01-24 16:31:20 +00:00
|
|
|
&Xdrv03,
|
2018-01-05 11:26:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_04
|
2018-01-24 16:31:20 +00:00
|
|
|
&Xdrv04,
|
2018-01-05 11:26:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_05
|
2018-01-24 16:31:20 +00:00
|
|
|
&Xdrv05,
|
2018-01-05 11:26:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_06
|
2018-01-24 16:31:20 +00:00
|
|
|
&Xdrv06,
|
2018-01-05 11:26:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_07
|
2018-01-24 16:31:20 +00:00
|
|
|
&Xdrv07,
|
2018-01-05 11:26:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_08
|
2018-01-24 16:31:20 +00:00
|
|
|
&Xdrv08,
|
2018-01-05 11:26:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_09
|
2018-01-24 16:31:20 +00:00
|
|
|
&Xdrv09,
|
2018-01-05 11:26:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_10
|
2018-01-24 16:31:20 +00:00
|
|
|
&Xdrv10,
|
2018-01-05 11:26:19 +00:00
|
|
|
#endif
|
2018-02-08 14:20:03 +00:00
|
|
|
|
|
|
|
#ifdef XDRV_11
|
|
|
|
&Xdrv11,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_12
|
|
|
|
&Xdrv12,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_13
|
|
|
|
&Xdrv13,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_14
|
|
|
|
&Xdrv14,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_15
|
|
|
|
&Xdrv15,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_16
|
|
|
|
&Xdrv16,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_17
|
|
|
|
&Xdrv17,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_18
|
|
|
|
&Xdrv18,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_19
|
|
|
|
&Xdrv19,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_20
|
|
|
|
&Xdrv20,
|
|
|
|
#endif
|
|
|
|
|
2018-10-23 15:03:57 +01:00
|
|
|
#ifdef XDRV_21
|
|
|
|
&Xdrv21,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_22
|
|
|
|
&Xdrv22,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_23
|
|
|
|
&Xdrv23,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_24
|
|
|
|
&Xdrv24,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_25
|
|
|
|
&Xdrv25,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_26
|
|
|
|
&Xdrv26,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_27
|
|
|
|
&Xdrv27,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_28
|
|
|
|
&Xdrv28,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_29
|
|
|
|
&Xdrv29,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_30
|
|
|
|
&Xdrv30,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_31
|
|
|
|
&Xdrv31,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_32
|
|
|
|
&Xdrv32,
|
|
|
|
#endif
|
|
|
|
|
2019-08-18 12:23:43 +01:00
|
|
|
#ifdef XDRV_33
|
|
|
|
&Xdrv33,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_34
|
|
|
|
&Xdrv34,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_35
|
|
|
|
&Xdrv35,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_36
|
|
|
|
&Xdrv36,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_37
|
|
|
|
&Xdrv37,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_38
|
|
|
|
&Xdrv38,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_39
|
|
|
|
&Xdrv39,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_40
|
|
|
|
&Xdrv40,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_41
|
|
|
|
&Xdrv41,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_42
|
|
|
|
&Xdrv42,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_43
|
|
|
|
&Xdrv43,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_44
|
|
|
|
&Xdrv44,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_45
|
|
|
|
&Xdrv45,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_46
|
|
|
|
&Xdrv46,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_47
|
|
|
|
&Xdrv47,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_48
|
|
|
|
&Xdrv48,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_49
|
|
|
|
&Xdrv49,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_50
|
|
|
|
&Xdrv50,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_51
|
|
|
|
&Xdrv51,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_52
|
|
|
|
&Xdrv52,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_53
|
|
|
|
&Xdrv53,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_54
|
|
|
|
&Xdrv54,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_55
|
|
|
|
&Xdrv55,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_56
|
|
|
|
&Xdrv56,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_57
|
|
|
|
&Xdrv57,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_58
|
|
|
|
&Xdrv58,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_59
|
|
|
|
&Xdrv59,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_60
|
|
|
|
&Xdrv60,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_61
|
|
|
|
&Xdrv61,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_62
|
|
|
|
&Xdrv62,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_63
|
|
|
|
&Xdrv63,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_64
|
|
|
|
&Xdrv64,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_65
|
|
|
|
&Xdrv65,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_66
|
|
|
|
&Xdrv66,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_67
|
|
|
|
&Xdrv67,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_68
|
|
|
|
&Xdrv68,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_69
|
|
|
|
&Xdrv69,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_70
|
|
|
|
&Xdrv70,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_71
|
|
|
|
&Xdrv71,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_72
|
|
|
|
&Xdrv72,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_73
|
|
|
|
&Xdrv73,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_74
|
|
|
|
&Xdrv74,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_75
|
|
|
|
&Xdrv75,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_76
|
|
|
|
&Xdrv76,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_77
|
|
|
|
&Xdrv77,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_78
|
|
|
|
&Xdrv78,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_79
|
|
|
|
&Xdrv79,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_80
|
|
|
|
&Xdrv80,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_81
|
|
|
|
&Xdrv81,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_82
|
|
|
|
&Xdrv82,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_83
|
|
|
|
&Xdrv83,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_84
|
|
|
|
&Xdrv84,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_85
|
|
|
|
&Xdrv85,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_86
|
|
|
|
&Xdrv86,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_87
|
|
|
|
&Xdrv87,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_88
|
|
|
|
&Xdrv88,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_89
|
|
|
|
&Xdrv89,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_90
|
|
|
|
&Xdrv90,
|
|
|
|
#endif
|
2018-02-08 14:20:03 +00:00
|
|
|
|
|
|
|
#ifdef XDRV_91
|
|
|
|
&Xdrv91,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_92
|
|
|
|
&Xdrv92,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_93
|
|
|
|
&Xdrv93,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_94
|
|
|
|
&Xdrv94,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_95
|
|
|
|
&Xdrv95,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_96
|
|
|
|
&Xdrv96,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_97
|
|
|
|
&Xdrv97,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_98
|
|
|
|
&Xdrv98,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_99
|
2021-01-15 11:01:15 +00:00
|
|
|
&Xdrv99,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_100
|
|
|
|
&Xdrv100,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_101
|
|
|
|
&Xdrv101,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_102
|
|
|
|
&Xdrv102,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_103
|
|
|
|
&Xdrv103,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_104
|
|
|
|
&Xdrv104,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_105
|
|
|
|
&Xdrv105,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_106
|
|
|
|
&Xdrv106,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_107
|
|
|
|
&Xdrv107,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_108
|
|
|
|
&Xdrv108,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_109
|
|
|
|
&Xdrv109,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_110
|
|
|
|
&Xdrv110,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_111
|
|
|
|
&Xdrv111,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_112
|
|
|
|
&Xdrv112,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_113
|
|
|
|
&Xdrv113,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_114
|
|
|
|
&Xdrv114,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_115
|
|
|
|
&Xdrv115,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_116
|
|
|
|
&Xdrv116,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_117
|
|
|
|
&Xdrv117,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_118
|
|
|
|
&Xdrv118,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_119
|
|
|
|
&Xdrv119,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_120
|
|
|
|
&Xdrv120,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_121
|
|
|
|
&Xdrv121,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_122
|
|
|
|
&Xdrv122,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_123
|
|
|
|
&Xdrv123,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_124
|
|
|
|
&Xdrv124,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_125
|
|
|
|
&Xdrv125,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_126
|
|
|
|
&Xdrv126,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_127
|
|
|
|
&Xdrv127,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_128
|
|
|
|
&Xdrv128
|
2018-02-08 14:20:03 +00:00
|
|
|
#endif
|
2018-01-24 16:31:20 +00:00
|
|
|
};
|
2018-01-05 11:26:19 +00:00
|
|
|
|
2018-01-24 16:31:20 +00:00
|
|
|
const uint8_t xdrv_present = sizeof(xdrv_func_ptr) / sizeof(xdrv_func_ptr[0]); // Number of drivers found
|
2018-01-05 11:26:19 +00:00
|
|
|
|
2019-08-18 12:23:43 +01:00
|
|
|
/*********************************************************************************************\
|
|
|
|
* Xdrv available list
|
|
|
|
\*********************************************************************************************/
|
|
|
|
|
|
|
|
#ifdef XFUNC_PTR_IN_ROM
|
|
|
|
const uint8_t kXdrvList[] PROGMEM = {
|
|
|
|
#else
|
|
|
|
const uint8_t kXdrvList[] = {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_01
|
|
|
|
XDRV_01,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_02
|
|
|
|
XDRV_02,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_03
|
|
|
|
XDRV_03,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_04
|
|
|
|
XDRV_04,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_05
|
|
|
|
XDRV_05,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_06
|
|
|
|
XDRV_06,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_07
|
|
|
|
XDRV_07,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_08
|
|
|
|
XDRV_08,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_09
|
|
|
|
XDRV_09,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_10
|
|
|
|
XDRV_10,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_11
|
|
|
|
XDRV_11,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_12
|
|
|
|
XDRV_12,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_13
|
|
|
|
XDRV_13,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_14
|
|
|
|
XDRV_14,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_15
|
|
|
|
XDRV_15,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_16
|
|
|
|
XDRV_16,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_17
|
|
|
|
XDRV_17,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_18
|
|
|
|
XDRV_18,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_19
|
|
|
|
XDRV_19,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_20
|
|
|
|
XDRV_20,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_21
|
|
|
|
XDRV_21,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_22
|
|
|
|
XDRV_22,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_23
|
|
|
|
XDRV_23,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_24
|
|
|
|
XDRV_24,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_25
|
|
|
|
XDRV_25,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_26
|
|
|
|
XDRV_26,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_27
|
|
|
|
XDRV_27,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_28
|
|
|
|
XDRV_28,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_29
|
|
|
|
XDRV_29,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_30
|
|
|
|
XDRV_30,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_31
|
|
|
|
XDRV_31,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_32
|
|
|
|
XDRV_32,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_33
|
|
|
|
XDRV_33,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_34
|
|
|
|
XDRV_34,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_35
|
|
|
|
XDRV_35,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_36
|
|
|
|
XDRV_36,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_37
|
|
|
|
XDRV_37,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_38
|
|
|
|
XDRV_38,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_39
|
|
|
|
XDRV_39,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_40
|
|
|
|
XDRV_40,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_41
|
|
|
|
XDRV_41,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_42
|
|
|
|
XDRV_42,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_43
|
|
|
|
XDRV_43,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_44
|
|
|
|
XDRV_44,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_45
|
|
|
|
XDRV_45,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_46
|
|
|
|
XDRV_46,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_47
|
|
|
|
XDRV_47,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_48
|
|
|
|
XDRV_48,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_49
|
|
|
|
XDRV_49,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_50
|
|
|
|
XDRV_50,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_51
|
|
|
|
XDRV_51,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_52
|
|
|
|
XDRV_52,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_53
|
|
|
|
XDRV_53,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_54
|
|
|
|
XDRV_54,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_55
|
|
|
|
XDRV_55,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_56
|
|
|
|
XDRV_56,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_57
|
|
|
|
XDRV_57,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_58
|
|
|
|
XDRV_58,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_59
|
|
|
|
XDRV_59,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_60
|
|
|
|
XDRV_60,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_61
|
|
|
|
XDRV_61,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_62
|
|
|
|
XDRV_62,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_63
|
|
|
|
XDRV_63,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_64
|
|
|
|
XDRV_64,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_65
|
|
|
|
XDRV_65,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_66
|
|
|
|
XDRV_66,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_67
|
|
|
|
XDRV_67,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_68
|
|
|
|
XDRV_68,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_69
|
|
|
|
XDRV_69,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_70
|
|
|
|
XDRV_70,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_71
|
|
|
|
XDRV_71,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_72
|
|
|
|
XDRV_72,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_73
|
|
|
|
XDRV_73,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_74
|
|
|
|
XDRV_74,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_75
|
|
|
|
XDRV_75,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_76
|
|
|
|
XDRV_76,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_77
|
|
|
|
XDRV_77,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_78
|
|
|
|
XDRV_78,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_79
|
|
|
|
XDRV_79,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_80
|
|
|
|
XDRV_80,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_81
|
|
|
|
XDRV_81,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_82
|
|
|
|
XDRV_82,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_83
|
|
|
|
XDRV_83,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_84
|
|
|
|
XDRV_84,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_85
|
|
|
|
XDRV_85,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_86
|
|
|
|
XDRV_86,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_87
|
|
|
|
XDRV_87,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_88
|
|
|
|
XDRV_88,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_89
|
|
|
|
XDRV_89,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_90
|
|
|
|
XDRV_90,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_91
|
|
|
|
XDRV_91,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_92
|
|
|
|
XDRV_92,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_93
|
|
|
|
XDRV_93,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_94
|
|
|
|
XDRV_94,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_95
|
|
|
|
XDRV_95,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_96
|
|
|
|
XDRV_96,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_97
|
|
|
|
XDRV_97,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_98
|
|
|
|
XDRV_98,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_99
|
2021-01-15 11:01:15 +00:00
|
|
|
XDRV_99,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_100
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_100,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_101
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_101,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_102
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_102,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_103
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_103,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_104
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_104,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_105
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_105,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_106
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_106,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_107
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_107,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_108
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_108,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_109
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_109,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_110
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_110,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_111
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_111,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_112
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_112,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_113
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_113,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_114
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_114,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_115
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_115,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_116
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_116,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_117
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_117,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_118
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_118,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_119
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_119,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_120
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_120,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_121
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_121,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_122
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_122,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_123
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_123,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_124
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_124,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_125
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_125,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_126
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_126,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_127
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_127,
|
2021-01-15 11:01:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XDRV_128
|
2021-08-12 20:34:22 +01:00
|
|
|
XDRV_128
|
2019-08-18 12:23:43 +01:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
/*********************************************************************************************/
|
|
|
|
|
|
|
|
void XsnsDriverState(void)
|
|
|
|
{
|
|
|
|
ResponseAppend_P(PSTR(",\"Drivers\":\"")); // Use string for future enable/disable signal
|
|
|
|
for (uint32_t i = 0; i < sizeof(kXdrvList); i++) {
|
|
|
|
#ifdef XFUNC_PTR_IN_ROM
|
|
|
|
uint32_t driverid = pgm_read_byte(kXdrvList + i);
|
|
|
|
#else
|
|
|
|
uint32_t driverid = kXdrvList[i];
|
|
|
|
#endif
|
|
|
|
ResponseAppend_P(PSTR("%s%d"), (i) ? "," : "", driverid);
|
|
|
|
}
|
|
|
|
ResponseAppend_P(PSTR("\""));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************************************/
|
|
|
|
|
2021-06-09 16:24:28 +01:00
|
|
|
bool XdrvRulesProcess(bool teleperiod, const char* event) {
|
2021-06-02 16:56:44 +01:00
|
|
|
char* data_save = XdrvMailbox.data;
|
2021-06-09 16:24:28 +01:00
|
|
|
XdrvMailbox.data = (char*)event;
|
2021-04-23 09:59:33 +01:00
|
|
|
bool rule_handled = XdrvCallDriver(10, (teleperiod) ? FUNC_TELEPERIOD_RULES_PROCESS : FUNC_RULES_PROCESS);
|
2021-08-19 11:37:19 +01:00
|
|
|
#if defined(USE_BERRY) && !defined(USE_RULES)
|
|
|
|
// events are sent to Berry in Rules driver, or here if USE_RULES is not defined (only on a subset)
|
2021-02-13 11:01:45 +00:00
|
|
|
bool berry_handled = XdrvCallDriver(52, FUNC_RULES_PROCESS);
|
2021-04-05 09:39:43 +01:00
|
|
|
rule_handled |= berry_handled;
|
2021-02-13 11:01:45 +00:00
|
|
|
#endif
|
2021-06-02 16:56:44 +01:00
|
|
|
XdrvMailbox.data = data_save;
|
2021-04-05 09:39:43 +01:00
|
|
|
return rule_handled;
|
2018-05-24 15:23:20 +01:00
|
|
|
}
|
|
|
|
|
2021-06-02 16:56:44 +01:00
|
|
|
bool XdrvRulesProcess(bool teleperiod) {
|
2022-04-05 20:55:05 +01:00
|
|
|
#ifdef USE_INFLUXDB
|
|
|
|
if (!teleperiod) { // Only process ad-hoc data here
|
|
|
|
InfluxDbProcessJson(1); // Use a copy
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-08-15 16:26:32 +01:00
|
|
|
bool result = XdrvRulesProcess(teleperiod, ResponseData());
|
2022-04-05 20:55:05 +01:00
|
|
|
ResponseClear(); // Free heap space
|
2021-06-09 16:24:28 +01:00
|
|
|
return result;
|
2021-06-02 16:56:44 +01:00
|
|
|
}
|
|
|
|
|
2019-03-11 09:38:41 +00:00
|
|
|
#ifdef USE_DEBUG_DRIVER
|
2018-06-26 10:48:09 +01:00
|
|
|
void ShowFreeMem(const char *where)
|
|
|
|
{
|
2019-03-27 17:09:27 +00:00
|
|
|
char stemp[30];
|
2018-06-26 10:48:09 +01:00
|
|
|
snprintf_P(stemp, sizeof(stemp), where);
|
|
|
|
XdrvMailbox.data = stemp;
|
|
|
|
XdrvCall(FUNC_FREE_MEM);
|
|
|
|
}
|
2019-03-11 09:38:41 +00:00
|
|
|
#endif
|
2018-06-26 10:48:09 +01:00
|
|
|
|
2019-08-19 10:18:50 +01:00
|
|
|
/*********************************************************************************************\
|
|
|
|
* Function call to single xdrv
|
|
|
|
\*********************************************************************************************/
|
|
|
|
|
|
|
|
bool XdrvCallDriver(uint32_t driver, uint8_t Function)
|
|
|
|
{
|
|
|
|
for (uint32_t x = 0; x < xdrv_present; x++) {
|
|
|
|
#ifdef XFUNC_PTR_IN_ROM
|
|
|
|
uint32_t listed = pgm_read_byte(kXdrvList + x);
|
|
|
|
#else
|
|
|
|
uint32_t listed = kXdrvList[x];
|
|
|
|
#endif
|
|
|
|
if (driver == listed) {
|
|
|
|
return xdrv_func_ptr[x](Function);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-01-05 11:26:19 +00:00
|
|
|
/*********************************************************************************************\
|
|
|
|
* Function call to all xdrv
|
|
|
|
\*********************************************************************************************/
|
|
|
|
|
2019-01-28 13:08:33 +00:00
|
|
|
bool XdrvCall(uint8_t Function)
|
2018-01-05 11:26:19 +00:00
|
|
|
{
|
2019-01-28 13:08:33 +00:00
|
|
|
bool result = false;
|
2018-01-05 11:26:19 +00:00
|
|
|
|
2021-10-29 17:49:29 +01:00
|
|
|
// DEBUG_TRACE_LOG(PSTR("DRV: %d"), Function);
|
|
|
|
|
|
|
|
uint32_t profile_driver_start = millis();
|
2019-11-06 16:48:38 +00:00
|
|
|
|
2019-06-30 15:44:36 +01:00
|
|
|
for (uint32_t x = 0; x < xdrv_present; x++) {
|
2021-10-29 17:49:29 +01:00
|
|
|
|
|
|
|
uint32_t profile_function_start = millis();
|
|
|
|
|
2018-01-05 11:26:19 +00:00
|
|
|
result = xdrv_func_ptr[x](Function);
|
2018-12-30 14:32:53 +00:00
|
|
|
|
2021-10-31 10:57:06 +00:00
|
|
|
#ifdef USE_PROFILE_FUNCTION
|
|
|
|
#ifdef XFUNC_PTR_IN_ROM
|
|
|
|
uint32_t index = pgm_read_byte(kXdrvList + x);
|
|
|
|
#else
|
|
|
|
uint32_t index = kXdrvList[x];
|
|
|
|
#endif
|
|
|
|
PROFILE_FUNCTION("drv", index, Function, profile_function_start);
|
|
|
|
#endif // USE_PROFILE_FUNCTION
|
2021-10-29 17:49:29 +01:00
|
|
|
|
2018-12-30 14:32:53 +00:00
|
|
|
if (result && ((FUNC_COMMAND == Function) ||
|
2019-03-10 12:33:32 +00:00
|
|
|
(FUNC_COMMAND_DRIVER == Function) ||
|
2018-12-30 14:32:53 +00:00
|
|
|
(FUNC_MQTT_DATA == Function) ||
|
|
|
|
(FUNC_RULES_PROCESS == Function) ||
|
|
|
|
(FUNC_BUTTON_PRESSED == Function) ||
|
|
|
|
(FUNC_SERIAL == Function) ||
|
|
|
|
(FUNC_MODULE_INIT == Function) ||
|
|
|
|
(FUNC_SET_CHANNELS == Function) ||
|
2019-08-12 16:18:08 +01:00
|
|
|
(FUNC_PIN_STATE == Function) ||
|
2018-12-30 14:32:53 +00:00
|
|
|
(FUNC_SET_DEVICE_POWER == Function)
|
|
|
|
)) {
|
|
|
|
break;
|
|
|
|
}
|
2018-01-05 11:26:19 +00:00
|
|
|
}
|
|
|
|
|
2021-10-31 10:57:06 +00:00
|
|
|
PROFILE_DRIVER("drv", Function, profile_driver_start);
|
2021-10-29 17:49:29 +01:00
|
|
|
|
2018-01-05 11:26:19 +00:00
|
|
|
return result;
|
|
|
|
}
|