LSC Smart Connect 806lm Multicolor LED bulb is incompatible with Tasmota

Smart lights without cloud services

In my search for some cheap wifi lightbulbs which I can flash with Tasmota to remove all cloud related firmware I came across the collection of LSC Smart Connect devices for sale at Action. I purchased the most normal looking bulb with RGB colors and a E27 fitting: https://www.action.com/nl-nl/p/lsc-smart-connect-slimme-multicolor-ledlamp-3/

LSC Smart Multicolor LED light

LSC Smart Connect RGB LED Bulb

  • Based on the Tuya Smart Platform
  • Smart RGB-light with E27-fitting.
  • Connect with wifi to control the light with the app.
  • Adjust brightness, color temperature and color. Choose any RGB color.

I did a little bit of research on the LSC Smart Connect family of devices and it seemed like the only devices that were not compatible with Tasmota are the remote control and smart siren. Even though this particular light is not present in the Tasmota supported devices list there is another RGB bulb that is supported.

My attempt

Once I got it I connected it with the LSC Smart Connect app which is a BIG no no! Apparently when you connect the light for the first time it might flash the firmware with a version that cannot be flashed to Tasmota easily. Anyway, after playing around with the app I tried to flash Tasmota on it with tuya-convert. I followed the instructions on the GitHub page but it kept getting stuck on Resending SmartConfig Packets. I figured maybe the firmware was already updated to an incompatible version, so I tried to open up the bulb and use a serial connector to flash the firmware directly.

After painstakingly opening up the bulb and slightly damaging it, I didn't find an ESP8266/ESP8285 but instead found a small board with a antenna that had WR3L printed on it. Turns out this is a different wifi module and is not supported by Tasmota.

Guess I have to continue my search for another LED bulb.
Fortunately I am able to use the cloud services in Home Assistant, so I can still use this smart light in my home automation.

References

XRDP with LXDE on Ubuntu Server 18.04

If you want to connect with Remote Desktop to your Ubuntu 18.04 Server, a good way to do so is by using XRDP. If you are like me and run a server with very little RAM you also want to use a Desktop Environment that uses as little memory as possible. LXDE is a very lightweight Desktop Environment, so I will be using that one.

Install required packages

First of all update the package lists with this command

sudo apt update

Then install LXDE

sudo apt install lxde
This might take a while as LXDE is quite big to install if you don’t already have a desktop environment installed.

Then install XRDP

sudo apt install xrdp

Configure XRDP to use LXDE

Open up /etc/xrdp/startwm.sh. I use the nano text editor here

sudo nano /etc/xrdp/startwm.sh

Then add this all the way at the end of the file

lxsession -s LXDE -e LXDE
Press ctrl+x, y and enter to save.

Disable GUI on boot

If you run a headless server you might want to disable booting into the graphical login screen, to make sure it does not use any extra memory. You can disable the GUI on boot this with this command.

sudo systemctl set-default multi-user.target

And use this command to enable it again if you want to.

 sudo systemctl set-default graphical.target
Disable the GUI if you run a headless server.

Connect with RDP

Open up Windows Remote Desktop Connection and enter the address of the computer you’re trying to connect to.

Enter the IP or name of the computer you are trying to connect to.

Connect and a screen will show where you need to enter your login credentials. Select Xorg from the list and enter your username and password, press OK and you should be seeing the LXDE desktop environment.

Enter your login details and press OK
Successfully connected!

Enable and change sandbox mode on Windows Phone 10

We had to test our Windows app Rocket Riot in sandbox mode to make sure in-app-purchases and such are working correctly, but on the internet it was impossible to find how to do this! So we mailed Microsoft and they helped us. First of all we had to update our phone to the latest version of Windows 10, so it's a new feature too!

Turn on Developer Mode and the Device Portal

First of all your phone needs to be in Developer Mode, and the Device Portal needs to be turned on. See this page for more info on that.

Set Device Portal to On

Set Device Portal to On

Log in to the Device Portal

