diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 4a6ba09a..0d494e22 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,7 +1,10 @@ name: Meadow.CLI env: - TOOLS_RELEASE_VERSION: 1.0.2.2 + TOOLS_RELEASE_VERSION: 1.0.4.0 + SHORT_TOOLS_RELEASE_VERSION: 1.0.4 MEADOW_OS_VERSION: 1.0.2.0 + VS_MAC_2019_VERSION: 8.10 + VS_MAC_2022_VERSION: 17.5 on: push: @@ -33,7 +36,7 @@ jobs: - name: Setup NuGet uses: NuGet/setup-nuget@v1.0.5 - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.event_name == 'workflow_dispatch' }} name: Update CLI Version Numbers run: | $content = Get-Content main/Meadow.CLI/Meadow.CLI.csproj | Out-String @@ -68,7 +71,7 @@ jobs: - name: Upload nuget Artifacts for internal testing uses: actions/upload-artifact@v2 with: - name: Meadow.CLI.nuget + name: Meadow.CLI.nuget.${{ ENV.TOOLS_RELEASE_VERSION }} path: 'main\**\Meadow.CLI\bin\Release\*.nupkg' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} @@ -117,11 +120,11 @@ jobs: - name: Add MSBuild to Path uses: microsoft/setup-msbuild@v1.1 - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.event_name == 'workflow_dispatch' }} name: Update VS2019 Version Numbers run: | $content = Get-Content vs-win/VS_Meadow_Extension/VS_Meadow_Extension.2019/source.extension.vsixmanifest | Out-String - $newcontent = $content -replace 'Version="0.*" Language="en-US" Publisher="Wilderness Labs"', 'Version="${{ ENV.TOOLS_RELEASE_VERSION }}" Language="en-US" Publisher="Wilderness Labs"' + $newcontent = $content -replace 'Version="1.*" Language="en-US" Publisher="Wilderness Labs"', 'Version="${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}" Language="en-US" Publisher="Wilderness Labs"' $newcontent | Set-Content vs-win/VS_Meadow_Extension/VS_Meadow_Extension.2019/source.extension.vsixmanifest - name: Restore VS2019 dependencies @@ -136,7 +139,7 @@ jobs: - name: Upload VS2019 VSIX Artifacts uses: actions/upload-artifact@v2 with: - name: Meadow.Win.VS2019.vsix + name: Meadow.Win.VS2019.vsix.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} path: 'vs-win\VS_Meadow_Extension\VS_Meadow_Extension.2019\bin\Release\*.vsix' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} @@ -186,11 +189,11 @@ jobs: with: vs-version: '[17.0, 18.0)' - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.event_name == 'workflow_dispatch' }} name: Update VS2022 Version Numbers run: | $content = Get-Content vs-win/VS_Meadow_Extension/VS_Meadow_Extension.2022/source.extension.vsixmanifest | Out-String - $newcontent = $content -replace 'Version="0.*" Language="en-US" Publisher="Wilderness Labs"', 'Version="${{ ENV.TOOLS_RELEASE_VERSION }}" Language="en-US" Publisher="Wilderness Labs"' + $newcontent = $content -replace 'Version="1.*" Language="en-US" Publisher="Wilderness Labs"', 'Version="${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}" Language="en-US" Publisher="Wilderness Labs"' $newcontent | Set-Content vs-win/VS_Meadow_Extension/VS_Meadow_Extension.2022/source.extension.vsixmanifest - name: Restore VS2022 dependencies @@ -204,7 +207,7 @@ jobs: - name: Upload VS2022 VSIX Artifacts uses: actions/upload-artifact@v2 with: - name: Meadow.Win.VS2022.vsix + name: Meadow.Win.VS2022.vsix.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} path: 'vs-win\VS_Meadow_Extension\VS_Meadow_Extension.2022\bin\Release\*.vsix' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} @@ -260,10 +263,10 @@ jobs: mv "/Applications/Visual Studio.app" "/Applications/Visual Studio 2022.app" mv "/Applications/Visual Studio 2019.app" "/Applications/Visual Studio.app" - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.event_name == 'workflow_dispatch' }} name: Update VS2019 Version Numbers run: | - sed -i "" "s/Version = \"0.*\"/Version = \"${{ENV.TOOLS_RELEASE_VERSION}}\"/" vs-mac/VS4Mac_Meadow_Extension/Properties/AddinInfo.cs + sed -i "" "s/Version = \"1.*\"/Version = \"${{ENV.SHORT_TOOLS_RELEASE_VERSION}}\"/" vs-mac/VS4Mac_Meadow_Extension/Properties/AddinInfo.cs - name: Restore our VS2019 project run: | @@ -276,7 +279,7 @@ jobs: - name: Upload Mac VS2019 mpack Artifacts uses: actions/upload-artifact@v2 with: - name: Meadow.Mac.2019.mpack + name: Meadow.Mac.2019.mpack.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} path: 'vs-mac/VS4Mac_Meadow_Extension/bin/Release/net472/*.mpack' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} @@ -313,8 +316,8 @@ jobs: with: owner: WildernessLabs repo: VS_Mac_Meadow_Extension - tag_name: v${{ ENV.TOOLS_RELEASE_VERSION }}.VS2019 - release_name: VS Mac VS2019 Extension v${{ ENV.TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }} + tag_name: v${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}-vsm${{ ENV.VS_MAC_2019_VERSION }} + release_name: VS Mac VS2019 Extension v${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }} body: | ${{ steps.commit_messages.outputs.result }} draft: true @@ -323,13 +326,13 @@ jobs: # - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} #- name: Upload Release Asset - # uses: actions/upload-release-asset@v1.0.2 + # uses: actions/upload-release-asset@v1.0.4 # env: # GITHUB_TOKEN: ${{ secrets.MEADOW_MAC_TOKEN }} # with: # upload_url: ${{ steps.create_release.outputs.upload_url }} # asset_path: vs-mac/VS4Mac_Meadow_Extension/bin/Release/net472/*.mpack - # asset_name: Meadow.Mac.2019.mpack + # asset_name: Meadow.Mac.2019.mpack.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} # asset_content_type: application/zip build-vsmac-2022: @@ -368,10 +371,10 @@ jobs: - name: Setup NuGet uses: NuGet/setup-nuget@v1.0.5 - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.event_name == 'workflow_dispatch' }} name: Update VS2022 Version Numbers run: | - sed -i "" "s/Version = \"0.*\"/Version = \"${{ ENV.TOOLS_RELEASE_VERSION }}\"/" vs-mac/VS4Mac_Meadow_Extension/Properties/AddinInfo.2022.cs + sed -i "" "s/Version = \"1.*\"/Version = \"${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}\"/" vs-mac/VS4Mac_Meadow_Extension/Properties/AddinInfo.2022.cs - name: Restore our VS2022 project run: | @@ -384,7 +387,7 @@ jobs: - name: Upload VS2022 mpack Artifacts uses: actions/upload-artifact@v2 with: - name: Meadow.Mac.2022.mpack + name: Meadow.Mac.2022.mpack.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} path: 'vs-mac/VS4Mac_Meadow_Extension/bin/Release/net7.0/*.mpack' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} @@ -421,8 +424,8 @@ jobs: with: owner: WildernessLabs repo: VS_Mac_Meadow_Extension - tag_name: v${{ ENV.TOOLS_RELEASE_VERSION }}.VS2022 - release_name: VS Mac VS2022 Extension v${{ ENV.TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }} + tag_name: v${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}-vsm${{ ENV.VS_MAC_2022_VERSION }} + release_name: VS Mac VS2022 Extension v${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }} body: | ${{ steps.commit_messages.outputs.result }} draft: true @@ -431,13 +434,13 @@ jobs: # - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} #- name: Upload Release Asset - # uses: actions/upload-release-asset@v1.0.2 + # uses: actions/upload-release-asset@v1.0.4 # env: # GITHUB_TOKEN: ${{ secrets.MEADOW_MAC_TOKEN }} # with: # upload_url: ${{ steps.create_release.outputs.upload_url }} # asset_path: vs-mac/VS4Mac_Meadow_Extension/bin/Release/net7.0/*.mpack - # asset_name: Meadow.Mac.2022.mpack + # asset_name: Meadow.Mac.2022.mpack.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} # asset_content_type: application/zip build-vscode: @@ -478,10 +481,10 @@ jobs: - name: Setup Nuget uses: Nuget/setup-nuget@v1.0.5 - - name: Setup Node.js 14 + - name: Setup Node.js 16 uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '16' - name: Install NPM run: | @@ -496,11 +499,11 @@ jobs: - name: Add MSBuild to Path uses: microsoft/setup-msbuild@v1.1 - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.event_name == 'workflow_dispatch' }} name: Update VSCode Version Numbers run: | $content = Get-Content vs-code/package.json | Out-String - $newcontent = $content -replace '"version": "0.*",', '"version": "${{ENV.TOOLS_RELEASE_VERSION}}",' + $newcontent = $content -replace '"version": "1.*",', '"version": "${{ENV.SHORT_TOOLS_RELEASE_VERSION}}",' $newcontent | Set-Content vs-code/package.json - name: Restore VSCode Extension dependencies @@ -532,7 +535,7 @@ jobs: - name: Upload VSIX Artifacts uses: actions/upload-artifact@v2 with: - name: Meadow.VSCode.vsix + name: Meadow.VSCode.vsix.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} path: 'vs-code/*.vsix' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} diff --git a/Meadow.CLI.Core/Constants.cs b/Meadow.CLI.Core/Constants.cs index d5c87d4d..aad2ff3e 100644 --- a/Meadow.CLI.Core/Constants.cs +++ b/Meadow.CLI.Core/Constants.cs @@ -7,7 +7,7 @@ namespace Meadow.CLI.Core { public static class Constants { - public const string CLI_VERSION = "1.0.2.2"; + public const string CLI_VERSION = "1.0.4.0"; public const ushort HCOM_PROTOCOL_PREVIOUS_VERSION_NUMBER = 0x0006; public const ushort HCOM_PROTOCOL_CURRENT_VERSION_NUMBER = 0x0007; // Used for transmission public const string WILDERNESS_LABS_USB_VID = "2E6A"; diff --git a/Meadow.CLI.Core/Devices/IMeadowDevice.cs b/Meadow.CLI.Core/Devices/IMeadowDevice.cs index 105a8240..a7aac8c7 100644 --- a/Meadow.CLI.Core/Devices/IMeadowDevice.cs +++ b/Meadow.CLI.Core/Devices/IMeadowDevice.cs @@ -39,7 +39,10 @@ public interface IMeadowDevice : IDisposable public Task NshDisable(CancellationToken cancellationToken = default); public Task TraceEnable(CancellationToken cancellationToken = default); public Task SetTraceLevel(uint traceLevel, CancellationToken cancellationToken = default); - public Task SetDeveloper(ushort mode, uint userData, CancellationToken cancellationToken = default); + public Task SetDeveloper1(uint userData, CancellationToken cancellationToken = default); + public Task SetDeveloper2(uint userData, CancellationToken cancellationToken = default); + public Task SetDeveloper3(uint userData, CancellationToken cancellationToken = default); + public Task SetDeveloper4(uint userData, CancellationToken cancellationToken = default); public Task Uart1Apps(CancellationToken cancellationToken = default); public Task Uart1Trace(CancellationToken cancellationToken = default); public Task TraceDisable(CancellationToken cancellationToken = default); diff --git a/Meadow.CLI.Core/Devices/MeadowDeviceHelper.cs b/Meadow.CLI.Core/Devices/MeadowDeviceHelper.cs index 434515da..8cc6d7fa 100644 --- a/Meadow.CLI.Core/Devices/MeadowDeviceHelper.cs +++ b/Meadow.CLI.Core/Devices/MeadowDeviceHelper.cs @@ -213,9 +213,24 @@ public Task TraceDisable(CancellationToken cancellationToken = default) return _meadowDevice.TraceDisable(cancellationToken); } - public Task SetDeveloper(ushort level, uint userData, CancellationToken cancellationToken = default) + public Task SetDeveloper1(uint userData, CancellationToken cancellationToken = default) { - return _meadowDevice.SetDeveloper(level, userData, cancellationToken); + return _meadowDevice.SetDeveloper1(userData, cancellationToken); + } + + public Task SetDeveloper2(uint userData, CancellationToken cancellationToken = default) + { + return _meadowDevice.SetDeveloper2(userData, cancellationToken); + } + + public Task SetDeveloper3(uint userData, CancellationToken cancellationToken = default) + { + return _meadowDevice.SetDeveloper3(userData, cancellationToken); + } + + public Task SetDeveloper4(uint userData, CancellationToken cancellationToken = default) + { + return _meadowDevice.SetDeveloper4(userData, cancellationToken); } public Task Uart1Apps(CancellationToken cancellationToken = default) diff --git a/Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs b/Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs index 01da0693..75e16750 100644 --- a/Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs +++ b/Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs @@ -43,7 +43,7 @@ public async Task> GetFilesAndFolders( } }; - var command = new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_GET_FILES_AND_FOLDERS) + var command = new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_4) .WithResponseHandler(handler) .Build(); diff --git a/Meadow.CLI.Core/Devices/MeadowLocalDevice.cs b/Meadow.CLI.Core/Devices/MeadowLocalDevice.cs index 6734ae69..8fe7f0f3 100644 --- a/Meadow.CLI.Core/Devices/MeadowLocalDevice.cs +++ b/Meadow.CLI.Core/Devices/MeadowLocalDevice.cs @@ -233,11 +233,40 @@ public Task SetTraceLevel(uint traceLevel, CancellationToken cancellationToken = return SendCommand(command, cancellationToken); } - public Task SetDeveloper(ushort level, uint userData, CancellationToken cancellationToken = default) + public Task SetDeveloper1(uint userData, CancellationToken cancellationToken = default) { var command = - new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER) - .WithDeveloperLevel(level) + new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_1) + .WithUserData(userData) + .Build(); + + return SendCommand(command, cancellationToken); + } + + public Task SetDeveloper2(uint userData, CancellationToken cancellationToken = default) + { + var command = + new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_2) + .WithUserData(userData) + .Build(); + + return SendCommand(command, cancellationToken); + } + + public Task SetDeveloper3(uint userData, CancellationToken cancellationToken = default) + { + var command = + new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_3) + .WithUserData(userData) + .Build(); + + return SendCommand(command, cancellationToken); + } + + public Task SetDeveloper4(uint userData, CancellationToken cancellationToken = default) + { + var command = + new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_4) .WithUserData(userData) .Build(); diff --git a/Meadow.CLI.Core/Internals/MeadowCommunication/Command.cs b/Meadow.CLI.Core/Internals/MeadowCommunication/Command.cs index 8e9d6b83..ab653be3 100644 --- a/Meadow.CLI.Core/Internals/MeadowCommunication/Command.cs +++ b/Meadow.CLI.Core/Internals/MeadowCommunication/Command.cs @@ -8,14 +8,14 @@ public class Command { private protected const int HcomProtocolCommandRequiredHeaderLength = 12; private protected const int HcomProtocolCommandSeqNumber = 0; - // TODO No longer required? private protected const ushort HcomProtocolExtraDataDefaultValue = 0x0000; + private protected const ushort HcomProtocolExtraDataDefaultValue = 0x0000; private protected const int HcomProtocolRequestMd5HashLength = 32; static internal ushort HcomProtocolCommunicationVersion = Constants.HCOM_PROTOCOL_CURRENT_VERSION_NUMBER; public Command(HcomMeadowRequestType requestType, TimeSpan timeout, - ushort developerLevel, uint userData, + byte[]? data, Predicate responsePredicate, Predicate completionPredicate, EventHandler? responseHandler, @@ -24,8 +24,8 @@ public Command(HcomMeadowRequestType requestType, { RequestType = requestType; Timeout = timeout; - DeveloperLevel = developerLevel; UserData = userData; + Data = data; ResponsePredicate = responsePredicate; CompletionPredicate = completionPredicate; ResponseHandler = responseHandler; @@ -34,7 +34,6 @@ public Command(HcomMeadowRequestType requestType, } public HcomMeadowRequestType RequestType { get; protected set; } - public ushort DeveloperLevel { get; protected set; } public uint UserData { get; protected set; } public TimeSpan Timeout { get; protected set; } public byte[]? Data { get; protected set; } @@ -80,7 +79,7 @@ protected int ToMessageBytes(ref byte[] messageBytes) // Extra Data Array.Copy( - BitConverter.GetBytes(DeveloperLevel), + BitConverter.GetBytes(HcomProtocolExtraDataDefaultValue), 0, messageBytes, offset, diff --git a/Meadow.CLI.Core/Internals/MeadowCommunication/FileCommand.cs b/Meadow.CLI.Core/Internals/MeadowCommunication/FileCommand.cs index fe001597..0eb47309 100644 --- a/Meadow.CLI.Core/Internals/MeadowCommunication/FileCommand.cs +++ b/Meadow.CLI.Core/Internals/MeadowCommunication/FileCommand.cs @@ -21,7 +21,7 @@ internal FileCommand(HcomMeadowRequestType requestType, Predicate responseHandler, Predicate completionHandler, string commandBuilder) - : base(requestType, timeout, 0, partition, responseHandler, completionHandler, null, true, commandBuilder) + : base(requestType, timeout, partition, null, responseHandler, completionHandler, null, true, commandBuilder) { SourceFileName = sourceFileName; DestinationFileName = destinationFileName; diff --git a/Meadow.CLI.Core/Internals/MeadowCommunication/SimpleCommandBuilder.cs b/Meadow.CLI.Core/Internals/MeadowCommunication/SimpleCommandBuilder.cs index 41f376f1..b024f6af 100644 --- a/Meadow.CLI.Core/Internals/MeadowCommunication/SimpleCommandBuilder.cs +++ b/Meadow.CLI.Core/Internals/MeadowCommunication/SimpleCommandBuilder.cs @@ -17,7 +17,6 @@ public SimpleCommandBuilder(HcomMeadowRequestType requestType) private protected MeadowMessageType? CompletionMessageType; private protected HcomMeadowRequestType RequestType { get; set; } - private protected ushort DeveloperLevel { get; set; } private protected uint UserData { get; set; } private protected TimeSpan Timeout { get; set; } private protected byte[]? Data { get; set; } @@ -32,12 +31,6 @@ public SimpleCommandBuilder WithTimeout(TimeSpan timeout) return this; } - public SimpleCommandBuilder WithDeveloperLevel(ushort level) - { - DeveloperLevel = level; - return this; - } - public SimpleCommandBuilder WithUserData(uint userData) { UserData = userData; @@ -102,14 +95,13 @@ public Command Build() else CompletionPredicate = e => e.MessageType == MeadowMessageType.Concluded; } - return new Command(RequestType, Timeout, DeveloperLevel, UserData, ResponsePredicate, CompletionPredicate, ResponseHandler, IsAcknowledged, ToString()); + return new Command(RequestType, Timeout, UserData, Data, ResponsePredicate, CompletionPredicate, ResponseHandler, IsAcknowledged, ToString()); } public override string ToString() { return $"RequestType: {RequestType} " + $"Timeout: {Timeout} " - + $"DeveloperLevel: {DeveloperLevel} " + $"UserData: {UserData} " + $"ResponseType {ResponseMessageType?.ToString() ?? "none"} " + $"CompletionMessageType: {CompletionMessageType?.ToString() ?? "none"} " diff --git a/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj b/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj index 6b5d3ce6..7f805e96 100644 --- a/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj +++ b/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj @@ -11,7 +11,7 @@ preview enable True - 1.0.2.2 + 1.0.4.0 diff --git a/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj b/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj index d08d13a4..04f68621 100644 --- a/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj +++ b/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj @@ -11,7 +11,7 @@ preview enable True - 1.0.2.2 + 1.0.4.0 diff --git a/Meadow.CLI.Core/Meadow.CLI.Core.csproj b/Meadow.CLI.Core/Meadow.CLI.Core.csproj index 17b21e00..07f99348 100644 --- a/Meadow.CLI.Core/Meadow.CLI.Core.csproj +++ b/Meadow.CLI.Core/Meadow.CLI.Core.csproj @@ -11,7 +11,7 @@ preview enable True - 1.0.2.2 + 1.0.4.0 diff --git a/Meadow.CLI/Commands/MeadowSerialCommand.cs b/Meadow.CLI/Commands/MeadowSerialCommand.cs index 11ea31a9..4b43df4f 100644 --- a/Meadow.CLI/Commands/MeadowSerialCommand.cs +++ b/Meadow.CLI/Commands/MeadowSerialCommand.cs @@ -56,6 +56,12 @@ private string GetSerialPort() private bool PortExists(string name) { + if (OperatingSystem.IsWindows()) + { + // windows is case-insensitive + return System.IO.Ports.SerialPort.GetPortNames().Contains(name, StringComparer.InvariantCultureIgnoreCase); + } + return System.IO.Ports.SerialPort.GetPortNames().Contains(name); } diff --git a/Meadow.CLI/Commands/Trace/SetDeveloperValueCommand.cs b/Meadow.CLI/Commands/Trace/SetDeveloperValueCommand.cs index 75ce5e59..f923fad1 100644 --- a/Meadow.CLI/Commands/Trace/SetDeveloperValueCommand.cs +++ b/Meadow.CLI/Commands/Trace/SetDeveloperValueCommand.cs @@ -19,10 +19,10 @@ public SetDeveloperValueCommand(DownloadManager downloadManager, ILoggerFactory _logger = LoggerFactory.CreateLogger(); } - [CommandOption("developer", 'd', Description = "The developer value to set.")] - public ushort DeveloperLevel { get; set; } + [CommandOption("developer", 'd', Description = "The developer value to set. Valid values are 1 - 4")] + public uint Developer { get; set; } - [CommandOption("value", 'v', Description = "The value to apply to the developer value.")] + [CommandOption("value", 'v', Description = "The value to apply to the developer value. Valid values are 0 to 4,294,967,295")] public uint Value { get; set; } public override async ValueTask ExecuteAsync(IConsole console) @@ -31,14 +31,16 @@ public override async ValueTask ExecuteAsync(IConsole console) var cancellationToken = console.RegisterCancellationHandler(); - try + var task = Developer switch { - await Meadow.SetDeveloper(DeveloperLevel, Value, cancellationToken); - } - catch (Exception ex) - { - _logger.LogError($"Error Setting Developer : {ex.Message}"); - } + 1 => Meadow.SetDeveloper1(Value, cancellationToken), + 2 => Meadow.SetDeveloper2(Value, cancellationToken), + 3 => Meadow.SetDeveloper3(Value, cancellationToken), + 4 => Meadow.SetDeveloper4(Value, cancellationToken), + _ => throw new ArgumentOutOfRangeException(nameof(Developer), Developer, "Valid values are 1 - 4") + }; + + await task; } } } diff --git a/Meadow.CLI/Meadow.CLI.csproj b/Meadow.CLI/Meadow.CLI.csproj index b4355b5c..9bfbc004 100644 --- a/Meadow.CLI/Meadow.CLI.csproj +++ b/Meadow.CLI/Meadow.CLI.csproj @@ -10,7 +10,7 @@ Peter Moody, Adrian Stevens, Brian Kim, Pete Garafano, Dominique Louis Wilderness Labs, Inc true - 1.0.2.2 + 1.0.4.0 AnyCPU http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ icon.png diff --git a/Meadow.Hcom/HcomMeadowRequestType.cs b/Meadow.Hcom/HcomMeadowRequestType.cs index d5146b31..01e52700 100644 --- a/Meadow.Hcom/HcomMeadowRequestType.cs +++ b/Meadow.Hcom/HcomMeadowRequestType.cs @@ -40,10 +40,11 @@ public enum HcomMeadowRequestType : ushort HCOM_MDOW_REQUEST_GET_DEVICE_NAME = 0x1f | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, HCOM_MDOW_REQUEST_GET_INITIAL_FILE_BYTES = 0x20 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, - HCOM_MDOW_REQUEST_GET_FILES_AND_FOLDERS = 0xf3 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, - // Only used for testing - HCOM_MDOW_REQUEST_DEVELOPER = 0xf8 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, + HCOM_MDOW_REQUEST_DEVELOPER_1 = 0xf0 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, + HCOM_MDOW_REQUEST_DEVELOPER_2 = 0xf1 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, + HCOM_MDOW_REQUEST_DEVELOPER_3 = 0xf2 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, + HCOM_MDOW_REQUEST_DEVELOPER_4 = 0xf3 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, HCOM_MDOW_REQUEST_S25FL_QSPI_INIT = 0xf4 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, HCOM_MDOW_REQUEST_S25FL_QSPI_WRITE = 0xf5 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE,