Skip to content

Commit

Permalink
battery sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulaScharf committed Nov 19, 2024
1 parent e2b6d2c commit 9054972
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion sensebox-bike-atrai-v2-esp32s3/src/display/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void SBDisplay::showSystemStatus()
display.print(batteryCharge, 1);
display.println(" %");

drawBattery(0, 0, 16, 4);
// drawBattery(0, 0, 16, 4);

display.display();
}
Expand Down
6 changes: 2 additions & 4 deletions sensebox-bike-atrai-v2-esp32s3/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ DustSensor dustSensor;
TempHumiditySensor tempHumiditySensor;
DistanceSensor distanceSensor;
AccelerationSensor accelerationSensor;
// BatterySensor batterySensor;
BatterySensor batterySensor;

BaseSensor *sensors[] = {
&dustSensor,
&tempHumiditySensor,
&distanceSensor,
&accelerationSensor,
// &batterySensor
&batterySensor
};

SBDisplay display;
Expand Down Expand Up @@ -47,8 +47,6 @@ void setup()
SBDisplay::showLoading("Setup BLE...", 0.2);
bleModule.begin();

// batterySensor.begin();

bleModule.createService("4fafc201-1fb5-459e-8fcc-c5c9c331914b");

SBDisplay::showLoading("Setup Sensors...", 0.4);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#include "BatterySensor.h"

BatterySensor::BatterySensor() : BaseSensor("batterySensorTask", 2048, 10000) {}
BatterySensor::BatterySensor() : BaseSensor("batterySensorTask", 8192, 1000) {}

// 5b262dea-4565-4ea0-912f-1e453bda0ca7
// String batteryUUID = "5B262DEA45654EA0912F1E453BDA0CA7";
String batteryUUID = "2A19";
String batteryUUID = "5b262dea-4565-4ea0-912f-1e453bda0ca7";
int batteryCharacteristic = 0;

Adafruit_MAX17048 maxlipo;
Expand All @@ -18,9 +16,8 @@ void BatterySensor::initSensor()
Serial.println(F("Couldnt find Adafruit MAX17048?\nMake sure a battery is plugged in!"));
delay(2000);
}

// BLEModule::createService("180F");
// batteryCharacteristic = BLEModule::createCharacteristic(batteryUUID.c_str());
batteryCharacteristic = BLEModule::createCharacteristic(batteryUUID.c_str());
// add more if needed
}

Expand All @@ -43,7 +40,7 @@ bool BatterySensor::readSensorData()

void BatterySensor::notifyBLE(float batteryCharge)
{
// BLEModule::writeBLE(batteryCharacteristic, batteryCharge);
BLEModule::writeBLE(batteryUUID.c_str(), batteryCharge);
}

float BatterySensor::getBatteryCharge()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "../BaseSensor.h"
#include <Adafruit_MAX1704X.h>

// include necceary libraries
// include necessary libraries

class BatterySensor : public BaseSensor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <sps30.h>
// #include <Wire.h>

// include necceary libraries
// include necessary libraries

class DustSensor : public BaseSensor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "../BaseSensor.h"

// include necceary libraries
// include necessary libraries

class SampleSensor : public BaseSensor
{
Expand Down

0 comments on commit 9054972

Please sign in to comment.