OPEnSLab-OSU / Loom

Arduino library for Internet of Things Rapid Prototyping in environmental sensing
GNU General Public License v3.0
26 stars 3 forks source link

Loom doesn't set time until after sample period #194

Open BGoto808 opened 2 years ago

BGoto808 commented 2 years ago

Describe the bug When manually setting the RTC time through the serial monitor, the time doesn't get set for the clock until after the sample period which may cause issues if the user doesn't wait until the end of the sample period.

Hardware in Use Feather + Hypnos (or any RTC device)

To Reproduce Steps to reproduce the behavior:

  1. Go to Hypnos_SD_Sleep example
  2. Compile and upload code to Feather
  3. Boot up serial monitor and enter in time values as it prompts
  4. Disconnect Feather before the program puts it to sleep

Expected behavior The time will not be set and will reprompt the user for it the next time

kurtjd commented 2 years ago

Is this using the Loom 2 example or the Loom 3 one? This is surprising since from what I remember when I was digging around in the Loom RTC code is that the time gets set before setup() ends and loop() even starts, but who knows, might be something weird going on.

udellc commented 2 years ago

Yes I would have thought the user-input time from serial is prompted in Setup - so it should set the time before leaving Setup. But according to Bryson's usage it does not. Do you think you can reproduce the issue for Kurt, Bryson?

BGoto808 commented 2 years ago

This is for Loom 3. You can grab a dendrometer node from the lab and reproduce it by uploading the Dendrometer node code on the GitHub. The code is setup so that the magnet needs to be in a good position before moving onto the loop.

So you can test it by setting the time and the code will automatically stop when the sensor tries to read the magnet position.

udellc commented 2 years ago

Maybe we can look at this sometime next week?

BGoto808 commented 2 years ago

I can send an updated testing guide for using the Dendrometer node to test this issue so that someone can test it next week.

udellc commented 2 years ago

Thanks,

kurtjd commented 2 years ago

I will see if I can reproduce this without Dendrometer first. If it happens with just a simple Feather + Hypnos setup it's likely a Loom issue. I'll update this with what I find.

udellc commented 2 years ago

Thanks!

kurtjd commented 2 years ago

I was not able to replicate this using a Feather M0 WiFi and Hypnos v3.3. Using the Loom 3 Hypnos_SD_Sleep example, I first reset the RTC and as expected I was prompted to enter a custom time. I immediately removed power from the Feather and after plugging it back in, it seemed the time was set correctly and it did not reprompt me.

Thinking that maybe the Feather went to sleep before I could unplug it, I reset the RTC again and I put in a 10 second delay right before the Feather would go to sleep to ensure I had time to remove power before sleep. Again, after trying this, the RTC seemed to be set correctly despite losing power before going to sleep.

So this doesn't appear to be a general Loom issue. Is there any other information you have that might further help narrow this down?