Added isConnected() to ESP32 Bluetooth classes (enables polymorphism from CBluetoothAbstract)

key repeat added to time setting screen
This commit is contained in:
rljonesau 2018-12-08 20:31:15 +11:00
parent 0f397e93f8
commit 069633c61f
3 changed files with 30 additions and 3 deletions

View file

@ -102,7 +102,7 @@ CBluetoothESP32Classic::sendFrame(const char* pHdr, const CProtocol& Frame, bool
CBluetoothAbstract::sendFrame(pHdr, Frame, lineterm);
delay(40);
if(SerialBT.hasClient()) {
if(isConnected()) {
if(Frame.verifyCRC()) {
#if BT_LED == 1
@ -128,7 +128,13 @@ CBluetoothESP32Classic::sendFrame(const char* pHdr, const CProtocol& Frame, bool
#endif
}
}
bool
CBluetoothESP32Classic::isConnected()
{
return SerialBT.hasClient();
}
// ^
// |
// CLASSIC BLUETOOTH on ESP32
@ -254,7 +260,7 @@ CBluetoothESP32BLE::sendFrame(const char* pHdr, const CProtocol& Frame, bool lin
CBluetoothAbstract::sendFrame(pHdr, Frame, lineterm);
delay(40);
if(_deviceConnected) {
if(isConnected()) {
if(Frame.verifyCRC()) {
#if BT_LED == 1
@ -278,6 +284,12 @@ CBluetoothESP32BLE::sendFrame(const char* pHdr, const CProtocol& Frame, bool lin
}
}
bool
CBluetoothESP32BLE::isConnected()
{
return _deviceConnected;
}
void
CBluetoothESP32BLE::check()
{

View file

@ -37,6 +37,7 @@ public:
virtual void init();
virtual void sendFrame(const char* pHdr, const CProtocol& Frame, bool lineterm=true);
virtual void check();
virtual bool isConnected();
};
#include <BLEDevice.h>
@ -59,4 +60,6 @@ public:
virtual void init();
virtual void sendFrame(const char* pHdr, const CProtocol& Frame, bool lineterm=true);
virtual void check();
virtual bool isConnected();
};

View file

@ -184,6 +184,18 @@ CScreen6::keyHandler(uint8_t event)
}
}
}
if(event & keyRepeat) {
if(_rowSel==1) {
// press UP
if(event & key_Up) {
adjTimeDate(+1);
}
// press DOWN
if(event & key_Down) {
adjTimeDate(-1);
}
}
}
_nextT = millis();
_ScreenManager.reqUpdate();