Complex DataField for Garmin ForeAthlete® 230J, ForeAthlete® 235J, ForeAthlete® 630J, Forerunner® 230, Forerunner® 235, Forerunner® 630
Foreword and disclaimer: although being a big step forward in comparison to previous generation "hard-coded" data layouts, Garmin SDK currently lacks tools and means to provide easy to use development framework. Nevertheless there is a possibility to develop applications and I decided to use this opportunity at least to my personal advantage. Why such big words? Because out of almost 60 manhours spent on this project, I spent only about quarter of time in actual development, while other three quarters were used to optimize and align code. There is a predefined memory limit of 16kb for Garmin IQ DataField, but practice shows that even if your application memory usage as shown in SDK device Simulator is about 13.5kb or more field tends to show severe performance degradation (slow redraw maybe due to system services running at the same time) and stability issues (crashes). Even worse is the situation, that the virtual machine on watch seems to be your average interpreter without too much optimizations in byte-code, this means that even if you add 3-4 lines of code it may add another 200 bytes in memory footprint and break your overall performance/stability. This leads to neccessity of heavy code alignment, that makes sources efficient but almost unreadable: e.g. conversion of easy to read multiple if's into complex conditional assignments, declaration of less functions, since any declaration use memory, even long comprehensive variable names may hinder your optimization efforts... What you see in this project is a result of heavy optimizations and many hours spent in trial and error attempts to improve memory usage and performance, where almost every line of code undergone multiple refactoring attempts to find the best solution. It wasn't easy or very interesting to dig that, but in the end it works very well indeed and, last but not least, I find myself very satisfied with the result.
Those eager to develop with Garmin SDK I encourage to look through sources for a couple of times due to rather comprehensive remarks. Hope this project will help someone to create something even better. Best regards and good luck 8)