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