Added LOG_PID_MSG to log.pde

git-svn-id: https://arducopter.googlecode.com/svn/trunk@650 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
jjulio1234 2010-10-11 12:25:26 +00:00
parent 018e8efc00
commit dc13c7320a
1 changed files with 35 additions and 1 deletions

View File

@ -50,6 +50,7 @@ TODO:
#define LOG_RAW_MSG 0x07
#define LOG_RADIO_MSG 0x08
#define LOG_SENSOR_MSG 0x09
#define LOG_PID_MSG 0x0A
// Function to display available logs and solicit action from the user.
@ -159,6 +160,20 @@ void Log_Write_Sensor(int s1, int s2, int s3,int s4, int s5, int s6, int s7)
}
#endif
// Write a PID control info
void Log_Write_PID(byte num_PID, int P, int I,int D, int output)
{
DataFlash.WriteByte(HEAD_BYTE1);
DataFlash.WriteByte(HEAD_BYTE2);
DataFlash.WriteByte(LOG_PID_MSG);
DataFlash.WriteByte(num_PID);
DataFlash.WriteInt(P);
DataFlash.WriteInt(I);
DataFlash.WriteInt(D);
DataFlash.WriteInt(output);
DataFlash.WriteByte(END_BYTE);
}
#if LOG_PM
// Write a performance monitoring packet. Total length : 19 bytes
void Log_Write_Performance()
@ -334,6 +349,22 @@ void Log_Read_Attitude()
Serial.println();
}
// Read a Sensor raw data packet
void Log_Read_PID()
{
Serial.print("PID:");
Serial.print((int)DataFlash.ReadByte()); // NUM_PID
Serial.print(",");
Serial.print(DataFlash.ReadInt()); // P
Serial.print(",");
Serial.print(DataFlash.ReadInt()); // I
Serial.print(",");
Serial.print(DataFlash.ReadInt()); // D
Serial.print(",");
Serial.print(DataFlash.ReadInt()); // output
Serial.println();
}
// Read a mode packet
void Log_Read_Mode()
{
@ -477,6 +508,9 @@ void Log_Read(int start_page, int end_page)
}else if(data==LOG_RAW_MSG){
Log_Read_Raw();
log_step++;
}else if(data==LOG_PID_MSG){
Log_Read_PID();
log_step++;
}else {
if(data==LOG_GPS_MSG){
Log_Read_GPS();
@ -513,4 +547,4 @@ void Log_Read(int start_page, int end_page)
digitalWrite(A_LED_PIN,HIGH);
}