Originally Posted by
marcus_54
Thank you for your reply
I know the 3 fields that interest me:
voltageCell1
voltageCell2
current(A)
I tried to modify the script but a priori it does not seem to be correct
I exported this script under the name "Powerdrone.rro"
Please see if you could do something with it
Code:
if(DataValue > MaxValue)
I = DataValue;
u1=GetDataValue(voltageCell1);
u2=GetDataValue(voltageCell2);
//I=GetDataValue(current(A));
DisplayValue=((u1+u2)*i;
DisplayLabel = MaxLabel;
DisplayColor = HighColor;
DisplayValue = MaxValue;
DrawRect(0, 0, SizeX, SizeY, DisplayColor, Filled);
SetTextOutline(Invisible);
TextColor = ActiveColor;
DrawText(DisplayLabel + ":", OffsetX - 5, 0, TextColor, FontSize, AlignH_Right);
DrawText(FormatNumber(DisplayValue, Decimals) + " " + UnitLabel, OffsetX + 16, 0, TextColor, FontSize, AlignH_Left);
I'm not quite sure that I follow your logic here, but you're really close to getting the values. You need to use the GetDataIndex(DataFieldName) function first to get the index of your data column (preferably in the Background Script since that won't ever change); then you can pass that into the GetDataValue(DataFieldIndex) function to get the value in the current frame.
Background Script:
Code:
// Shows recent minimum and maximum extremes for the selected data channel// This display requires "Persistent Script Variables" to be enabled
// Options
DisplayLabel = "Puissance:";
UnitLabel = "W"; // May need to increase the object width for this (SizeX on the parameters tab)
Decimals = 1; // Number of decimal places
//OffsetX = 260;
OffsetX = SizeX / 2; // X coordinate where the split between label and number is centered
HighColor = ColorA;
ActiveColor = ColorB;
FontSize = SizeY * 0.90;
DefaultMaxValue = -999999999; // Lower than any expected data value
MaxValue = DefaultMaxValue;
VoltageCell1Index = GetDataIndex("voltageCell1");
VoltageCell2Index = GetDataIndex("voltageCell2");
Foreground Script:
Code:
if(DataValue > MaxValue) {
MaxValue = DataValue;
}
u1=GetDataValue(VoltageCell1Index);
u2=GetDataValue(VoltageCell2Index);
//I = DataValue; // Always display the exact value of the current?
I = MaxValue; // Always display whatever the maximum current was?
DisplayColor = HighColor;
DisplayValue=(u1+u2)*I;
DrawRect(0, 0, SizeX, SizeY, DisplayColor, Filled);
SetTextOutline(Invisible);
TextColor = ActiveColor;
DrawText(DisplayLabel, OffsetX - 5, 0, TextColor, FontSize, AlignH_Right);
DrawText(FormatNumber(DisplayValue, Decimals) + " " + UnitLabel, OffsetX + 16, 0, TextColor, FontSize, AlignH_Left);
PowerDrone.rro