Tuesday, November 10, 2020

Blue Ridge Mountains Adventure - Day 2

Technically, my day started at 3am when I rolled over to check my phone to see how badly Joe Biden had lost the election. Shira was awake doing the same, and gave me the quick update: Joe had lost Florida, but there were a number of states that were too close to call. I took some comfort in knowing that the race wasn't over and tried to go back to bed.

Over breakfast, we continued to be glued to election coverage. During one of CNN's panel discussions, the obviously leaning Democrat explained that despite the overwhelmingly red map, the Biden team was optimistic. More surprisingly, the Republican guest didn't argue this point, but instead emphasized the record turn-out and victories in the House and Senate. Might Biden actually win this? After last night, I wasn't sure of anything.

Mostly, I was happy that once again we had a day planned in the woods and I'd have my phone in Airplane Mode. This meant I could finally tune out the endless stream of meaningless, yet tantalizing, Key Race Alerts that CNN was issuing every few minutes. Damn you Blitzer. You get me. Every. Single. Time.

Today we planned to cover the 9+ mile Torry Ridge - Lower Shernado Lake - White Gap Trail. The hike promised views, a waterfall and a picturesque lake. Perhaps it was the stellar weather, but I have to say, the hike delivered. The hike up to, and down from Torry Ridge was challenging and made more so by the at-times slippery leaf cover. But thanks to the now leafless trees, we had amazing views from the ridge. The waterfall at White Gap Creek was in impressive form, and served as one of a number of interesting stream crossings we'd make during the day.

We saw almost no wildlife during the hike. But thanks to Shira's keen eyes, we did have an encounter with one remarkable creature: a Phasmid, more commonly known as a walking stick insect. It was kind enough to pose for me as I captured pics. Even a few inches away from it, it looked more stick-like than insect-like. This guy was truly a natural wonder.

After 6.5 hours of hiking, we arrived at our car as the sun was setting. From there we headed to a brewery for more pub-food. This time I enjoyed hot apple cider without booze and some of the best fried pickles I'd ever had the privilege to eat. Back at our condo, we tuned back into election coverage, and like the rest of the nation, watched the equivalent of paint drying as we waited for ballots to be counted.

Monday, November 09, 2020

Blue Ridge Mountains Adventure - Day 1

We're on vacation! And there's a pandemic! And it's election day! These were the thoughts running through my mind as I awoke on the first full day of our Blue Ridge Mountains Adventure. Looking for a Covid-19 friendly vacation idea, we opted to explore a part of Virginia that we hadn't spent a lot of time in. We rented a one bedroom condo in the expansive Wintergreen Resort and hoped the weather would cooperate for a week of outdoor activities.

While the week promised sunshine and a shocking lack of rain, the temperture this morning was hovering at freezing. As if to remind us that we were indeed adventuring outdoors in wintertime, we couldn't help but marvel at the remarkable displays of icicles clinging to rock walls as we drove along the Blue Ridge Parkway.

Our plan for today was to hike during the day and then have a traditional election night watching John King zoom in and out of various US counties that we obsess over for a single night every four years.

One factor cementing our decision to stay at the Wintergreen resort was the sheer number of interesting trails it would put us in proximity to. Today, we tackled the Jack Albright Loop with a side-trip out and back on the Appalachian Trail (AT). The hike got off to a windy and chilly start, but over time, things warmed up. The scenery was terrific and the side trip on the AT brought us face to face with a series of waterfalls and an overflowing creek. Perhaps best of all, I had my phone on Airplane Mode, so I didn't have to endure election chatter.

After the hike, we made our way to Bold Rock Cidery where I enjoyed a flight of hard ciders. The dish that stole the show were the nachos. They mixed melted cheese with cider to make a sort of fondue like queso which was heavenly. It was a bit nippy out, but eating outdoors, in both a beautiful and covid-friendly setting was a real treat.

