The code looks like that:
Nope, can't paste it here :(To get the same results for the Forerunner 935 and in the simulator, I need to remove / add Ui.requestUpdate() in the sleep function.
Nope, can't paste it here :(using Toybox.Application as App;
using Toybox.WatchUi as Ui;
using Toybox.Graphics as Gfx;
using Toybox.System as Sys;
using Toybox.Lang as Lang;
using Toybox.ActivityMonitor as Act;
using Toybox.Time.Gregorian as Calendar;
var active=0; // initialisieren (onUpdate)
var display=0; // initialisieren (onUpdate)
var hipower=0; // initialisieren (onUpdate)
class ClockMain extends Ui.WatchFace
{
function initialize() { WatchFace.initialize(); }
function onLayout(dc) { }
function onUpdate(dc)
{
Sys.println("[tock]");
// View.onUpdate(dc); // WHY THIS IS NEEDED?
dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_BLACK);
dc.clear();
if (active>0)
{
dc.setColor(0xffaaaa,-1);
dc.drawText(120,80,Gfx.FONT_LARGE,"HIGH POWER",Gfx.TEXT_JUSTIFY_CENTER);
dc.setColor(0xaaaaFF,-1);
dc.drawText(120,130,Gfx.FONT_LARGE,"SCREEN "+hipower,Gfx.TEXT_JUSTIFY_CENTER);
}
else
{
dc.setColor(0xaaaaaa,-1);
dc.drawText(120,80,Gfx.FONT_LARGE,"NORMAL MODE",Gfx.TEXT_JUSTIFY_CENTER);
dc.setColor(0xaaaaFF,-1);
dc.drawText(120,130,Gfx.FONT_LARGE,"DISPLAY TIME",Gfx.TEXT_JUSTIFY_CENTER);
}
dc.setColor(0xaaffaa,-1);
dc.drawText(80,180,Gfx.FONT_TINY,active,Gfx.TEXT_JUSTIFY_CENTER);
dc.drawText(160,180,Gfx.FONT_TINY,hipower,Gfx.TEXT_JUSTIFY_CENTER);
if (active==0) // one minute in low power, page 0
{ hipower=0; Sys.println("PAGE 0"); }
else if (active<0) // exit High-Power, prepare next page
{ active=0; hipower=(hipower+1)%3; Sys.println("NEXT PAGE "+hipower);}
else
{ active++; }
}
function onExitSleep() { active= 1; // active=1,2,...
Ui.requestUpdate(); Sys.println("SIMMODE"); // Simulator vs. Uhr
}
function onEnterSleep() { active=-1; // active=0
Ui.requestUpdate(); Sys.println("SIMMODE"); // Simulator vs. Uhr
}
}
class Init extends App.AppBase
{
function initialize() { AppBase.initialize(); }
function getInitialView() { return [new ClockMain()]; } // return initial view of the application
}