7/2/15 – Adam Shaw

Today I mostly just continued working on porting the app over to its new home, now named “HMC Word Scroll” I spent a good long while working on tweaking the index recording, because I found that often the indices recorded were a character off, and sometimes two characters off depending on which side of the screen was screwing up end index or start index. The problem is small, but if we want to most accurate data possible it bears fixing. It turns out the built in type conversion Int(float) in swift doesn’t actually round, it just truncates the number to its ones place, which I suppose makes sense, but also is kinda stupid. So first I implemented rounding using a floating function, and then decided to remake the system entirely. It used to compute the percent completed and then get the indices from that, but I have changed it to now record how many character lengths it has moved, with rounding, and those are the indices reported. I don’t know if this will make a substantive difference, but the code is cleaner and overall I like this implementation.

I then spent a while wrestling for information about the update time interval for the accelerometer, because I did some timing tests and found it to be quite off. It turns out, the update time interval is VERY VERY loose. When set to 0.1 seconds, it updated approximately every 0.16 seconds, and when set to 0.2 sec it updated approx ever 0.21 sec. I changed the elapsed time calculation to record the NSDateInterval traversed, not the number of time intervals travelled, which makes the timing far more accurate than it was previously. It doesn’t change how many data points we get, just more accurately reflects their times.

The app is now complete. On Monday I will update to swift 2.0 beta, see what breaks, fix it and go from there.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s