Kam Max
Kam Max

Reputation: 1

Why did it take so long for my Visual Studio Code to debug Monkey C (Garmin Watch face Development tool)?

I'm trying to create a custom watch face for my Garmin device.
However, when I start debugging my app with a Hello World program, the page gets stuck in an endless load. [see image](https://i.sstatic.net/4hp8vgfL.png) .

I expect the program to run and display an image of what my watch looks like afterward, or generate a .png file for visualization.

This is what in the debug console:

 *  Executing task: monkeyc: Building For Device 

java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar c:\Users\Max\AppData\Roaming\Garmin\ConnectIQ\Sdks\connectiq-sdk-win-7.3.1-2024-09-23-df7b5816a\bin\monkeybrains.jar -o bin\Hackerswatchface.prg -f c:\Users\Max\OneDrive\桌面\Garmin\WatchFaces\Hacker'swatchface\monkey.jungle -y undefined -d epix2pro47mm_sim -w

Since I'm new to Monkey C, I'm not sure what to do.
Any help would be greatly appreciated!

Code I've used (hello world program) layout.xml

<layout id="WatchFace">
    <label id="TimeLabel" x="center" y="center" font="Graphics.FONT_LARGE" justification="Graphics.TEXT_JUSTIFY_CENTER" color="0x20C20E" />
        <label id="HelloWorldLabel" x="center" y="20%" font="Graphics.FONT_LARGE" justification="Graphics.TEXT_JUSTIFY_CENTER" color="Graphics.COLOR_WHITE" />
</layout>

Hello_world_programView.mc

import Toybox.Graphics;
import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;

class Hacker_swatchfaceView extends WatchUi.WatchFace {

    function initialize() {
        WatchFace.initialize();
    }

    // Load your resources here
    function onLayout(dc as Dc) as Void {
        setLayout(Rez.Layouts.WatchFace(dc));
    }

    // Called when this View is brought to the foreground. Restore
    // the state of this View and prepare it to be shown. This includes
    // loading resources into memory.
    function onShow() as Void {
    }

    // Update the view
    function onUpdate(dc as Dc) as Void {
        // Get and show the current time
        var clockTime = System.getClockTime();
        var timeString = Lang.format("$1$:$2$", [clockTime.hour, clockTime.min.format("%02d")]);
        var view = View.findDrawableById("TimeLabel") as Text;
        var HelloWorldText = View.findDrawableById("HelloWorldLabel") as Text;
        HelloWorldText.setText("Hello World");
        view.setText(timeString);

        // Call the parent onUpdate function to redraw the layout
        View.onUpdate(dc);
    }

    // Called when this View is removed from the screen. Save the
    // state of this View here. This includes freeing resources from
    // memory.
    function onHide() as Void {
    }

    // The user has just looked at their watch. Timers and animations may be started here.
    function onExitSleep() as Void {
    }

    // Terminate any active timers and prepare for slow updates.
    function onEnterSleep() as Void {
    }

}

Note: I did not change anything else

Upvotes: -1

Views: 126

Answers (1)

hertzi
hertzi

Reputation: 2959

I think the only issue is the ' in your projects name Hacker'swatchface the rest of the code works for me.

Upvotes: 0

Related Questions