ossw / ossw-firmware-s120

OSSW firmware for S120 2.0.0 softdevice
42 stars 9 forks source link

Add stopwatch functionality #2

Closed althink closed 9 years ago

althink commented 9 years ago

Add stopwatch functionality and expose time/lap and functions like start/reset/stop/lap to watchsets

althink commented 9 years ago

Sample, ugly stopwatch watchset:

{
    "type": "watchset",
    "name": "stopwatch",
    "apiVersion": 1,
    "data": {
        "screens": [
            {
                "id": "stopwatch",

                "controls": [
                        {
                            "type": "number",
                            "numberRange": "0-9",
                            "position": {"x": 22, "y": 10},
                            "style": {"type": "generated", "thickness": 2, "width": 12, "height": 20, "space": 2, "leftPadded": true},
                            "source": {"type": "internal", "property": "stopwatch.total.time.hours"}
                        },
                        {
                            "type": "number",
                            "numberRange": "0-99",
                            "position": {"x": 44, "y": 10},
                            "style": {"type": "generated", "thickness": 2, "width": 12, "height": 20, "space": 2, "leftPadded": true},
                            "source": {"type": "internal", "property": "stopwatch.total.time.minutes"}
                        },
                        {
                            "type": "number",
                            "numberRange": "0-99",
                            "position": {"x": 80, "y": 10},
                            "style": {"type": "generated", "thickness": 2, "width": 12, "height": 20, "space": 2, "leftPadded": true},
                            "source": {"type": "internal", "property": "stopwatch.total.time.seconds"}
                        },
                        {
                            "type": "number",
                            "numberRange": "0-99",
                            "position": {"x": 116, "y": 10},
                            "style": {"type": "generated", "thickness": 2, "width": 12, "height": 20, "space": 2, "leftPadded": true},
                            "source": {"type": "internal", "property": "stopwatch.total.time.cs"}
                        },
                        {
                            "type": "number",
                            "numberRange": "0-199",
                            "position": {"x": 0, "y": 50},
                            "style": {"type": "generated", "thickness": 2, "width": 6, "height": 10, "space": 2, "leftPadded": false},
                            "source": {"type": "internal", "property": "stopwatch.currentLap.number"}
                        },
                        {
                            "type": "number",
                            "numberRange": "0-9",
                            "position": {"x": 22, "y": 50},
                            "style": {"type": "generated", "thickness": 2, "width": 12, "height": 20, "space": 2, "leftPadded": true},
                            "source": {"type": "internal", "property": "stopwatch.currentLap.time.hours"}
                        },
                        {
                            "type": "number",
                            "numberRange": "0-99",
                            "position": {"x": 44, "y": 50},
                            "style": {"type": "generated", "thickness": 2, "width": 12, "height": 20, "space": 2, "leftPadded": true},
                            "source": {"type": "internal", "property": "stopwatch.currentLap.time.minutes"}
                        },
                        {
                            "type": "number",
                            "numberRange": "0-99",
                            "position": {"x": 80, "y": 50},
                            "style": {"type": "generated", "thickness": 2, "width": 12, "height": 20, "space": 2, "leftPadded": true},
                            "source": {"type": "internal", "property": "stopwatch.currentLap.time.seconds"}
                        },
                        {
                            "type": "number",
                            "numberRange": "0-99",
                            "position": {"x": 116, "y": 50},
                            "style": {"type": "generated", "thickness": 2, "width": 12, "height": 20, "space": 2, "leftPadded": true},
                            "source": {"type": "internal", "property": "stopwatch.currentLap.time.cs"}
                        },
                        {
                            "type": "number",
                            "numberRange": "0-9",
                            "position": {"x": 22, "y": 90},
                            "style": {"type": "generated", "thickness": 2, "width": 12, "height": 20, "space": 2, "leftPadded": true},
                            "source": {"type": "internal", "property": "stopwatch.lastLap.time.hours"}
                        },
                        {
                            "type": "number",
                            "numberRange": "0-99",
                            "position": {"x": 44, "y": 90},
                            "style": {"type": "generated", "thickness": 2, "width": 12, "height": 20, "space": 2, "leftPadded": true},
                            "source": {"type": "internal", "property": "stopwatch.lastLap.time.minutes"}
                        },
                        {
                            "type": "number",
                            "numberRange": "0-99",
                            "position": {"x": 80, "y": 90},
                            "style": {"type": "generated", "thickness": 2, "width": 12, "height": 20, "space": 2, "leftPadded": true},
                            "source": {"type": "internal", "property": "stopwatch.lastLap.time.seconds"}
                        },
                        {
                            "type": "number",
                            "numberRange": "0-99",
                            "position": {"x": 116, "y": 90},
                            "style": {"type": "generated", "thickness": 2, "width": 12, "height": 20, "space": 2, "leftPadded": true},
                            "source": {"type": "internal", "property": "stopwatch.lastLap.time.cs"}
                        }
                ],
                "actions": {
                        "button_back_short": {"action": "close"},
                        "button_back_long": {"action": "toggleBacklight"},
                        "button_up_long": {"action": "stopwatch.reset"},
                        "button_up_short": {"action": "stopwatch.startStop"},
                        "button_down_short": {"action": "stopwatch.nextLap"}
                }
            }
        ]
    }
}