mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 11:46:31 +00:00
Moved all func ptr tables to RAM
Moved all function pointer tables to RAM to check performance issues
This commit is contained in:
parent
a4df728115
commit
44d6714b69
@ -20,6 +20,16 @@
|
||||
#ifndef _SONOFF_H_
|
||||
#define _SONOFF_H_
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Performance ROM (PROGMEM) vs RAM (RODATA)
|
||||
\*********************************************************************************************/
|
||||
|
||||
//#define XFUNC_PTR_IN_ROM // Enable for keeping tables in ROM (PROGMEM) which seem to have access issues on some flash types
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Default sensor states
|
||||
\*********************************************************************************************/
|
||||
|
||||
#define USE_DHT // Default DHT11 sensor needs no external library
|
||||
#define USE_ENERGY_SENSOR // Use energy sensors (+14k code)
|
||||
#define USE_HLW8012 // Use energy sensor for Sonoff Pow and WolfBlitz
|
||||
|
@ -17,9 +17,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//#define XDRV_IN_ROM
|
||||
|
||||
#ifdef XDRV_IN_ROM
|
||||
#ifdef XFUNC_PTR_IN_ROM
|
||||
boolean (* const xdrv_func_ptr[])(byte) PROGMEM = { // Driver Function Pointers
|
||||
#else
|
||||
boolean (* const xdrv_func_ptr[])(byte) = { // Driver Function Pointers
|
||||
|
@ -17,7 +17,12 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef XFUNC_PTR_IN_ROM
|
||||
boolean (* const xdsp_func_ptr[])(byte) PROGMEM = { // Display Function Pointers
|
||||
#else
|
||||
boolean (* const xdsp_func_ptr[])(byte) = { // Display Function Pointers
|
||||
#endif
|
||||
|
||||
#ifdef XDSP_01
|
||||
&Xdsp01,
|
||||
#endif
|
||||
|
@ -17,7 +17,12 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef XFUNC_PTR_IN_ROM
|
||||
int (* const xnrg_func_ptr[])(byte) PROGMEM = { // Energy driver Function Pointers
|
||||
#else
|
||||
int (* const xnrg_func_ptr[])(byte) = { // Energy driver Function Pointers
|
||||
#endif
|
||||
|
||||
#ifdef XNRG_01
|
||||
&Xnrg01,
|
||||
#endif
|
||||
|
@ -17,13 +17,12 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//#define XSNS_IN_ROM
|
||||
|
||||
#ifdef XSNS_IN_ROM
|
||||
#ifdef XFUNC_PTR_IN_ROM
|
||||
boolean (* const xsns_func_ptr[])(byte) PROGMEM = { // Sensor Function Pointers for simple implementation of sensors
|
||||
#else
|
||||
boolean (* const xsns_func_ptr[])(byte) = { // Sensor Function Pointers for simple implementation of sensors
|
||||
#endif
|
||||
|
||||
#ifdef XSNS_01
|
||||
&Xsns01,
|
||||
#endif
|
||||
@ -266,11 +265,12 @@ boolean (* const xsns_func_ptr[])(byte) = { // Sensor Function Pointers for sim
|
||||
const uint8_t xsns_present = sizeof(xsns_func_ptr) / sizeof(xsns_func_ptr[0]); // Number of External Sensors found
|
||||
uint8_t xsns_index = 0;
|
||||
|
||||
#ifdef XSNS_IN_ROM
|
||||
#ifdef XFUNC_PTR_IN_ROM
|
||||
const uint8_t kXsnsList[] PROGMEM = {
|
||||
#else
|
||||
const uint8_t kXsnsList[] = {
|
||||
#endif
|
||||
|
||||
#ifdef XSNS_01
|
||||
XSNS_01,
|
||||
#endif
|
||||
@ -518,7 +518,7 @@ const uint8_t kXsnsList[] = {
|
||||
boolean XsnsEnabled(byte sns_index)
|
||||
{
|
||||
if (sns_index < sizeof(kXsnsList)) {
|
||||
#ifdef XSNS_IN_ROM
|
||||
#ifdef XFUNC_PTR_IN_ROM
|
||||
uint8_t index = pgm_read_byte(kXsnsList + sns_index);
|
||||
#else
|
||||
uint8_t index = kXsnsList[sns_index];
|
||||
@ -532,7 +532,7 @@ boolean XsnsPresent(byte sns_index)
|
||||
{
|
||||
uint8_t index = 0;
|
||||
for (byte i = 0; i < sizeof(kXsnsList); i++) {
|
||||
#ifdef XSNS_IN_ROM
|
||||
#ifdef XFUNC_PTR_IN_ROM
|
||||
index = pgm_read_byte(kXsnsList + i);
|
||||
#else
|
||||
index = kXsnsList[i];
|
||||
|
Loading…
x
Reference in New Issue
Block a user