Fixed M5Core2 LoRa868 module receive exception

This commit is contained in:
Theo Arends 2024-04-06 15:04:05 +02:00
parent e149a0399e
commit 02f6e05289
3 changed files with 11 additions and 9 deletions

View File

@ -12,10 +12,11 @@ All notable changes to this project will be documented in this file.
### Breaking Changed
### Changed
- Refactored Wifi for ESP32 to allow for Core3
- ESP32 refactored Wifi for ESP32 Core3 release (#21106)
### Fixed
- NeoPool hydrolysis unit for Hidrolife, Bionet and Generic device (#21098)
- M5Core2 LoRa868 module receive exception
### Removed
- Unused `#define MQTT_DATA_STRING` support

View File

@ -157,6 +157,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- Prevent shutter MQTT broadcast with activated ShutterLock [#20827](https://github.com/arendst/Tasmota/issues/20827)
- Some `display.ini` to utouch [#21029](https://github.com/arendst/Tasmota/issues/21029)
- KNX format of energy to match specifications [#21074](https://github.com/arendst/Tasmota/issues/21074)
- ESP32 refactored Wifi for ESP32 Core3 release [#21106](https://github.com/arendst/Tasmota/issues/21106)
- ESP32 WiFi phy modes 11n and 11ax represented as HT20, HT40 and HE20 [#19350](https://github.com/arendst/Tasmota/issues/19350)
- berry.exe (pre-compiled for Windows) updated to latest Berry patches [#21024](https://github.com/arendst/Tasmota/issues/21024)
- Berry class `int64` made immutable [#20727](https://github.com/arendst/Tasmota/issues/20727)
@ -180,6 +181,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- Color swap option for rgb displaytext [#21049](https://github.com/arendst/Tasmota/issues/21049)
- NeoPool hydrolysis unit for Hidrolife, Bionet and Generic device [#21098](https://github.com/arendst/Tasmota/issues/21098)
- ESP32 PWM activity on unconfigured PWM GPIOs [#20732](https://github.com/arendst/Tasmota/issues/20732)
- M5Core2 LoRa868 module receive exception
- BTHome, prep BLE5 [#20989](https://github.com/arendst/Tasmota/issues/20989)
- Berry Memory leak in `import re` [#20823](https://github.com/arendst/Tasmota/issues/20823)
- Berry bug when parsing ternary operator [#20839](https://github.com/arendst/Tasmota/issues/20839)

View File

@ -38,24 +38,23 @@ void LoraSx127xOnReceive(int packet_size) {
if (!Lora->receive_time) {
Lora->receive_time = millis();
}
Lora->packet_size = packet_size; // we got a packet, set the flag
Lora->received_flag = true; // we got a packet, set the flag
}
bool LoraSx127xAvailable(void) {
return (Lora->packet_size > 0); // check if the flag is set
return Lora->received_flag; // check if the flag is set
}
int LoraSx127xReceive(char* data) {
Lora->received_flag = false; // reset flag
int packet_size = 0;
while (Lora->Available()) { // read packet up to LORA_MAX_PACKET_LENGTH
char sdata = LoRa.read();
if (packet_size < TAS_LORA_MAX_PACKET_LENGTH -1) {
data[packet_size++] = sdata;
}
int sdata = LoRa.read();
while ((sdata > -1) && (packet_size < TAS_LORA_MAX_PACKET_LENGTH -1)) { // Read packet up to LORA_MAX_PACKET_LENGTH
data[packet_size++] = (char)sdata;
sdata = LoRa.read();
}
Lora->rssi = LoRa.packetRssi();
Lora->snr = LoRa.packetSnr();
Lora->packet_size = 0; // reset flag
return packet_size;
}