'Color Value From:' block notworking

AutomaxionAutomaxion Posts: 8
edited 2020-05-15 - 16:00:06 in Learn with BlocklyProp
Can anyone solve this problem?

I am using BlocklyProp Solo with a Propellor FLiP board. I re-installed BlocklyProp Launcher (BPL) so I assume the libraries are up to date (no way of knowing as the BPL has no version shown). My OLED is working with other blocks. I tried a simple program shown in .png file.

Basically, the 'color value from:' block does not work since if I change it to a 'Color [x]' where [x] is a square of actual color, it works and draws a square of the selected [x] color.

The code is shown as being:

// Libraries and Definitions #include "simpletools.h"
#include "ssd1331.h"
#include "colormath.h"

// Global Variables and Objects screen *oledc;



// Main Program int main() {
oledc = ssd1331_init(17, 6, 5, 3, 2, 96, 64);
fillRect(oledc, 0, 0, 96, 63, remapColor(0x NaN, "8R8G8B", "5R6G5B"));
}


When I tried to compile it I get:

Compile... Failed!
compiler messages Included libraries: ssd1331, simpletools, colormath
single.c: In function 'main':
single.c:14:44: error: invalid suffix "x" on integer constant
single.c:14:47: error: expected ')' before 'NaN'
single.c:14:47: error: too few arguments to function 'remapColor'
/opt/parallax/simple-libraries/Learn/Simple Libraries/Utility/libcolormath/colormath.h:86:5: note: declared here
undefined

Comments

  • VonSzarvasVonSzarvas Posts: 1,921
    edited 2020-05-15 - 17:02:57
    Looks like the Block has not generated the right code.

    As I think you spotted, this line has incorrect parameters : fillRect(oledc, 0, 0, 96, 63, remapColor(0x NaN, "8R8G8B", "5R6G5B"));

    Would you be able to attach the svg file of the blockly code to this thread, or email it to support@parallax.com if you cannot share publicly?

    With the svg the problem could be diagnosed really fast, and probably there will be a quick workaround whilst any fixes are implemented.


    As for the code versions, the online blockly compiler is always up-to-date. The launcher can be updated sometimes to help with serial port issues, but that wouldn't impact the code compiler.
    There was an update to launcher in the last couple days.... v0.11.2 is the latest as of today.
  • An issue has been filed on GitHub for this error. You can follow it here
  • Von,
    Yes I guessed the NaN was the problem (now I know it means 'not a number'. Call me ignorant: what is the svg please and where do I find it? How do I know what launcher I have and where are the latest versions downloadable. I did reinstall the launcher yesterday from (https://www.parallax.com/downloads/propeller-p8x32a-software) which is dated Jan 2020: annoyingly, the launcher screen does not have a version shown or any means to update.

    Jim,
    Thank-you. I did a lot more complex things to make a colour fade from one to another and was frustrated when I could not get it to compile and thought it was me. I am looking forward to a solution.

    Cheers both,
    Steve
  • The BlocklyProp Launcher version is in the logo near the bottom on the window. The recent versions of BlocklyProp Solo will detect the version of the Launcher once you load or create a project. Solo will offer up a new version when one becomes available.

    We should be able to get to the NaN issue early this next week. There isn't a lot that can go wrong there.
  • Jim,

    Ah, OK. I see the version number. Mine is v0.11.0 running on Windows 10.

    Thanks,
    Steve
  • Any progress Jim?
  • I posted an update on this issue here. The color value from block is not emitting the expected value for the OLED triangle block.
  • Thanks Jim.
    So for now it is a work around. How often do updates get issued?

    Steve
  • I tried your block-code exactly as you show (added the item) and it still does not work and still gives not a number:

    //
    Libraries and Definitions
    #include "simpletools.h"
    #include "colormath.h"
    #include "ssd1331.h"

    //
    Global Variables and Objects
    screen *oledc;
    int item;



    //
    Main Program
    int main() {
    oledc = ssd1331_init(17, 6, 5, 3, 2, 96, 64);
    item = (getColorRRGGBB(50, 50, 50));
    fillRect(oledc, 0, 0, 96, 63, remapColor(0x NaN, "8R8G8B", "5R6G5B"));
    }
Sign In or Register to comment.