Skip to content

Commit 3553428

Browse files
committed
Merge branch 'develop' of github.com:adafruit/Adafruit_nRF52_Arduino into develop
2 parents 1b7abdc + 710a875 commit 3553428

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

libraries/Bluefruit52Lib/examples/Projects/rssi_proximity/rssi_proximity_central/rssi_proximity_central.ino

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* ARRAY_SIZE
3939
* ----------
4040
* 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.
4242
*
4343
* TIMEOUT_MS
4444
* ----------
@@ -69,8 +69,8 @@
6969
#define ENABLE_TFT (0) // Set this to 1 to enable ILI9341 TFT display support
7070
#define ENABLE_OLED (0) // Set this to 1 to enable SSD1306 128x32 OLED display support
7171

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"
7474
#endif
7575
#if (ENABLE_TFT) && (ENABLE_OLED)
7676
#error "ENABLE_TFT and ENABLE_OLED can not both be set at the same time"
@@ -649,6 +649,27 @@ void loop()
649649
{
650650
/* Toggle red LED every second */
651651
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 */
669+
#if ENABLE_OLED
670+
renderResultsToOLED();
671+
#endif
672+
}
673+
653674
delay(1000);
654675
}

0 commit comments

Comments
 (0)