Hello, I’m using the Notecarrier F and Swan. I recently followed this guide to enable DFU, and I’ve noticed that now each time I call hub.sync I get flooded with a bunch of _health.qo events that look like this:
{
"method": "dfu",
"text": "host restarted: card.attn sleep (interrupt)",
"voltage": 4.2109375
}
My code takes a sensor reading once per minute then uses card.attn to put the MCU to sleep. After 30 readings I call hub.sync. It seems like each of those attn events is being logged and sent to Notehub. Is there any way to prevent this? I’ve included a snippet of my setup and loop functions in case I’m doing something incorrectly there.
void setup(void) {
Wire.begin();
Wire.setClock(400000);
Serial.begin(9600);
while (!scd30.begin()) {}
notecard.begin();
notecard.setDebugOutputStream(Serial);
// Configure Notehub
J *req = notecard.newRequest("hub.set");
JAddStringToObject(req, "product", productUID);
JAddStringToObject(req, "mode", "minimum");
notecard.sendRequest(req);
req = notecard.newRequest("card.dfu");
if (req != NULL) {
JAddStringToObject(req, "name", "stm32");
JAddBoolToObject(req, "on", true);
notecard.sendRequest(req);
}
...
}
void loop() {
auto inputLength = strlen(myBuffer);
static char output[3000];
base64::encode((const uint8_t*)myBuffer, inputLength, output);
J *req = notecard.newCommand("card.attn");
JAddStringToObject(req, "mode", "sleep");
if (strlen(output) > 0)
JAddStringToObject(req, "payload", output);
JAddNumberToObject(req, "seconds", READING_INTERVAL);
notecard.sendRequest(req);
// Delay 1 second in case the host fails to sleep and try again
delay(1000);
}