Skip to content
Snippets Groups Projects
Commit 6b731d30 authored by Zoe Pfister's avatar Zoe Pfister :speech_balloon:
Browse files

move log includes to header files, init espnow to fix runtime errors, specify log level to VERBOSE

parent 5b39899b
No related branches found
No related tags found
5 merge requests!39Merge Develop into Main,!19development into master,!17Inital Host, initial Client,!10merge serial comm and sd write into espnow,!8merge sensor_readout into develop
Showing
with 44 additions and 40 deletions
#include "ram_caching.hpp"
static const char* TAG = "CACHING";
#include "esp_log.h"
RTC_DATA_ATTR int cachedAmount = -1;
RTC_DATA_ATTR ClientDataPackage backup[NUM_SENSORS];
......
#ifndef _RAM_CACHE
#define _RAM_CACHE
#include "ClientDataPackage.hpp"
#include "esp_log.h"
#include <ESP32Time.h>
bool ram_cache_is_empty();
......
#include "dr26.hpp"
static const char* TAG = "DR26";
#include "esp_log.h"
Adafruit_ADS1115 ads;
......
......@@ -3,6 +3,7 @@
#include "ForteSensor.hpp"
#include "Message.hpp"
#include "esp_log.h"
#include "pinout.hpp"
#include <Adafruit_ADS1X15.h>
#include <Wire.h>
......
#include <drs26.hpp>
static const char* TAG = "DRS26";
#include "esp_log.h"
/*
It happens for some reason that the sensor cant get reached every 2 time
Because the sensor use sdi12 protocoll we have to wait aproxemettly 1 secound between the commands
......@@ -45,7 +44,8 @@ out_data_drs26 Forte_DRS26 ::read_data()
Message Forte_DRS26 ::build_message()
{
// auto message = Message();
// message.add_data(data.circumference, data.id);
throw "Not yet implemented";
auto message = Message();
message.add_data(12.12, 1);
ESP_LOGE(TAG, "test");
return message;
}
\ No newline at end of file
......@@ -4,6 +4,7 @@
#include "ForteSensor.hpp"
#include "Message.hpp"
#include "Wire.h"
#include "esp_log.h"
#include "pinout.hpp"
#include <SDI12.h>
......
#include "ESPNow.hpp"
static const char* TAG = "ESPNOW";
#include "esp_log.h"
uint8_t BROADCAST_MAC[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
esp_now_peer_info_t hostInfo;
......
......@@ -3,6 +3,7 @@
#include "Message.hpp"
#include "Time.hpp"
#include "esp_log.h"
#include "ram_caching.hpp"
#include <ClientDataPackage.hpp>
#include <ESP32Time.h>
......
#include "Message.hpp"
static const char* TAG = "MESSAGE";
#include "esp_log.h"
static const char *TAG = "MESSAGE";
void Message::add_data(float value, int identifier)
{
......@@ -23,12 +22,12 @@ esp_err_t Message::send()
// }
// }
for (int i = 0; i < data.amountData; i++) {
Serial.println(data.values[i]);
ESP_LOGD(TAG, "Sent data: %i", data.values[i]);
}
ESP_LOGD(TAG, "time sent: " + data.timestamp);
ESP_LOGD(TAG, "send status: " + success);
ESP_LOGD(TAG, "time sent: %l", data.timestamp);
ESP_LOGD(TAG, "send status: %d", success);
return success;
}
......
......@@ -3,6 +3,7 @@
#include "ClientDataPackage.hpp"
#include "ESPNow.hpp"
#include "Time.hpp"
#include "esp_log.h"
#include <Arduino.h>
#include <ESP32Time.h>
#include <esp_now.h>
......
#include "ina219.hpp"
static const char* TAG = "INA219";
#include "esp_log.h"
void Forte_INA219 ::setup()
{
......
......@@ -4,6 +4,7 @@
#include "ForteSensor.hpp"
#include "Message.hpp"
#include "Wire.h"
#include "esp_log.h"
#include "pinout.hpp"
#include <INA219_WE.h>
......
#include "scd30.hpp"
static const char* TAG = "SCD30";
#include "esp_log.h"
void Forte_SCD30 ::setup()
{
......
......@@ -4,6 +4,7 @@
#include "ForteSensor.hpp"
#include "Message.hpp"
#include "NoDataAvailableException.hpp"
#include "esp_log.h"
#include "pinout.hpp"
#include <SparkFun_SCD30_Arduino_Library.h>
#include <Wire.h>
......
......@@ -12,16 +12,17 @@
platform = espressif32
board = esp32-c3-devkitm-1
framework = arduino
monitor_speed = 9600
build_flags =
-I include
lib_deps =
sparkfun/SparkFun SCD30 Arduino Library@^1.0.18
Wire
adafruit/Adafruit ADS1X15@^2.4.0
wollewald/INA219_WE@^1.3.1
adafruit/Adafruit BusIO@^1.13.2
Adafruit_I2CDevice
SPI
envirodiy/SDI-12@^2.1.4
fbiego/ESP32Time@^2.0.0
monitor_speed = 115200
build_flags =
-I include
-DCORE_DEBUG_LEVEL=5
lib_deps =
sparkfun/SparkFun SCD30 Arduino Library@^1.0.18
Wire
adafruit/Adafruit ADS1X15@^2.4.0
wollewald/INA219_WE@^1.3.1
adafruit/Adafruit BusIO@^1.13.2
Adafruit_I2CDevice
SPI
envirodiy/SDI-12@^2.1.4
fbiego/ESP32Time@^2.0.0
#include "NoDataAvailableException.hpp"
#include "esp_log.h"
#include <Arduino.h>
#include <dr26.hpp>
#include <drs26.hpp>
#include <ina219.hpp>
#include <scd30.hpp>
static const char* TAG = "MAIN";
#include "esp_log.h"
// #include "esp32-hal-log.h"
static const char *TAG = "MAIN";
Forte_DRS26 drs26;
void setup()
{
Serial.begin(9600);
Serial.begin(115200);
drs26.setup();
ESP_LOGI(TAG, "Setup complete.");
// log_e("Setup complete.");
}
void loop()
......@@ -22,16 +23,17 @@ void loop()
out_data_drs26 data{};
try {
data = drs26.read_data();
// auto message = scd30.build_message();
// message.send();
espnow_setup();
// data = drs26.read_data();
auto message = drs26.build_message();
message.send();
} catch (const NoDataAvailableException &e) {
std::cerr << e.what() << '\n';
}
ESP_LOGI(TAG, "Sensor Circumference: " + data.circumference);
ESP_LOGI(TAG, "Temperature: " + data.temperatur);
ESP_LOGI(TAG, "Id: " + data.id);
ESP_LOGE(TAG, "Sensor Circumference: ");
// log_e("Temperature: ");
// log_e("Id: ");
delay(5000);
}
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