Open a browser on your PC and go to the IP address displayed on the phone, in this case http://192.168.10.157/. You will see a web page with several menu options, choose Xbox Live on the bottom. You can also open this page on your phone by opening the browser and going to http://127.0.0.1/ or http://localhost/.

Enter your sandbox ID

Enter your sandbox ID

Set the Sandbox ID

Then press Change a thousand times (it gives me an error every time I do it), close some apps, and restart the phone. For some reason this was the only way to do it for me, clicking it once didn't work, and I had to restart the phone. After that the phone is in sandbox mode! Yay! If you want to turn off sandbox, set it to RETAIL.

Other stuff

You can also do other things in the Device Portal like

  1. Change settings
  2. Sideload apps by uploading them
  3. Kill running apps
  4. Browse files
  5. View processes
  6. View performance statistics
  7. ETW tracing
  8. Performance tracing
  9. View connected devices
  10. Connect to wifi networks and change wifi settings
  11. And of course change sandbox modes
Rocket Riot

Help us launch Rocket Riot

Soon we will be launching our beloved party shooter Rocket Riot (www.rocketriot.com) to Steam and Windows 10. We'd be immensely flattered if you could give us a hand and write a social media post about Rocket Riot on Nouncy. That way you allow us to control when your post is published, and thus amplifying the message.

As a token of gratitude, we'll do a sweepstake after the campaign and give away 10 Steam keys for Rocket Riot (PC) !

Help us here: http://codeglue.nouncy.com/rocketriot

Rocket Riot

Rocket Riot

See video here.

Thread is waiting for init_thread_header and init_thread_wait

The other day I ran into an issue where a thread got stuck on accessing a singleton. It was quite curious because there was no locking with mutexes or critical sections going on, yet the thread stalled. The callstack showed init_thread_header and init_thread_wait as the top most functions of the callstack, so the thread was definitely waiting for something... As it turns out, the constructor of the singleton class was calling some functions, which in turn would try to access the singleton again, this would of course result in an endless loop, depending on which implementation of singletons you use.
If you would instantiate the singleton with new, there would be an endless loop, and the stack would overflow. But if you used a static instance, the thread would simply stall at completion of the first loop, and Visual Studio would not complain, warn, or break.

Here is a simple example of how you can recreate this issue.

class MySingleton
{
public:
	static MySingleton& GetInstance()
	{
		static MySingleton instance;
		return instance;
	}

	MySingleton()
	{
		MySingleton::GetInstance(); // This is obviously bad
	}

	~MySingleton()
	{
	}
};

int main(void)
{
	MySingleton::GetInstance();
}

Of course the code I was working with was not so straightforward. So you would definitely have to look at the entire callstack to find the source of the problem.

Interesting issue, something to look out of in case your code stalls while accessing a singleton. But then again, we probably shouldn't be calling any functions in constructors anyway... 🙂

Unity blurry or fuzzy icons

Lately I have been using Unity and today when I ran the editor on my laptop I noticed that most of the icons were very fuzzy or blurry.

Example of blurry or fuzzy Unity editor icons

Example of blurry or fuzzy Unity editor icons

I tried to mess around with the quality settings in the Unity Editor itself, but that didn't to fix the problem, so I looked around on the internet and several people reported the same issue, only after updating their graphics drivers. I'm using a quite old laptop with two video cards in it (NVIDIA GT555M and Intel HD Graphics 3000), unfortunately the NVIDIA card died a while back so I can only use the slower Intel card. Because it's such a slow graphics chip I used to set all graphics settings to prefer performance over quality. So I checked to see if that may have caused the blurry icons. I opened the Intel Graphics control panel and set the 3D Preference slider from "Performance" to the middle setting.

Prefer performance setting

Prefer performance setting

Middle performance setting

Middle performance setting

After this, the icons were sharp again 🙂 So I guess the graphics settings were influencing the method in which the icons are rendered.

ARM NEON C++ Cheat Sheet

Newer ARM processors have their own flavor of SIMD instructions called NEON. In my little Android application Arashi, NEON is used a lot to speed up the simulation of particles.

Here is a table explaining some of the NEON functions that are used:

