From 5507d11fe87a3e70b3fb3e8b7ed2b6df90d29ca7 Mon Sep 17 00:00:00 2001 From: Clara Dautermann Date: Wed, 2 Jul 2025 15:13:35 +0200 Subject: [PATCH] removed old stuff --- .idea/.gitignore | 8 --- .idea/misc.xml | 12 ---- .idea/modules.xml | 8 --- .idea/untitled.iml | 2 - .idea/vcs.xml | 6 -- .vscode/settings.json | 3 - firmware/.gitignore | 5 -- firmware/.idea/.gitignore | 8 --- firmware/.idea/firmware.iml | 2 - firmware/.idea/misc.xml | 9 --- firmware/.idea/modules.xml | 8 --- firmware/.idea/vcs.xml | 6 -- firmware/.vscode/extensions.json | 10 --- firmware/CMakeLists.txt | 33 ---------- firmware/include/README | 39 ------------ firmware/lib/README | 46 -------------- firmware/platformio.ini | 15 ----- firmware/src/ble/BluetoothServer.cpp | 92 ---------------------------- firmware/src/ble/BluetoothServer.h | 25 -------- firmware/src/main.cpp | 28 --------- firmware/src/sensors/BmpSensor.cpp | 89 --------------------------- firmware/src/sensors/BmpSensor.h | 29 --------- firmware/src/sensors/Sensor.h | 25 -------- firmware/src/sensors/sensor_data_t.h | 16 ----- firmware/test/README | 11 ---- flake.nix | 7 +-- 26 files changed, 2 insertions(+), 540 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/untitled.iml delete mode 100644 .idea/vcs.xml delete mode 100644 .vscode/settings.json delete mode 100644 firmware/.gitignore delete mode 100644 firmware/.idea/.gitignore delete mode 100644 firmware/.idea/firmware.iml delete mode 100644 firmware/.idea/misc.xml delete mode 100644 firmware/.idea/modules.xml delete mode 100644 firmware/.idea/vcs.xml delete mode 100644 firmware/.vscode/extensions.json delete mode 100644 firmware/CMakeLists.txt delete mode 100644 firmware/include/README delete mode 100644 firmware/lib/README delete mode 100644 firmware/platformio.ini delete mode 100644 firmware/src/ble/BluetoothServer.cpp delete mode 100644 firmware/src/ble/BluetoothServer.h delete mode 100644 firmware/src/main.cpp delete mode 100644 firmware/src/sensors/BmpSensor.cpp delete mode 100644 firmware/src/sensors/BmpSensor.h delete mode 100644 firmware/src/sensors/Sensor.h delete mode 100644 firmware/src/sensors/sensor_data_t.h delete mode 100644 firmware/test/README diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 80cd00a..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index aeb7613..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/untitled.iml b/.idea/untitled.iml deleted file mode 100644 index f08604b..0000000 --- a/.idea/untitled.iml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index c9594a6..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "cmake.sourceDirectory": "/home/clara/repositorys/climate-go/firmware" -} \ No newline at end of file diff --git a/firmware/.gitignore b/firmware/.gitignore deleted file mode 100644 index 89cc49c..0000000 --- a/firmware/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.pio -.vscode/.browse.c_cpp.db* -.vscode/c_cpp_properties.json -.vscode/launch.json -.vscode/ipch diff --git a/firmware/.idea/.gitignore b/firmware/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/firmware/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/firmware/.idea/firmware.iml b/firmware/.idea/firmware.iml deleted file mode 100644 index f08604b..0000000 --- a/firmware/.idea/firmware.iml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/firmware/.idea/misc.xml b/firmware/.idea/misc.xml deleted file mode 100644 index a54a8fc..0000000 --- a/firmware/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/firmware/.idea/modules.xml b/firmware/.idea/modules.xml deleted file mode 100644 index cb860b6..0000000 --- a/firmware/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/firmware/.idea/vcs.xml b/firmware/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/firmware/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/firmware/.vscode/extensions.json b/firmware/.vscode/extensions.json deleted file mode 100644 index 080e70d..0000000 --- a/firmware/.vscode/extensions.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - "platformio.platformio-ide" - ], - "unwantedRecommendations": [ - "ms-vscode.cpptools-extension-pack" - ] -} diff --git a/firmware/CMakeLists.txt b/firmware/CMakeLists.txt deleted file mode 100644 index 0fb7688..0000000 --- a/firmware/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -# !!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE -# https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags -# -# If you need to override existing CMake configuration or add extra, -# please create `CMakeListsUser.txt` in the root of project. -# The `CMakeListsUser.txt` will not be overwritten by PlatformIO. - -cmake_minimum_required(VERSION 3.13) -set(CMAKE_SYSTEM_NAME Generic) -set(CMAKE_C_COMPILER_WORKS 1) -set(CMAKE_CXX_COMPILER_WORKS 1) - -project("firmware" C CXX) - -include(CMakeListsPrivate.txt) - -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeListsUser.txt) -include(CMakeListsUser.txt) -endif() - -add_custom_target( - Production ALL - COMMAND platformio -c clion run "$<$>:-e${CMAKE_BUILD_TYPE}>" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_custom_target( - Debug ALL - COMMAND platformio -c clion debug "$<$>:-e${CMAKE_BUILD_TYPE}>" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_executable(Z_DUMMY_TARGET ${SRC_LIST}) diff --git a/firmware/include/README b/firmware/include/README deleted file mode 100644 index 194dcd4..0000000 --- a/firmware/include/README +++ /dev/null @@ -1,39 +0,0 @@ - -This directory is intended for project header files. - -A header file is a file containing C declarations and macro definitions -to be shared between several project source files. You request the use of a -header file in your project source file (C, C++, etc) located in `src` folder -by including it, with the C preprocessing directive `#include'. - -```src/main.c - -#include "header.h" - -int main (void) -{ - ... -} -``` - -Including a header file produces the same results as copying the header file -into each source file that needs it. Such copying would be time-consuming -and error-prone. With a header file, the related declarations appear -in only one place. If they need to be changed, they can be changed in one -place, and programs that include the header file will automatically use the -new version when next recompiled. The header file eliminates the labor of -finding and changing all the copies as well as the risk that a failure to -find one copy will result in inconsistencies within a program. - -In C, the usual convention is to give header files names that end with `.h'. -It is most portable to use only letters, digits, dashes, and underscores in -header file names, and at most one dot. - -Read more about using header files in official GCC documentation: - -* Include Syntax -* Include Operation -* Once-Only Headers -* Computed Includes - -https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/firmware/lib/README b/firmware/lib/README deleted file mode 100644 index 6debab1..0000000 --- a/firmware/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 -#include - -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 diff --git a/firmware/platformio.ini b/firmware/platformio.ini deleted file mode 100644 index 1a0090b..0000000 --- a/firmware/platformio.ini +++ /dev/null @@ -1,15 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[env:esp32dev] -platform = espressif32 -board = esp32dev -framework = arduino -lib_deps = adafruit/Adafruit BMP280 Library@^2.6.1 diff --git a/firmware/src/ble/BluetoothServer.cpp b/firmware/src/ble/BluetoothServer.cpp deleted file mode 100644 index 4586e42..0000000 --- a/firmware/src/ble/BluetoothServer.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include -#include -#include -#include "BluetoothServer.h" - -#define INTERNAL_LED_PIN 2 -#define BLE_SERVER_NAME "ClimateGO" -#define SERVICE_UUID "2150123c-af53-4038-bc92-ba3d0870a9e4" -#define TEMPERATURE_CHARACTERISTIC_UUID "cba1d466-344c-4be3-ab3f-189f80dd7518" -#define PRESSURE_CHARACTERISTIC_UUID "ca73b3ba-39f6-4ab3-91ae-186dc9577d99" - -//Setup callbacks onConnect and onDisconnect -class ServerCallbacks : public BLEServerCallbacks { - void onConnect(BLEServer *pServer) override { - Serial.println("New device connected."); - digitalWrite(INTERNAL_LED_PIN, HIGH); - }; - - void onDisconnect(BLEServer *pServer) override { - Serial.println("Device disconnected."); - digitalWrite(INTERNAL_LED_PIN, LOW); - //restart advertising on device disconnect - pServer->getAdvertising()->start(); - } -}; - -/** - * Represents the Bluetooth server that handles all interactions - */ -BluetoothServer::BluetoothServer() { - // Create the BLE Device - BLEDevice::init(BLE_SERVER_NAME); - - // Create the BLE Server - this->bleServer = BLEDevice::createServer(); - bleServer->setCallbacks(new ServerCallbacks()); - - // Create the BLE Service - this->sensorService = bleServer->createService(SERVICE_UUID); - - //create characteristics that will enable data sharing - BLECharacteristic *temperatureCharacteristic = sensorService->createCharacteristic( - TEMPERATURE_CHARACTERISTIC_UUID, - BLECharacteristic::PROPERTY_READ - ); - BLECharacteristic *pressureCharacteristic = sensorService->createCharacteristic( - PRESSURE_CHARACTERISTIC_UUID, - BLECharacteristic::PROPERTY_READ - ); - - //set initial values - temperatureCharacteristic->setValue("NA"); - pressureCharacteristic->setValue("NA"); -} - -/** - * Method to start the Bluetooth server and enable advertising to allow other devices to connect - */ -void BluetoothServer::startServer() { - // Start the service - this->sensorService->start(); - - // Start advertising - BLEAdvertising *pAdvertising = BLEDevice::getAdvertising(); - pAdvertising->addServiceUUID(SERVICE_UUID); - this->bleServer->getAdvertising()->start(); - Serial.println("Started BLE Server."); -} - -/** - * TODO: Convert temperature to string somehow - * Publish a new temperature to the appropriate characteristic - * @param temperature the new temperature - */ -void BluetoothServer::setTemperature(float temperature) { - sensorService - ->getCharacteristic(TEMPERATURE_CHARACTERISTIC_UUID) - ->setValue(temperature); -} - -/** - * TODO: Convert pressure to string somehow - * Publish a new pressure to the appropriate characteristic - * @param pressure the new pressure - */ -void BluetoothServer::setPressure(float pressure) { - sensorService - ->getCharacteristic(PRESSURE_CHARACTERISTIC_UUID) - ->setValue(pressure); -} - - diff --git a/firmware/src/ble/BluetoothServer.h b/firmware/src/ble/BluetoothServer.h deleted file mode 100644 index 4afd1ec..0000000 --- a/firmware/src/ble/BluetoothServer.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef NEW_CLIMTE_GO_BLUETOOTHSERVER_H -#define NEW_CLIMTE_GO_BLUETOOTHSERVER_H - -#include -#include -#include -#include -#include - -#define temperatureCelsius - -class BluetoothServer { -private: - BLEService *sensorService; - BLEServer *bleServer; -public: - BluetoothServer(); - - void startServer(); - void setTemperature(float temperature); - void setPressure(float pressure); -}; - - -#endif //NEW_CLIMTE_GO_BLUETOOTHSERVER_H diff --git a/firmware/src/main.cpp b/firmware/src/main.cpp deleted file mode 100644 index 38b5852..0000000 --- a/firmware/src/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include -#include - -#define SLEEP_TIME 2 -#define BAUD_RATE 112500 -#define INTERNAL_LED_PIN 2 - - -Sensor *bmpSensor; -BluetoothServer *server; - -void setup() { - Serial.begin(BAUD_RATE); - pinMode(INTERNAL_LED_PIN, OUTPUT); - - bmpSensor = new BmpSensor(); - - server = new BluetoothServer(); - server->startServer(); -} - -void loop() { - sensor_data_t sample = ((BmpSensor *) bmpSensor)->sampleLowEnergy(); - server->setPressure(sample.pressure); - server->setTemperature(sample.temperature); - delay(SLEEP_TIME * 1000); -} \ No newline at end of file diff --git a/firmware/src/sensors/BmpSensor.cpp b/firmware/src/sensors/BmpSensor.cpp deleted file mode 100644 index 7f68a25..0000000 --- a/firmware/src/sensors/BmpSensor.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include -#include -#include -#include "BmpSensor.h" - -/** - * Creates a new BMP Sensor and initializes it - */ -BmpSensor::BmpSensor() { - this->BmpSensor::sensor_setup(); - this->state = SensorState::ASLEEP; -} - -/** - * Function responsible for setting up the sensor and the I2C connection - */ -void BmpSensor::sensor_setup() { - while (!Serial) delay(100); // wait for native usb - - unsigned status = this->bmp.begin(0x76); //set the correct I2C port - - //query status and reboot the board if no sensor is detected - if (!status) - ESP.restart(); - - //put sensor to standby mode - this->enableStandbyMode(); -} - -/** - * Function to wake sensor up from standby mode - */ -void BmpSensor::wakeUp() { - this->bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating Mode. */ - Adafruit_BMP280::SAMPLING_X2, /* Temp. oversampling */ - Adafruit_BMP280::SAMPLING_X16, /* Pressure oversampling */ - Adafruit_BMP280::FILTER_X16, /* Filtering. */ - Adafruit_BMP280::STANDBY_MS_500 /* Standby time. */ - ); -} - -/** - * Function to put sensor to standby mode - */ -void BmpSensor::enableStandbyMode() { - this->bmp.setSampling(Adafruit_BMP280::MODE_SLEEP, /* Operating Mode. */ - Adafruit_BMP280::SAMPLING_X2, /* Temp. oversampling */ - Adafruit_BMP280::SAMPLING_X16, /* Pressure oversampling */ - Adafruit_BMP280::FILTER_X16, /* Filtering. */ - Adafruit_BMP280::STANDBY_MS_500 /* Standby time. */ - ); -} - -/** - * read a sample from the sensor - * @return a struct containing all necessary sensor data - */ -sensor_data_t BmpSensor::sample() { - //wake sensor up if it is in standby mode - if (this->state == SensorState::ASLEEP) - this->wakeUp(); - - //sample pressure and temperature - sensors_event_t temp_event, pressure_event; - this->bmp_temp->getEvent(&temp_event); - this->bmp_pressure->getEvent(&pressure_event); - - - return sensor_data_t - { - temp_event.temperature, - pressure_event.pressure - }; -} - -/** - * Read a sample and put sensor to standby mode. - * !!! Do not use this if sampling time is <= 500ms !!! - * @return the sample read - */ -sensor_data_t BmpSensor::sampleLowEnergy() { - //read sample - sensor_data_t sampledData = this->sample(); - //put sensor to standby - this->enableStandbyMode(); - return sampledData; -} - - diff --git a/firmware/src/sensors/BmpSensor.h b/firmware/src/sensors/BmpSensor.h deleted file mode 100644 index f5949fc..0000000 --- a/firmware/src/sensors/BmpSensor.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef NEW_CLIMTE_GO_BMPSENSOR_H -#define NEW_CLIMTE_GO_BMPSENSOR_H - -#include "Sensor.h" -#include "Adafruit_BMP280.h" - -class BmpSensor : public Sensor { -private: - Adafruit_BMP280 bmp; // use I2C interface - Adafruit_Sensor *bmp_temp = bmp.getTemperatureSensor(); - Adafruit_Sensor *bmp_pressure = bmp.getPressureSensor(); - -public: - BmpSensor(); - - sensor_data_t sample() override; - sensor_data_t sampleLowEnergy(); - - void enableStandbyMode() override; - - void wakeUp() override; - -protected: - void sensor_setup() override; - -}; - -#endif //NEW_CLIMTE_GO_BMPSENSOR_H - diff --git a/firmware/src/sensors/Sensor.h b/firmware/src/sensors/Sensor.h deleted file mode 100644 index 7f3a1f8..0000000 --- a/firmware/src/sensors/Sensor.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef NEW_CLIMTE_GO_SENSOR_H -#define NEW_CLIMTE_GO_SENSOR_H - -#include - -enum class SensorState : unsigned short { - AWAKE, ASLEEP -}; - -class Sensor { -public: - virtual sensor_data_t sample() = 0; - - virtual void wakeUp() = 0; - - virtual void enableStandbyMode() = 0; - -protected: - SensorState state = SensorState::ASLEEP; - - virtual void sensor_setup() = 0; - -}; - -#endif //NEW_CLIMTE_GO_SENSOR_H diff --git a/firmware/src/sensors/sensor_data_t.h b/firmware/src/sensors/sensor_data_t.h deleted file mode 100644 index 0d96e8d..0000000 --- a/firmware/src/sensors/sensor_data_t.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef NEW_CLIMTE_GO_SENSOR_DATA_T_H -#define NEW_CLIMTE_GO_SENSOR_DATA_T_H - -#include - -/** - * This struct represents data read from any sensor. - * This implies, reading temperature from e.g. the CO2 Sensor - * does not make any sense - */ -struct sensor_data_t { - float temperature; - float pressure; -}; - -#endif diff --git a/firmware/test/README b/firmware/test/README deleted file mode 100644 index b94d089..0000000 --- a/firmware/test/README +++ /dev/null @@ -1,11 +0,0 @@ - -This directory is intended for PlatformIO Unit Testing and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PlatformIO Unit Testing: -- https://docs.platformio.org/page/plus/unit-testing.html diff --git a/flake.nix b/flake.nix index 8d9655b..0d9824c 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "A Nix-flake-based PlatformIO development environment"; + description = "A Nix-flake-based Rust development environment for ESP"; inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; @@ -14,10 +14,7 @@ devShells = forEachSupportedSystem ({ pkgs }: { default = pkgs.mkShell { packages = with pkgs; [ - platformio-core - openocd - python3 - platformio + ]; }; });