Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onRecive() method never triggered. #661

Open
Alain-Godo opened this issue Aug 14, 2023 · 1 comment
Open

onRecive() method never triggered. #661

Alain-Godo opened this issue Aug 14, 2023 · 1 comment

Comments

@Alain-Godo
Copy link

Alain-Godo commented Aug 14, 2023

Hi everyone!!! I have the following issue. When I receive the data in a sync way all is fine (using the loop for example) but the callback function is never triggered using the onReceive() method.

IDE: PlatformIO
Board: ESP32 DOIT DEVKIT V1
Pin used: HSPI + 4 (Reset) + 2 (DIO0)

Setup code:

hspi = new SPIClass(HSPI);
hspi->begin();
lora2.setSPI(*hspi);

lora2.setPins(15,4,2);
Serial.println("Begining 2...");
Serial.println(lora2.begin(915E6));
lora2.onReceive(lora2Callback);
lora2.receive();

Callback function:

void lora2Callback(int packet_size) {
Serial.print("Received packet: '");

// read packet
while (lora2.available()) {
Serial.print((char)lora2.read());
}

// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(lora2.packetRssi());

}

Note:

I tried changing the DIO0 pin that is related to the interrupt but still doesn't work.

@qiweimao
Copy link

qiweimao commented Jun 3, 2024

Try to keep your callback extremely short. It's a system interrupt. This problem bugged me for days.

Read this issue to solve all your confusions: link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants