Skip to content

Commit

Permalink
Some clean-up and improvement
Browse files Browse the repository at this point in the history
(e.g. no hang if LoRa init fails)
  • Loading branch information
beegee-tokyo committed May 15, 2023
1 parent 28c59ce commit 3f3d876
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 39 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Arduino library for RAKWireless WisBlock Core modules that takes all the LoRaWAN

# Release Notes

## 2.0.6 Some clean-up and improvement (e.g. no hang if LoRa init fails)

## 2.0.5 Fix new AT command
- Fix wrong implementation of AT+PORT command

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,8 @@ AT Command functions: Taylor Lee ([email protected])
----
# Changelog
[Code releases](CHANGELOG.md)
- 2023-05-15
- Some clean-up and improvement (e.g. no hang if LoRa init fails)
- 2023-04-30
- Added option to set the LoRaWAN port using the AT command set. Thanks to @xoseperez## 2.0.5 Fix new AT command
- Fix wrong implementation of AT+PORT command
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "WisBlock-API-V2",
"version": "2.0.5",
"version": "2.0.6",
"keywords": [
"lora",
"Semtech",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=WisBlock-API-V2
version=2.0.5
version=2.0.6
author=Bernd Giesecke <[email protected]>
maintainer=Bernd Giesecke <[email protected]>
sentence=API for WisBlock Core module
Expand Down
1 change: 1 addition & 0 deletions src/WisBlock-API-V2.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <Arduino.h>
#include <LoRaWan-Arduino.h>
#include "wisblock_cayenne.h"
#include <Wire.h>

#ifdef NRF52_SERIES
#include <nrf_nvic.h>
Expand Down
36 changes: 5 additions & 31 deletions src/WisBlock-API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,12 @@ void setup()
if (lora_init_result != 0)
{
API_LOG("API", "Init LoRa failed");

// Without working LoRa we just stop here
while (1)
{
API_LOG("API", "Get your LoRa stuff in order");
pinMode(LED_GREEN, OUTPUT);
digitalWrite(LED_GREEN, !digitalRead(LED_GREEN));
delay(5000);
}
API_LOG("API", "Get your LoRa stuff in order");
}
else
{
API_LOG("API", "LoRa init success");
}
API_LOG("API", "LoRa init success");
}
else
{
Expand All @@ -226,20 +221,6 @@ void setup()
{
// Without working application we give a warning message
API_LOG("API", "Get your application stuff in order");
// // Without working LoRa we just stop here
// while (1)
// {
// API_LOG("MAIN", "Get your application stuff in order");
// AT_PRINTF("+EVT:HW Failure");
// pinMode(LED_GREEN, OUTPUT);
// digitalWrite(LED_GREEN, !digitalRead(LED_GREEN));
// while (Serial.available() > 0)
// {
// at_serial_input(uint8_t(Serial.read()));
// delay(5);
// }
// delay(5000);
// }
}
}

Expand Down Expand Up @@ -320,12 +301,5 @@ void loop()
digitalWrite(LED_GREEN, LOW);
delay(10);
// Go back to sleep
#if defined NRF52_SERIES || defined ESP32

xSemaphoreTake(g_task_sem, 10);
#endif
#ifdef ARDUINO_ARCH_RP2040
yield();
#endif
}
}
4 changes: 2 additions & 2 deletions src/lora.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ int8_t init_lora(void)
g_lorawan_settings.p2p_symbol_timeout, false,
0, true, 0, 0, false, true);

// LoRa is setup, start the timer that will wakeup the loop frequently
api_timer_init();
if (g_lorawan_settings.send_repeat_time != 0)
{
// LoRa is setup, start the timer that will wakeup the loop frequently
api_timer_init();
api_timer_start();
}

Expand Down
11 changes: 7 additions & 4 deletions src/lorawan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,13 @@ int8_t init_lorawan(void)
// Initialize the app timer
api_timer_init();

API_LOG("LORA", "Start Join");
// Start Join process
lmh_join();

/// \todo Join should be only started if g_lorawan_settings.auto_join is true.
if (g_lorawan_settings.auto_join)
{
API_LOG("LORA", "Start Join");
// Start Join process
lmh_join();
}
g_lorawan_initialized = true;
return 0;
}
Expand Down

0 comments on commit 3f3d876

Please sign in to comment.