For the files i posted here:
- I used the change proposed by boarchuz, but instead of using it in the main.c, it was the solution for one of the issues from the main.cpp.
boarchuz wrote: You could change->
Code: Select all
uint32_t C_cnt;
in ANSI_Encoder.h, so the linker knows to go looking for it somewhere else for main.c.Code: Select all
extern uint32_t C_cnt;
- I think that by updating to esp-idf v4.4 as I mentioned in a previous post really was a key aspect to reach the solution, since before that the main.c interrupt wasn't working, but after that it worked.
Otherwise, maybe it still wouldn't work with the CPP files.
- From this liebman's reply, although it didn't break the program by not using the configs as static, because it's a short program and they weren't swapped out yet in memory, it will definitely be helpful following his instructions.
liebman wrote: In `encoder_init`. You have `encoder_isr_config_t isr_args;`. thats on the stack and is no longer valid after the function returns. You need to declare that as static. You also need one for each interrupt, you're overwriting the first when you setup the second.
- In the GPIO configs I was using
instead of
- gpio_conf.pin_bit_mask = 0x1<<this->enc1_pin | 0x1<<this->enc2_pin;
which didn't really configured the right pins.- gpio_conf.pin_bit_mask = 1ULL<<this->enc1_pin | 1ULL<<this->enc2_pin;
A huge thank you for everyone that replied and helped me!!