Skip to content

Commit f41b2b5

Browse files
authored
Added invalidation to the main loop
1 parent c9d0359 commit f41b2b5

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)