[table caption="C++ NEON functions" width="500" colwidth="20|100|50" colalign="left|left"]
NEON,Explanation,Pseudocode
vdupq_n_f32(a),New NEON value,a
vsubq_f32(a\, b),Subtract,a - b
vaddq_f32(a\, b),Add,a + b
vmulq_f32(a\, b),Multiply,a * b
vmlaq_f32(a\, b\, c),Multiply and add,a + (b * c)
vmlsq_f32(a\, b\, c),Multiply and subtract,a - (b * c)
vrsqrteq_f32(a),Reciprocal square root,1 / sqrt(a)
vcgtq_f32(a\, b),Compare greater than,a > b ? 1 : 0
vcltq_f32(a\, b),Compare less than,a < b ? 1 : 0
vbslq_f32(mask\, a\, b),Select by mask,mask != 0 ? a : b
vminq_f32(a\, b),Get minimum,a < b ? a : b
vmaxq_f32(a\, b),Get maximum,a > b ? a : b
[/table]

Compiling Unreal Tournament 4 from GitHub source

I am just writing down the steps I take to compile Unreal Tournament 4 from the GitHub source and mention any problems I encounter.

If you plan to use these steps as a guide on how to compile UT4 for yourself, I recommend reading through the steps first! I made some mistakes, so make sure you don't make the same mistakes 🙂

Prerequisites

  1. TortoiseGit https://code.google.com/p/tortoisegit/
  2. Visual Studio 2013
  3. A GitHub account associated with an Unreal Engine 4 account

Downloading the source

Use TortoiseGit to download all UT and UE4 sourcecode from https://github.com/EpicGames/UnrealTournament.git

Use right mouse button on a folder and choose "Git Clone...".

 

TortoiseGit

Log in with your GitHub username and password and it will start downloading.

TortoiseGit2

Download additional necessary binary content

Run [UnrealTournament\Setup.bat] to download necessary additional binary content.

SetupBat

 

SetupBat2

Compiling the Unreal Tournament project

  1. Open up [UnrealTournament\Engine\Source\Programs\UnrealSwarm\UnrealSwarm.sln] with Visual Studio 2013.
  2. Select "Development" as the Solution Configuration.
  3. Compile the whole solution, why not.UnrealSwarm
  4. Then you can close the solution.
  5. Run [UnrealTournament\GenerateProjectFiles.bat] to generate UE4.slnGenerateProjectFiles
  6. Open [UnrealTournament\UE4.sln] with Visual Studio 2013.
  7. Set the Solution Configuration to "Development Editor".DevEditor
  8. Build "ShaderCompileWorker" and "UnrealLightmass".ProjectsToCompile
  9. When that's done, compile the "UnrealTournament" project. This can take quite a while.
  10. After it is done compiling, rightclick the "UnrealTournament" project and select Debug > Start new instance.
  11. The UE4 editor will start.
  12. Press "Launch" to start Unreal Tournament. The first time this can take a long time.LaunchBtn
    1. This took like forever, only to be greeted by this error:Error
      LogPlayLevel: Running AutomationTool...
      LogPlayLevel: RunUAT.bat ERROR: Visual studio and/or AutomationTool.csproj was not found, nor was Engine\Binaries\DotNET\AutomationTool.exe. Can't run the automation tool.
    2. Apparently we also needed to compile this "AutomationTool"!
    3. Close the editor, and compile the "AutomationTool" project under "Programs".
    4. Once again, start the editor and press "Launch".
    5. Hurrah! More errors:Error2
      LogPlayLevel: Program.Main: ERROR: AutomationTool terminated with exception:
      LogPlayLevel: Program.Main: ERROR: Exception in AutomationTool: AutomationScripts.Automation.dll was not found or could not be loaded, can't run scripts.
      LogPlayLevel: Stacktrace: at AutomationTool.ScriptCompiler.LoadPreCompiledScriptAssemblies(List`1 OutScriptAssemblies) in d:\my_projects\UnrealTournament\Engine\Source\Programs\AutomationTool\ScriptCompiler.cs:line 256
      LogPlayLevel: at AutomationTool.ScriptCompiler.FindAndCompileAllScripts(List`1 AdditionalScriptsFolders) in d:\my_projects\UnrealTournament\Engine\Source\Programs\AutomationTool\ScriptCompiler.cs:line 87
      LogPlayLevel: at AutomationTool.Automation.Process(String[] CommandLine) in d:\my_projects\UnrealTournament\Engine\Source\Programs\AutomationTool\Automation.cs:line 324
      LogPlayLevel: at AutomationTool.Program.MainProc(Object Param) in d:\my_projects\UnrealTournament\Engine\Source\Programs\AutomationTool\Program.cs:line 168
      LogPlayLevel: at AutomationTool.InternalUtils.RunSingleInstance(MainProc Main, Object Param) in d:\my_projects\UnrealTournament\Engine\Source\Programs\AutomationTool\Utils.cs:line 705
      LogPlayLevel: at AutomationTool.Program.Main() in d:\my_projects\UnrealTournament\Engine\Source\Programs\AutomationTool\Program.cs:line 115
      LogPlayLevel: Program.Main: ERROR: AutomationScripts.Automation.dll was not found or could not be loaded, can't run scripts.
    6. Perhaps we also need to compile the "AutomationScripts.Automation" project.
    7. Close the editor, and compile ALL PROJECTS under Programs/Automation, just to be sure.
      Automation
    8. Again, start the editor and press "Launch".
    9. Now it starts compiling UnrealTournament from within the editor. Once more this will take a while...
    10. After a loooong time, I get this error! 🙁Error3
    11. I have no idea how to fix this error!
    12. I asked on the forums what the deal is: https://forums.unrealtournament.com/showthread.php?16535-UnrealTournament-exe-incompatible-with-64-bit-windows-(16-Bit-Application)
    13. Apparently you cannot start the game from within the editor (yet).
  13. To start the compiled UT4 game, in the UnrealTournament project, set Command Arguments under Debugging to "unrealtournament -game" and start debugging it! Again, rightclick the "UnrealTournament" project and select Debug > Start new instance.
  14. Hurrahh

