Skip to content

Commit 7b8f198

Browse files
author
Kristifor Milchev
committed
Adding linux troubleshooting intrusctions for Debian/Ubuntu based systems
1 parent 035fe26 commit 7b8f198

File tree

2 files changed

+70
-14
lines changed

2 files changed

+70
-14
lines changed

Pages/HardwareSelect.razor

Lines changed: 66 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
@using SYNCWallet.Models
1010
@using SYNCWallet.Services
1111
@using SYNCWallet.Services.Definitions
12+
@using SYNCWallet.Services.Implementation
1213
@using static SYNCWallet.Models.Enums
1314

1415
@inject NavigationManager NavigationManager
@@ -17,7 +18,7 @@
1718

1819
<Loader BindingData="Updating firmware please wait..." ></Loader>
1920
<div class="container FixCenter" id="LoginPanel" style="height:100vh; display:@ShowPicker;">
20-
<div class="row" style="width: 100%;display: flex;justify-content: center;align-items: center; padding:0; margin:0;">
21+
<div class="row" style="width: 100%;display: flex;justify-content: center;align-items: center; padding:0; margin:0; height: 100vh;">
2122
<div class="col-md-4 col-sm-12 " style=" min-width: 500px;">
2223
<div class="row" style="display: flex;flex-direction: row;align-items: center;justify-content: center;">
2324
<img src="/logo.png" style="width: 250px;height: 200px;" alt="homepage" class="light-logo" />
@@ -27,6 +28,8 @@
2728
<h2 style="color:#EA7080; text-align:center; font-size:25pt;padding: 50px;">
2829
Connect and select ATmega328 compatable device.
2930
</h2>
31+
32+
3033
</div>
3134
<a class="nav-link dropdown-toggle waves-effect waves-dark" href="#" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="color: black;font-weight: 400; text-align:center;">
3235
<i class="me-2 mdi mdi-access-point-network"></i>
@@ -46,6 +49,33 @@
4649

4750
}
4851
</div>
52+
@if (Utilities.GetSystemOs() == 2)
53+
{
54+
<p>
55+
Important, if you have troubles connecting your board or you find that the system cannot recodnize it follow these steps.
56+
</p>
57+
<p>
58+
Make sure you add your user to dialout
59+
</p>
60+
<p>
61+
<span class="popTextWarning">sudo usermod -a -G dialout username</span>
62+
</p>
63+
<p>
64+
To show all devices: <span class="popTextWarning">sudo dmesg | tail -f</span>
65+
</p>
66+
<p>
67+
Find the connected arduino port and enable write permissions.
68+
</p>
69+
<p>
70+
<span class="popTextWarning">sudo chmod a+rw /dev/ttyUSB0</span>
71+
</p>
72+
<p>
73+
Known issue with Debian/Ubuntu based systems (nb plug and replug the arduino afterwards) it keeps pinging the rx/tx preventing the board from conencting
74+
</p>
75+
<p>
76+
<span class="popTextWarning">sudo apt remove brltty</span>
77+
</p>
78+
}
4979
</div>
5080
</div>
5181
</div>
@@ -54,13 +84,16 @@
5484
private ICommunication Communication { get; set; }
5585
private IAuthenicationService AuthenicationHandler { get; set; }
5686
private IHardwareService HardwareService { get; set; }
87+
private IUtilities Utilities { get; set; }
5788
private string Address { get; set; }
5889
private string Port{ get; set; }
5990
private string ShowPicker { get; set; }
91+
int Attempts { get; set; }
6092

6193
public ArduinoModel DeviceModel { get; set; }
6294
public List<ArduinoModel> Devices { get; set; }
6395
TriggerLoader CurrentLoader { get; set; }
96+
public int OperatingSystem { get; set; }
6497

6598

6699
System.Timers.Timer aTimer { get; set; }
@@ -77,30 +110,52 @@
77110
AuthenicationHandler = ServiceHelper.GetService<IAuthenicationService>();
78111
HardwareService = ServiceHelper.GetService<IHardwareService>();
79112
Communication = ServiceHelper.GetService<ICommunication>();
80-
113+
Utilities = ServiceHelper.GetService<IUtilities>();
114+
Attempts = 0;
115+
81116

82117
Communication.Init();
83118
//Get Supported Devices
84119
Devices = HardwareService.GetSupportedDevices();
85120
Port = HardwareService.DeviceConnected();
121+
122+
InitTimer();
123+
}
124+
125+
126+
void InitTimer()
127+
{
86128
aTimer = new System.Timers.Timer();
87129
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
88130
aTimer.Interval = 5000;
89131
aTimer.Start();
90-
91132
}
92-
93-
94-
95133
// Specify what you want to happen when the Elapsed event is raised.
96-
private void OnTimedEvent(object source, ElapsedEventArgs e)
134+
private async void OnTimedEvent(object source, ElapsedEventArgs e)
97135
{
98136

99137
Port = HardwareService.DeviceConnected();
138+
139+
Attempts += 1;
140+
141+
if(Attempts == 2 && string.IsNullOrEmpty(Port))
142+
{
143+
144+
await InvokeAsync(() =>
145+
{
146+
ShowPicker = "flex";
147+
Communication.TriggerLoader.Invoke("none");
148+
StateHasChanged();
149+
150+
});
151+
152+
Communication.PublishError("Port not found", "Please connect atmega328 compatible device <a href='' >click here for supported devices.</a>");
153+
KillTimer();
154+
}
155+
100156
if(!string.IsNullOrEmpty(Port))
101157
{
102-
aTimer.Stop();
103-
aTimer.Dispose();
158+
KillTimer();
104159
}
105160
}
106161

@@ -156,11 +211,8 @@
156211

157212
private void KillTimer()
158213
{
159-
if (aTimer != null)
160-
{
161-
aTimer.Stop();
162-
aTimer.Dispose();
163-
}
214+
aTimer.Stop();
215+
aTimer.Dispose();
164216
}
165217

166218
private async void DeviceChanged(ArduinoModel deviceType)

wwwroot/css/site.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,4 +889,8 @@
889889

890890
html body .display-6 {
891891
font-size: 1.5rem;
892+
}
893+
894+
.popTextWarning{
895+
color: white;
892896
}

0 commit comments

Comments
 (0)