We then returned to our hotel to watch the election coverage. Naturally, I ignored the warnings of a red or blue mirage and instead focused on the obvious Blue Wave that would be cresting over the country shortly after polls closed at 7pm EST. Instead of a Blue Wave I was treated to Election 2016 v2.0, where I went to bed convinced that Trump had once again pulled out a victory.

Monday, November 02, 2020

Building a Garmin Watch Widget | Part 2: Holy Smokes! It Works!

The next task in building out the Sun Compass Widget for my Garmin Vivoactive 4  watch was to implement the underlying math. I carefully translated the first formula, Equation of Time, from Scheme to the Monkey C and of course it didn't work. The problem: I forgot to convert degrees to radians before calling sin() and cos(). Once passed this beginner mistake, the rest of the implementation was smooth sailing.

I fired up the pveducation.org calculator and the Garmin simulator and was below away. They match!

You'll notice in the screenshot above that the phrase 'fresh' next to the latitude and longitude. This tells me that the widget's call to the GPS for the current location was successful. Until this call returns, which can take quite a bit of time, I use the last known location. When a previous location is used, it's marked as stale. Fortunately, your location to the meter isn't needed for the compass to be reasonably accurate. As long a fresh reading was taken near your current location, the quickly shown stale value should work.

Caching the location went a long way towards speeding up the widget and making usable.

Here are some snapshots of the widget running on my actual watch on my actual wrist.

Next up: I'll graphically render the azimuth of the sun using something approximating a compass dial. I have to say, this development has been really fun. As I close in on finishing this little project, I'm already brainstorming on what my next app may be.

Check out the source code for the widget on github.

Tuesday, October 27, 2020

Building a Garmin Watch Widget | Part 1: Getting Started

This past weekend, while on walk, I flipped over to the myABC widget on my Garmin Vivoactive 4 watch to see what direction we were headed. The compass (the 'C' in ABC) announced we were walking North-West. On our return, I once again checked my watch and once again, it read North-West. That can't be right I thought, and for not the first time I cursed my watch's compass.

I was disappointed, but not surprised. Like nearly every electronic device with a compass, I've found that at times it's wildly inaccurate. The irony that my watch can communicate with satellites in space to determine my location on the globe to a few meters, but can't do the job of a couple of magnets and dental floss isn't lost on me.

Yet, I've got a solution: I'm going to add a solar compass to my digital one. From earlier experiments, I know that with the current time and lat/long I can predict the direction and elevation of the sun. My watch has a GPS and a clock, so with a bit of math to figure out the azimuth of the Sun and dollop of graphics to render a dial, I should have an accurate navigation tool.

On a sunny day, with a locked in GPS, such a widget should be fast and reliable. There's only one minor detail: I've never written code for my Vivoactive. But not to worry, I've got a plan! All I need to do is:

  1. Figure out how to write a Hello World widget for the Vivoactive 4.
  2. Find useful examples that I can cheat with use as inspiration.
  3. Write code to display the input values I'll need for my calculations.
  4. Code the calculations to determine the Sun's position.
  5. Render this position information graphically using a dial.
  6. Publish the app to the Connect IQ store to give back to the community I've benefited from.

Step 1 was easy enough, I followed the instructions here. I'm not a fan of IDEs, but even I have to admit that the eclipse plugin made getting started a breeze.

I got lucky with Step 2, when I found this Garmin watch app: SunCalc. It's not quite the same solar calculations I'll be making, but there's definitely overlap. Just seeing that I can call Math.sin(...) is encouraging and gives me the sense that the calculations I want to make are doable.

And finally, I played with the API docs until I figured out Step 3: showing necessary inputs. Here's a screenshot of the simulator that shows the current time zone, lat/lng and day-of-year number for the current moment. It's not much to look at, but it's huge progress:

Find the code for this widget here.

Up next, I'll be working on coding the algorithms to power the compass. Stay tuned.