I'm new to Pebble programming and trying to write code that displays a count down window (like counting 5...4...3...2...1...), but when I run the code below, all I get is a blank screen for 5 seconds before a 0 appears. So the system ran the code without updating the window.
while (CountDownTime > 0){
CountDownTime--;
snprintf(countdown_text, sizeof(countdown_text), "%i", CountDownTime);
text_layer_set_text(countdown_time_layer, countdown_text);
layer_mark_dirty(window_layer);
psleep(1000);
}
Is there something else I need to do in order for the intermittent countdown layers to appear? I don't need to animate the layers, I just want the number to change. Is there a way other than "layer_mark_dirty" to force a re-draw?
SDK docs mention that
psleepis a blocking call that is to be avoided as much as possible. In your code, nothing is happening during that call.