Add Vision Master T190 Color display

This commit is contained in:
Egor Shitikov
2024-09-08 01:42:05 -07:00
parent 4ed29ce786
commit f8650ab5c8
5 changed files with 1311 additions and 617 deletions
+59 -1
View File
@@ -14,7 +14,7 @@
void setOSD() {}
// TODO: Make Async Scan
// https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/scan-examples.html#async-scan
void scanWiFi(void)
void scanWiFi(DFRobot_OSD osd)
{
osd.clear();
osd.displayString(14, 2, "Scanning WiFi..");
@@ -50,3 +50,61 @@ void scanWiFi(void)
}
osd.displayChar(14, 1, 0x10f);
}
//**********************
// BLE devices scan.
//***********************
// TODO: Make Async Scan
// https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLETests/SampleAsyncScan.cpp
void scanBT(DFRobot_OSD osd)
{
osd.clear();
osd.displayString(14, 2, "Scanning BT...");
cycleCnt++;
BLEDevice::init("");
BLEScan *pBLEScan = BLEDevice::getScan();
// active scan uses more power, but get results faster
pBLEScan->setActiveScan(true);
// TODO: adjust interval and window
pBLEScan->setInterval(0x50);
pBLEScan->setWindow(0x30);
#ifdef SERIAL_PRINT
Serial.printf("Start BLE scan for %d seconds...\n", BT_SCAN_TIME);
#endif
BLEScanResults foundDevices = pBLEScan->start(BT_SCAN_TIME);
int count = foundDevices.getCount();
#ifdef PRINT_DEBUG
Serial.printf("Found devices: %d \n", count);
#endif
present = false;
for (int i = 0; i < count; i++)
{
BLEAdvertisedDevice device = foundDevices.getDevice(i);
String currDevAddr = device.getAddress().toString().c_str();
String deviceName;
if (device.haveName())
{
deviceName = device.getName().c_str();
}
else
{
deviceName = currDevAddr;
}
#ifdef PRINT_DEBUG
Serial.printf("Found device #%s/%s with RSSI: %d \n", currDevAddr, deviceName,
device.getRSSI());
#endif
osd.displayString(i + 1, 1,
"BT:" + deviceName + ":" + String(device.getRSSI()) + " \n");
}
#ifdef PRINT_DEBUG
Serial.println("Scan done!");
Serial.printf("Cycle counter: %d, Free heap: %d \n", cycleCnt, ESP.getFreeHeap());
#endif
osd.displayChar(14, 1, 0x10f);
scanFinished = true;
}