diff --git a/.gitignore b/.gitignore index 23b4089d3cc1f51224abf31302d6e238d622ddf4..88fc45a5d3e6393ec741bdcde9b09edfd146f48e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ dist/ downloads/ eggs/ .eggs/ -#lib/ // commented this out as to not always force add /lib in platformio project +lib/ lib64/ parts/ sdist/ diff --git a/client/client/lib/I2C/I2C.cpp b/client/client/lib/I2C/I2C.cpp deleted file mode 100644 index e293d48fd0fd44c55b4c07d1dedce2bf9f1fe2af..0000000000000000000000000000000000000000 --- a/client/client/lib/I2C/I2C.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include <Wire.h> -#include <SparkFun_SCD30_Arduino_Library.h> -#include "pinout.hpp" -#include "I2C.hpp" - -SCD30 airSensor; - -int i2c_setup(){ - Wire.begin(I2C_SDA, I2C_SCL); - if(!airSensor.begin()){ - return 1; - } - return 0; -} - -i2c_readout get_i2c_data(){ - if(airSensor.dataAvailable()){ - i2c_readout result; - result.co2 = airSensor.getCO2(); - result.temp = airSensor.getTemperature(); - result.humidity = airSensor.getHumidity(); - return result; - } - i2c_readout empty; // bad, remove this - return empty; -} \ No newline at end of file diff --git a/client/client/lib/I2C/I2C.hpp b/client/client/lib/I2C/I2C.hpp deleted file mode 100644 index 1c767d1f4f2c32043c02a0a8f2b0983b24b7e003..0000000000000000000000000000000000000000 --- a/client/client/lib/I2C/I2C.hpp +++ /dev/null @@ -1,8 +0,0 @@ -typedef struct i2c_readout{ - float co2; - float temp; - float humidity; -} i2c_readout; - -int i2c_setup(); -i2c_readout get_i2c_data(); diff --git a/client/client/lib/I2C/pinout.hpp b/client/client/lib/I2C/pinout.hpp deleted file mode 100644 index 7385cac569f85223e14ccb084bfea970419e2e69..0000000000000000000000000000000000000000 --- a/client/client/lib/I2C/pinout.hpp +++ /dev/null @@ -1,2 +0,0 @@ -#define I2C_SDA 18 -#define I2C_SCL 19 diff --git a/client/client/lib/espnow/src/espnow.hpp b/client/client/lib/espnow/src/espnow.hpp deleted file mode 100644 index a32e7c9d5041a31c9ac2647030252f682828e60e..0000000000000000000000000000000000000000 --- a/client/client/lib/espnow/src/espnow.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#include <string> -#define NUM_SENSORS 10 - -// I originally wanted to define the mac addresses here, but i got a "multiple definition" error? -typedef struct dataMessage{ - std::string identifiers[NUM_SENSORS]; - float values[NUM_SENSORS]; -}dataMessage; - -int send_data(dataMessage data); - -int espnow_setup(); - diff --git a/client/client/platformio.ini b/client/client/platformio.ini index aeb9e53bf932227a4e13d3252f4da94147a547dd..ee508333132cfda864e7904a4bce39848398781c 100644 --- a/client/client/platformio.ini +++ b/client/client/platformio.ini @@ -12,5 +12,4 @@ platform = espressif32 board = esp32-c3-devkitm-1 framework = arduino -monitor_speed = 115200 -lib_deps = sparkfun/SparkFun SCD30 Arduino Library@^1.0.18 +monitor_speed = 115200 \ No newline at end of file diff --git a/client/client/src/main.cpp b/client/client/src/main.cpp index e0d73dac7d692854cdf05435e356f5cfad56c520..91da067ae710afa516736eee9e828bacd5627a23 100644 --- a/client/client/src/main.cpp +++ b/client/client/src/main.cpp @@ -1,6 +1,5 @@ #include <Arduino.h> #include "espnow.hpp" -#include "I2C.hpp" void setup() { @@ -8,24 +7,9 @@ void setup() { Serial.begin(115200); while(!Serial); - espnow_setup(); - i2c_setup(); + int result = espnow_setup(); } void loop() { // put your main code here, to run repeatedly: - i2c_readout data = get_i2c_data(); - dataMessage message; - message.identifiers[0] = "co2"; - message.identifiers[1] = "temp"; - message.identifiers[2] = "humid"; - - message.values[0] = data.co2; - message.values[1] = data.co2; - message.values[2] = data.humidity; - - send_data(message); - Serial.println("Message sent"); - - delay(3000); } \ No newline at end of file diff --git a/code-snippets/espnow/espNowTest/lib/README b/code-snippets/espnow/espNowTest/lib/README deleted file mode 100644 index 6debab1e8b4c3faa0d06f4ff44bce343ce2cdcbf..0000000000000000000000000000000000000000 --- a/code-snippets/espnow/espNowTest/lib/README +++ /dev/null @@ -1,46 +0,0 @@ - -This directory is intended for project specific (private) libraries. -PlatformIO will compile them to static libraries and link into executable file. - -The source code of each library should be placed in a an own separate directory -("lib/your_library_name/[here are source files]"). - -For example, see a structure of the following two libraries `Foo` and `Bar`: - -|--lib -| | -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html -| | -| |--Foo -| | |- Foo.c -| | |- Foo.h -| | -| |- README --> THIS FILE -| -|- platformio.ini -|--src - |- main.c - -and a contents of `src/main.c`: -``` -#include <Foo.h> -#include <Bar.h> - -int main (void) -{ - ... -} - -``` - -PlatformIO Library Dependency Finder will find automatically dependent -libraries scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html