v1.2.91: enhanced RGB LED blink

This commit is contained in:
Klaus K Wilting 2018-04-03 21:26:51 +02:00
parent 42cb206789
commit dc7f4ca90e
3 changed files with 6 additions and 4 deletions

View File

@ -211,6 +211,7 @@ Description of the RGB LED color (LoPy/LoPy4 and Lolin32 only):
- Yellow quick blink: joining LoRaWAN network in progress or pending - Yellow quick blink: joining LoRaWAN network in progress or pending
- Blue blink: LoRaWAN data transmit (including waiting for receive windows) in progress or pending - Blue blink: LoRaWAN data transmit (including waiting for receive windows) in progress or pending
- Green each blink: seen a Wifi device, new or not, while Wifi scanning
- Magenta each blink: seen a BLE device, new or not, while BLE scanning - Magenta each blink: seen a BLE device, new or not, while BLE scanning
# License # License

View File

@ -53,11 +53,15 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) {
added = newmac.second; // true if hashed MAC is unique in container added = newmac.second; // true if hashed MAC is unique in container
if (sniff_type == MAC_SNIFF_WIFI ) { if (sniff_type == MAC_SNIFF_WIFI ) {
rgb_set_color(COLOR_GREEN);
newmac = wifis.insert(hashedmac); // add hashed MAC to wifi container if new unique newmac = wifis.insert(hashedmac); // add hashed MAC to wifi container if new unique
strcpy(typebuff, "WiFi"); strcpy(typebuff, "WiFi");
rgb_set_color(COLOR_NONE);
} else if (sniff_type == MAC_SNIFF_BLE ) { } else if (sniff_type == MAC_SNIFF_BLE ) {
rgb_set_color(COLOR_MAGENTA);
newmac = bles.insert(hashedmac); // add hashed MAC to BLE container if new unique newmac = bles.insert(hashedmac); // add hashed MAC to BLE container if new unique
strcpy(typebuff, "BLE "); strcpy(typebuff, "BLE ");
rgb_set_color(COLOR_NONE);
} }
if (added) { // first time seen this WIFI or BLE MAC if (added) { // first time seen this WIFI or BLE MAC
@ -85,14 +89,11 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
void onResult(BLEAdvertisedDevice advertisedDevice) { void onResult(BLEAdvertisedDevice advertisedDevice) {
uint8_t *p = (uint8_t *) advertisedDevice.getAddress().getNative(); uint8_t *p = (uint8_t *) advertisedDevice.getAddress().getNative();
rgb_set_color(COLOR_MAGENTA);
// Current devices seen on this scan session // Current devices seen on this scan session
currentScanDevice++; currentScanDevice++;
mac_add(p, advertisedDevice.getRSSI(), MAC_SNIFF_BLE); mac_add(p, advertisedDevice.getRSSI(), MAC_SNIFF_BLE);
u8x8.setCursor(12,3); u8x8.setCursor(12,3);
u8x8.printf("%d", currentScanDevice); u8x8.printf("%d", currentScanDevice);
rgb_set_color(COLOR_NONE);
} }
}; };

View File

@ -1,5 +1,5 @@
// program version - note: increment version after modifications to configData_t struct!! // program version - note: increment version after modifications to configData_t struct!!
#define PROGVERSION "1.2.9" // use max 10 chars here! #define PROGVERSION "1.2.91" // use max 10 chars here!
#define PROGNAME "PAXCNT" #define PROGNAME "PAXCNT"
// Verbose enables serial output // Verbose enables serial output