Skip to content

Conversation

@juehv
Copy link
Contributor

@juehv juehv commented Aug 25, 2019

Another snippet from my "towards long term offline looping"-project. I had the issue when the rig was down for more than a few minutes, the missaligned clockes prevented the loop from running. Therefore I take the clock from the pump when the rig boots and is offline. That does not effect online operation as this script does nothing when wifi is connected. Also when the rig comes online again, the rig clock gets ntp syncronized and updates the pump clock at some point.

Tested on my PI+HAT rig but should work for every pi based and edison based rig

Another snippet from my "towards long term offline looping"-project. I had the issue when the rig was down for more than a few minutes, the missaligned clockes prevented the loop from running. Therefore I take the clock from the pump when the rig boots and is offline. That does not effect online operation as this script does nothing when wifi is connected. Also when the rig comes online again, the rig clock gets ntp syncronized and updates the pump clock at some point.

Tested on my PI+HAT rig but should work for every pi based and edison based rig
@scottleibrand
Copy link
Contributor

Does this pose a race condition with oref0-pump-loop using the radio? Your sleep 60 would allow the pump-loop to start, at which point the radio would be locked, right?

I know we originally put similar logic to this into oref0-pump-loop itself: not sure if that isn't working, or ?

https://github.com/openaps/oref0/blob/dev/bin/oref0-pump-loop.sh#L387

@juehv
Copy link
Contributor Author

juehv commented Sep 12, 2019

Interesting! I'm absolutely sure the current code is not working since I had this clock related problem several times. But you may be right with the race condition. But without the sleep statement the Wifi connection may be still down. I'll think about it...

@straykatz
Copy link

Hi - while backpacking for a week offline the last few days, I ran into the chip clock issue big time when rig lost power and when I had to swap batteries. I am looking forward to see what you are doing! And I can confirm that this is an issue at least with the chip I was using, which was up-to-date in dev last week (there have been two new commits since then.)

@scottleibrand
Copy link
Contributor

Actually, looking into this further, this shouldn't be able to do any harm, since setting the system clock just reads a file, and doesn't actually talk to the pump. I'm also attempting to fix this with https://github.com/openaps/oref0/tree/offline-clock-set and will let you know if that works.

@scottleibrand
Copy link
Contributor

@juehv would you care to test out #1290 and see if that fixes offline looping for you without the new cron job?

@juehv
Copy link
Contributor Author

juehv commented Sep 22, 2019

@scottleibrand Yes of course. I'll install it tomorrow evening.

@scottleibrand
Copy link
Contributor

Thanks. LMK (preferably by commenting on #1290) when you've had a chance to confirm that it helps and doesn't break anything.

@juehv
Copy link
Contributor Author

juehv commented Sep 29, 2019

#1290 works better

@juehv juehv closed this Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants