1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Junsi Powerlog utility: output data in CSV format, so that it is actually useful. Works great to make graphs.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@3044 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2011-03-17 18:12:08 +00:00 committed by edouard
parent 1e59cc79ec
commit 03a5e78897

View File

@ -59,6 +59,8 @@ enum
buf[0] = 2;
buf[1] = 0;
cout << "Interval,Current,Volt,Cap,Cell1,Cell2,Cell3,Cell4,Cell5,Cell6,RPM,Temp1,Temp2,Temp3,Temp4,Period,Pulse" << endl;
while (int received = hidHandle.receive(0, buf, BUF_LEN, 3500) ) {
ShowInf(buf);
}
@ -67,7 +69,7 @@ enum
void ShowInf(char *pBuf)
{
qDebug() << "--------------------";
// qDebug() << "--------------------";
POWERLOG_HID_PACK Inf;
int i;
int Count;
@ -80,7 +82,7 @@ enum
Count += sizeof(Inf.Type);
Inf.Interval = *((DWORD *)&pBuf[Count]);
printf("Interval:%ld\n",Inf.Interval);
printf("%ld,",Inf.Interval);
Count += sizeof(Inf.Interval);
@ -145,13 +147,15 @@ enum
Inf.Pulse = *((USHORT *)&pBuf[Count]);
Count += sizeof(Inf.Pulse);
GetShowValue(QString("Pulse:"),Inf.Pulse,6,0);
printf("\n");
}
}
void GetShowValue(QString label,DWORD Value,WORD Len,WORD Dot)
{
cout << label .toStdString() << " ";
//cout << label .toStdString() << " ";
if(Value<0)
{
@ -180,7 +184,7 @@ void GetShowValue(QString label,DWORD Value,WORD Len,WORD Dot)
else
printf("%ld",Value);
}
printf("\n");
printf(",");
}