Description
Early observations with Firefly and Katydid are seeing occasional failure to Advertise/present their MAC to pick up with "STM BLE Sensor" (SBS app) on Android Phone.
Starting with sketch : BlueST_Console.ino where loop() modified to:
`uint32_t lCnt = 0;
uint32_t msSec = millis();
void loop()
{
int c;
lCnt++;
if ( millis() - msSec > 2000 ) {
msSec = millis();
Serial.print( "Cnt of ");
lCnt /= 2;
Serial.println( lCnt);
SerialBLE.print("\nLoopCount = ");
SerialBLE.println(lCnt);
lCnt = 0;
if (!BLE.advertising() && !BLE.connected()) {
BLE.advertise();
}
SerialBLE.print("Temperature = ");
SerialBLE.print(STM32WB.readTemperature());
SerialBLE.println(" *C");
SerialBLE.print("Battery = ");
SerialBLE.print(STM32WB.readBattery());
SerialBLE.println(" V");
SerialBLE.println();
while ((c = SerialBLE.read()) >= 0) {
if ( c == '1' )
digitalWrite(LED_BUILTIN, HIGH);
if ( c == '0' )
digitalWrite(LED_BUILTIN, LOW);
if (c == '\n') {
Serial.write('\r');
} Serial.write(c);
}
}
}
`
Often it works after upload and the SBS app will see devices to connect. On some occasions it does not, and a board 'Reset' does not seem to be enough to restore connectivity? That is on Katydid and power switch cycle will then show the device.
When the SBS app works the MAC is shown and the device can be selected and opening the " ... / Open Debug Console " with display the recurring 2 seconds messages sent with SerialBLE.print()
On occasion that Console will stop showing the incoming .print() items. Once connected the connect seems 'sticky' and assuming this behavior is similar to the failure to present in the first place? It may be a second instance.
It seems that in these cases going to the 'Bottom Red Line' that is Debug OUTPUT and sending '1' or '0' the above code still responds and will as coded turn the LED On or Off. And it seems at that point the .print() data lines can return to the Console.