Label fmt_string
Label fmt_string
I seem to be having some difficulties with the string formatters. Is there a better description of the formatters that are supported?
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Label fmt_string
The String Format worked in the same way as the using of printf in C or C++
Please see here or here for more information (you will find x-thousend pages on the WEB)
Please see here or here for more information (you will find x-thousend pages on the WEB)
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: Label fmt_string
OK, thats how I thought it was based off of and I believe I have that correct.
Under the [VARIABLE] section, is there a better explanation of vartype and datatype?
For testing, I am just trying to display battery voltage.
This is what I have pertaining to that message, variable, and label:
All I get is 0.000000
(Changed by Admin - consulidate both post to one & format source code / ini file)
Under the [VARIABLE] section, is there a better explanation of vartype and datatype?
For testing, I am just trying to display battery voltage.
This is what I have pertaining to that message, variable, and label:
Code: Select all
// =======================================================================================================================
// Global Settings
// =======================================================================================================================
[global]
format=1
compress=0
messages=3
variables=3
labels=3
fonts=2
[font1]
font="century_16_18_numbers.fon"
name="Font1"
type=0
[font2]
font="Palatino_Linotype_24_28.fon"
name="Font2"
type=0
//-------------Messages-----------------------
[message1]
enable=1
name="EEC1"
canid=0x0CF00400
frametype=1
channel=0
timeout=0
[message2]
enable=1
name="CCVS1"
canid=0x18FEF100
frametype=1
channel=0
timeout=0
[message3]
enable=1
name="VEP1"
canid=0x18FEF700
frametype=1
channel=0
timeout=0
//----------------Variables---------------------
[variable1]
name="RPM"
messagename="EEC1"
position=32,16
byteorder=1
muxtype=0
muxval=0
scale=0.125
offset=0
vartype=2
datatype=2
[variable2]
name="SPEED"
messagename="CCVS1"
position=16,16
byteorder=1
muxtype=0
muxval=0
scale=0.00390625
offset=0
vartype=2
datatype=2
[variable3]
name="VOLTS"
messagename="VEP1"
position=40,16
byteorder=1
muxtype=0
muxval=0
scale=.05
offset=0
vartype=2
datatype=2
//-------------Labels----------------------
[label1]
position=10,10
name="label1"
font_name="Font2"
fmt_string="%4.1f RPM"
var_name="RPM"
length=10
initval="--- RPM"
fontcolor=255,0,0
bgcolor=0,0,0
update_rate=0
[label2]
position=10,40
name="label2"
font_name="Font2"
fmt_string="%4.1f KPH"
var_name="SPEED"
length=10
initval="--- KPH"
fontcolor=0,255,0
bgcolor=0,0,0
update_rate=0
[label3]
position=10,70
name="label3"
font_name="Font2"
fmt_string="%3.2f Volts"
var_name="VOLTS"
length=10
initval="--- VOLTS"
fontcolor=0,0,255
bgcolor=0,0,0
update_rate=0
All I get is 0.000000
(Changed by Admin - consulidate both post to one & format source code / ini file)
Re: Label fmt_string
Hello,
label3 is used to dispaly the voltage, and uses variable "VOLTS".
fmt_string="%3.2f Volts" indicates that the variable has to be float type.
Variable "VOLTS" has got vartype=2 which is float (correct)
datatype is also set to 2 (float) which means that the value on the CAN-Bus is a float value. A float-value on the CAN-bus is very unusual, usually unsigned or signed integer is used.
position=40,16 shows that on the CAN-Bus this is a 16bit value, and I would assume it is an integer value.
Please set datatype to 0 (unsigned) or 1 (signed), this depends on how the vaylue is transmitted.
Regards,
Gunnar Bohlen
label3 is used to dispaly the voltage, and uses variable "VOLTS".
fmt_string="%3.2f Volts" indicates that the variable has to be float type.
Variable "VOLTS" has got vartype=2 which is float (correct)
datatype is also set to 2 (float) which means that the value on the CAN-Bus is a float value. A float-value on the CAN-bus is very unusual, usually unsigned or signed integer is used.
position=40,16 shows that on the CAN-Bus this is a 16bit value, and I would assume it is an integer value.
Please set datatype to 0 (unsigned) or 1 (signed), this depends on how the vaylue is transmitted.
Regards,
Gunnar Bohlen