Skip to content

Commit 2b45f1a

Browse files
committed
Tracker Download Button
- Optional control for downloading tracker-edge samples without needing git
1 parent 671ea3a commit 2b45f1a

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

src/assets/js/api-helper-tracker.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ $(document).ready(function() {
1919
main: $(thisPartial).attr('data-main'),
2020
project: $(thisPartial).attr('data-project'),
2121
libraries: $(thisPartial).attr('data-libraries'),
22+
src: $(thisPartial).attr('data-src'),
2223
setStatus: setStatus,
2324
next: function() {
2425
$(thisButton).removeAttr('disabled');
@@ -51,15 +52,30 @@ async function buildTrackerDownload(options) {
5152
const zipFsVsCodeDir = zipFsTrackerDir.addDirectory('.vscode');
5253
await zipFsVsCodeDir.importHttpContent(vsCodeSettingsUrl);
5354

55+
const srcDir = zipFs.find(zipFsTrackerDir.getFullname() + '/src');
56+
5457
if (options.main) {
5558
const oldMain = zipFs.find(zipFsTrackerDir.getFullname() + '/src/main.cpp');
5659
zipFs.remove(oldMain);
5760

58-
const srcDir = zipFs.find(zipFsTrackerDir.getFullname() + '/src');
59-
6061
await srcDir.addHttpContent('main.cpp', options.main);
6162
}
6263

64+
if (options.src) {
65+
for(const src of options.src.split(' ')) {
66+
let name;
67+
const lastSlashIndex = src.lastIndexOf('/');
68+
if (lastSlashIndex > 0) {
69+
name = src.substr(lastSlashIndex + 1);
70+
}
71+
else {
72+
name = src;
73+
}
74+
75+
await srcDir.addHttpContent(name, src);
76+
}
77+
}
78+
6379
if (options.libraries) {
6480
const projectPropertiesEntry = zipFs.find(zipFsTrackerDir.getFullname() + '/project.properties');
6581

src/content/tutorials/asset-tracking/tracker-configuration.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ columns: two
44
layout: tutorials.hbs
55
order: 32
66
description: Particle Tracker Configuration
7-
includeDefinitions: [api-helper, api-helper-config]
7+
includeDefinitions: [api-helper, api-helper-config, api-helper-tracker, zip]
88
---
99

1010
# Tracker Configuration
@@ -310,6 +310,24 @@ This is what it looks like in the console.
310310
311311
### Getting the Tracker Edge Firmware
312312
313+
314+
You can download a complete project for use with Particle Workbench as a zip file here:
315+
316+
{{> tracker-edge main="/assets/files/tracker/example/main.cpp" project="config-sample"
317+
src="/assets/files/tracker/example/MyConfig.cpp /assets/files/tracker/example/MyConfig.h" }}
318+
319+
- Extract **tracker-config-example.zip** in your Downloads directory
320+
- Open the **tracker-config-example** folder in Workbench using **File - Open...**; it is a pre-configured project directory.
321+
- From the Command Palette (Command-Shift-P or Ctrl-Shift-P), use **Particle: Configure Project for Device**.
322+
- If you are building in the cloud, you can use **Particle: Cloud Flash** or **Particle: Cloud Compile**.
323+
- If you are building locally, open a CLI window using **Particle: Launch CLI** then:
324+
325+
```
326+
particle library copy
327+
```
328+
329+
#### Manually
330+
313331
The Tracker Edge firmware can be downloaded from Github:
314332
315333
[https://github.com/particle-iot/tracker-edge](https://github.com/particle-iot/tracker-edge)

templates/partials/tracker-edge.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="apiHelper apiHelperTrackerEdge" data-main="{{main}}" data-project="{{project}}" data-libraries="{{libraries}}">
1+
<div class="apiHelper apiHelperTrackerEdge" data-main="{{main}}" data-project="{{project}}" data-libraries="{{libraries}}" data-src="{{src}}">
22
<div class="apiHelperBox">
33
<div class="apiHelperTrackerEdgeControls">
44
<p>

0 commit comments

Comments
 (0)