You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libraries/Bluefruit52Lib/examples/Projects/rssi_proximity/rssi_proximity_central/rssi_proximity_central.ino
+25-4Lines changed: 25 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@
38
38
* ARRAY_SIZE
39
39
* ----------
40
40
* The numbers of peripherals tracked and sorted can be set via the
41
-
* ARRAY_SIZE macro.
41
+
* ARRAY_SIZE macro. Must be at least 2.
42
42
*
43
43
* TIMEOUT_MS
44
44
* ----------
@@ -69,8 +69,8 @@
69
69
#defineENABLE_TFT (0) // Set this to 1 to enable ILI9341 TFT display support
70
70
#defineENABLE_OLED (0) // Set this to 1 to enable SSD1306 128x32 OLED display support
71
71
72
-
#if (ARRAY_SIZE <= 0)
73
-
#error "ARRAY_SIZE must be a non-zero value"
72
+
#if (ARRAY_SIZE <= 1)
73
+
#error "ARRAY_SIZE must be at least 2"
74
74
#endif
75
75
#if (ENABLE_TFT) && (ENABLE_OLED)
76
76
#error "ENABLE_TFT and ENABLE_OLED can not both be set at the same time"
@@ -649,6 +649,27 @@ void loop()
649
649
{
650
650
/* Toggle red LED every second */
651
651
digitalToggle(LED_RED);
652
-
652
+
653
+
/* Invalidate old results once per second in addition
654
+
* to the invalidation in the callback handler. */
655
+
/* ToDo: Update to use a mutex or semaphore since this
656
+
* can lead to list corruption as-is if the scann results
657
+
* callback is fired in the middle of the invalidation
658
+
* function. */
659
+
if (invalidateRecords())
660
+
{
661
+
/* The list was updated, print the new values */
662
+
printRecordList();
663
+
Serial.println("");
664
+
/* Display the device list on the TFT if available */
665
+
#if ENABLE_TFT
666
+
renderResultsToTFT();
667
+
#endif
668
+
/* Display the device list on the OLED if available */
0 commit comments