From e0f85f63fb0230b39c0a3e8976e186f66085edfd Mon Sep 17 00:00:00 2001 From: rmackay9 Date: Mon, 19 Nov 2012 11:55:47 +0900 Subject: [PATCH] ArduCopter: performance monitoring - changed loop counters to uint16_t. Removed an unused items from dataflash logging of Performance. --- ArduCopter/Log.pde | 31 ++++++++++++++----------------- ArduCopter/perf_info.pde | 4 ++-- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/ArduCopter/Log.pde b/ArduCopter/Log.pde index d8105645a6..b9c53b7514 100644 --- a/ArduCopter/Log.pde +++ b/ArduCopter/Log.pde @@ -665,19 +665,18 @@ static void Log_Read_Iterm() } -// Write a performance monitoring packet. Total length : 9 bytes +// Write a performance monitoring packet. Total length : 11 bytes static void Log_Write_Performance() { DataFlash.WriteByte(HEAD_BYTE1); DataFlash.WriteByte(HEAD_BYTE2); DataFlash.WriteByte(LOG_PERFORMANCE_MSG); - DataFlash.WriteByte(0); //1 - DataFlash.WriteByte(ahrs.renorm_range_count); //2 - DataFlash.WriteByte(ahrs.renorm_blowup_count); //3 - DataFlash.WriteByte(gps_fix_count); //4 - DataFlash.WriteInt(perf_info_get_num_long_running()); //5 - number of long running loops - DataFlash.WriteLong(perf_info_get_num_loops()); //6 - total number of loops - DataFlash.WriteLong(perf_info_get_max_time()); //7 - time of longest running loop + DataFlash.WriteByte(ahrs.renorm_range_count); //1 + DataFlash.WriteByte(ahrs.renorm_blowup_count); //2 + DataFlash.WriteByte(gps_fix_count); //3 + DataFlash.WriteInt(perf_info_get_num_long_running()); //4 - number of long running loops + DataFlash.WriteInt(perf_info_get_num_loops()); //5 - total number of loops + DataFlash.WriteLong(perf_info_get_max_time()); //6 - time of longest running loop DataFlash.WriteByte(END_BYTE); } @@ -687,20 +686,18 @@ static void Log_Read_Performance() int8_t temp1 = DataFlash.ReadByte(); int8_t temp2 = DataFlash.ReadByte(); int8_t temp3 = DataFlash.ReadByte(); - int8_t temp4 = DataFlash.ReadByte(); + uint16_t temp4 = DataFlash.ReadInt(); uint16_t temp5 = DataFlash.ReadInt(); - uint32_t temp6 = DataFlash.ReadLong(); - uint32_t temp7 = DataFlash.ReadLong(); + uint32_t temp6 = DataFlash.ReadLong(); - // 1 2 3 4 5 6 7 - Serial.printf_P(PSTR("PM, %d, %d, %d, %d, %u, %lu, %lu\n"), + // 1 2 3 4 5 6 + Serial.printf_P(PSTR("PM, %d, %d, %d, %u, %u, %lu\n"), (int)temp1, (int)temp2, (int)temp3, - (int)temp4, - temp5, - temp6, - temp7); + (unsigned int)temp4, + (unsigned int)temp5, + (unsigned long)temp6); } // Write a command processing packet. Total length : 21 bytes diff --git a/ArduCopter/perf_info.pde b/ArduCopter/perf_info.pde index 3f3d98b125..b73231adf0 100644 --- a/ArduCopter/perf_info.pde +++ b/ArduCopter/perf_info.pde @@ -32,7 +32,7 @@ void perf_info_check_loop_time(uint32_t time_in_micros) } // perf_info_get_long_running_percentage - get number of long running loops as a percentage of the total number of loops -uint32_t perf_info_get_num_loops() +uint16_t perf_info_get_num_loops() { return perf_info_loop_count; } @@ -44,7 +44,7 @@ uint32_t perf_info_get_max_time() } // perf_info_get_num_long_running - get number of long running loops -uint32_t perf_info_get_num_long_running() +uint16_t perf_info_get_num_long_running() { return perf_info_long_running; } \ No newline at end of file