Skip to content

Conversation

@Andrik45719
Copy link
Contributor

These changes make it possible to determine which LoRa module triggered the interrupt by reading the GPIO state.
This allows for creating multiple instances of RadioLibInterface.

#3831

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V4
    • Seeed Studio T-1000E tracker card

@thebentern thebentern added the enhancement New feature or request label Nov 7, 2025
@Andrik45719 Andrik45719 closed this Nov 7, 2025
/** Our ISR code currently needs this to find our active instance
*/
RadioLibInterface *RadioLibInterface::instance;
std::vector<RadioLibInterface*> RadioLibInterface::instances;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this is a static variable you have to explicitly remove instances that have been pushed into this vector when the instance (i.e. an instance of a derived class of RadioLibInterface) is deleted as in main.cpp where several radio chip types are probed.

Copy link
Contributor Author

@Andrik45719 Andrik45719 Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I currently have two radio interfaces running. The variable must be static, as it needs to be accessed from an interrupt.
The problem is that there is not enough IRAM memory on the ESP32, I will solve it.

Copy link
Collaborator

@mverch67 mverch67 Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, you need to remove instances from the vector in the dtor, otherwise the vector will contain pointers to deleted objects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I’ve opened a new PR, could you check it?
#8607

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants