Ham Radio - Icom PCR1000 FrontEnd

Oooops....

I forgot to include the "Dreaded CSS script" in the above instructions!!

Here it is:

[
    {
        "id": "c57d58e3a3d7d9ef",
        "type": "ui_template",
        "z": "68e5c71acc43e814",
        "g": "1501e67dfda50a42",
        "group": "62350f50d4b09ff8",
        "name": "Class=\"input-knob\" Style=\"knobwrapper\"",
        "order": 2,
        "width": 25,
        "height": 1,
        "format": "<script src=\"/js/input-knob.js\"></script>\n<style>.knobwrapper{\n        width:100%;\n        height:100%;\n        display:flex;\n        justify-content: center;\n        align-items: center;\n    }</style> ",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "global",
        "className": "",
        "x": 300,
        "y": 70,
        "wires": [
            []
        ]
    },
    {
        "id": "62350f50d4b09ff8",
        "type": "ui_group",
        "name": "Radio",
        "tab": "554e77d51ad13f2d",
        "order": 1,
        "disp": false,
        "width": "25",
        "collapse": false,
        "className": ""
    },
    {
        "id": "554e77d51ad13f2d",
        "type": "ui_tab",
        "name": "PCR1000",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

Your knob should now be fully visible... (In the cleanest, most innocent, non-dirtyminded tone!)

(Also added to the post above...)
Lol
Ed

Running on pi4

Added your css code. Not sure what to do with it so put it in a template node and set to add to site head section
No difference, sigh....
I'm thinking may be a laptop - pi difference thing

Hi G,

I might have posted it incorrectly... It should have brought in a template node automatically...

Try this:

[
    {
        "id": "c57d58e3a3d7d9ef",
        "type": "ui_template",
        "z": "68e5c71acc43e814",
        "g": "1501e67dfda50a42",
        "group": "62350f50d4b09ff8",
        "name": "Class=\"input-knob\" Style=\"knobwrapper\"",
        "order": 2,
        "width": 25,
        "height": 1,
        "format": "<script src=\"/js/input-knob.js\"></script>\n<style>.knobwrapper{\n        width:100%;\n        height:100%;\n        display:flex;\n        justify-content: center;\n        align-items: center;\n    }</style> ",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "global",
        "className": "",
        "x": 300,
        "y": 70,
        "wires": [
            []
        ]
    },
    {
        "id": "62350f50d4b09ff8",
        "type": "ui_group",
        "name": "Radio",
        "tab": "554e77d51ad13f2d",
        "order": 1,
        "disp": false,
        "width": "25",
        "collapse": false,
        "className": ""
    },
    {
        "id": "554e77d51ad13f2d",
        "type": "ui_tab",
        "name": "PCR1000",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

So, to recap
added dir node-red-static
added sub dir png and js under the static dir
put input-knob.js into js dir
put the image file into png dir
modified the settings.js file to add dir info
added css file
imported your flow

I managed to duplicate your problem:

by disabling my template for the knob...

E

(The template which I forgot to add previously in my howto)

ok, may have done the original css thing wrong. I did a copy paste into the node instead of importing your code. Imported code and it did create node. made a difference in image but still no knob

heartache

Ok... Progress..

If you click and drag on the "crappy not there" image, do you get any output from the node?

nope, nada

Ok... Stand by a mo... I am going to post in the next post hereafter, a new png, a new set of knob nodes as well as a copy of the css etc as well... These are the ones I have developed in the last day or 3 and I am using at the moment... (the js script, is unchanged... too much dark magic for me!)

Back soon!

Need to scoot off for now. Later today I'll try your new post.
Thanks for hanging in there with me

CSS Template:

[
    {
        "id": "c57d58e3a3d7d9ef",
        "type": "ui_template",
        "z": "68e5c71acc43e814",
        "g": "1501e67dfda50a42",
        "group": "62350f50d4b09ff8",
        "name": "Class=\"input-knob\" Style=\"knobwrapper\"",
        "order": 2,
        "width": 25,
        "height": 1,
        "format": "<script src=\"/js/input-knob.js\"></script>\n<style>.knobwrapper{\n        width:100%;\n        height:100%;\n        display:flex;\n        justify-content: center;\n        align-items: center;\n    }</style> ",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "global",
        "className": "",
        "x": 300,
        "y": 70,
        "wires": [
            []
        ]
    },
    {
        "id": "62350f50d4b09ff8",
        "type": "ui_group",
        "name": "Radio",
        "tab": "554e77d51ad13f2d",
        "order": 1,
        "disp": false,
        "width": "25",
        "collapse": false,
        "className": ""
    },
    {
        "id": "554e77d51ad13f2d",
        "type": "ui_tab",
        "name": "PCR1000",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

Tuner Nodes:

[
    {
        "id": "5cf139dd8d90b1ed",
        "type": "ui_template",
        "z": "68e5c71acc43e814",
        "g": "f2430a429a98d37b",
        "group": "62350f50d4b09ff8",
        "name": "Knob_Tuner",
        "order": 6,
        "width": 4,
        "height": 4,
        "format": "<div ng-init=\"init()\" class=\"knobwrapper\">\n<input type=\"range\" \nid=\"{{'knob_'+$id}}\" \nng-model=\"knobvalue\" \nclass=\"input-knob\" \ndata-width = \"192\"\ndata-height = \"192\"\nmin=\"-100\" \nmax=\"100\" \nstep=\".1\" \ndata-src = \"/png/Tuner_Black_1.png\" \ndata-sprites = \"500\"\nng-mousedown=\"send({payload: true})\"\nng-mouseup=\"send({payload: false})\"\n/>\n</div>\n<script>\n(function(scope) {\n   \n    \n    scope.inited = false \n    scope.init = function(){\n        if($(\"#knob_\"+scope.$id).length){\n            actuallyInit()            \n        }\n        else{\n            setTimeout(function(){\n                actuallyInit()\n            },100)\n        }\n    }\n    \n    function actuallyInit(){ \n        console.log(scope.$id,'actuallyInit()')\n        $(\"#knob_\"+scope.$id).closest(\"md-card\").css('padding','unset')\n        if(scope.initialvalue){            \n            scope.knobvalue = scope.initialvalue          \n        }\n        scope.inited = true\n    }\nscope.$watch('msg', function(msg) {\n        if (msg) {        \n            scope.incoming = true\n            scope.knobvalue = msg.payload\n            if(!scope.initialvalue){\n                scope.initialvalue = msg.payload\n            }        \n        }\n  });\nscope.$watch('knobvalue', function(knobvalue) {\n        if(!scope.inited){\n            return\n        }\n        if(scope.incoming){\n            scope.incoming = false\n            return\n        }\n        if (knobvalue) {\n            scope.send({payload:knobvalue})            \n        }\n    })\n       \n   \n})(scope);\n\n</script>",
        "storeOutMessages": true,
        "fwdInMessages": false,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 380,
        "y": 1560,
        "wires": [
            [
                "f63ac070cc0e322d",
                "b0b8326a641965e1",
                "4a0edc38bcec9f31"
            ]
        ]
    },
    {
        "id": "f63ac070cc0e322d",
        "type": "function",
        "z": "68e5c71acc43e814",
        "g": "f2430a429a98d37b",
        "name": "KnobReset",
        "func": "if (typeof msg.payload === \"boolean\"){\n    if(msg.payload==false){return[{payload: 0}]}\n}\nreturn",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 380,
        "y": 1600,
        "wires": [
            [
                "5cf139dd8d90b1ed"
            ]
        ]
    },
    {
        "id": "b0b8326a641965e1",
        "type": "function",
        "z": "68e5c71acc43e814",
        "g": "f2430a429a98d37b",
        "name": "+/- 1 or 10",
        "func": "if(msg.payload==false){\n    context.set(\"previous\",0)\n}if(msg.payload==true){\n    return\n}\n\nprevious = context.get(\"previous\")\nif(previous == msg.payload) {return}\nif(msg.payload>previous){\n    context.set(\"previous\",msg.payload)\n    if((msg.payload-3)>previous){return[{payload:+10}]}\n    return[{payload:+1}]\n}\nelse{\n    context.set(\"previous\",msg.payload)\n    if((msg.payload+3)<previous){return[{payload:-10}]}\n    return[{payload:-1}]\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 600,
        "y": 1520,
        "wires": [
            [
                "fd3b7f56a0f44bba"
            ]
        ]
    },
    {
        "id": "fd3b7f56a0f44bba",
        "type": "function",
        "z": "68e5c71acc43e814",
        "g": "f2430a429a98d37b",
        "name": "Step Updater",
        "func": "fullfreq = global.get(\"fullfreq\")\nstepsize = global.get(\"stepsize\")\nfullfreq = parseInt(fullfreq/stepsize)*stepsize\nfullfreq = fullfreq + msg.payload*stepsize\nglobal.set('fullfreq',fullfreq)\nmsg.payload = fullfreq/1000//(set in kc on tuner)\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 600,
        "y": 1560,
        "wires": [
            [
                "110c006d72b5bb2f",
                "3e3e97c772de26b8"
            ]
        ]
    },
    {
        "id": "4a0edc38bcec9f31",
        "type": "trigger",
        "z": "68e5c71acc43e814",
        "g": "f2430a429a98d37b",
        "name": "",
        "op1": "",
        "op2": "0",
        "op1type": "nul",
        "op2type": "num",
        "duration": "500",
        "extend": true,
        "overrideDelay": false,
        "units": "ms",
        "reset": "false",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 370,
        "y": 1520,
        "wires": [
            [
                "5cf139dd8d90b1ed",
                "b0b8326a641965e1"
            ]
        ]
    },
    {
        "id": "3e3e97c772de26b8",
        "type": "debug",
        "z": "68e5c71acc43e814",
        "g": "f2430a429a98d37b",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 600,
        "y": 1600,
        "wires": []
    },
    {
        "id": "62350f50d4b09ff8",
        "type": "ui_group",
        "name": "Radio",
        "tab": "554e77d51ad13f2d",
        "order": 1,
        "disp": false,
        "width": "25",
        "collapse": false,
        "className": ""
    },
    {
        "id": "554e77d51ad13f2d",
        "type": "ui_tab",
        "name": "PCR1000",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

Tuner Knob png:

Once the basic pre-req's are set up (As it appears to be on your side) this should just plug in and work... it gives a +1 or a -1 out of the debug indicating a tune up/down by one notch... On the dashboard layout, make it at least 4x4 tiles...

She's still drinking her coffee! Imported the new files and the entire picture went away. Went back to the first flow and get a weird picture but I do get out put when I click on the thingie. Still not sure I got the png file right.
I click on the image and it's a jpg file. I save to desktop open in paint and convert to png then load that to pi.

heartache2

heartache3

went out to website for knobs and made a new png file got this

maybe

so I'm getting closer, and as an added bonus I even get output

You are getting an output now as it should... Windoze/the forum is messing it up in the save I think....

Check how many frames it has in the png creator(knobman)...

This is what you will see if you open the template for the tuner knob:

screenshot-127.0.0.1_1880-2021.11.08-18_22_01

(Note the entry that says: "data-sprites" ... that is how many frames are expected for the animation... ie in this case, 500... Under knobman, if I remember, you then export 499 or 501 frames.... Either that, or set the knob template to 499/500/501/ or whatever number of frames you generated under knobman, plus or minus one...or equal to...)

managed to get to here

knobber

But when I try to spin knob it goes up and off screen or down and off screen. I do get output and am currently trying to suss out what is wrong. Note: different knob than you sent, this is the website downloaded one.
[EDIT] I still think it's a png file problem but not sure how to troubleshoot it However, never would have made it here without your help. Thanks bunches, I have been working on this off and on for literally months with no progress. I think I'm one small step away now. Again, thanks

Hi Gerry,

It is indeed a png file problem... As I mentioned Above:

100% sure!!

Well done so far!! Glad to help!!

Regds
Ed

Edit: A bit of a nudge in the KnobMan proggie:

Highlight preference ion the lhs pane... in the rhs pane, export option must be stitched frame and render frames must match what the number in "data sprites" is +1 or -1.... (play until you get a non vertically moving widget)...

Hi Y'all...

Another update... now 91% done and only 15 years to go...

Did some work on the "memory" channel store and retrieve:

Mouse scroll wheel changes the blue button between Red-Set/Read-blue - when clicking on the "set" option, Tuner, as set currently, mode/bandwidth/frequency are stored into a non volatile memory...

To enter a frequency directly, use VFO(0) entry area...

Time to go play with the VNA that just arrived....

Regds
Ed

Just to let you know, got the whole knob thing working. PNG file issues. Thanks for all your help.

1 Like

AWesome!!!!!!!