Friday, September 27, 2013

Software Improvements

I've had a while to field test this.  Lost one watch water skiing.  Some issues that have been bothering me:
  1. Since the RasPI doesn't have an internal clock, and the MetaWatch resets each time you re-charge it (ridiculous), I have to spend a few minutes with the RasPI networked to get the time correct.  Not ideal, this needs to be as close to "grab and go" as I can get it.
  2. Bluetooth issues.  This thing uses "bleeding edge" bluetooth.  I create a new bluetooth connection to the watch every time there's a new value to send.  Intermittently, I start getting "bluetooth.btcommon.BluetoothError: (113, 'No route to host')" errors.  Sometimes the device recovers, or I just reboot the PI and things go back to normal.  

The Time Issue:
Finally figured out how to get the current time from the Dex.  I do this on startup and set the RaspPI system time to the current time reported by the Dexcom.  This keeps everything in sync, and gives me a functional watch to boot.  One of many "interesting" issues here, C# on Debian doesn't do dates.  Huge bug.  Luckily, I can pass "Seconds since the epoch" to the Unix date function and it does it for me.

I've been using "/etc/init.d/bluetooth restart" after every call to the watch.  Randomly, the bluetooth device time's out, and stays unreachable.  Determined today that calling "hciconfig hci0 reset" fixes that issue.  So now I'm using hciconfig after every call instead of restart.