diff --git a/README.md b/README.md index abfcf3b..c8ebab5 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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: diff --git a/website/Config.h b/website/Config.h index f2fc155..4b60dc3 100644 --- a/website/Config.h +++ b/website/Config.h @@ -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! // ------------------------------------------------------------------------------- diff --git a/website/pages/Page.cpp b/website/pages/Page.cpp index 69d44dd..8e86317 100644 --- a/website/pages/Page.cpp +++ b/website/pages/Page.cpp @@ -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("" WEBSITE_PLUGIN_PAGE1_TITLE "")); + #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("" WEBSITE_PLUGIN_PAGE2_TITLE "")); + #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("" WEBSITE_PLUGIN_PAGE3_TITLE "")); + #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("" WEBSITE_PLUGIN_PAGE4_TITLE "")); + #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("" WEBSITE_PLUGIN_PAGE5_TITLE "")); + #endif + + + data.concat(FPSTR(html_onstep_header_end)); www.sendContentAndClear(data); }