Skip to content
Snippets Groups Projects
Commit 969e7ded authored by Moritz Perschke's avatar Moritz Perschke
Browse files

added lib to cache data if not sent successfully

parent f5efcdf3
No related branches found
No related tags found
5 merge requests!39Merge Develop into Main,!19development into master,!17Inital Host, initial Client,!3Merge Branch `develop` into `sensor_readout`,!1Espnow
#include <Arduino.h>
#include "espnow.hpp"
RTC_DATA_ATTR int cachedAmount = -1;
RTC_DATA_ATTR data_struct backup[10];
data_struct ram_cache_pop(){
return backup[cachedAmount--];
}
bool ram_cache_push(data_struct data){
backup[++cachedAmount] = data;
}
bool ram_cache_is_empty(){
return cachedAmount == -1;
}
bool ram_cache_is_full(){
return cachedAmount == 9;
}
\ No newline at end of file
#ifndef _RAM_CACHE
#define _RAM_CACHE
#include "espnow.hpp"
bool ram_cache_push(data_struct data);
bool ram_cache_is_empty();
bool ram_cache_is_full();
data_struct ram_cache_pop();
#endif
\ No newline at end of file
......@@ -22,6 +22,7 @@ typedef struct config{
class Message{
public:
Message();
Message(data_struct old_data);
void add_data(float value, int identifier);
esp_err_t send();
......
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