Category Archives: New Stuff

News about site and in general

Full control of your Limitless LED/Milight bulbs from Amazon Echo

Limitless LED Limitless LED offers full color RGBW light bulbs that you can control over Wi-Fi/4G from your computer, phone or smartwatch. They’re an inexpensive alternative to Philips Hue and they look really cool.
But I, being lazy ass that I am, was wondering if you can control the lights from Amazon Echo by voice commands alone. Out of the box Echo and Limitless LED don’t recognize each other. Amazon can see and control Hue, but not Limitless LED. Fortunately geniuses of BWS Systems came up with a really cool piece of software – home automation bridge “HA-Bridge”. It’s free and written in Java so it can run pretty much in any environment under any OS. What it does – it emulates Philips Hue API so other devices on your network – like Echo – can see and interact with it. Continue reading →

Pebbles, rectangles and stack overflow

UntitledWhile working on my Pebble watchface “Future Time” I have encountered persistent annoying problem – watchface would run for a while and then crash – and not only crash, but actually restart the watch. What made this even more frustrating – after 3 restarts in a row Pebble would revert to recovery mode and complete firmware reinstall was required (did I accidentally write a Pebble virus?).
When I dug into device logs I found out that every restart was given reason: “Dangerous Stack Overflow”. Which is kinda strange – I don’t have any recursions nor deeply nested function calls nor large local variables. I tried lots of things – including extreme ones like declaring all local function variables as global or static – nothing helped.
Finally Christian form Pebble developers forum shed a light. He pointed out that I use a lot of GRect constructs which is basic rectangle building block for pretty much anything from defining layers to graphics functions. I used GRect inline directly inside function calls, which I thought wasn’t a big deal, after all “everybody does that” – including Pebble in its examples. Well, as Christian pointed out those GRects are kind of local variables, and either memory is not reclaimed fast enough when they go out of scope or they spring memory leak.
Keeping this in mind I created a global GRect variable and when needed to use a GRect in local function, first I’d assign it’s value to the variable and then use variable in the function.
So something like this:

static void layer_update(Layer *layer, GContext *ctx) {
   //...
   graphics_draw_rect(ctx, GRect(10, 10, 30, 30));
   //...
   graphics_draw_bitmap_in_rect(ctx, bitmap, GRect(20, 20, 40, 40));
}

Becomes thus:

GRect temp_rect;

static void layer_update(Layer *layer, GContext *ctx) {
   //...
   temp_rect = GRect(10, 10, 30, 30);
   graphics_draw_rect(ctx, temp_rect);
   //...
   temp_rect = GRect(20, 20, 40, 40);
   graphics_draw_bitmap_in_rect(ctx, bitmap, temp_rect);
}

That’s it. This simple change cured the plague, no more crashes, restarts or recovery – just smooth sailing.

Fire on High or Framebuffer in Rocky.js

First things first. DISCLAMER: Everything described here is a hack upon a crude hack and most likely, barring a divine intervention, won’t work in final product. And I apologize in advance to Pebble dev team if my attempts at “hacking” seem silly. Now to business. Pebble SDK offers very cool framebuffer API that allows developers to address display memory of the watch directly. This makes possible creation of many cool special effects (matter of fact EffectLayer library uses framebuffer extensively).
Rocky.js is JavaScript incarnation of Pebble SDK and it made me wonder whether it offers framebuffer access. Turned out it is hidden, but it’s there. At least at the latest commit at the time of this article it is. If you take a look at source file html-bindings.js you will see that binding function looks something like this:

Rocky.bindCanvas = function(canvas, options) {
  
  //...
   
  var framebufferPixels = new Uint8Array(module.HEAPU8.buffer,
                                         framebufferPixelPTR,
                                         canvasW * canvasH);

  //...

  var binding = {
  
  //...

  }

  //...

  return binding;
};

Continue reading →

Persistent configs in Rocky.js watchfaces

Rocky.JS is the first step in Pebble journey to run JavaScript directly on the watches (unlike Pebble.JS which runs on your phone). Previously I described how to convert a simple watchface from C to Rocky.js. But that was a static watchface with unchangeable settings.

Here I will show how to create a configurable watchface in Rocky.js similarly how classic SDK faces can be configured. You will be able to reuse your existing config page – and if it was set to work with Pebble emulator as well as real watch – you will reuse it without any changes at all.

First let’s review how classic Pebble SDK calls config page. In PKJS (JavaScript) portion of Pebble code usually there’s a piece like this:

Pebble.addEventListener("showConfiguration",
  function(e) {
    Pebble.openURL("http://my.cool.server/pebble/my_cool_config.html");
  }
);

If user requests config of face/app – this event fires and opens page with configurable options from specified URL. After user modifies settings usually “Save” button is clicked on that page and code similar to this executes:

$('#xbtnSave').click(function () {
   var location = (decodeURIComponent(getURLVariable('return_to')) || 
                   "pebblejs://close#") + 
                   encodeURIComponent(JSON.stringify(settings));
   document.location = location;
})

Here, first we determine which location to redirect config page to. If parameter "return_to” is passed in query string (here custom function getURLVariable() is used to extract individual parameters – look it up), so if this parameter is passed – it means config page is called form the emulator and we use it for redirection. Otherwise we use standard "pebblejs://close#" URL to save settings into real watch. We also take settings object which has our collective options combined, convert it to string and add to the URL as a parameter. Page then is redirected to resulting URL and Pebble emulator or real watch takes care of processing parameters.