References

  1. https://github.com/epicgames/unrealtournament
  2. https://wiki.unrealengine.com/Getting_Started_With_Unreal_Tournament#Building_the_Editor_and_Game
  3. https://code.google.com/p/tortoisegit/
  4. https://forums.unrealtournament.com/showthread.php?16535-UnrealTournament-exe-incompatible-with-64-bit-windows-(16-Bit-Application

 

Open source Skeletal Animation and Software Skinning

tl;dr I wrote a tiny open source skeletal animation and software skinning library for C++: https://github.com/FakeTruth/SkeletalAnimation

Why Skeletal Animations?

Animations can really bring life to projects, that's why for some projects I am working on I want to have skeletal animation. Looking around on the internet I could not really find an open source solution that did what I wanted. I was looking for something really simple.

ozz-animation

On my Google adventure I came across ozz-animation which I thought would do exactly what I was looking for. A complete package for animating skeletons and software skinning. There was a problem though. This library added tools to convert FBX files to skeletons and animations, and one tool to convert FBX files to a skinned mesh. The mesh however does not contain materials or texture coordinates or any other things you might be interested in, just vertices and normals. The source of the converters also seem really complicated so I was not sure how to add materials and texture coordinates to that. Instead I decided to roll out my own library, which may be useful to other people as well.

My own open source solution

As it turned out, it was really easy to write a library that handles skeletal animation and skinning. Following a simple tutorial that actually included skinning in vertex shaders I was able to write a library that does the skinning on the CPU.

Included in my library is also a converter that converts loaded Assimp scenes to models that can be animated, as well as (de)serialization functions to store and load these models on and from disk.

Why software skinning? Just for the sake of simplicity. I am not looking to animate models with millions of vertices, just simple models which can easily be skinned on the CPU. It is also easier to port to different platforms without worrying about shader languages.

It is really easy to load a model from Assimp:

