Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ You must copy the /elegantota directory into the OnStepX/src/plugins directory a
#endif
```

To add ElegantOTA to your OnStepX website plugin menu, you can define the following in `Config.h`:
```
#define WEBSITE_PLUGIN_PAGE1_TITLE "OTA Update"
#define WEBSITE_PLUGIN_PAGE1_URL "/update"
#define WEBSITE_PLUGIN_PAGE1_TARGET "_blank" // Optional, opens in a new tab
```

### Firmware upload

The plugin works in two different ways, depending on whether WiFi is enabled
Expand Down Expand Up @@ -153,6 +160,13 @@ You must copy the /metrics directory into the OnStepX/src/plugins directory and

Once enabled, you can head to the path defined by `METRICS_PLUGIN_PATH` (by default `/metrics`) to see your metrics. This is also the path you'll want to use if you want to scrape these metrics using Prometheus.

You can also add the metrics to your OnStepX website menu by defining the following in `Config.h`:
```
#define WEBSITE_PLUGIN_PAGE2_TITLE "Metrics"
#define WEBSITE_PLUGIN_PAGE2_URL "/metrics"
#define WEBSITE_PLUGIN_PAGE2_TARGET "_blank"
```

### Adding metrics

An example implementation on how to add custom metrics is available with GPS metrics:
Expand Down
7 changes: 7 additions & 0 deletions website/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,12 @@
#define HOME_OFFSET_RANGE_AXIS2 7200 // 7200, allow adjusting home offset up to +/- 2 degrees Infreq
#endif

// Extra menu links, up to 5
// For each link, define the title and URL. If you want the link to open in a new tab, define the target as "_blank".
// Example:
// #define WEBSITE_PLUGIN_PAGE1_TITLE "My first link"
// #define WEBSITE_PLUGIN_PAGE1_URL "/my-first-link-target"
// #define WEBSITE_PLUGIN_PAGE1_TARGET "_blank"

// THAT'S IT FOR USER CONFIGURATION!
// -------------------------------------------------------------------------------
37 changes: 37 additions & 0 deletions website/pages/Page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,43 @@ void pageHeader(int selected) {
data.concat(FPSTR(html_links_net_end));
}

#if defined(WEBSITE_PLUGIN_PAGE1_TITLE) && defined(WEBSITE_PLUGIN_PAGE1_URL)
#ifndef WEBSITE_PLUGIN_PAGE1_TARGET
#define WEBSITE_PLUGIN_PAGE1_TARGET ""
#endif
data.concat(F("<a href='" WEBSITE_PLUGIN_PAGE1_URL "' target='" WEBSITE_PLUGIN_PAGE1_TARGET "'>" WEBSITE_PLUGIN_PAGE1_TITLE "</a>"));
#endif

#if defined(WEBSITE_PLUGIN_PAGE2_TITLE) && defined(WEBSITE_PLUGIN_PAGE2_URL)
#ifndef WEBSITE_PLUGIN_PAGE2_TARGET
#define WEBSITE_PLUGIN_PAGE2_TARGET ""
#endif
data.concat(F("<a href='" WEBSITE_PLUGIN_PAGE2_URL "' target='" WEBSITE_PLUGIN_PAGE2_TARGET "'>" WEBSITE_PLUGIN_PAGE2_TITLE "</a>"));
#endif

#if defined(WEBSITE_PLUGIN_PAGE3_TITLE) && defined(WEBSITE_PLUGIN_PAGE3_URL)
#ifndef WEBSITE_PLUGIN_PAGE3_TARGET
#define WEBSITE_PLUGIN_PAGE3_TARGET ""
#endif
data.concat(F("<a href='" WEBSITE_PLUGIN_PAGE3_URL "' target='" WEBSITE_PLUGIN_PAGE3_TARGET "'>" WEBSITE_PLUGIN_PAGE3_TITLE "</a>"));
#endif

#if defined(WEBSITE_PLUGIN_PAGE4_TITLE) && defined(WEBSITE_PLUGIN_PAGE4_URL)
#ifndef WEBSITE_PLUGIN_PAGE4_TARGET
#define WEBSITE_PLUGIN_PAGE4_TARGET ""
#endif
data.concat(F("<a href='" WEBSITE_PLUGIN_PAGE4_URL "' target='" WEBSITE_PLUGIN_PAGE4_TARGET "'>" WEBSITE_PLUGIN_PAGE4_TITLE "</a>"));
#endif

#if defined(WEBSITE_PLUGIN_PAGE5_TITLE) && defined(WEBSITE_PLUGIN_PAGE5_URL)
#ifndef WEBSITE_PLUGIN_PAGE5_TARGET
#define WEBSITE_PLUGIN_PAGE5_TARGET ""
#endif
data.concat(F("<a href='" WEBSITE_PLUGIN_PAGE5_URL "' target='" WEBSITE_PLUGIN_PAGE5_TARGET "'>" WEBSITE_PLUGIN_PAGE5_TITLE "</a>"));
#endif



data.concat(FPSTR(html_onstep_header_end));
www.sendContentAndClear(data);
}