Skip to content

Commit 2e38de7

Browse files
committed
Fixed firmware stuff
Improved performance Fixed seeking Other small fixes
1 parent 9ce3253 commit 2e38de7

24 files changed

+1296
-337
lines changed

MaterialSkin

OpenpilotSdk/Hardware/OpenpilotDevice.cs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
using System.Collections.Immutable;
2-
using System.Drawing;
3-
using System.Net;
4-
using System.Net.NetworkInformation;
5-
using System.Net.Sockets;
6-
using System.Text.RegularExpressions;
1+
using DnsClient;
72
using FFMpegCore;
83
using NetTopologySuite.IO;
4+
using OpenpilotSdk.Exceptions;
95
using OpenpilotSdk.Git;
106
using OpenpilotSdk.OpenPilot;
7+
using OpenpilotSdk.OpenPilot.FileTypes;
118
using OpenpilotSdk.OpenPilot.Fork;
12-
using Renci.SshNet;
13-
using Renci.SshNet.Sftp;
9+
using OpenpilotSdk.OpenPilot.Media;
10+
using OpenpilotSdk.OpenPilot.Segment;
1411
using OpenpilotSdk.Sftp;
12+
using Renci.SshNet;
1513
using Renci.SshNet.Common;
14+
using Renci.SshNet.Sftp;
1615
using Serilog;
16+
using System.Collections.Immutable;
17+
using System.Drawing;
1718
using System.Globalization;
19+
using System.Net;
20+
using System.Net.NetworkInformation;
21+
using System.Net.Sockets;
1822
using System.Runtime.CompilerServices;
19-
using OpenpilotSdk.Exceptions;
20-
using OpenpilotSdk.OpenPilot.Segment;
21-
using DnsClient;
22-
using OpenpilotSdk.OpenPilot.FileTypes;
23-
using OpenpilotSdk.OpenPilot.Media;
23+
using System.Text.RegularExpressions;
2424

2525
namespace OpenpilotSdk.Hardware
2626
{
@@ -46,7 +46,7 @@ public abstract class OpenpilotDevice
4646
public virtual string ShutdownCommand => @"am start -n android/com.android.internal.app.ShutdownActivity";
4747
public virtual string FlashCommand => @"pkill -f openpilot & cd /data/openpilot/panda/board && ./recover.sh";
4848
public virtual string InstallEmuCommand => @"cd /data/openpilot && echo 'y' | bash <(curl -fsSL install.emu.sh) && source /data/community/.bashrc";
49-
public virtual string GitCloneCommand => @"cd /data && rm -rf openpilot; git clone -b {1} --depth 1 --single-branch --progress --recurse-submodules --shallow-submodules {0} openpilot";
49+
public virtual string GitCloneCommand => @"sudo systemctl stop comma || {{ echo ""ERROR: Failed to stop 'comma' service"" >&2; exit 1; }} && cd /data || {{ echo ""ERROR: Directory '/data' not found or inaccessible"" >&2; exit 1; }} && rm -rf openpilot || {{ echo ""ERROR: Failed to remove old openpilot folder"" >&2; exit 1; }} && git clone -b {1} --depth 1 --single-branch --progress --recurse-submodules --shallow-submodules https://github.com/{0}/{2}.git openpilot || {{ echo ""ERROR: Git clone failed. Check URL, branch, or network."" >&2; exit 1; }}";
5050

5151
public abstract IReadOnlyDictionary<CameraType,Camera> Cameras { get; }
5252

@@ -206,7 +206,7 @@ public async Task<CombinedStream> GetVideoStream(Route route, Camera camera)
206206

207207
public async Task<CombinedStreamCollection> GetVideoStreams(Route route)
208208
{
209-
return new CombinedStreamCollection(this, route);
209+
return new CombinedStreamCollection(this, route,true);
210210
}
211211

212212
public async Task ExportRouteAsync(string exportPath, Route route, Camera camera, bool combineSegments = false, IProgress<OpenPilot.Camera.Progress>? progress = null)
@@ -682,7 +682,7 @@ public async Task<GpxFile> GenerateGpxFileAsync(Route route, IProgress<int>? pro
682682
try
683683
{
684684
directoryListing = (await SftpClient.ListDirectoryAsync(StorageDirectory, cancellationToken)
685-
.ConfigureAwait(false));
685+
.ConfigureAwait(false));
686686
}
687687
catch (SftpPathNotFoundException)
688688
{
@@ -1074,7 +1074,8 @@ public static async IAsyncEnumerable<OpenpilotDevice> DiscoverAsync()
10741074
//~26ms
10751075
try
10761076
{
1077-
using (var command = sshClient.CreateCommand("hostname"))
1077+
//new command here gives the model
1078+
using (var command = sshClient.CreateCommand("cat /sys/firmware/devicetree/base/model"))
10781079
{
10791080
hostName = await Task.Factory.FromAsync(command.BeginExecute(), command.EndExecute).ConfigureAwait(false);
10801081
if (hostName != null && (hostName.StartsWith("comma") || hostName.Equals("tici")))
@@ -1196,7 +1197,7 @@ public virtual async Task<ForkResult> InstallForkAsync(string username, string b
11961197
await ConnectSshAsync().ConfigureAwait(false);
11971198

11981199
var installCommand =
1199-
string.Format(@"cd /data && rm -rf openpilot ; git clone -b {1} --depth 1 --single-branch --progress --recurse-submodules --shallow-submodules https://github.com/{0}/{2}.git openpilot", username, branch, repository);
1200+
string.Format(GitCloneCommand, username, branch, repository);
12001201

12011202
var progressRegex = new Regex(@"\d+(?=%)", RegexOptions.Compiled);
12021203
int previousProgress = 0;
@@ -1253,8 +1254,8 @@ public virtual async Task<ForkResult> InstallForkAsync(string username, string b
12531254
await ConnectSshAsync().ConfigureAwait(false);
12541255

12551256
var installCommand =
1256-
string.Format(@"cd /data && rm -rf openpilot; git clone -b {1} --depth 1 --single-branch --recurse-submodules --shallow-submodules https://github.com/{0}/{2}.git openpilot", username, branch, repository);
1257-
1257+
string.Format(GitCloneCommand, username, branch, repository);
1258+
12581259
using (var command = SshClient.CreateCommand(installCommand))
12591260
{
12601261
var result = await Task.Factory.FromAsync(command.BeginExecute(), command.EndExecute).ConfigureAwait(false);

OpenpilotSdk/Hardware/OpenpilotDeviceType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public enum OpenpilotDeviceType
1010
{
1111
Comma2,
1212
Comma3,
13+
Comma3X,
1314
Unknown
1415
}
1516
}

0 commit comments

Comments
 (0)