Thursday 29 September 2011

Metawatch Menus

The top menu

The Bluetooth Menu

and the clock settings menu

This change took 2 minutes. Not sure how long it would have taken with the old system.
I changed The code


MENU_START(menu1)
MENU_DYNAMIC_ICON_ACTION(bluetooth_get_discoverability_icon, bluetooth_toggle_discoverability, 0) // no update as the spp callback does the refresh
MENU_DYNAMIC_ICON_ACTION(LinkAlarmIcon, ToggleLinkAlarmEnable, MENU_FLAG_UPDATE)
MENU_STATIC_ICON_ACTION(pLedIcon, 0, 0)
MENU_DYNAMIC_ICON_ACTION(bluetooth_get_status_icon, bluetooth_toggle_bluetooth, 0) // no update as the spp callback does the refresh
MENU_END

MENU_START(menu2)
MENU_MSG_BUTTON(SoftwareResetMsg, NO_MSG_OPTIONS, pResetButtonIcon, BUTTON_STATE_PRESSED, MENU_FLAG_UPDATE)
MENU_DYNAMIC_ICON_ACTION(bluetooth_get_secure_smiple_pairing_icon, bluetooth_toggle_secure_smiple_pairing, MENU_FLAG_UPDATE)
MENU_STATIC_ICON_ACTION(pLedIcon, 0, 0)
MENU_STATIC_ICON_ACTION(pRstPinIcon, ToggleRstPin, MENU_FLAG_UPDATE)
MENU_END


MENU_START(menu3)
MENU_STATIC_ICON_ACTION(pNormalDisplayMenuIcon,ToggleIdleBufferInvert, MENU_FLAG_UPDATE)
MENU_DYNAMIC_ICON_ACTION(SecondsIcon, ToggleSecondsHandler, MENU_FLAG_UPDATE)
MENU_STATIC_ICON_ACTION(pLedIcon, 0, 0)
MENU_DYNAMIC_ICON_ACTION(TimeFormatIcon, ToggleTimeFormat, MENU_FLAG_UPDATE)
MENU_END



To


MENU_START(bluetooth)
MENU_DYNAMIC_ICON_ACTION(bluetooth_get_discoverability_icon, bluetooth_toggle_discoverability, 0) // no update as the spp callback does the refresh
MENU_DYNAMIC_ICON_ACTION(bluetooth_get_secure_smiple_pairing_icon, bluetooth_toggle_secure_smiple_pairing, MENU_FLAG_UPDATE)
MENU_STATIC_ICON_ACTION(pLedIcon, 0, 0)
MENU_DYNAMIC_ICON_ACTION(bluetooth_get_status_icon, bluetooth_toggle_bluetooth, 0) // no update as the spp callback does the refresh
MENU_END

MENU_START(clock)
MENU_DYNAMIC_ICON_ACTION(SecondsIcon, ToggleSecondsHandler, MENU_FLAG_UPDATE)
MENU_DYNAMIC_ICON_ACTION(DateFormatIcon, ToggleDateFormat, MENU_FLAG_UPDATE)
MENU_STATIC_ICON_ACTION(pLedIcon, 0, 0)
MENU_DYNAMIC_ICON_ACTION(TimeFormatIcon, ToggleTimeFormat, MENU_FLAG_UPDATE)
MENU_END

MENU_DEF(dev2)

MENU_START_WITH_NEXT(dev, dev2)
MENU_STATIC_ICON_ACTION(pNormalDisplayMenuIcon,ToggleIdleBufferInvert, MENU_FLAG_UPDATE)
MENU_MSG_BUTTON(SoftwareResetMsg, NO_MSG_OPTIONS, pResetButtonIcon, BUTTON_STATE_PRESSED, MENU_FLAG_UPDATE)
MENU_DYNAMIC_ICON_ACTION(LinkAlarmIcon, ToggleLinkAlarmEnable, MENU_FLAG_UPDATE)
MENU_STATIC_ICON_ACTION(pLedIcon, 0, 0)
MENU_END

MENU_START_WITH_NEXT(dev2, dev)
MENU_STATIC_ICON_ACTION(pNormalDisplayMenuIcon,ToggleIdleBufferInvert, MENU_FLAG_UPDATE)
MENU_FLAG_UPDATE)
MENU_DYNAMIC_ICON_ACTION(LinkAlarmIcon, ToggleLinkAlarmEnable, MENU_FLAG_UPDATE)
MENU_STATIC_ICON_ACTION(pLedIcon, 0, 0)
MENU_STATIC_ICON_ACTION(pRstPinIcon, ToggleRstPin, MENU_FLAG_UPDATE)
MENU_END


MENU_START(TopLevel)
MENU_SUB(bluetooth, pBluetooth, MENU_FLAG_UPDATE)
MENU_SUB(clock, pClockSettings, MENU_FLAG_UPDATE)
MENU_STATIC_ICON_ACTION(pLedIcon, 0, 0)
MENU_SUB(dev, pDevSettings, MENU_FLAG_UPDATE)
MENU_END

Metawatch Firmware Hacking

So I got a new watch.....

And I do what anyone does when they get a new piece of technology....

Improve it! First I fixed it so the date and time were shown in the correct format.
Then added a menu item to allow configuring of this.

Now adding this menu item was quite tricky. The code does lots of message passing and has a custom message for each item. I decided to rewrite the menuing system and made life alot easier(in my opinion)[1], I've since added items for the Day/Month ordering (Although why anyone would want to change this is beyond me ;-) ) and am currently trying out sub menu organisation. The new system makes it very easy to reorder the menus. I've stuck with the current menu design but may experiment with others and possibly add dynamic menus that can be added by applications on the phone (A common request)

Then of course I moved onto the next stage. Writing "Space invaders" for it. (Less encumbered than Xtris) This is the screen.

You can move left and right. But I need to rethink the design and how it fits with the watch architecture. I'd like to split out all the idle screens to separate pluggable entities from the code that handles the LCD. This would make it easer to swap functionality in and out. I'm having to think about how a app can take control from the watch safely and fast. All this source is available on git hub. https://github.com/garthy/MetaWatch-WDS11x-IAR/