Skip to content

Commit

Permalink
Fix issue with logging interval and perform a full data clear.
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-carlos committed Nov 15, 2024
1 parent a595cb5 commit 2dd4f1a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static void log_battery_voltage() {
// Configure data logging and clear any previous data
uBit.log.setSerialMirroring(false);
uBit.log.setTimeStamp(TimeStampFormat::Seconds);
uBit.log.clear(false);
uBit.log.clear(true);
uBit.log.setVisibility(true);

// Read the battery voltage every second, average it over 60 seconds and log it
Expand All @@ -101,7 +101,7 @@ static void log_battery_voltage() {
uint32_t next_log_time = uBit.systemTime();
while (!uBit.log.isFull()) {
while (uBit.systemTime() < next_log_time);
next_log_time += LOGGING_INTERVAL_SECS * 1000;
next_log_time += 1000;

voltages[voltages_index] = get_vdd_millivolts();
voltages_index++;
Expand Down

0 comments on commit 2dd4f1a

Please sign in to comment.