Decorate Loop() functions with IRAM_ATTR

This commit is contained in:
fvanroie 2021-05-06 03:47:46 +02:00
parent 0b7bda066d
commit dca9a5d8b8
39 changed files with 114 additions and 110 deletions

View File

@ -55,8 +55,8 @@ enum zifont_codepage_t8_t { ASCII = 0x01, ISO_8859_1 = 0x03, UTF_8 = 0x18 };
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
const uint8_t* IRAM_ATTR lv_font_get_bitmap_fmt_zifont(const lv_font_t* font, uint32_t unicode_letter); HASP_ATTRIBUTE_FAST_MEM const uint8_t* lv_font_get_bitmap_fmt_zifont(const lv_font_t* font, uint32_t unicode_letter);
bool IRAM_ATTR lv_font_get_glyph_dsc_fmt_zifont(const lv_font_t* font, lv_font_glyph_dsc_t* dsc_out, HASP_ATTRIBUTE_FAST_MEM bool lv_font_get_glyph_dsc_fmt_zifont(const lv_font_t* font, lv_font_glyph_dsc_t* dsc_out,
uint32_t unicode_letter, uint32_t unicode_letter_next); uint32_t unicode_letter, uint32_t unicode_letter_next);
/********************** /**********************
@ -83,8 +83,8 @@ static uint8_t* charBitmap_p;
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
static void IRAM_ATTR blackAdd(uint8_t* charBitmap_p, uint16_t pos); HASP_ATTRIBUTE_FAST_MEM static void blackAdd(uint8_t* charBitmap_p, uint16_t pos);
static void IRAM_ATTR colorsAdd(uint8_t* charBitmap_p, uint8_t color1, uint16_t pos); HASP_ATTRIBUTE_FAST_MEM static void colorsAdd(uint8_t* charBitmap_p, uint8_t color1, uint16_t pos);
// static uint16_t unicode2codepoint(uint32_t unicode, uint8_t codepage); // static uint16_t unicode2codepoint(uint32_t unicode, uint8_t codepage);
// static void printBuffer(uint8_t * charBitmap_p, uint8_t w, uint8_t h); // static void printBuffer(uint8_t * charBitmap_p, uint8_t w, uint8_t h);
@ -282,7 +282,7 @@ int lv_zifont_font_init(lv_font_t** font, const char* font_path, uint16_t size)
* @param unicode_letter an unicode letter which bitmap should be get * @param unicode_letter an unicode letter which bitmap should be get
* @return pointer to the bitmap or NULL if not found * @return pointer to the bitmap or NULL if not found
*/ */
const uint8_t* IRAM_ATTR lv_font_get_bitmap_fmt_zifont(const lv_font_t* font, uint32_t unicode_letter) HASP_ATTRIBUTE_FAST_MEM const uint8_t* lv_font_get_bitmap_fmt_zifont(const lv_font_t* font, uint32_t unicode_letter)
{ {
/* Bitmap still in buffer */ /* Bitmap still in buffer */
if(charInBuffer == unicode_letter && charBitmap_p) { if(charInBuffer == unicode_letter && charBitmap_p) {
@ -469,7 +469,7 @@ const uint8_t* IRAM_ATTR lv_font_get_bitmap_fmt_zifont(const lv_font_t* font, ui
* @return true: descriptor is successfully loaded into `dsc_out`. * @return true: descriptor is successfully loaded into `dsc_out`.
* false: the letter was not found, no data is loaded to `dsc_out` * false: the letter was not found, no data is loaded to `dsc_out`
*/ */
bool IRAM_ATTR lv_font_get_glyph_dsc_fmt_zifont(const lv_font_t* font, lv_font_glyph_dsc_t* dsc_out, HASP_ATTRIBUTE_FAST_MEM bool lv_font_get_glyph_dsc_fmt_zifont(const lv_font_t* font, lv_font_glyph_dsc_t* dsc_out,
uint32_t unicode_letter, uint32_t unicode_letter_next) uint32_t unicode_letter, uint32_t unicode_letter_next)
{ {
/* Only ascii characteres supported for now */ /* Only ascii characteres supported for now */
@ -564,7 +564,7 @@ bool IRAM_ATTR lv_font_get_glyph_dsc_fmt_zifont(const lv_font_t* font, lv_font_g
return true; return true;
} }
static void IRAM_ATTR blackAdd(uint8_t* charBitmap_p, uint16_t pos) HASP_ATTRIBUTE_FAST_MEM static void blackAdd(uint8_t* charBitmap_p, uint16_t pos)
{ {
uint8_t col = pos & 0x0001; // remainder uint8_t col = pos & 0x0001; // remainder
uint16_t map_p = pos >> 1; // devide by 2 uint16_t map_p = pos >> 1; // devide by 2
@ -576,7 +576,7 @@ static void IRAM_ATTR blackAdd(uint8_t* charBitmap_p, uint16_t pos)
} }
} }
static inline void IRAM_ATTR colorsAdd(uint8_t* charBitmap_p, uint8_t color1, uint16_t pos) HASP_ATTRIBUTE_FAST_MEM static inline void colorsAdd(uint8_t* charBitmap_p, uint8_t color1, uint16_t pos)
{ {
uint32_t col = pos & 0x0001; // remainder uint32_t col = pos & 0x0001; // remainder
uint32_t map_p = pos >> 1; // devide by 2 uint32_t map_p = pos >> 1; // devide by 2

View File

@ -116,12 +116,13 @@ build_flags =
-D NO_GLOBAL_HTTPUPDATE ; dont instantiate httpUpdate -D NO_GLOBAL_HTTPUPDATE ; dont instantiate httpUpdate
; -- lvgl build options ----------------------------- ; -- lvgl build options -----------------------------
-D LV_MEM_SIZE=61440U ; 60kB lvgl memory -D LV_MEM_SIZE=61440U ; 60kB lvgl memory
-D LV_ATTRIBUTE_FAST_MEM=IRAM_ATTR -D LV_ATTRIBUTE_FAST_MEM=
; -- ArduinoJson build options ---------------------------- ; -- ArduinoJson build options ----------------------------
-D ARDUINOJSON_ENABLE_PROGMEM=1 ; for PROGMEM arguments -D ARDUINOJSON_ENABLE_PROGMEM=1 ; for PROGMEM arguments
; -- tft_espi build options ------------------------ ; -- tft_espi build options ------------------------
;-D USE_DMA_TO_TFT ;-D USE_DMA_TO_TFT
; -- openHASP build options ------------------------ ; -- openHASP build options ------------------------
-D HASP_ATTRIBUTE_FAST_MEM=IRAM_ATTR
-D HASP_USE_TELNET=1 -D HASP_USE_TELNET=1
;-D HASP_USE_SPIFFS=1 ;-D HASP_USE_SPIFFS=1
-D HASP_USE_LITTLEFS=1 -D HASP_USE_LITTLEFS=1
@ -189,10 +190,12 @@ build_flags=
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
; -- lvgl build options ----------------------------- ; -- lvgl build options -----------------------------
-D LV_MEM_SIZE=12288U ; 12kB lvgl memory -D LV_MEM_SIZE=12288U ; 12kB lvgl memory
-D LV_ATTRIBUTE_FAST_MEM=
; -- ArduinoJson build options ---------------------------- ; -- ArduinoJson build options ----------------------------
-D ARDUINOJSON_ENABLE_PROGMEM=1 ; for PROGMEM arguments -D ARDUINOJSON_ENABLE_PROGMEM=1 ; for PROGMEM arguments
-D ARDUINOJSON_ENABLE_STD_STRING=1 ; for std::string -D ARDUINOJSON_ENABLE_STD_STRING=1 ; for std::string
; -- openHASP build options ------------------------- ; -- openHASP build options -------------------------
-D HASP_ATTRIBUTE_FAST_MEM=
-D HASP_USE_TELNET=1 -D HASP_USE_TELNET=1
;-D HASP_USE_SPIFFS=1 ;-D HASP_USE_SPIFFS=1
-D HASP_USE_LITTLEFS=1 -D HASP_USE_LITTLEFS=1

View File

@ -1,10 +1,10 @@
/* MIT License - Copyright (c) 2019-2021 Francis Van Roie /* MIT License - Copyright (c) 2019-2021 Francis Van Roie
For full license information read the LICENSE file in the project folder */ For full license information read the LICENSE file in the project folder */
#include "hasplib.h"
#include "hasp_drv_touch.h" #include "hasp_drv_touch.h"
#include "hasp/hasp.h"
#include "drv/tft_driver.h" #include "drv/tft_driver.h"
#include "lvgl.h"
#if TOUCH_DRIVER == 2046 #if TOUCH_DRIVER == 2046
#if defined(USE_FSMC) #if defined(USE_FSMC)
@ -174,7 +174,7 @@ static inline bool drv_touchpad_getXY(int16_t* touchX, int16_t* touchY)
return touched; return touched;
} }
bool IRAM_ATTR drv_touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) IRAM_ATTR bool drv_touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
{ {
#if TOUCH_DRIVER > 0 #if TOUCH_DRIVER > 0
int16_t touchX = 0; int16_t touchX = 0;
@ -211,7 +211,7 @@ bool IRAM_ATTR drv_touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* dat
return false; return false;
} }
void IRAM_ATTR drv_touch_loop() IRAM_ATTR void drv_touch_loop()
{ {
#if TOUCH_DRIVER == 911 #if TOUCH_DRIVER == 911
GT911_loop(); GT911_loop();

View File

@ -4,14 +4,14 @@
#ifndef HASP_DRV_TOUCH_H #ifndef HASP_DRV_TOUCH_H
#define HASP_DRV_TOUCH_H #define HASP_DRV_TOUCH_H
#include "lvgl.h" #include "hasplib.h"
#ifndef TOUCH_DRIVER #ifndef TOUCH_DRIVER
#define TOUCH_DRIVER -1 // No Touch #define TOUCH_DRIVER -1 // No Touch
#endif #endif
void drv_touch_init(uint8_t rotation); void drv_touch_init(uint8_t rotation);
bool drv_touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data); IRAM_ATTR bool drv_touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data);
void drv_touch_loop(); IRAM_ATTR void drv_touch_loop();
#endif #endif

View File

@ -11,7 +11,7 @@
FT6336U* touchpanel; FT6336U* touchpanel;
// Read touch points // Read touch points
bool IRAM_ATTR FT6336U_getXY(int16_t* touchX, int16_t* touchY, bool debug) HASP_ATTRIBUTE_FAST_MEM bool FT6336U_getXY(int16_t* touchX, int16_t* touchY, bool debug)
{ {
if(touchpanel->read_touch_number() != 1) return false; if(touchpanel->read_touch_number() != 1) return false;

View File

@ -8,7 +8,7 @@
#include "hasp_debug.h" // for TAG_DRVR #include "hasp_debug.h" // for TAG_DRVR
bool FT6336U_getXY(int16_t* touchX, int16_t* touchY, bool debug); HASP_ATTRIBUTE_FAST_MEM bool FT6336U_getXY(int16_t* touchX, int16_t* touchY, bool debug);
void FT6336U_init(); void FT6336U_init();
#endif #endif

View File

@ -15,7 +15,7 @@
static Adafruit_STMPE610 touch = Adafruit_STMPE610(STMPE_CS); static Adafruit_STMPE610 touch = Adafruit_STMPE610(STMPE_CS);
// Read touch points from global variable // Read touch points from global variable
bool IRAM_ATTR STMPE610_getXY(int16_t * touchX, int16_t * touchY, uint8_t touchRotation, bool debug) HASP_ATTRIBUTE_FAST_MEM bool STMPE610_getXY(int16_t* touchX, int16_t* touchY, uint8_t touchRotation, bool debug)
{ {
uint16_t x, y; uint16_t x, y;
uint8_t z; uint8_t z;
@ -55,7 +55,6 @@ bool IRAM_ATTR STMPE610_getXY(int16_t * touchX, int16_t * touchY, uint8_t touchR
*touchX = x; *touchX = x;
*touchY = y; *touchY = y;
return true; return true;
} }
void STMPE610_init() void STMPE610_init()

View File

@ -8,7 +8,7 @@
#include "hasp_debug.h" // for TAG_DRVR #include "hasp_debug.h" // for TAG_DRVR
bool IRAM_ATTR STMPE610_getXY(int16_t * touchX, int16_t * touchY, uint8_t touchRotation, bool debug); HASP_ATTRIBUTE_FAST_MEM bool STMPE610_getXY(int16_t* touchX, int16_t* touchY, uint8_t touchRotation, bool debug);
void STMPE610_init(); void STMPE610_init();
#endif #endif

View File

@ -102,7 +102,7 @@ lv_font_t* hasp_get_font(uint8_t fontid)
/** /**
* Check if sleep state needs to be updated * Check if sleep state needs to be updated
*/ */
bool IRAM_ATTR hasp_update_sleep_state() HASP_ATTRIBUTE_FAST_MEM bool hasp_update_sleep_state()
{ {
uint32_t idle = lv_disp_get_inactive_time(NULL); uint32_t idle = lv_disp_get_inactive_time(NULL);
@ -470,7 +470,7 @@ void haspSetup(void)
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
void haspLoop(void) IRAM_ATTR void haspLoop(void)
{ {
dispatchLoop(); dispatchLoop();
} }

View File

@ -47,7 +47,7 @@ extern "C" {
* Create a hasp application * Create a hasp application
*/ */
void haspSetup(void); void haspSetup(void);
void haspLoop(void); IRAM_ATTR void haspLoop(void);
void haspEverySecond(void); void haspEverySecond(void);
void haspReconnect(void); void haspReconnect(void);
@ -67,7 +67,7 @@ bool haspSetConfig(const JsonObject& settings);
lv_font_t* hasp_get_font(uint8_t fontid); lv_font_t* hasp_get_font(uint8_t fontid);
bool hasp_update_sleep_state(); HASP_ATTRIBUTE_FAST_MEM bool hasp_update_sleep_state();
void hasp_get_sleep_state(char* payload); void hasp_get_sleep_state(char* payload);
void hasp_get_sleep_time(uint16_t& short_time, uint16_t& long_time); void hasp_get_sleep_time(uint16_t& short_time, uint16_t& long_time);
void hasp_set_sleep_time(uint16_t short_time, uint16_t long_time); void hasp_set_sleep_time(uint16_t short_time, uint16_t long_time);

View File

@ -1449,7 +1449,8 @@ static void hasp_process_obj_attribute_range(lv_obj_t* obj, const char* attr, co
* @param update bool: change/set the value if true, dispatch/get value if false * @param update bool: change/set the value if true, dispatch/get value if false
* @note setting a value won't return anything, getting will dispatch the value * @note setting a value won't return anything, getting will dispatch the value
*/ */
void IRAM_ATTR hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* payload, bool update) HASP_ATTRIBUTE_FAST_MEM void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* payload,
bool update)
{ {
// unsigned long start = millis(); // unsigned long start = millis();
if(!obj) { if(!obj) {

View File

@ -16,7 +16,8 @@ void my_obj_set_value_str_text(lv_obj_t* obj, uint8_t part, lv_state_t state, co
void my_btnmatrix_map_clear(lv_obj_t* obj); void my_btnmatrix_map_clear(lv_obj_t* obj);
void line_clear_points(lv_obj_t* obj); void line_clear_points(lv_obj_t* obj);
void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* payload, bool update); HASP_ATTRIBUTE_FAST_MEM void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* payload,
bool update);
bool hasp_process_obj_attribute_val(lv_obj_t* obj, const char* attr, int16_t intval, bool booval, bool update); bool hasp_process_obj_attribute_val(lv_obj_t* obj, const char* attr, int16_t intval, bool booval, bool update);
void attr_out_str(lv_obj_t* obj, const char* attribute, const char* data); void attr_out_str(lv_obj_t* obj, const char* attribute, const char* data);

View File

@ -991,7 +991,7 @@ void dispatchSetup()
/* WARNING: remember to expand the commands array when adding new commands */ /* WARNING: remember to expand the commands array when adding new commands */
} }
void dispatchLoop() IRAM_ATTR void dispatchLoop()
{ {
lv_task_handler(); // process animations lv_task_handler(); // process animations
} }

View File

@ -28,7 +28,7 @@ enum hasp_event_t { // even = released, odd = pressed
/* ===== Default Event Processors ===== */ /* ===== Default Event Processors ===== */
void dispatchSetup(void); void dispatchSetup(void);
void dispatchLoop(void); IRAM_ATTR void dispatchLoop(void);
void dispatchEverySecond(void); void dispatchEverySecond(void);
void dispatchStart(void); void dispatchStart(void);
void dispatchStop(void); void dispatchStop(void);

View File

@ -32,7 +32,7 @@
static lv_style_int_t last_value_sent; static lv_style_int_t last_value_sent;
static lv_color_t last_color_sent; static lv_color_t last_color_sent;
void IRAM_ATTR swipe_event_handler(lv_obj_t* obj, lv_event_t event); void swipe_event_handler(lv_obj_t* obj, lv_event_t event);
/** /**
* Clean-up allocated memory before an object is deleted * Clean-up allocated memory before an object is deleted
@ -137,7 +137,7 @@ void event_timer_refresh(lv_task_t* task)
* @param event type of event that occured * @param event type of event that occured
* @param eventid returns the hasp eventid * @param eventid returns the hasp eventid
*/ */
static bool IRAM_ATTR translate_event(lv_obj_t* obj, lv_event_t event, uint8_t& eventid) static bool translate_event(lv_obj_t* obj, lv_event_t event, uint8_t& eventid)
{ {
switch(event) { switch(event) {
case LV_EVENT_GESTURE: case LV_EVENT_GESTURE:
@ -173,7 +173,7 @@ static bool IRAM_ATTR translate_event(lv_obj_t* obj, lv_event_t event, uint8_t&
// ##################### Value Senders ######################################################## // ##################### Value Senders ########################################################
static void IRAM_ATTR event_send_object_data(lv_obj_t* obj, const char* data) static void event_send_object_data(lv_obj_t* obj, const char* data)
{ {
uint8_t pageid; uint8_t pageid;
uint8_t objid; uint8_t objid;
@ -187,7 +187,7 @@ static void IRAM_ATTR event_send_object_data(lv_obj_t* obj, const char* data)
} }
// Send out events with a val attribute // Send out events with a val attribute
static void IRAM_ATTR event_object_val_event(lv_obj_t* obj, uint8_t eventid, int16_t val) static void event_object_val_event(lv_obj_t* obj, uint8_t eventid, int16_t val)
{ {
char data[40]; char data[40];
char eventname[8]; char eventname[8];
@ -198,7 +198,7 @@ static void IRAM_ATTR event_object_val_event(lv_obj_t* obj, uint8_t eventid, int
} }
// Send out events with a val and text attribute // Send out events with a val and text attribute
static void IRAM_ATTR event_object_selection_changed(lv_obj_t* obj, uint8_t eventid, int16_t val, const char* text) static void event_object_selection_changed(lv_obj_t* obj, uint8_t eventid, int16_t val, const char* text)
{ {
char data[200]; char data[200];
char eventname[8]; char eventname[8];
@ -211,7 +211,7 @@ static void IRAM_ATTR event_object_selection_changed(lv_obj_t* obj, uint8_t even
// ##################### Event Handlers ######################################################## // ##################### Event Handlers ########################################################
#if HASP_USE_GPIO > 0 #if HASP_USE_GPIO > 0
void IRAM_ATTR event_gpio_input(uint8_t pin, uint8_t group, uint8_t eventid) void event_gpio_input(uint8_t pin, uint8_t group, uint8_t eventid)
{ {
char payload[64]; char payload[64];
char topic[8]; char topic[8];
@ -289,7 +289,7 @@ static void log_event(const char* name, lv_event_t event)
* @param obj pointer to a button matrix * @param obj pointer to a button matrix
* @param event type of event that occured * @param event type of event that occured
*/ */
void IRAM_ATTR wakeup_event_handler(lv_obj_t* obj, lv_event_t event) void wakeup_event_handler(lv_obj_t* obj, lv_event_t event)
{ {
log_event("wakeup", event); log_event("wakeup", event);
@ -302,7 +302,7 @@ void IRAM_ATTR wakeup_event_handler(lv_obj_t* obj, lv_event_t event)
} }
} }
void IRAM_ATTR swipe_event_handler(lv_obj_t* obj, lv_event_t event) void swipe_event_handler(lv_obj_t* obj, lv_event_t event)
{ {
if(!obj || obj->user_data.swipeid == 0) return; if(!obj || obj->user_data.swipeid == 0) return;
@ -330,7 +330,7 @@ void IRAM_ATTR swipe_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a button object * @param obj pointer to a button object
* @param event type of event that occured * @param event type of event that occured
*/ */
void IRAM_ATTR generic_event_handler(lv_obj_t* obj, lv_event_t event) void generic_event_handler(lv_obj_t* obj, lv_event_t event)
{ {
log_event("generic", event); log_event("generic", event);
@ -429,7 +429,7 @@ void IRAM_ATTR generic_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a switch object * @param obj pointer to a switch object
* @param event type of event that occured * @param event type of event that occured
*/ */
void IRAM_ATTR toggle_event_handler(lv_obj_t* obj, lv_event_t event) void toggle_event_handler(lv_obj_t* obj, lv_event_t event)
{ {
log_event("toggle", event); log_event("toggle", event);
@ -472,7 +472,7 @@ void IRAM_ATTR toggle_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a dropdown list or roller * @param obj pointer to a dropdown list or roller
* @param event type of event that occured * @param event type of event that occured
*/ */
void IRAM_ATTR selector_event_handler(lv_obj_t* obj, lv_event_t event) void selector_event_handler(lv_obj_t* obj, lv_event_t event)
{ {
log_event("selector", event); log_event("selector", event);
@ -544,7 +544,7 @@ void IRAM_ATTR selector_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a dropdown list or roller * @param obj pointer to a dropdown list or roller
* @param event type of event that occured * @param event type of event that occured
*/ */
void IRAM_ATTR btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event) void btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event)
{ {
log_event("btnmatrix", event); log_event("btnmatrix", event);
@ -579,7 +579,7 @@ void IRAM_ATTR btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a dropdown list or roller * @param obj pointer to a dropdown list or roller
* @param event type of event that occured * @param event type of event that occured
*/ */
void IRAM_ATTR msgbox_event_handler(lv_obj_t* obj, lv_event_t event) void msgbox_event_handler(lv_obj_t* obj, lv_event_t event)
{ {
log_event("msgbox", event); log_event("msgbox", event);
@ -611,7 +611,7 @@ void IRAM_ATTR msgbox_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a slider * @param obj pointer to a slider
* @param event type of event that occured * @param event type of event that occured
*/ */
void IRAM_ATTR slider_event_handler(lv_obj_t* obj, lv_event_t event) void slider_event_handler(lv_obj_t* obj, lv_event_t event)
{ {
log_event("slider", event); log_event("slider", event);
@ -651,7 +651,7 @@ void IRAM_ATTR slider_event_handler(lv_obj_t* obj, lv_event_t event)
* @param obj pointer to a color picker * @param obj pointer to a color picker
* @param event type of event that occured * @param event type of event that occured
*/ */
void IRAM_ATTR cpicker_event_handler(lv_obj_t* obj, lv_event_t event) void cpicker_event_handler(lv_obj_t* obj, lv_event_t event)
{ {
log_event("cpicker", event); log_event("cpicker", event);
@ -678,7 +678,7 @@ void IRAM_ATTR cpicker_event_handler(lv_obj_t* obj, lv_event_t event)
// dispatch_normalized_group_values(obj->user_data.groupid, obj, val, min, max); // dispatch_normalized_group_values(obj->user_data.groupid, obj, val, min, max);
} }
void IRAM_ATTR calendar_event_handler(lv_obj_t* obj, lv_event_t event) void calendar_event_handler(lv_obj_t* obj, lv_event_t event)
{ {
log_event("calendar", event); log_event("calendar", event);

View File

@ -15,19 +15,19 @@
void event_timer_calendar(lv_task_t* task); void event_timer_calendar(lv_task_t* task);
// Object event Handlers // Object event Handlers
void IRAM_ATTR wakeup_event_handler(lv_obj_t* obj, lv_event_t event); void wakeup_event_handler(lv_obj_t* obj, lv_event_t event);
void IRAM_ATTR generic_event_handler(lv_obj_t* obj, lv_event_t event); void generic_event_handler(lv_obj_t* obj, lv_event_t event);
void IRAM_ATTR toggle_event_handler(lv_obj_t* obj, lv_event_t event); void toggle_event_handler(lv_obj_t* obj, lv_event_t event);
void IRAM_ATTR slider_event_handler(lv_obj_t* obj, lv_event_t event); void slider_event_handler(lv_obj_t* obj, lv_event_t event);
void IRAM_ATTR selector_event_handler(lv_obj_t* obj, lv_event_t event); void selector_event_handler(lv_obj_t* obj, lv_event_t event);
void IRAM_ATTR btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event); void btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event);
void IRAM_ATTR msgbox_event_handler(lv_obj_t* obj, lv_event_t event); void msgbox_event_handler(lv_obj_t* obj, lv_event_t event);
void IRAM_ATTR cpicker_event_handler(lv_obj_t* obj, lv_event_t event); void cpicker_event_handler(lv_obj_t* obj, lv_event_t event);
void IRAM_ATTR calendar_event_handler(lv_obj_t* obj, lv_event_t event); void calendar_event_handler(lv_obj_t* obj, lv_event_t event);
#if HASP_USE_GPIO > 0 #if HASP_USE_GPIO > 0
// GPIO event Handler // GPIO event Handler
void IRAM_ATTR event_gpio_input(uint8_t pin, uint8_t group, uint8_t eventid); void event_gpio_input(uint8_t pin, uint8_t group, uint8_t eventid);
#endif #endif
#endif // HASP_EVENT_H #endif // HASP_EVENT_H

View File

@ -133,7 +133,7 @@ extern "C" {
// Functions used by ANDROID, WINDOWS and POSSIX // Functions used by ANDROID, WINDOWS and POSSIX
void debugLvglLogEvent(lv_log_level_t level, const char* file, uint32_t line, const char* funcname, const char* descr); void debugLvglLogEvent(lv_log_level_t level, const char* file, uint32_t line, const char* funcname, const char* descr);
void debugLoop(void); IRAM_ATTR void debugLoop(void);
void debugEverySecond(void); void debugEverySecond(void);
void debugStart(void); void debugStart(void);
void debugStop(void); void debugStop(void);

View File

@ -48,7 +48,7 @@ File pFileOut;
#define INVERT_COLORS 0 #define INVERT_COLORS 0
#endif #endif
// static void IRAM_ATTR lv_tick_handler(void); // HASP_ATTRIBUTE_FAST_MEM static void lv_tick_handler(void);
gui_conf_t gui_settings = {.show_pointer = false, gui_conf_t gui_settings = {.show_pointer = false,
.backlight_pin = TFT_BCKL, .backlight_pin = TFT_BCKL,
@ -73,7 +73,7 @@ gui_conf_t gui_settings = {.show_pointer = false,
// lv_tick_inc(LVGL_TICK_PERIOD); // lv_tick_inc(LVGL_TICK_PERIOD);
// } // }
void IRAM_ATTR gui_flush_cb(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p) IRAM_ATTR void gui_flush_cb(lv_disp_drv_t* disp, const lv_area_t* area, lv_color_t* color_p)
{ {
haspTft.flush_pixels(disp, area, color_p); haspTft.flush_pixels(disp, area, color_p);
} }
@ -285,7 +285,7 @@ void guiSetup(void)
LOG_INFO(TAG_LVGL, F(D_SERVICE_STARTED)); LOG_INFO(TAG_LVGL, F(D_SERVICE_STARTED));
} }
void IRAM_ATTR guiLoop(void) IRAM_ATTR void guiLoop(void)
{ {
#if defined(STM32F4xx) #if defined(STM32F4xx)
// tick.update(); // tick.update();

View File

@ -17,7 +17,7 @@ struct gui_conf_t
/* ===== Default Event Processors ===== */ /* ===== Default Event Processors ===== */
void guiSetup(void); void guiSetup(void);
void guiLoop(void); IRAM_ATTR void guiLoop(void);
void guiEverySecond(void); void guiEverySecond(void);
void guiStart(void); void guiStart(void);
void guiStop(void); void guiStop(void);

View File

@ -333,7 +333,7 @@ void debugSetupWithoutLogging(JsonObject settings)
} }
} }
void debugLoop(void) IRAM_ATTR void debugLoop(void)
{ {
int16_t keypress; int16_t keypress;
do { do {

View File

@ -68,10 +68,6 @@ void setup()
haspSetup(); haspSetup();
} }
#if HASP_USE_GPIO > 0
gpioSetup();
#endif
/**************************** /****************************
* Apply User Configuration * Apply User Configuration
***************************/ ***************************/
@ -80,6 +76,10 @@ void setup()
mqttSetup(); // Load Hostname before starting WiFi mqttSetup(); // Load Hostname before starting WiFi
#endif #endif
#if HASP_USE_GPIO > 0
gpioSetup();
#endif
#if HASP_USE_WIFI > 0 || HASP_USE_ETHERNET > 0 #if HASP_USE_WIFI > 0 || HASP_USE_ETHERNET > 0
networkSetup(); networkSetup();
#endif #endif
@ -109,7 +109,7 @@ void setup()
// guiStart(); // guiStart();
} }
void IRAM_ATTR loop() IRAM_ATTR void loop()
{ {
guiLoop(); guiLoop();
haspLoop(); haspLoop();

View File

@ -23,7 +23,7 @@ typedef enum {
} hasp_mqtt_error_t; } hasp_mqtt_error_t;
void mqttSetup(); void mqttSetup();
void mqttLoop(); IRAM_ATTR void mqttLoop();
void mqttEvery5Seconds(bool wifiIsConnected); void mqttEvery5Seconds(bool wifiIsConnected);
void mqttStart(); void mqttStart();
void mqttStop(); void mqttStop();

View File

@ -430,7 +430,7 @@ void mqttStop()
void mqttSetup(){}; void mqttSetup(){};
void mqttLoop(){}; IRAM_ATTR void mqttLoop(){};
void mqttEvery5Seconds(bool wifiIsConnected){}; void mqttEvery5Seconds(bool wifiIsConnected){};

View File

@ -403,7 +403,7 @@ void mqttSetup()
printf("%s %d\n", __FILE__, __LINE__); printf("%s %d\n", __FILE__, __LINE__);
} }
void mqttLoop() IRAM_ATTR void mqttLoop()
{ {
int topicLen; int topicLen;
char* topicName; // Freed by msgarrvd char* topicName; // Freed by msgarrvd

View File

@ -355,7 +355,7 @@ void mqttSetup()
} }
} }
void mqttLoop(void) IRAM_ATTR void mqttLoop(void)
{ {
if(mqttEnabled) mqttClient.loop(); if(mqttEnabled) mqttClient.loop();
} }

View File

@ -333,7 +333,7 @@ void gpioSetup()
LOG_INFO(TAG_GPIO, F(D_SERVICE_STARTED)); LOG_INFO(TAG_GPIO, F(D_SERVICE_STARTED));
} }
void gpioLoop(void) IRAM_ATTR void gpioLoop(void)
{ {
// Should be called every 4-5ms or faster, for the default debouncing time of ~20ms. // Should be called every 4-5ms or faster, for the default debouncing time of ~20ms.
for(uint8_t i = 0; i < gpioUsedInputCount; i++) { for(uint8_t i = 0; i < gpioUsedInputCount; i++) {
@ -349,7 +349,7 @@ void gpioSetup(void)
gpioSavePinConfig(2, 13, HASP_GPIO_LED, 0, -1); gpioSavePinConfig(2, 13, HASP_GPIO_LED, 0, -1);
gpioSavePinConfig(3, 14, HASP_GPIO_DAC, 0, -1); gpioSavePinConfig(3, 14, HASP_GPIO_DAC, 0, -1);
} }
void gpioLoop(void) IRAM_ATTR void gpioLoop(void)
{} {}
#endif // ARDUINO #endif // ARDUINO

View File

@ -22,7 +22,7 @@ struct hasp_gpio_config_t
}; };
void gpioSetup(void); void gpioSetup(void);
void gpioLoop(void); IRAM_ATTR void gpioLoop(void);
void gpioEvery5Seconds(void); void gpioEvery5Seconds(void);
// void gpio_set_group_onoff(uint8_t groupid, bool ison); // void gpio_set_group_onoff(uint8_t groupid, bool ison);

View File

@ -55,7 +55,7 @@ void ethernetSetup()
ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLKMODE); ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLKMODE);
} }
void ethernetLoop(void) IRAM_ATTR void ethernetLoop(void)
{} {}
bool ethernetEvery5Seconds() bool ethernetEvery5Seconds()

View File

@ -9,7 +9,7 @@
static bool eth_connected = false; static bool eth_connected = false;
void ethernetSetup(); void ethernetSetup();
void ethernetLoop(void); IRAM_ATTR void ethernetLoop(void);
bool ethernetEverySecond(); bool ethernetEverySecond();
bool ethernetEvery5Seconds(); bool ethernetEvery5Seconds();

View File

@ -58,7 +58,7 @@ void networkSetup()
#endif #endif
} }
void networkLoop(void) IRAM_ATTR void networkLoop(void)
{ {
#if HASP_USE_ETHERNET > 0 #if HASP_USE_ETHERNET > 0
ethernetLoop(); ethernetLoop();

View File

@ -6,7 +6,7 @@
/* ===== Default Event Processors ===== */ /* ===== Default Event Processors ===== */
void networkSetup(); void networkSetup();
void networkLoop(void); IRAM_ATTR void networkLoop(void);
bool networkEvery5Seconds(void); bool networkEvery5Seconds(void);
// bool networkEverySecond(void); // bool networkEverySecond(void);
void networkStart(void); void networkStart(void);

View File

@ -2219,7 +2219,7 @@ void httpReconnect()
} }
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
void httpLoop(void) IRAM_ATTR void httpLoop(void)
{ {
if(http_config.enable) webServer.handleClient(); if(http_config.enable) webServer.handleClient();
} }

View File

@ -16,7 +16,7 @@ struct hasp_http_config_t
}; };
void httpSetup(); void httpSetup();
void httpLoop(void); IRAM_ATTR void httpLoop(void);
void httpEvery5Seconds(void); void httpEvery5Seconds(void);
// void httpReconnect(void); // void httpReconnect(void);
void httpStart(void); void httpStart(void);

View File

@ -78,7 +78,7 @@ void mdnsStart()
} }
} }
void mdnsLoop(void) IRAM_ATTR void mdnsLoop(void)
{ {
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
if(mdns_config.enable) { if(mdns_config.enable) {

View File

@ -13,7 +13,7 @@ struct hasp_mdns_config_t
/* ===== Default Event Processors ===== */ /* ===== Default Event Processors ===== */
void mdnsSetup(); void mdnsSetup();
void mdnsLoop(void); IRAM_ATTR void mdnsLoop(void);
void mdnsStart(void); void mdnsStart(void);
void mdnsStop(void); void mdnsStop(void);

View File

@ -200,7 +200,7 @@ void otaSetup(void)
} }
} }
void otaLoop(void) IRAM_ATTR void otaLoop(void)
{ {
ArduinoOTA.handle(); ArduinoOTA.handle();
} }

View File

@ -10,7 +10,7 @@
/* ===== Default Event Processors ===== */ /* ===== Default Event Processors ===== */
void otaSetup(void); void otaSetup(void);
void otaLoop(void); IRAM_ATTR void otaLoop(void);
void otaEverySecond(void); void otaEverySecond(void);
/* ===== Special Event Processors ===== */ /* ===== Special Event Processors ===== */

View File

@ -258,7 +258,7 @@ void telnetSetup()
} }
} }
void telnetLoop() IRAM_ATTR void telnetLoop()
{ {
// Basic telnet client handling code from: https://gist.github.com/tablatronix/4793677ca748f5f584c95ec4a2b10303 // Basic telnet client handling code from: https://gist.github.com/tablatronix/4793677ca748f5f584c95ec4a2b10303

View File

@ -10,7 +10,7 @@
/* ===== Default Event Processors ===== */ /* ===== Default Event Processors ===== */
void telnetSetup(); void telnetSetup();
void telnetLoop(void); IRAM_ATTR void telnetLoop(void);
void telnetEvery5Seconds(void); void telnetEvery5Seconds(void);
void telnetEverySecond(void); void telnetEverySecond(void);
void telnetStart(void); void telnetStart(void);