Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for ESP32 BLE@2.0 lib #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bluetooth.ino
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MyServerCallbacks: public BLEServerCallbacks {

class MyCallbacks: public BLECharacteristicCallbacks {
void onWrite(BLECharacteristic *pCharacteristic) {
std::string rxValue = pCharacteristic->getValue();
String rxValue = pCharacteristic->getValue();

if (rxValue.length() > 0) {
Serial.println("*********");
Expand All @@ -48,12 +48,12 @@ class MyCallbacks: public BLECharacteristicCallbacks {

if (SEND_CONTINIOUSLY == 0) {
// send response accordingly to request
if (smartbmsutilIsCommandRunInfo(rxValue.data(), sizeof(rxValue))) {
if (smartbmsutilIsCommandRunInfo(rxValue.c_str(), sizeof(rxValue))) {
// received command to send RunInfo -> send RunInfo data
smartbmsdemoSendRunInfo();
/*delay(500);
smartbmsdemoSendVersionInfo();*/
} else if (smartbmsutilIsCommandSetDataInfo(rxValue.data(), sizeof(rxValue))) {
} else if (smartbmsutilIsCommandSetDataInfo(rxValue.c_str(), sizeof(rxValue))) {
smartbmsdemoSendSetDataInfo();
}
}
Expand Down
5 changes: 2 additions & 3 deletions esp32-smart-bms-simulation.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// HEADER_READ LOC No MaxLength CRC

#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
#include "datatypes.h"
Expand All @@ -37,8 +36,8 @@ void loop() {
delay(2000);
smartbmsdemoSendVersionInfo();

/*delay(2000);
smartbmsutilSendRunInfoLastBatteryValue();*/
//delay(2000);
//smartbmsutilSendRunInfoLastBatteryValue();

delay(UPDATE_INTERVAL_MILLIS);
}
Expand Down