So, how can we (re)use it in a Rocky.js watchface? Continue reading →

Rocky.js – Pebble watch coding in JavaScript

Pebble never ceases to amaze. And every time you think – this is it, they reached the pinnacle of awesomeness – they surprise you again. This time they did pretty much the impossible – ported their C SDK to JavaScript, by creating Rocky.JS project. Ultimate goal is to run JS directly on the watch hardware – this will open way to huge number of new developers who hesitate to dive into depth of C. Meanwhile it provides ability to run Pebble code directly in a browser! It’s a lot of fun and as a bonus you can insert Pebble watchfaces directly into your website as evident by living watchface you see here.
Watchface you see running above is called Meyer Object it’s been available for Pebble watch for a while and I decided to port it to Rocky.JS Continue reading →

Restore natural picture look on Samsung smart TV

I really like my new smart TV from Samsung it has tons of bells and whistles. But one thing I noticed – no matter what I watch – series or movies, streaming or broadcast – picture has a “teleplay” feeling – like the action is happening on stage in the theater. If you recall what later Twilight Zone episodes look like you’d know what I am talking about. Maybe it’s supposed to look like this, but I like “film” feeling more. So I found a setting that restores natural picture look:

CYMERA_20160202_215011
Go to your TV menu, then select Picture -> Picture Options -> Auto Motion Plus and turn it off.

Fix Roku problem connecting to 802.11ac 5Ghz WiFi

I recently got a Roku 4 – at the time of this post the latest and greatest streaming players from Roku family. It comes with many bells and whistles – including ability to connect to 5Ghz WiFi networks. But for the life of me – it could not connect to mine. Player was seeing the SSID of the network, able to connect to wireless, but chocked on joining to LAN. Extensive chat with support lead nowhere – they wanted me to change WAN DNS and many other hoops that achieved nothing. For the record – my router is a dual-band one, and Roku had no problems connecting to 2.4Ghz band. But Internet speed falls dramatically over 2.4Ghz connection and I needed 5Ghz.

Finally I found one thing that worked.
AC Network
AC connection has 3 bandwidth modes: 20Mhz, 40Mhz, and 80Mhz. My router was set to 80Mhz to take full advantage of 1300 speed. None of my devices had problem with this (including, I might add, my previous Roku 3 player). But apparently Roku 4 couldn’t handle it. But as soon as I switched bandwidth to 40Mhz – boom, instant connection.

Streaming doesn’t suffer from this change, but it does lower LAN speed, so I’d like alternative solution from Roku if possible. Is this a known issue? Would an update fix it?


UPDATE 2016-02-01: Found a better workaround with the help of this awesome device.
Bridge
WUMC710 is a bridge between 4 Gigabit Ethernet connections and full 802.11ac WiFi. And it has no problem with 80Mhz channel. So I basically tell Roku it has a wired connection (and it does to the bridge) and the bridge has beautiful wireless connection to my router. You can grab the WUMC710 pretty cheap (I got mine for $10) and besides not having to slowdown your main network it makes actual Roku internet Speed much faster. Shame Roku’s own WiFi is not on par, but hopefully it will catch on

Solved: Issue with Pebble framebuffer after notification is dismissed

Effect Layer Issue I’ve encountered a weird issue while working with EffectLayer Library (a visual effect library for Pebble smartwatch). In this particular watchface called Clean & Smart I used “invert” effect which inverts colors of the watchface should the user choose that option in settings. It was working fine when option changed when watchface was loaded/unload and behaved weirdly only in one particular scenario: when you would receive a notification (email, text etc.) and then dismiss it. Upon coming back from notification to watchface invert effect would only partially cover the watchface (as seen on the screenshot).
I don’t know exactly what was happening, but had a theory. Continue reading →

How to make your Pebble smartwatch really tick

“Tick tock, goes the clock, And Now what shall we play?”.

Pebble smartwatch is an amazing piece of hardware with no less amazing software to support it. Pebble appstore boasts huge variety of watchfaces from intricately carved art pieces to simplicity personified. And the apps, my gods the apps! You want to track your sleep, count swimming stokes, automate your home – Pebble can do all those things and more. But something was missing. Something that ordinary mechanical clocks could do since the dawn of time.

Tick tock, goes the clock, And then what shall we see?
Continue reading →

Solution: Windows 10: Unable to start Appstore apps

Ok, I went ahead and upgraded to Windows 10. everything went smoothly, all my settings and installed apps preserved and work without a hitch. I am loving the interface and getting along with Cortana pretty good.

But after a while I encountered a weird issue: Appstore installed apps – e.g. Calendar, Mail etc. even Windows AppStore itself wouldn’t launch. I’d either get a cryptic error message, something along the lines “Application did not start, please contact system administrator” or very briefly a window would appear and immediately closed.

Looking into Event log was a bit more explanatory, but not too much: “Microsoft.WindowsStore_8wekyb3d8bbwe!App failed with error: Access is denied. See the Microsoft-Windows-TWinUI/Operational log for additional information.

If you google it – you will find many possible explanations of the problem and many possible ways to solve it offered, but none of those worked for me. Finally I figured it out (and Event Log entry gave me a clue): C:\Program Files\WindowsApps folder was missing necessary permissions:

WindowsApps

Namely, “ALL APPLICATION PACKAGES” was missing read & execute permissions on that folder (had to to uncheck “Hide protected operating system files” in Control Panel, File Explorer options to be able to see it). Once I added correct permissions – appstore apps started launching with no problems.