mirror of https://github.com/arendst/Tasmota.git
Fix ESP8266 Lora SX1262 exceptions
This commit is contained in:
parent
b587287ce0
commit
7c52906a2e
|
@ -289,7 +289,8 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
|
|||
} else {
|
||||
uint32_t start = this->hal->millis();
|
||||
while(this->hal->digitalRead(this->gpioPin)) {
|
||||
this->hal->yield();
|
||||
// this->hal->yield();
|
||||
this->hal->delay(0);
|
||||
if(this->hal->millis() - start >= timeout) {
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("GPIO pre-transfer timeout, is it connected?");
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
|
@ -316,7 +317,8 @@ int16_t Module::SPItransferStream(uint8_t* cmd, uint8_t cmdLen, bool write, uint
|
|||
this->hal->delayMicroseconds(1);
|
||||
uint32_t start = this->hal->millis();
|
||||
while(this->hal->digitalRead(this->gpioPin)) {
|
||||
this->hal->yield();
|
||||
// this->hal->yield();
|
||||
this->hal->delay(0);
|
||||
if(this->hal->millis() - start >= timeout) {
|
||||
RADIOLIB_DEBUG_BASIC_PRINTLN("GPIO post-transfer timeout, is it connected?");
|
||||
#if !RADIOLIB_STATIC_ONLY
|
||||
|
@ -389,11 +391,13 @@ void Module::waitForMicroseconds(uint32_t start, uint32_t len) {
|
|||
}
|
||||
this->TimerFlag = false;
|
||||
while(!this->TimerFlag) {
|
||||
this->hal->yield();
|
||||
// this->hal->yield();
|
||||
this->hal->delay(0);
|
||||
}
|
||||
#else
|
||||
while(this->hal->micros() - start < len) {
|
||||
this->hal->yield();
|
||||
// this->hal->yield();
|
||||
this->hal->delay(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -256,7 +256,8 @@ int16_t SX126x::transmit(uint8_t* data, size_t len, uint8_t addr) {
|
|||
// wait for packet transmission or timeout
|
||||
uint32_t start = this->mod->hal->micros();
|
||||
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
||||
this->mod->hal->yield();
|
||||
// this->mod->hal->yield();
|
||||
this->mod->hal->delay(0);
|
||||
if(this->mod->hal->micros() - start > timeout) {
|
||||
finishTransmit();
|
||||
return(RADIOLIB_ERR_TX_TIMEOUT);
|
||||
|
@ -307,7 +308,8 @@ int16_t SX126x::receive(uint8_t* data, size_t len) {
|
|||
bool softTimeout = false;
|
||||
uint32_t start = this->mod->hal->micros();
|
||||
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
||||
this->mod->hal->yield();
|
||||
// this->mod->hal->yield();
|
||||
this->mod->hal->delay(0);
|
||||
// safety check, the timeout should be done by the radio
|
||||
if(this->mod->hal->micros() - start > timeout) {
|
||||
softTimeout = true;
|
||||
|
@ -440,7 +442,8 @@ int16_t SX126x::scanChannel(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin)
|
|||
|
||||
// wait for channel activity detected or timeout
|
||||
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
||||
this->mod->hal->yield();
|
||||
// this->mod->hal->yield();
|
||||
this->mod->hal->delay(0);
|
||||
}
|
||||
|
||||
// check CAD result
|
||||
|
@ -568,7 +571,8 @@ int16_t SX126x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
|||
|
||||
// wait for BUSY to go low (= PA ramp up done)
|
||||
while(this->mod->hal->digitalRead(this->mod->getGpio())) {
|
||||
this->mod->hal->yield();
|
||||
// this->mod->hal->yield();
|
||||
this->mod->hal->delay(0);
|
||||
}
|
||||
|
||||
return(state);
|
||||
|
@ -2115,7 +2119,8 @@ int16_t SX126x::config(uint8_t modem) {
|
|||
// wait for calibration completion
|
||||
this->mod->hal->delay(5);
|
||||
while(this->mod->hal->digitalRead(this->mod->getGpio())) {
|
||||
this->mod->hal->yield();
|
||||
// this->mod->hal->yield();
|
||||
this->mod->hal->delay(0);
|
||||
}
|
||||
|
||||
// check calibration result
|
||||
|
|
|
@ -2,7 +2,10 @@ TasmotaAlert
|
|||
|
||||
Action to take in case of new release of RadioLib
|
||||
|
||||
20240323
|
||||
20240327
|
||||
|
||||
1 - Remove folder `RadioLib\examples\NonArduino` (Fixes Github vulnerability alerts)
|
||||
2 - Change in file `RadioLib\src\modules\SX126x\SX126x.cpp` all occurences of ``this->mod->hal->yield();`` into ``this->mod->hal->delay(0);`` (Fixes ESP8266 Panic core_esp8266_main.cpp:133 __yield)
|
||||
3 - Change in file `RadioLib\src\Module.cpp` all occurences of ``this->hal->yield();`` into ``this->hal->delay(0);`` (Fixes ESP8266 Panic core_esp8266_main.cpp:133 __yield)
|
||||
|
||||
1 - Remove folder `RadioLibs/examples/NonArduino` (Fixes Github vulnerability alerts)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
SPDX-FileCopyrightText: 2024 Theo Arends
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
|
||||
#ifdef USE_SPI
|
||||
|
@ -43,7 +43,7 @@ bool LoraSx126xBusy(void) {
|
|||
|
||||
/*********************************************************************************************/
|
||||
|
||||
void LoraSx126xOnInterrupt(void) {
|
||||
void IRAM_ATTR LoraSx126xOnInterrupt(void) {
|
||||
// This is called after EVERY type of enabled interrupt so chk for valid receivedFlag in LoraAvailableSx126x()
|
||||
if (!Lora.sendFlag && !Lora.receivedFlag && !Lora.receive_time) {
|
||||
Lora.receive_time = millis();
|
||||
|
|
|
@ -388,6 +388,7 @@ bool LoraWanInput(uint8_t* data, uint32_t packet_size) {
|
|||
// 40 412E0100 80 2500 0A 6A6FEFD6A16B0C7AC37B 5F95FABC - decrypt using AppSKey
|
||||
// 80 412E0100 80 2A00 0A A58EF5E0D1DDE03424F0 6F2D56FA - decrypt using AppSKey
|
||||
// 80 412E0100 80 2B00 0A 8F2F0D33E5C5027D57A6 F67C9DFE - decrypt using AppSKey
|
||||
// 80 909AE100 00 0800 0A EEC4A52568A346A8684E F2D4BF05
|
||||
// 40 412E0100 A0 1800 00 0395 2C94B1D8 - FCtrl ADR support, Ack, FPort = 0 -> MAC commands, decrypt using NwkSKey
|
||||
// 40 412E0100 A0 7800 00 78C9 A60D8977 - FCtrl ADR support, Ack, FPort = 0 -> MAC commands, decrypt using NwkSKey
|
||||
// 40 F3F51700 20 0100 00 2A7C 407036A2 - FCtrl No ADR support, Ack, FPort = 0 -> MAC commands, decrypt using NwkSKey, response after LinkADRReq
|
||||
|
@ -505,6 +506,13 @@ bool LoraWanInput(uint8_t* data, uint32_t packet_size) {
|
|||
}
|
||||
|
||||
if (payload_len) {
|
||||
// Unique parameters:
|
||||
// node
|
||||
// LoraSettings.end_node[node].DevEUIh
|
||||
// LoraSettings.end_node[node].DevEUIl
|
||||
// FPort
|
||||
// payload_len
|
||||
// payload_decrypted[]
|
||||
if (bitRead(LoraSettings.flags, TAS_LORAWAN_DECODE_ENABLED) &&
|
||||
(0x00161600 == LoraSettings.end_node[node].DevEUIh)) { // MerryIoT
|
||||
if (120 == FPort) { // MerryIoT door/window Sensor (DW10)
|
||||
|
|
|
@ -134,7 +134,7 @@ void LoraSettingsLoad(bool erase) {
|
|||
// Called from FUNC_RESET_SETTINGS (erase = 1) after command reset 4, 5, or 6
|
||||
|
||||
// *** Start init default values in case key is not found ***
|
||||
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("DRV: " D_USE_DEFAULTS));
|
||||
// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("CFG: Lora use defaults"));
|
||||
|
||||
memset(&LoraSettings, 0x00, sizeof(LoraSettings));
|
||||
// Init any other parameter in struct LoraSettings
|
||||
|
|
Loading…
Reference in New Issue