You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there's an issue with the gateway, the ESP32 gets stuck sending join requests non-stop until the gateway comes back online. How can I set the number of join attempts to only 1?
I already tried changing "confirmedNbTrials" from 8 to 1, with no effect.
// Set BATTERY_CAPACITY to the design capacity of your battery.
const unsigned int BATTERY_CAPACITY = 10000; // e.g. 6200mAh battery
volatile unsigned int soc = 0; // Battery state of charge
/* Other LoRa settings /
uint16_t userChannelsMask[6]={ 0x00FF,0x0000,0x0000,0x0000,0x0000,0x0000 }; /LoraWan channelsmask, default channels 0-7/
DeviceClass_t loraWanClass = CLASS_A; /LoraWan Class, Class A and Class C are supported/
uint32_t appTxDutyCycle = 2601000; /the application data transmission duty cycle. value in [ms]./
bool overTheAirActivation = true; /OTAA or ABP/
bool loraWanAdr = true; /ADR enable/
bool isTxConfirmed = false; / Indicates if the node is sending confirmed or unconfirmed messages /
uint8_t appPort = 2; / Application port /
uint8_t confirmedNbTrials = 1; / Number of trials to transmit the frame */
uint8_t debugLevel = LoRaWAN_DEBUG_LEVEL; /*LoraWan debug level, select in arduino IDE tools. */
LoRaMacRegion_t loraWanRegion = ACTIVE_REGION; /LoraWan region, select in arduino IDE tools/
/EEPROM Setup/
ExternalEEPROM myMem;
unsigned long startAddress;
//eepromEmpty(); //Clear the data from the external EEPROM module
// The loop function is called in an endless loop
void loop()
{
switch( deviceState )
{
case DEVICE_STATE_INIT:
{
LoRaWAN.init(loraWanClass,loraWanRegion);
SERIAL.println("Prepare data to send");
prepareTxFrame( appPort ); //Get data to be transmitted
saveToEEPROM(); //Save data to EEPROM
break;
}
case DEVICE_STATE_JOIN:
{
LoRaWAN.join();
break;
}
case DEVICE_STATE_SEND:
{
LoRaWAN.send(loraWanClass); //Transmit data over LoRaWAN
SERIAL.println("Data sent");
delay(5000);
SERIAL.println("Start sleep");
digitalWrite(donePin, HIGH);
deviceState = DEVICE_STATE_CYCLE;
break;
}
case DEVICE_STATE_CYCLE:
{
// Schedule next packet transmission
txDutyCycleTime = appTxDutyCycle + randr( -APP_TX_DUTYCYCLE_RND, APP_TX_DUTYCYCLE_RND );
LoRaWAN.cycle(txDutyCycleTime);
deviceState = DEVICE_STATE_SLEEP;
break;
}
case DEVICE_STATE_SLEEP:
{
LoRaWAN.sleep(loraWanClass,debugLevel);
break;
}
default:
{
deviceState = DEVICE_STATE_INIT;
break;
}
}
}
`
The text was updated successfully, but these errors were encountered:
If there's an issue with the gateway, the ESP32 gets stuck sending join requests non-stop until the gateway comes back online. How can I set the number of join attempts to only 1?
I already tried changing "confirmedNbTrials" from 8 to 1, with no effect.
Console view on TTN:
This is the script I'm running:
`
//Libraries
#include <ESP32_LoRaWAN.h>
#include "Arduino.h"
#include "esp32-hal-adc.h"
#include "SCD30.h"
#include <SparkFunBQ27441.h>
#include "Adafruit_seesaw.h"
#include <Wire.h>
#include "SparkFun_External_EEPROM.h"
#include <Adafruit_ADS1015.h>
Adafruit_seesaw ss;
Adafruit_ADS1115 ads(0x48);
float Voltage = 0.0;
//Definitions
#define SERIAL Serial
#define soilmosPin 13
#define soiltempPin 2
#define methPin 13
#define donePin 12
#define n_sensors 7
// Set BATTERY_CAPACITY to the design capacity of your battery.
const unsigned int BATTERY_CAPACITY = 10000; // e.g. 6200mAh battery
volatile unsigned int soc = 0; // Battery state of charge
void tempTask(void *pvParameters);
bool getTemperature();
void triggerGetTemp();
/*license for Heltec ESP32 LoRaWan, quary your ChipID relevant license: http://resource.heltec.cn/search */
uint32_t license[4] = {REDACTED};
/* OTAA para*/
uint8_t DevEui[] = { REDACTED };
uint8_t AppEui[] = { REDACTED };
uint8_t AppKey[] = { REDACTED };
/* ABP para*/
uint8_t NwkSKey[] = { REDACTED };
uint8_t AppSKey[] = { REDACTED };
uint32_t DevAddr = ( uint32_t )REDACTED;
/* Other LoRa settings /
uint16_t userChannelsMask[6]={ 0x00FF,0x0000,0x0000,0x0000,0x0000,0x0000 }; /LoraWan channelsmask, default channels 0-7/
DeviceClass_t loraWanClass = CLASS_A; /LoraWan Class, Class A and Class C are supported/
uint32_t appTxDutyCycle = 2601000; /the application data transmission duty cycle. value in [ms]./
bool overTheAirActivation = true; /OTAA or ABP/
bool loraWanAdr = true; /ADR enable/
bool isTxConfirmed = false; / Indicates if the node is sending confirmed or unconfirmed messages /
uint8_t appPort = 2; / Application port /
uint8_t confirmedNbTrials = 1; / Number of trials to transmit the frame */
uint8_t debugLevel = LoRaWAN_DEBUG_LEVEL; /*LoraWan debug level, select in arduino IDE tools. */
LoRaMacRegion_t loraWanRegion = ACTIVE_REGION; /LoraWan region, select in arduino IDE tools/
/EEPROM Setup/
ExternalEEPROM myMem;
unsigned long startAddress;
//eepromEmpty(); //Clear the data from the external EEPROM module
// Initialization code
void setup()
{
Serial.begin(115200);
while (!Serial);
SPI.begin(SCK,MISO,MOSI,SS);
Mcu.init(SS,RST_LoRa,DIO0,DIO1,license);
if (!ss.begin(0x36)) {
Serial.println("ERROR! seesaw not found");
} else {
Serial.print("seesaw started! version: ");
Serial.println(ss.getVersion(), HEX);
}
adcAttachPin(soiltempPin); //Platinum resistance thermometer
//adcAttachPin(methPin); //Methane
ads.begin(); //ADC for methane
pinMode(donePin, OUTPUT);
digitalWrite(donePin, LOW);
analogSetClockDiv(255); // 1338mS
deviceState = DEVICE_STATE_INIT;
Wire.begin();
Serial.println("SCD30 Raw Data");
scd30.initialize();
setupBQ27441(); //Battery babysitter init
//Initialise EEPROM
delay(5000);
Serial.println("Qwiic EEPROM test with str to send");
if (myMem.begin() == false) {
Serial.println("No memory detected.");
}
else {
Serial.println("Memory detected!");
Serial.print("Mem size in bytes: ");
Serial.println(myMem.length());
}
}
// The loop function is called in an endless loop
void loop()
{
switch( deviceState )
{
case DEVICE_STATE_INIT:
{
LoRaWAN.init(loraWanClass,loraWanRegion);
SERIAL.println("Prepare data to send");
prepareTxFrame( appPort ); //Get data to be transmitted
saveToEEPROM(); //Save data to EEPROM
break;
}
case DEVICE_STATE_JOIN:
{
LoRaWAN.join();
break;
}
case DEVICE_STATE_SEND:
{
LoRaWAN.send(loraWanClass); //Transmit data over LoRaWAN
SERIAL.println("Data sent");
delay(5000);
SERIAL.println("Start sleep");
digitalWrite(donePin, HIGH);
deviceState = DEVICE_STATE_CYCLE;
break;
}
case DEVICE_STATE_CYCLE:
{
// Schedule next packet transmission
txDutyCycleTime = appTxDutyCycle + randr( -APP_TX_DUTYCYCLE_RND, APP_TX_DUTYCYCLE_RND );
LoRaWAN.cycle(txDutyCycleTime);
deviceState = DEVICE_STATE_SLEEP;
break;
}
case DEVICE_STATE_SLEEP:
{
LoRaWAN.sleep(loraWanClass,debugLevel);
break;
}
default:
{
deviceState = DEVICE_STATE_INIT;
break;
}
}
}
`
The text was updated successfully, but these errors were encountered: