From Panel - Decouple Signal Setting action from CAN Frame send action

Professional Windows® software to communicate with CAN and CAN FD busses and its add-ins: Plotter, CANdb Import, Instruments Panel, and J1939
Post Reply
mrwinter
Posts: 6
Joined: Thu 3. Aug 2023, 16:06

From Panel - Decouple Signal Setting action from CAN Frame send action

Post by mrwinter » Fri 4. Aug 2023, 15:06

Hello,
I am getting started with the instruments panel. I would like to use it for setting some CAN paramters on an end device, which I suppose would be the most basic application possible.
The CAN frame is made up of multiple variables(signal). ONE of these signals is set on a UI object (e.g. Slider) and the appropriate signal is linked to that object.
The problem I have, is that as soon as I adjust the widget (slider), a CAN message is sent with the new signal ... and whatever variables exist for the other 4 signals that happen to be in that message on the same CANID.

For example, if the instrumentation panel is just initialized, all 5 signals have the value '0'. Now I set one value to 150 via that Panel and automatically, a frame is sent to the end device with 150, and 4 zeros for the other signals.
...The end device explodes because zero was not a valid input.

Generally, I would like to decouple the action of setting a variable, from the action of sending a CAN frame.
I would like to ensure all variables in that CAN frame have values I want, before a CAN frame is sent.

Is there an obvious way, that I can set signals on the instrumentation panel WITHOUT sending a CAN frame?
Is there an obvious way to 'apply' new vaules to a CAN frame and send that can frame from a Panel button. (with an execution command)?

(P.S. I also don't wan to build my own frame in macro from a bunch of input numbers. The CAN frames structures are a mess and constructing CAN frames using sym files and input values is basically what I spent 1k on PCAN-Explorer for).

Thanks

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: From Panel - Decouple Signal Setting action from CAN Frame send action

Post by PEAK-Support » Fri 4. Aug 2023, 15:38

You have several Options to solve ypur "problem" but i recommend in your case to use for all Instrument Panel actors Virtual Signals and do the rest inside a script.
Then you have no fixed binding between the Values you change in the AddIn (user Panel) and real CAN Frames.
On the other side, every actor panel item have a "Actor" tab where you could set features like Use cycle time" , "Signal Feedback" etc.
When using for example Signal Feedback, every time you change the Slider a CAN Frame is send, if you switch of , the cycle time is used to send the latest value.
See User Panel Online Help it is well explained... search for "SignalFeedback Property" in the Online Help of the user Panel (Focus on User Panel - press F1)
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

mrwinter
Posts: 6
Joined: Thu 3. Aug 2023, 16:06

Re: From Panel - Decouple Signal Setting action from CAN Frame send action

Post by mrwinter » Tue 8. Aug 2023, 19:17

Thanks for the support Mr. Wilhelm.

The "Signal Feedback" property seems to effect the value displayed on the widget.
For example, if I deactivate "Signal Feedback" and change the signal on another widget, the displayed value is not updated. However when I change the widget without "Signal Feedback", the CAN frame still goes out.

If I change the "cycle time" to anything other than 0, then the whole CAN frame belonging to that signal goes out at that rate. So this setting is also not helpful, rather it sends more CAN frames that I am trying not to send.

==> So far no setting on the Intruments Panel to change a single signal without sending the corresponding CAN frame.


"Virtual Signals" don't seem to exist in the current symbol file version 6.0 (I would like not to regress to an older version).
Using the format 6.0 approach, I tried to create signals that are not assigned to any symbols. However if I do this, the signals are not available for selection on the instrumentation panel.

Creating some made up symbols or interfaces, just to prevent sending a whole CAN frame when I move a widget seems like a unnecessary hack for a very basic operation.

Is there another 6.0 equivalent for "Virtual Signals" in format 6.0 that will allow me to select and change those signals in the Instrumentation Panel without sending the whole CAN frame/symbol?

mrwinter
Posts: 6
Joined: Thu 3. Aug 2023, 16:06

Re: From Panel - Decouple Signal Setting action from CAN Frame send action

Post by mrwinter » Thu 10. Aug 2023, 18:40

Okay, so you can apply unassigned signals from the "Select Signal" menu. They appear under "All Signals", but not "CAN Signals"

There is acutally also a property of each signal "Auto-Transmit" ("automatically transmits the parent CAN symbol when the signal value is set"), which is basically what I was looking for orignially.

Now I have two methods for adjusting all signals of a given message individually, and preventing the whole CAN message going out before I am finished ... but now I need to send the completed CAN message.

What is a method of building and sending a message (aka symbol / CAN frame) in one command, from the existing signal values and sym file definitions?

(The command "send" is not useful, because it requires defining the data bytes. I want PeakCAN to construct the data bytes from existing signals and sym file, similar to the "Auto-Transmit" behaviour)

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: From Panel - Decouple Signal Setting action from CAN Frame send action

Post by PEAK-Support » Fri 11. Aug 2023, 10:16

As you want a solution that works asynchron (you use instead the original CAN based signal , virtual Signals) you need to run a main loop an copy the Signals of the Virtual Vars into the Signals of the CAN Vars.
To prevent here the same problem (setting a signal that is part of a CAN Frame , system will send out the CAN Frame) you need to add some additional code.

Here a sample - we have a real CAN Symbol with 2 Signals called MySendVar1 and MySendVar2
If we set the Property "AutoTransmit" of the first Signal to FALSE, it will not send the compete CAN Frame when we set the Value.
But when we set the second Signal (where the property is set to TRUE - default value) the CAN Frame is send.
If you want to use it in your system, you need to be sure that only the last Signal you set, of a CAN Frame have this Property set to true.

Code: Select all

Set sig_MySendVar1 = Signals("MySendVar1")
sig_MySendVar1.AutoTransmit = False ' Send only when 2nd Signal from thes Symbol is changed !
Set sig_MySendVar2 = Signals("MySendVar2")
sig_MySendVar2.AutoTransmit = TRUE ' Send when 2nd Signal from thes Symbol is changed !
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Post Reply