Closed Crypter closed 5 years ago
You're using reinterpret_cast which is potentially unsafe.
Why is call_from_ticker_or_separate_RTOS_task()
not static? I think the problem might be that the method is supposed to be run with a this
pointer as first argument - by reinterpreting the class method pointer you're removing that.
Why is
call_from_ticker_or_separate_RTOS_task()
not static? I think the problem might be that the method is supposed to be run with athis
pointer as first argument - by reinterpreting the class method pointer you're removing that.
I think you might be right, I didn't see this before. I'll give it a try once I get back home and report my success.
@OttoWinter thank you for your help! This was the solution to my problem:
static void testClass::member_function_callback_wrapper( void * context ){
((testClass*)context)->member_function();
}
void testClass::begin() {
ticker.attach(3.0, &testClass::member_function_callback_wrapper, (void*)(this));
}
Issue closed, and I'm glad it was me doing something wrong :)
Hardware:
Board: ESP32 Dev Module & Node32S Release: 1.0.1 & 1.0.0 - using Arduino Boards Manager IDE name: Arduino IDE Flash Frequency: 80Mhz, I think PSRAM enabled: no Upload Speed: Any Computer OS: Windows 7 64bit
Description:
I'm trying to use LinkedList.h type of structure in my project. Linked lists by nature accept all kinds of data structures, hence using templates as their data type (from now on 'T'). Any interaction, outside of the loop task, with pointers of data type T makes ESP32 crash. I stripped everything I could so that I can give you the simplest example that crashes consistently.
I honestly hope I'm doing something wrong and this is not a compiler bug.
Sketch:
Serial Output:
Debug Messages: