diff --git a/Source/v2/Meadow.CLI/Commands/Current/Uart/UartProfilerDisableCommand.cs b/Source/v2/Meadow.CLI/Commands/Current/Uart/UartProfilerDisableCommand.cs index 04c7bf0d..f43a1efe 100644 --- a/Source/v2/Meadow.CLI/Commands/Current/Uart/UartProfilerDisableCommand.cs +++ b/Source/v2/Meadow.CLI/Commands/Current/Uart/UartProfilerDisableCommand.cs @@ -19,13 +19,12 @@ protected override async ValueTask ExecuteCommand() return; } - connection.DeviceMessageReceived += (s, e) => - { - Logger?.LogInformation(e.message); - }; - - Logger?.LogInformation("Setting UART to application use..."); + Logger?.LogInformation("Disabling UART output for profiling data..."); await connection.Device.UartProfilerDisable(CancellationToken); + + Logger?.LogInformation("Reseting Meadow device..."); + + await connection.ResetDevice(); } } \ No newline at end of file diff --git a/Source/v2/Meadow.CLI/Commands/Current/Uart/UartProfilerEnableCommand.cs b/Source/v2/Meadow.CLI/Commands/Current/Uart/UartProfilerEnableCommand.cs index 0c3d3fa6..782bbce7 100644 --- a/Source/v2/Meadow.CLI/Commands/Current/Uart/UartProfilerEnableCommand.cs +++ b/Source/v2/Meadow.CLI/Commands/Current/Uart/UartProfilerEnableCommand.cs @@ -25,7 +25,6 @@ private void ReadAndSaveSerialData() // Define the equivalent header bytes sequence to the 32-bit representation of 0x4D505A01 // according to the Mono Profiler LOG_VERSION_MAJOR 3 LOG_VERSION_MINOR 0 LOG_DATA_VERSION 17 byte[] header = { 0x01, 0x5A, 0x50, 0x4D }; - byte[] buffer = new byte[header.Length]; int headerIndex = 0; string defaultDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); outputDirectory ??= defaultDirectory; @@ -53,7 +52,6 @@ private void ReadAndSaveSerialData() // Check if the received data matches the header sequence if (data == header[headerIndex]) { - buffer[headerIndex] = (byte)data; headerIndex++; // If the entire header sequence is found, start writing to a file if (headerIndex == header.Length) @@ -67,7 +65,6 @@ private void ReadAndSaveSerialData() writingToFile = true; totalBytesWritten += 4; headerIndex = 0; - buffer = new byte[header.Length]; headerFoundTimes++; } } @@ -104,7 +101,6 @@ private void ReadAndSaveSerialData() outputFile.WriteByte((byte)headerByte); } totalBytesWritten = 4; - buffer = new byte[header.Length]; } } else @@ -144,7 +140,7 @@ protected override async ValueTask ExecuteCommand() return; } - Logger?.LogInformation("Setting UART to output profiling data..."); + Logger?.LogInformation("Setting UART to only output profiling data..."); await connection.Device.UartProfilerEnable(CancellationToken); diff --git a/Source/v2/Meadow.Hcom/SerialRequests/RequestType.cs b/Source/v2/Meadow.Hcom/SerialRequests/RequestType.cs index 18844ec2..f8e83ff6 100644 --- a/Source/v2/Meadow.Hcom/SerialRequests/RequestType.cs +++ b/Source/v2/Meadow.Hcom/SerialRequests/RequestType.cs @@ -36,8 +36,8 @@ public enum RequestType : ushort HCOM_MDOW_REQUEST_MONO_FLASH = 0x19 | ProtocolType.HCOM_PROTOCOL_HEADER_ONLY_TYPE, HCOM_MDOW_REQUEST_SEND_TRACE_TO_UART = 0x1a | ProtocolType.HCOM_PROTOCOL_HEADER_ONLY_TYPE, HCOM_MDOW_REQUEST_NO_TRACE_TO_UART = 0x1b | ProtocolType.HCOM_PROTOCOL_HEADER_ONLY_TYPE, - HCOM_MDOW_REQUEST_SEND_PROFILER_TO_UART = 0x23 | ProtocolType.HCOM_PROTOCOL_HEADER_ONLY_TYPE, // TODO: Check if this is a good value - HCOM_MDOW_REQUEST_NO_PROFILER_TO_UART = 0x24 | ProtocolType.HCOM_PROTOCOL_HEADER_ONLY_TYPE, // TODO: Check if this is a good value + HCOM_MDOW_REQUEST_SEND_PROFILER_TO_UART = 0x23 | ProtocolType.HCOM_PROTOCOL_HEADER_ONLY_TYPE, + HCOM_MDOW_REQUEST_NO_PROFILER_TO_UART = 0x24 | ProtocolType.HCOM_PROTOCOL_HEADER_ONLY_TYPE, // >>> Breaking protocol change. // ToDo: This message is miscategorized should be ProtocolType.HCOM_PROTOCOL_HEADER_FILE_START_TYPE // like HCOM_MDOW_REQUEST_START_FILE_TRANSFER.