Skip to content

Commit

Permalink
Merge pull request #193 from nlesc-recruit/improve-data-sending
Browse files Browse the repository at this point in the history
Decrease missed packets when using marker
  • Loading branch information
loostrum authored Nov 28, 2024
2 parents 294db03 + 80cceed commit ddeeff5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion device/PowerSensor/PowerSensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ void setup() {

void loop() {
if (sendData) {
sendData = false;
// copy serialData to avoid overwrite by next values in IRQ handler
uint8_t serialDataToSend[sizeof(serialData)];
memcpy(serialDataToSend, serialData, sizeof(serialData));
Expand All @@ -421,7 +422,6 @@ void loop() {
sendMarkers--;
}
Serial.write(serialDataToSend, sizeof(serialDataToSend));
sendData = false;
}
// check for serial events
serialEvent();
Expand Down

0 comments on commit ddeeff5

Please sign in to comment.