This commit is contained in:
lash404 committed 2026-10-28 08:20:02 +01:00
1 parent f6da5b649f
commit 2a397db360
1 file changed
+4
+4
View File
@@ -61,6 +61,7 @@ class CharacteristicCallbacks: public BLECharacteristicCallbacks {
} }
} }
}; };
class MyServerCallbacks: public BLEServerCallbacks { class MyServerCallbacks: public BLEServerCallbacks {
void onConnect(BLEServer* pServer) { void onConnect(BLEServer* pServer) {
Serial.println("Conecction with client"); Serial.println("Conecction with client");
@@ -109,6 +110,7 @@ void loop() {
updateClock(); updateClock();
} }
void initDevice(){ void initDevice(){
BLEDevice::init(deviceName); BLEDevice::init(deviceName);
BLEServer *pServer = BLEDevice::createServer(); BLEServer *pServer = BLEDevice::createServer();
@@ -152,6 +154,7 @@ void initDevice(){
BLEDevice::startAdvertising(); BLEDevice::startAdvertising();
Serial.println("Characteristic defined! Now you can read it in your phone!"); Serial.println("Characteristic defined! Now you can read it in your phone!");
} }
void updateClock(){ void updateClock(){
unsigned long curMil = millis(); unsigned long curMil = millis();
@@ -164,6 +167,7 @@ void updateClock(){
if (MIN >= 60) {MIN = 0; HOUR++; timeChanged = true;} if (MIN >= 60) {MIN = 0; HOUR++; timeChanged = true;}
if (HOUR >= 24) {HOUR = 0; DAY++; timeChanged = true;} if (HOUR >= 24) {HOUR = 0; DAY++; timeChanged = true;}
} }
void drawText(int width, int hight,int size, const char* text) { void drawText(int width, int hight,int size, const char* text) {
gfx->setCursor(width, hight); gfx->setCursor(width, hight);
gfx->setTextSize(size); gfx->setTextSize(size);