Skip to content

Commit 4f873ae

Browse files
committed
show Node number as hex string in "info" command output table
- add getter to Mesh.cs (NumAsHexString) - consider NumAsHexString in GetNodeDisplayName and PrintNodesTable
1 parent e0d463b commit 4f873ae

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

Meshtastic.Cli/Display/ProtobufPrinter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public Table PrintNodesTable(bool compactTable = false)
7878
}
7979
else
8080
{
81-
table.AddRow(node.Num.ToString(),
81+
table.AddRow(node.NumAsHexString,
8282
container.GetNodeDisplayName(node.Num),
8383
(node.Position?.LatitudeI * 1e-7 ?? 0).ToString("N6") ?? String.Empty,
8484
(node.Position?.LongitudeI * 1e-7 ?? 0).ToString("N6") ?? String.Empty,

Meshtastic/Data/DeviceStateContainer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ public string GetNodeDisplayName(uint nodeNum, bool shortName = false, bool hide
8888
{
8989
var node = this.Nodes.Find(n => n.Num == nodeNum);
9090
if (node == null)
91-
return nodeNum.ToString();
91+
return nodeNum.ToString("X");
9292

9393
if (!shortName && hideNodeNum)
94-
return node?.User?.LongName ?? $"Meshtastic {nodeNum}";
94+
return node?.User?.LongName ?? $"Meshtastic {node?.NumAsHexString}";
9595

9696
if (shortName)
9797
return node?.User?.ShortName ?? String.Empty;
@@ -100,7 +100,7 @@ public string GetNodeDisplayName(uint nodeNum, bool shortName = false, bool hide
100100
return $"{node?.User?.LongName} ({node?.User?.ShortName})";
101101

102102

103-
return $"{node?.User?.LongName} ({node?.User?.ShortName}) - {node?.Num}";
103+
return $"{node?.User?.LongName} ({node?.User?.ShortName}) - {node?.NumAsHexString}";
104104
}
105105

106106
public string GetChannelUrl(int[]? selection = null)

Meshtastic/Generated/Mesh.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6044,6 +6044,17 @@ public uint Num {
60446044
}
60456045
}
60466046

6047+
/// <summary>
6048+
/// Return the node number as a hex string
6049+
/// </summary>
6050+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
6051+
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
6052+
public string NumAsHexString
6053+
{
6054+
get { return num_.ToString("X"); }
6055+
set { }
6056+
}
6057+
60476058
/// <summary>Field number for the "user" field.</summary>
60486059
public const int UserFieldNumber = 2;
60496060
private global::Meshtastic.Protobufs.User user_;

0 commit comments

Comments
 (0)