void LoadModel()
{
    Assimp::Importer Importer;
    const aiScene* pScene = Importer.ReadFile("some_animated_model.fbx",
        aiProcess_LimitBoneWeights |
        aiProcess_Triangulate |
        aiProcess_JoinIdenticalVertices |
        aiProcess_SortByPType);

    AssimpConverter::Convert(pScene, g_AnimatedModel);
}

Then to make the model animate, just call the Update function:

void Update(float a_Dt) // a_Dt is the elapsed time since last frame in seconds
{
  g_AnimatedModel.Update(a_Dt);
}

Rendering the model is very straightforward because you have direct access to the model's vertices and normals. As an example here is one way how you could render the model with OpenGL.

void Render()
{
    for (unsigned int i = 0; i < g_AnimatedModel.GetNumMeshes(); ++i)
    {
        const SA::sAnimatedMesh& AnimMesh = g_AnimatedModel.GetMesh(i);

        glBegin(GL_TRIANGLES);
        for (unsigned int i = 0; i < AnimMesh.NumIndices; ++i)
        {
            unsigned int Index = AnimMesh.pIndices[i];
            glm::vec3 n = AnimMesh.pNormals[Index];
            glm::vec3 v = AnimMesh.pTransformedVertices[Index];

            glColor4f(n.x, n.y, n.z, 1);
            glVertex3f(v.x, v.y, v.z);
        }
        glEnd();
    }
}

The license I decided to go with is the MIT License, so why not check it out? https://github.com/FakeTruth/SkeletalAnimation

References

  1. https://code.google.com/p/ozz-animation/
  2. http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html
  3. http://assimp.sourceforge.net/

Qt 5.1.1 with OpenGL for Windows 32-bit Visual Studio 2012

In case you would like to use the latest version of Qt using OpenGL instead of ANGLE in combination with Visual Studio 2012 and target a 32-bit platform you will be disappointed to find out that there are no precompiled libraries available from the Qt-Project website...

Instead of using precompiled libraries you need to compile Qt yourself if you still want to use Qt with Visual Studio 2012.

Requirements

In order to compile Qt you first need a couple of prerequisites, be sure to get the 32-bit versions.

  1. Download and install Python http://www.python.org/getit/ (x86).
  2. Download and install Perl http://strawberryperl.com/ (32 bit).
  3. Download jom http://qt-project.org/wiki/jom.
  4. Download and extract the Qt sources from http://qt-project.org/downloads.
    • You need to find the zip for windows, it's below all the installer downloads.qtdownload
  5. Copy the jom contents to the Qt sources directory.
  6. Make sure python and perl are accessible everywhere from the commandline by testing "python --version" and "perl -v".qtcheck

Compiling the Qt sources

  1. Open the Visual Studio 2012 command prompt.
    • It should be located in Start > Microsoft Visual Studio 2012 > Visual Studio Tools > VS2012 x86 Native Tools Command Prompt.
    • Be sure you are opening the x86 version and not the x64 version!
  2. Navigate to the Qt sources directory by using "cd <directory here>".
  3. Type "configure -developer-build -opensource -opengl desktop -nomake examples -nomake tests"
    • It should ask you to accept the terms of the license.
    • Then it should start configuring the Qt sources for compilation, this will just take a minute.
  4. Finally type "jom" to compile Qt.
    • This can take a long time, around 30-60 minutes depending on how fast your computer is. It took me 50 minutes to compile...

Integrating Qt with Visual Studio 2012

After you compiled the Qt libraries you can install the Visual Studio 2012 Add-in for Qt to make life easier. You can get the Add-in from the downloads page under "Other downloads": http://qt-project.org/downloads.

In Visual Studio 2012 I pointed Qt to the qtbase directory in the Qt sources directory by going in the Qt Options. Qt5 > Qt Options. Add a new Qt version and select the qtbase directory, pick a suitable name and press OK. Use this Qt version in your project and you should be able to compile for 32-bit platforms.

References

  1. http://zulis.blogspot.nl/2013/03/compiling-qt-501-with-visual-studio-2012.html
  2. http://stackoverflow.com/questions/15826893/downloading-and-integrating-qt5-with-visual-studio-2012
  3. http://qt-project.org/downloads