Skip to content

Updating radio driver pointer and few logic updates for robustness #85

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

Merged
merged 6 commits into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DummySensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
class DS1820
{
public:
DS1820(uint32_t) { value = 1.0; };
DS1820(uint32_t) { value = 1.0f; };
bool begin() { return true; };
void startConversion() {};
float read() {
value += 1.1;
value += 1.1f;
return value;
}

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ To enable Mbed trace, add to your `mbed_app.json` the following fields:
```json
"target_overrides": {
"*": {
"target.features_add": ["COMMON_PAL"],
"mbed-trace.enable": true
}
}
Expand Down
14 changes: 13 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ int main (void)
return 0;
}


/**
* Sends a message to the Network Server
*/
Expand Down Expand Up @@ -174,6 +173,13 @@ static void send_message()
if (retcode < 0) {
retcode == LORAWAN_STATUS_WOULD_BLOCK ? printf("send - WOULD BLOCK\r\n")
: printf("\r\n send() - Error code %d \r\n", retcode);

if (retcode == LORAWAN_STATUS_WOULD_BLOCK) {
//retry in 3 seconds
if (MBED_CONF_LORA_DUTY_CYCLE_ON) {
ev_queue.call_in(3000, send_message);
}
}
return;
}

Expand Down Expand Up @@ -253,6 +259,12 @@ static void lora_event_handler(lorawan_event_t event)
case JOIN_FAILURE:
printf("\r\n OTAA Failed - Check Keys \r\n");
break;
case UPLINK_REQUIRED:
printf("\r\n Uplink required by NS \r\n");
if (MBED_CONF_LORA_DUTY_CYCLE_ON) {
send_message();
}
break;
default:
MBED_ASSERT("Unknown Event");
}
Expand Down
2 changes: 1 addition & 1 deletion mbed-lora-radio-drv.lib
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://github.com/ARMmbed/mbed-semtech-lora-rf-drivers#c4dd25eec9ae30f9532e498ea7e2cacd758c733e
https://github.com/ARMmbed/mbed-semtech-lora-rf-drivers#5532d9d1f4d7c57133aed48c023e332b2a5a24ba
2 changes: 1 addition & 1 deletion mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"platform.default-serial-baud-rate": 115200,
"lora.over-the-air-activation": true,
"lora.duty-cycle-on": true,
"lora.phy": 0,
"lora.phy": "EU868",
"lora.device-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }",
"lora.application-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }",
"lora.application-key": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }"
Expand Down
78 changes: 39 additions & 39 deletions trace_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,53 +20,53 @@
* stack. The library could be made unavailable by removing FEATURE_COMMON_PAL
* from the mbed_app.json to save RAM.
*/
#if defined(FEATURE_COMMON_PAL)

#include "platform/PlatformMutex.h"
#include "mbed_trace.h"
#include "mbed_trace.h"

/**
* Local mutex object for synchronization
*/
static PlatformMutex mutex;
#ifdef FEA_TRACE_SUPPORT
#include "platform/PlatformMutex.h"

static void serial_lock();
static void serial_unlock();
/**
* Local mutex object for synchronization
*/
static PlatformMutex mutex;

/**
* Sets up trace for the application
* Wouldn't do anything if the FEATURE_COMMON_PAL is not added
* or if the trace is disabled using mbed_app.json
*/
void setup_trace()
{
// setting up Mbed trace.
mbed_trace_mutex_wait_function_set(serial_lock);
mbed_trace_mutex_release_function_set(serial_unlock);
mbed_trace_init();
}
static void serial_lock();
static void serial_unlock();

/**
* Lock provided for serial printing used by trace library
*/
static void serial_lock()
{
mutex.lock();
}
/**
* Sets up trace for the application
* Wouldn't do anything if the FEATURE_COMMON_PAL is not added
* or if the trace is disabled using mbed_app.json
*/
void setup_trace()
{
// setting up Mbed trace.
mbed_trace_mutex_wait_function_set(serial_lock);
mbed_trace_mutex_release_function_set(serial_unlock);
mbed_trace_init();
}

/**
* Releasing lock provided for serial printing used by trace library
*/
static void serial_unlock()
{
mutex.unlock();
}
/**
* Lock provided for serial printing used by trace library
*/
static void serial_lock()
{
mutex.lock();
}

/**
* Releasing lock provided for serial printing used by trace library
*/
static void serial_unlock()
{
mutex.unlock();
}
#else
void setup_trace()
{

void setup_trace()
{
}

}
#endif