Skip to content
Snippets Groups Projects
Verified Commit d50f6c0e authored by Zoe Michaela Dietmar Pfister's avatar Zoe Michaela Dietmar Pfister :gay_pride_flag:
Browse files

Fix broken calls to RTCMemory Interfaces

parent 0d93a38c
No related branches found
No related tags found
1 merge request!39Merge Develop into Main
......@@ -330,11 +330,11 @@ void setup()
for (const Message &message : messages) {
if (message.send() != ESP_OK) {
RtcMemory::store(message.getMessageAsMinifiedJsonString());
RtcMemory::store_data(message.getMessageAsMinifiedJsonString());
}
delay(5000);
if (!was_msg_received()) {
RtcMemory::store(message.getMessageAsMinifiedJsonString());
RtcMemory::store_data(message.getMessageAsMinifiedJsonString());
}
}
......
......@@ -2,6 +2,7 @@
#include "ESPNow.hpp"
#include "NoDataAvailableException.hpp"
#include "rs485.hpp"
#include <list>
static const char *TAG = "MAIN";
......@@ -41,14 +42,14 @@ void send_msgs(const std::__cxx11::list<Message> msgs)
for (const Message &msg : msgs) {
if (msg.send() != ESP_OK) {
RtcMemory::store(msg.getMessageAsMinifiedJsonString());
RtcMemory::store_data(msg.getMessageAsMinifiedJsonString());
}
unsigned long ts = millis();
// it takes ~110ms for receiving an acknowledgement by the host in perfect conditions
uint16_t message_timeout = 2000;
while (!was_msg_received()) {
if ((millis() - ts) > message_timeout) {
RtcMemory::store(msg.getMessageAsMinifiedJsonString());
RtcMemory::store_data(msg.getMessageAsMinifiedJsonString());
ESP_LOGE(TAG, "Timeout: Host not available\n");
break;
}
......
......@@ -4,6 +4,7 @@
#include "dr26.hpp"
#include "f_deep_sleep.hpp"
#include <Arduino.h>
#include <list>
// Execution time:
// FIXME: Boot: needs to be optimised. should be around 300 ms, can be <100ms
......@@ -35,14 +36,14 @@ void send_msgs(const std::__cxx11::list<Message> msgs)
for (const Message &msg : msgs) {
if (msg.send() != ESP_OK) {
RtcMemory::store(msg.getMessageAsMinifiedJsonString());
RtcMemory::store_data(msg.getMessageAsMinifiedJsonString());
}
unsigned long ts = millis();
// it takes ~110ms for receiving an acknowledgement by the host in perfect conditions
uint16_t message_timeout = 2000;
while (!was_msg_received()) {
if ((millis() - ts) > message_timeout) {
RtcMemory::store(msg.getMessageAsMinifiedJsonString());
RtcMemory::store_data(msg.getMessageAsMinifiedJsonString());
ESP_LOGE(TAG, "Timeout: Host not available\n");
break;
}
......
......@@ -19,7 +19,7 @@ class RtcMemory {
RtcMemory(RtcMemory const&) = delete;
void operator=(RtcMemory const&) = delete;
void store_data(std::string message);
static void store_data(std::string message);
String get_data_from_storage();
bool is_data_storage_full();
int amount_stored_data();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment